AI8051u 29 红外接收源代码不能用串口打印
F0 = P_IR_RX_temp; //Save Last sample status
P_IR_RX_temp = P_IR_RX; //Read current status
if(F0 && !P_IR_RX_temp) //请教下这句话怎么理解?
{
SampleTime = IR_SampleCnt; //get the sample time
IR_SampleCnt = 0;
就这样理解:
上次高,这次低,下降沿
DebugLab 发表于 2025-2-21 14:36
就这样理解:
上次高,这次低,下降沿
早上好啊, bit B_1ms; //1ms标志
u8cnt_1ms; //1ms基本计时
/*************红外接收程序变量声明 **************/
sbit P_IR_RX = P3^5; //定义红外接收输入IO口
u8IR_SampleCnt; //采样计数
u8IR_BitCnt; //编码位数
u8IR_UserH; //用户码(地址)高字节
u8IR_UserL; //用户码(地址)低字节
u8IR_data; //数据原码
u8IR_DataShit; //数据移位
bit P_IR_RX_temp; //Last sample
bit B_IR_Sync; //已收到同步标志
bit B_IR_Press; //红外接收标志
u8IR_code; //红外键码
u16 UserCode; //用户码
F0= P_IR_RX_temp; //Save Last sample status
P_IR_RX_temp = P_IR_RX; //Read current status //
if(F0 && !P_IR_RX_temp) //请教下这句话怎么理解?
我的理解是 初始F0 = 0; 执行 P_IR_RX_temp = P_IR_RX后,P_IR_RX_temp变成低,再执行if(F0 && !P_IR_RX_temp)条件不为真,不执行,请教下怎么理解?
页:
[1]