XS128單片機實驗:B口燈交替閃亮
#include "derivative.h" /* derivative-specific definitions */
#include "WQ.h"
//This is the firstprogramof mine,its used to text the board;
//LED will twinkle in very fast speed;
void DELAY(int y)
{
int i,x;
for (i=y;i>0;i--)
for(x=220;x>0;x--);
}
void main(void) {
DDRB =0XFF; //置1,作為輸出口
while(1){
PORTB=0x55;
DELAY(550);
PORTB=0XAA;
DELAY(550);
}
}
評論