View previous topic :: View next topic |
Author |
Message |
naughty_mark
Joined: 29 Aug 2012 Posts: 97
|
RS232 software flow control |
Posted: Sun Sep 16, 2012 9:12 pm |
|
|
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
|
|
Posted: Sun Sep 16, 2012 10:36 pm |
|
|
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
|
|
Posted: Mon Sep 17, 2012 1:59 am |
|
|
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
|
|
Posted: Mon Sep 17, 2012 1:59 pm |
|
|
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
|
|
Posted: Mon Sep 17, 2012 4:06 pm |
|
|
Thank you, ckielstra and bkamen.
The ideas are useful, I will try some way else.
Thanks again. |
|
|
|