I am just wanting to make sure the idea I have in mind for reading and decoding the signals is correct.
Warning-- Long post ahead
I start off by setting up a counter in the PIC and check the state of Pin RA2 (the pin I have connected to the track). If the time of transition is between 52 and 64 microseconds, I store a 1 in a byte variable. I start checking again and check transition again and then OR that value with 02h (and then the 02h result with the first byte variable). I then repeat this process until I have a 8 bit long byte. If I AND the byte with 0FF,I should get a result of 0, representing a preamble. If not, I need to start reading data again until I find a preamble byte. If the byte was a preamble, I need to use the same method to read in the next byte. I need to AND that byte with my own address to see if the packet is for me. If it is, I need to read the next two bytes and store them. I will check the error packet first to make sure the data is good. If it is, I will use bit tests on the third packet to interpret what I am supposed to do. This whole time, I also need to be updating the function outputs, sound output, and motor output.
I think that is correct, but as I said, I have never really worked with PIC ASM before, and this is my first time working with this low of a level of serial work.
thanks