• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

RS232 flow control

Status
Not open for further replies.
i use HyperTerminal (telnet) to observe data sending from Pic. In which situation, i have to set the flow control to :hardware, xon/xoff or none?

i've observed that, if i use printf() (CCS C), i have to set the flow control as xon/xoff.
If i use putc(), then i have to set the flow control to none, in order to obtain a proper display.
 

Exo

Active Member
It depends, on both your hardware and software.
Hardware flow control uses 2 extra lines between pc and pic (RTS and CTS). With these 2 lines the pc and pic can tell each other when they are ready to receive data. On the pic you will have to implement this yourself by using 2 general io pins.

Xon/Xoff uses certain character codes in the data to indicate the transmitter must stop tranmitting, or resume when it was stopped.

Most ppl don't use handshaking. They just let the pc send data to the pic and the pic has to respond before the program continues, this is a sort of flow control on its own

search some documentation about your C compiler to see how the printf(); was written and what it requires. Or write your own routine...
 

bmcculla

New Member
Very few devices use flow control these days. It was originally intended to keep you from overflowing the buffers on modems. I don't think your PIC is using flow control. I'ts posible that the Printf function is doing flow control. Its easy to check. just look at the number of lines going into the RS232 Level shifter. If its only two there's no flow control.

Brent
 

StupidDum

New Member
yea.. i first tried out RS232 using hyperterminal as well. Janet, it seems like we are going through the same process during learning. I use CCS as well.

During those days, i tried all the hardware, software(Xon/Xoff) shaking and no handshaking, without understanding what are those thing.

To make things easy, if you connect using 2 wires, that is "no handshaking". 4 wires = hardware handshaking. It is not often to use software handshaking.

In most of the PIC projects, no-handshaking is ok. If your PIC is driven by crystal oscillator, the timing should be accurate, this avoids handshaking
 

Nigel Goodwin

Super Moderator
Most Helpful Member
StupidDum said:
In most of the PIC projects, no-handshaking is ok. If your PIC is driven by crystal oscillator, the timing should be accurate, this avoids handshaking
It's not down to accuracy, that's nothing to do with handshaking.

Handshaking is required when one end sends data too fast for the other end to process - sensible program design avoids this quite easily.

A 16F628 using it's internal 4MHz oscillator is quite accurate enough to run at 9600 baud.
 
:) after i remove
bit=9, parity=n
from
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)
and insert NOWDT into #fuses

and set the control flow to none, everything works fine.
Although i don't know the reason behind this. ^_^
 

Exo

Active Member
bit=9 would make the pic send 9 databits, if the pc excpects 8 bits (normal setup) the 9-bit data from the pic could generate a overrun error.

It just comes down to the fact that you have to use the same settings on both sides.
 

StupidDum

New Member
:) after i remove
bit=9, parity=n
from
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)
and insert NOWDT into #fuses

and set the control flow to none, everything works fine.
Although i don't know the reason behind this. ^_^
Yea.The setting in PIC suppose to be same with the one on PC, those are baud rate, data bit, parity bit, stop bits.
By default in CCS, the data bit is 8, no parity.
I still don't understand the exact function of #fuses. Anyway, i never turn on the watchdog timer, it causes problem.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top