Hi, I would like to setup a custom kind of one-direction serial communication between an I/O device and a PIC in order to send some commands from the device to the PIC.
My I/O device has 2 output pins, a clock pin and a data pin. I have setup my PIC to have two corresponding input pins.
My I/O device then sends (in synchronization with the clock pin) 8 bits of serial data over the data pin which enables me theoretically call 256 different commands inside the PIC, each one corresponding to a different address of the 8 bit data.
I have implemented this and it more or less works but I feel my implementation (in C) inside the PIC is not very robust and sometimes the wrong function inside the PIC is called and I am not sure why.
So my question is simple: can anyone point me to some code example on how to implement a loop function inside the PIC that will watch out for incoming data and address it to the right command? The tricky thing is probably with repsect to timeouts and so on. For instance, my I/O device always sends the data within a certain timeframe but there may be some variations because it is MS-Windows related.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum