PDA

View Full Version : Serout2, Serin2 and Flowpin



rsocor01
- 18th May 2013, 20:59
Hi,

I'm sending and receiving data from a serial module using Serout2 and Serin2 at a 19200 baud rate without any problems. I have read these command sections in my PBP 2.60 manual several times. I just can't figure out what is the function of the Flowpin and how it works. The explanation given in the manual is just not helping me much. Can somebody enlight me here?

Thank you,

Robert

Demon
- 18th May 2013, 22:18
From reading the manual, using flowpin will permit transfer of data without overrunning receiver. I've never used it even at 115K at 48MHz (or was it 64MHz), didn't overrun receiver.

This would be useful if your receiver could be "disturbed" by an interrupt handler or something like that.

Robert

rsocor01
- 19th May 2013, 03:53
From reading the manual, using flowpin will permit transfer of data without overrunning receiver.

Yes, that's the description of Flowpin in the manual. But, that doesn't really help much. No explanation as how it works or at least a useful example.

HenrikOlsson
- 19th May 2013, 08:59
Hi,
Lets say you have two PIC that are supposed to talk to each other over a serial line, you use SEROUT2 on one and SERIN2 on the other. Both PICs however have other things to do as well so if the sender would just spit out data whenever it feels to there's a big chance the receiver isn't listening and the data would be lost. Using flow control is a way around that problem.

The sender PIC will not send any data untill it sees its flowcontrol input going active and the receiver PIC won't set its flowcontrol output untill it's actually ready to receive.

So, when the receiver is ready to accept data it sets its flowcontrol output and waits for the data, if the sender isn't ready no data will be sent and the recveiver will timeout and continue. If the sender is ready to send data it'll look at its flowcontrol input to see if the receiver is ready, if it is it will send the data. If the sender does NOT see the flowcontrol signal then IT will timeout and continue.

/Henrik.

rsocor01
- 19th May 2013, 23:02
Thank you Henrik. That explains it all. It might come handy in the future.

Robert