#include "led.h"#include "Basic.h"uint16 T_delay = 10;void main(void){P0SEL &= ~0x04;P0DIR |= 0x04;P0_2 = 0;INIT_LED();
for( ;; ){LEDprintf(LED1_ON,BYTE_5); //BYTE_5到底有什么作用?Delay(T_delay);LEDprintf(LED2_ON,BYTE_5);Delay(T_delay);LEDprintf(LED3_ON,BYTE_5);Delay(T_delay);……}}
void INIT_LED(void) //这个初始化led函数的作用是什么?{P1SEL &= ~0xFF;P1DIR |= 0xFF;P1 = 0;}void LEDprintf(unsigned char data,unsigned char byte){unsigned char bits = 0;unsigned char get_bit = 0x80;P1 |= byte; //P1 |= byte的意义是什么?RCK = LOW;SRCK = LOW;for(bits = 8;bits > 0;bits --){if(data & get_bit)SER = 1;elseSER = 0;SRCK = HIGH;get_bit >>= 1;SRCK = LOW;}RCK = HIGH;}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>