#include <mega88.h> #define LowPower PORTB &= 0xfe; #define HighPower PORTB |= 0x01; #define uchar unsigned int
void main(void) { uchar i,j = 0; DDRB = 0x01; TCNT0 = 0; TCCR0B = 0x05; //分频F/1024 while(1) { //等待1S,4000000/1024/256/15=1Hz for(i=0 ;i<15 ;i++) { while(TIFR0.0 = 0); TIFR0.0 = 0; } if(j) {LowPower; j = 0;} else {HighPower;j = 1;} } }
这个在PB0脚2S内变换一次高低电平,请帮我看看我的程序对吗?
|