PIC单片机TIMER0实现流水灯的自动控制设计
#include __CONFIG(0x3B31); unsignedcharnum=0,i=0; voidinit() { TRISB=0x00; TRISC=0x00; PORTB=0xFE; PORTC=0xFE; } voidTMR0_init() { OPTION=0x07;//0有上拉电阻00001111:256分频 GIE=1; PEIE=1; T0IF=0; TMR0=250; T0IE=1; } voidinterruptTIMER0() { T0IF=0; if(num==5) { num=0; PORTB=(PORTB
暂无评论