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

RS232 software flow control

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



Joined: 29 Aug 2012
Posts: 97

View user's profile Send private message

RS232 software flow control
PostPosted: Sun Sep 16, 2012 9:12 pm     Reply with quote

Hi guys.

I want to use RS232 with flow control, but I haven't found options in PCD manual. Does anyone know how to setup with ccs?
Actually even if CCS can not setup RS232 with software flow control is ok, what I want to do is once I want to sending terminal to stop sending, it can stop. And can be resumed once it got "ON" command.
I checked online and just sending Xon or Xoff can make sending terminal stop or continue sending. However, after my PIC sent Xoff (0x13) to PC, the software (RealTerm) keeps sending the data to PIC. I set a breakpoint just after PIC sends 0x13 (Xoff), but the RealTerm software doesn't stop sending the file.
Anyone has idea? or I misunderstand something?
Thanks a lot

Mark
naughty_mark



Joined: 29 Aug 2012
Posts: 97

View user's profile Send private message

PostPosted: Sun Sep 16, 2012 10:36 pm     Reply with quote

I tried
fprintf(GSM,"%x", 0x13);
and
fputc(0x13,GSM);

both of them can not let RealTerm stop sending.

If I make loopback at the RS232 port, and send 0x13 by RealTerm, then RealTerm can not sending any further byte at all which means it gets stop cmd.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Sep 17, 2012 1:59 am     Reply with quote

Two possible reasons for it not working:
1) With your breakpoint directly after sending the XOFF character it is possible the UART didn't have time to transmit the data. Assuming 9600 baud it will take close to 1ms to transmit the 10 bits (8 data, start and 1 stop bit). And that is assuming the transmit buffer was empty when you sent the XOFF. Your dsPIC33EP256MU814 has a transmit buffer of 4 characters so you might have to wait a total of 5 character times (50ms) before you can activate the breakpoint.

2) Another reason might be that RealTerm isn't configured for using software flow control. I don't use Realterm because I think it is a bit overwhelming in options. From the screenshot at http://realterm.sourceforge.net/index.html#Baud_Rates__Ports it looks like you have to check both the Receive XON character and Transmit XOFF character. Looks like a confusing configuration to me as you can't have XOFF without XON to enable the flow again. Perhaps that's why I prefer to use PuTTY.
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Sep 17, 2012 1:59 pm     Reply with quote

I'm also a big fan of PuTTY -- although I will say RealTerm does have its uses when doing debugging in some cases.

For all other cases -- PuTTY

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
naughty_mark



Joined: 29 Aug 2012
Posts: 97

View user's profile Send private message

PostPosted: Mon Sep 17, 2012 4:06 pm     Reply with quote

Thank you, ckielstra and bkamen.

The ideas are useful, I will try some way else.
Thanks again.
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