CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to set up a custom serial communication?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Bob666
Guest







How to set up a custom serial communication?
PostPosted: Wed Feb 14, 2007 10:11 am     Reply with quote

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.

Thanks in advance,

Bob



My problem
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 14, 2007 12:29 pm     Reply with quote

Example of a hardware SPI slave with an interrupt-driven receive buffer:
http://www.ccsinfo.com/forum/viewtopic.php?t=26888
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group