min2max
Advanced Member level 4
Hello guys,
I find difficulty handling the TMR0 and RB change interrupts at the same time with a PIC16F877A.
I'm making a LED grid clock with IR remote control. I put the LED scan routine in the TMR0 ISR to get a constant scanning rate. At the mean time, I connect the signal pin of a HS0038B (IR decoder) to RB6 and try to figure out the timing of the remote controller's signal in the corresponding RB<7:4> change ISR.
I'm not able to decode the signal because the timing of the decoded signal series is never in compliance with the protocol. After long time of investigation, I've found the cause is probably the fact that GIE is reset automatically as soon as the ISR is invoked handling another interrupt (TMR0 in this case) which makes some change(s) of RB6 not properly detected and handled.
During the process of debug, it becomes clearer to me that I cannot enable both TMR0 and RB change interrupts at the same time. Is my understanding correct?
[More strictly speaking, I should say -
I can enable both TMR0 and RB change interrupts but I cannot handle both interrupts at the same time]
And does any guy have any suggestion on my project? My basic goal at the time being is to keep a constant refresh rate of LED grid and get the IR signal instantaneously decoded. If this goal cannot be achieved with this chip, which one do you recommend?
I'm coding in C with MPLAB and HI-TECH PIC C complier.
Thanks for any help.
Max
I find difficulty handling the TMR0 and RB change interrupts at the same time with a PIC16F877A.
I'm making a LED grid clock with IR remote control. I put the LED scan routine in the TMR0 ISR to get a constant scanning rate. At the mean time, I connect the signal pin of a HS0038B (IR decoder) to RB6 and try to figure out the timing of the remote controller's signal in the corresponding RB<7:4> change ISR.
I'm not able to decode the signal because the timing of the decoded signal series is never in compliance with the protocol. After long time of investigation, I've found the cause is probably the fact that GIE is reset automatically as soon as the ISR is invoked handling another interrupt (TMR0 in this case) which makes some change(s) of RB6 not properly detected and handled.
During the process of debug, it becomes clearer to me that I cannot enable both TMR0 and RB change interrupts at the same time. Is my understanding correct?
[More strictly speaking, I should say -
I can enable both TMR0 and RB change interrupts but I cannot handle both interrupts at the same time]
And does any guy have any suggestion on my project? My basic goal at the time being is to keep a constant refresh rate of LED grid and get the IR signal instantaneously decoded. If this goal cannot be achieved with this chip, which one do you recommend?
I'm coding in C with MPLAB and HI-TECH PIC C complier.
Thanks for any help.
Max
Last edited: