Shop OBEX P1 Docs P2 Docs Learn Events
FullDuplexSerial & Inverting data via "TX" — Parallax Forums

FullDuplexSerial & Inverting data via "TX"

JMLStamp2pJMLStamp2p Posts: 259
edited 2008-02-01 19:15 in Propeller 1
Hello,

Is there a simple command that would invert the data sent via FullDuplexSerial
Excluding the Mode command?
My situation is that I have "2" Trancievers attached to two seperate Prop boards. I have to give the transmitting end a Mode "1" to Transmit correctly and
the recieving end a mode "2" to recieve correctly. The reason for this is that I have a pair of N-Channel MOSFETS on each board to accomplish the RS232 level conversions interfacing to the Prop. I can transmit to the recieving end and the recieving end will ack. and transmit a code back but when I recieve it back the data is inverted. I have looked through the manual and did not see a command to invert the byte before it is used in FullDuplexSerials TX method but may be overlooking it.

Thanks for any help,
JMLStamp2p

Comments

  • JMLStamp2pJMLStamp2p Posts: 259
    edited 2008-02-01 16:40
    I am assuming that I cannot use the NOT operator "!" with a varible, am I right ?
    ................................................
    My Recieve code fragment below:
    ................................................

    PUB Recieve | rxbyte

    repeat

    rxbyte := data.rx

    if rxbyte == 2
    Data_Recieved_1

    if rxbyte == 5
    Data_Recieved_4
    ..................................
  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-01 16:43
    You have to use the mode value because the start and stop bits (and the idle state of the line) have to be inverted as well, not just the data bits.
  • AribaAriba Posts: 2,685
    edited 2008-02-01 17:04
    You can invert a byte with an Exor operation:
    theByte := theByte ^ $FF
    or shorter: theByte ^= $FF

    Andy
  • JMLStamp2pJMLStamp2p Posts: 259
    edited 2008-02-01 19:10
    Thanks Guys,
    I got it working by bypassing the MOSFET on the Transmit out line. Andy, I will experiment with your code statement and appreciate your help as always !
    Mike, I was having to use different Modes in the Transmitter and Reciever Props until I changed the configuration of my hardware. Now I am using Mode-2 on both ends and everything is working fine, thanks for your help as it is always appreciated as well.
    JMLStamp2p
  • JMLStamp2pJMLStamp2p Posts: 259
    edited 2008-02-01 19:15
    In essence I guess what I meant to say is that the Idle state of the line had to be changed on the Transmit out Pin. The Trancievers that I am using have MAX232's in them and I had to use a level converter "MOSFET" on the recieve in Pin.
    JMLStamp2p
Sign In or Register to comment.