The HT6026 uses three states for the data encoder. This makes the decoding much more difficult using PIC instead of a dedicated chip.
To decode this in software, I think it is necessary to use interrupts on PortB.0 and also in cooperation with the flag 6 in Option_Reg to detect the edge of the incoming pulse.
Then with the timers of the PIC you can measure the width of every pulse by starting and stoping the timer for every pulse that triggers the interrupt pin on PortB.0
As you can understand it is not at all an easy task.
It would be necessary to use a second timer also to have a timeout, if the incoming series of pulse is noise and dump the collected data so far. Every data packet is 72 clock long. For 20KHz clock this is 3,6 ms. So if the data packet (AD0-AD8) is longer than say 4ms, software should consider it as noise.
Now that I check each pulse, it seems that for 20KHz clock, each pulse is 50usec width. For a PIC like 628 at say 4 or even 8MHz this is too fast.
It may not be possible to decode in basic and assembly might be the way to go.
Ioannis




Bookmarks