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 CCS Technical Support

Questions on RS232 Receiving

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



Joined: 27 Sep 2006
Posts: 11
Location: ITHACA,NY

View user's profile Send private message

Questions on RS232 Receiving
PostPosted: Sun Oct 01, 2006 9:05 pm     Reply with quote

Hi,
I'm new to the "PIC WORLD" and so these questions may seem a little foolish, but any insight would be greatly appreciated. I'm using the USB Protyping board (with a 18F4550 PIC) to test out RS232 communication with a microscope stage. I am able to transmit commands to the stage without a problem, however, after telling the stange controller to, for example, go to position (x,y), the controller is supposed to return 5 bytes upon the stage having reached that position. I am having difficulty recieving these status bytes. The code that I have been playing around with looks like this...

Code:


//code here telling the stage to go to (x,y)

while(!kbhit()){};
for(int8 i = 1; i<=5; i++)
    getc();


Following this I try to send more commands to the stage controller, but for some reason the system hangs. Do I need to worry about the fact that the pic set up has no RTS/CTS lines?
Also, I think i read somewhere that the buffer can only store 3 bytes, and so I am worried that 5 bytes coming in rapidly is somehow crashing the system. Is this possible?

Thanks for any help, it's much appreciated.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 02, 2006 1:47 am     Reply with quote

getc() will wait for a kbhit(). You don't need to check it first.

If you're worried about over-running the hardware receive fifo,
the standard method is to use an interrupt-driven software receive fifo.
See the CCS example file, EX_SISR.C.
It's in this folder: c:\Program Files\Picc\Examples
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