刚接触ABOV的片子没几天,老板先让熟悉熟悉,就用了以前别人设计的成品板直接仿真。遥控发射芯片才用的HS5104,非常常见的遥控。这个我刚学51的时候用DJNZ一直减数字的等待信号变化似乎很容易,调试起来也很轻松。现在ABOV的片子功能多,我就这样做的: 信号输入中断INT1,设置双沿触发,发现第一个信号后用定时1开始把BOX1的值每200US加1。然后每次中断触发INT1的时候BOX1的值就是电平持续的时间,然后BOX1清0等待下一次触发。可是调试起来很多问题,后来我用了很多单元连续读了好几次的值。发现有时候遥控了按了半天根本收不到信号,有时候又收的到。收到的信号偶然会出现个很大的值,其他基本正常。 ;SINT1 ;外部中断1用于红外遥控 ;<<5104>> ;-------------------------------------------------- SINT1: PUSH A PUSH X PUSH Y DI FINT1:;第一部分 LDA HW54F CMP #00H BNE FINT2 LDM BOX1,#00H LDM HW54F,#02H JMP SINT9 FINT2:; LDA HW54F CMP #02H BNE FINT3 LDA BOX1 STA BOT2 LDM BOX1,#00H LDM HW54F,#03H JMP SINT9 FINT3:; LDA HW54F CMP #03H BNE FINT4 LDA BOX1; STA BOT3 LDM HW54F,#04H LDM BOX1,#00H JMP SINT9 FINT4: LDA HW54F CMP #04H BNE FINT5
LDA BOX1; STA BOT4 LDM HW54F,#05H LDM BOX1,#00H JMP SINT9 FINT5: LDA HW54F CMP #05H BNE FINT6 LDA BOX1 STA BOT5 LDM HW54F,#06H LDM BOX1,#00H JMP SINT9 FINT6: LDA HW54F CMP #06H BNE FINT7 LDA BOX1 STA BOT6 LDM HW54F,#07H LDM BOX1,#00H JMP SINT9 FINT7: LDA HW54F CMP #07H BNE FINT8 LDA BOX1 STA BOT7 LDM HW54F,#08H LDM BOX1,#00H JMP SINT9 FINT8: LDA HW54F CMP #08H BNE FINT9 LDA BOX1 STA BOT8 LDM HW54F,#09H LDM BOX1,#00H JMP SINT9 FINT9:
LDA BOX1 STA BOT9 LDM HW54F,#00H LDM BOX1,#00H JMP SINT9 FINT99: JMP SINT9 SINT9: EI CLR1 IRQH.6 POP Y POP X POP A RETI 下面是定时1: TIMT1: PUSH A PUSH X PUSH Y CLR1 TM1.0 TIMT8: INC BOX1 SET1 TM1.0;分定时 CLR1 IRQL.7 TIMT9: POP Y POP X POP A RETI |