level 1
丶Beat_it丶0
楼主
这是一个CC2530单片机输出的C文件。请问下面FOR循环里面的语句各是什么意思???
#include "led.h"
void INIT_LED(void)
{
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;
RCK = LOW;
SRCK = LOW;
for(bits = 8;bits > 0;bits --)
{
if(data & get_bit)
SER = 1;
else
SER = 0;
SRCK = HIGH;
get_bit >>= 1;
SRCK = LOW;
}
RCK = HIGH;
}
2015年12月16日 04点12分
1
#include "led.h"
void INIT_LED(void)
{
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;
RCK = LOW;
SRCK = LOW;
for(bits = 8;bits > 0;bits --)
{
if(data & get_bit)
SER = 1;
else
SER = 0;
SRCK = HIGH;
get_bit >>= 1;
SRCK = LOW;
}
RCK = HIGH;
}