cc1984
- 18th February 2012, 00:33
Reading all the interrupt stuff lately, I am trying to use it to solve a problem I have.  I am trying to set up a hardware serial transmission of data from PC to PIC (18F46K22) at 115200 baud.  I need to transfer 20 bytes of data repetively, then write the data to a memory chip.  So after many other attempts to perform this task, I have resorted to interrupts.  My thoughts are that I will signal the PC that the PIC is ready for data in the main routine, by setting CTS (connected from a pic pin to the pc CTS line) high.  This then uses a Windows Comm Control Comm Event to signal something changed.  Once the PC sees a CTS event and sees that CTS is high, it sends the 20 bytes of data.  I know that the PIC hardware serial port has only 2 bytes of storage but I think that when the interrupt is recieved notifying that data is in the receive buffer, I will grab the whole  20 bytes, hopefully preventing an overflow.  Just to get it going and not worrying about missing some data, I clear the overflow bit after every receive.
This seems to work for a few interations, but then all just stops. I am still trying, but would appreciate any help that anyone could provide. Code attached
This seems to work for a few interations, but then all just stops. I am still trying, but would appreciate any help that anyone could provide. Code attached