PDA

View Full Version : Multiple SERIN's



JoeR
- 29th September 2005, 20:59
I'm trying to build an app that can listen to serial data streams from multiple input pins by polling the pins with multiple SERIN statements, each one referring to a specific input pin.

My problem is that, after the first instance of SERIN does its thing on its pin, subsequent SERIN's on different pins don't seem to do anything.

Does anyone have a suggestion for how to make this work?


Joe

BobK
- 29th September 2005, 23:27
Hi Joe,

I'll just beat the "pros" to the punch and tell you that if you want help you have to post the code. They don't like quessing about what you are doing.

BobK

Luciano
- 30th September 2005, 08:59
Hi,

From the PicBasic PRo manual:

SERIN

An optional Timeout and Label may be included to allow the program
to continue if a character is not received within a certain amount of time.
Timeout is specified in 1 millisecond units. If the serial input pin stays
in the idle state during the Timeout time, the program will exit the
SERIN command and jump to Label.

* * * * *

Post your code and describe the format of the data your are receiving.
The devices sending data are also running code written by you?

* * *

While you receive data on one pin, data arriving at the same time on
another pin will be lost. (Could work only if the sent data is redundant).

Best regards,

Luciano

crocodilebobbie
- 6th October 2005, 05:00
Hi:

I found this same problem when the serin command does not get
what it is looking for. If the strings do not get to the SERIN in the right
format, then the serin just hangs up the PIC. The PIC is waiting for the
correct number format.

for example.

SERIN PortC.0, t300, [170,170,TempIn]

if the numbers 170 are not transmitted, or arrive correctly, the PIC hangs
waiting for the correct "strings"

bobbie

Dwayne
- 6th October 2005, 22:22
Why don't you connect all the Serial pins up to the same pin?

Use Serin with the "Flag" or "Qualifier" to acknowledge good data.

You can have bi-directional via one pin...a slave and/or master.

When you use Serin on 3 different pins...You can still use the Qualifier, but I would use a very short "timeout". And either way, there is no guarantee you will lose a packet or two sometime or another. You may have to keep sending until you receive your data from the chip, them send a "receive" bit.

Dwayne