Dedicated serial pin to dedicated serial pin only?
Hi again guys,
I have done some testing:
Scenario:
-Stamp to Stamp Communication.
-2 Basic Stamp used. BS2p40 as receiver and BS2px24 as Transmitter.
Case 1: Dedicated Serin physical pin 2 of BS2p40 and dedicated·Serout·physical pin 1 of BS2px24 used.
Result = Correct data received.
Case 2: Dedicated Serin physical pin 2 of BS2p40 used and Serout of BS2px24 is now changed to physical pin 5 (P0 of the I/O pins)
Result =·Incorrect data received.
Case 3: Serin of BS2p40 is now changed to physical pin 5 (P0 of I/O pins) and dedicated Serout physical pin 1 of BS2px24 used.
Result = Incorrect data received.
Case 4: Serin of BS2p40 is physical pin 5(I/O pins)·and Serout of BS2px24 is physical pin 5(I/O pins)
Result = Correct data received.
My questions is why would it be that only when both Rx and Tx are normal I/O pins or when both Rx and Tx are dedicated serin and serout pins,·the data can be·send/received correctly, and why can't a dedicated Serin send/receive the correct data from a normal I/O pin programmed as Serout, and vice-versa. Would it be possible to make the dedicated serout and serin work·correctly with normal I/O pins programmed as serout and serin? Thanks for your time reading my question [noparse]:D[/noparse]
·
I have done some testing:
Scenario:
-Stamp to Stamp Communication.
-2 Basic Stamp used. BS2p40 as receiver and BS2px24 as Transmitter.
Case 1: Dedicated Serin physical pin 2 of BS2p40 and dedicated·Serout·physical pin 1 of BS2px24 used.
Result = Correct data received.
Case 2: Dedicated Serin physical pin 2 of BS2p40 used and Serout of BS2px24 is now changed to physical pin 5 (P0 of the I/O pins)
Result =·Incorrect data received.
Case 3: Serin of BS2p40 is now changed to physical pin 5 (P0 of I/O pins) and dedicated Serout physical pin 1 of BS2px24 used.
Result = Incorrect data received.
Case 4: Serin of BS2p40 is physical pin 5(I/O pins)·and Serout of BS2px24 is physical pin 5(I/O pins)
Result = Correct data received.
My questions is why would it be that only when both Rx and Tx are normal I/O pins or when both Rx and Tx are dedicated serin and serout pins,·the data can be·send/received correctly, and why can't a dedicated Serin send/receive the correct data from a normal I/O pin programmed as Serout, and vice-versa. Would it be possible to make the dedicated serout and serin work·correctly with normal I/O pins programmed as serout and serin? Thanks for your time reading my question [noparse]:D[/noparse]
·
Comments
Take a look at the DEBUG command in the PBASIC Reference Manual on Page 159. That may answer your questions.
As noted before, pin port 16 is a PSEUDO port, and does not act/react like the REAL I/O pin ports (0-15). Pin port 16 has some fixed characteristics, which follow:
BS-2 (O/T BS-2px) - 9600, N, 8, 1
BS-2px - 19,200, N, 8, 1
As I remember, the output is always INVERTED as well.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
SEROUT 0,16780,[noparse][[/noparse]"a"] ' for the BS2px to transmit at 9600 baud
SERIN 16,240,[noparse][[/noparse]char] ' to receive on the BS2p at 9600 baud
In the SERIN command above, it does not matter whether you use baudmode 16624 or 240. The dedicated serial port should receive it correctly either way (The "inversion" bit is ignored in reference to the dedicated port.)
The same type of inversion must be used in case 3, where the BS2p will have to use inverted baudmode to receive (16624 to receive at 9600 baud).
The dedicated serial port can do many different baud rates using SERIN/SEROUT. But as Bruce pointed out, the DEBUG command is limited to a specific baud rate of 9600 on all stamps {b}except the BS2px, which is 19200 baud.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com