Inverting Serial comms for RS232 input

Status
Not open for further replies.

Aargh

New member
Hi Everyone
I recently bought a Maxbotix ultrasonic range finder, which outputs data in "RS232" which is not really RS232 as it is 0 - Vcc. I found another post with details on how to invert the signal coming from the teensy, and used this approach to set the UART Status Register 2 (UART_S2), one bit of which inverts the incoming signal, which works a treat.
Code:
UART1_S2=0b00010000;
My question relates to the other bits I'm setting as I have no idea what these are doing (from page 1216 of the technical manual):
LIN Break Detect Interrupt Flag
RxD Pin Active Edge Interrupt Flag
Most Significant Bit First
Receive Wakeup Idle Detect
Break Transmit Character Length
LIN Break Detection Enable
Receiver Active Flag

I don't really care what these things do, just so long as I know the way I have set them isn't going to cause stability or performance issues.
The other thing which I think this line of code may open up is the ability for the teensy to read real RS232 data with a couple of resistors and a diode:
teensyRS.jpg
Although I'm not sure if that diode will work to stop the negative voltage getting to the teensy?
Disclaimer - I'm pretty new to all this if you haven't figured it out.....
 
On Teensy3, you can use Serial1.begin(baud, format), where "format" can be SERIAL_8N1_RXINV_TXINV to select inverted signals.

You can also directly manipulate the hardware registers, if you really want to...
 
Haha yep that would be more straight forward! Cheers for that Paul.
Not important now but I forgot to mention that I'm using a Teensy 3.1 board.
 
Status
Not open for further replies.
Back
Top