![]() |
Forum Index : Microcontroller and PC projects : Terminal program to invert signal
Author | Message | ||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Hi all, I want to feed an rs232 signal into my PC via a serial to usb converter over an HC-12 link. I know I could use an MM to invert the signal (I have used Geoff's circuit to convert the levels) but does anyone know if Terra Term or some other termainal program can do it. If TT can do it where is the setting? Rob White |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
All PC serial ports seem to use or emulate (USB) the 16550. As far as I can see this does not support inverted data signals. I think it is therefore unlikely that any terminal emulator could do what you want as the H/W serial port will just report multiple framing errors as the inverted data arrives. |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5091 |
In PC's (historically) the serial port was a hardware chip (as matherp mentiones a 16450 or 16550). The RS232 protocol defines a data START condition and a data STOP condition that have pre defined (+/- 12V) levels. Since the computer chips (16550) cannot provide +/-12V they used a bus driver chip to convert from 5V signals to +/-12V signals. In the PC's from early on these chips where 1488/1489 driver chips (predecessors of the MAX232 chips). And these drivers happen to invert the signal. (-12V to +5V and +12V to 0V). This architecture is build in into the 16550 silicon, and cannot be changed. It needs an invertor to get to the correct RS232 levels. Therefore PC terminal programs can NOT invert the data, because the hardware in the PC cannot. They can manipulate DTR and RTS because these signals can be ignored or overruled. But they can not invert the data line. Only reason we sometimes tend to invert RS232 signals is to save cost of the driver chips (if we use short connections, less than 10 feet), why convert to +/-12V and back again.... Regards, Volhout PicomiteVGA PETSCII ROBOTS |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
I am a bit lost here. Why do you need to invert the signal? If it's *pure* RS232 then I get it as the mark voltage is -12V but with TTL levels a mark is +VCC. So you are shifting the levels +VCC <---> -12V and 0V <---> +12V Is this it? I don't know if I am teaching you to suck eggs here, but; problem is, the inversion required is at the hardware level - a terminal emulator doesn't see this, it works at the abstraction on the back side of the hardware i.e. with the data coming out of the interface electronics. No usable data will come out if the input signals are flipped. To illustrate, Serial is normally left in a "marking" state when idle... that is with the transmit level at a '1'. With RS232, this would be (commonly) -12V (incidentally, this is how some comms hardware derives a negative supply when one isn't available - it "steals" it by siphoning the negative voltage levels into a capacitor through a blocking diode). As a character arrives, you get a '0' start bit (+12v), then your data then the stop bit - a '1' (-12V) which is 1, 1.5 or 2 bits long, leaving the serial link in a marking state for the next character. If you invert this, the start bit will never be seen properly (while idle, the interface will be "spacing" rather than marking so it will get confused) and I am betting you'd get either a load of gibberish on the screen or nothing - irretrievable because the start bit would be interpreted from some arbitrary bit in the data. |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5091 |
Some people try to avoid the cost of the MAX232 / 1488/1489 drivers by implementing a poor mans solution. The RS232 standard the threshold between MARK and SPACE is 1.92V. Everything above 1.9V is SPACE (i.e. +12V), and everything below is MARK (i.e. -12V). There is no hard requirement to achieven +12V and -12V levels, that is why we have MAX232 chips (+9V and -9V) that work well. The poor mans solution however is to use +5V and 0V (or even +3.3V and 0V) logic levels for RS232. That will work with short cable runs. But you still need the hardware inverters if you want to connect to a PC. PicomiteVGA PETSCII ROBOTS |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Sorry I have probably only given part of the full scenario. I will flesh it out. Among other hats I am a cattle farmer. I have been given a probe to read the REFRID ear tags, all cattle in Australia should carry a tag the system is known as NLIS. This probe (manual here) has internal storage of these numbers and outputs via RS232 It will plug onto an old laptop (read dead battery) with serial port and works fine with TT. Problem is it is very difficult to use the cattle yards! We really need to be able to see the numbers as we scan so we can correlate the NLIS with our own visible ear tags. So my solution was to pick up the RS232 signal from the probe and feed it to a radio link made with a pair of Hc-12's. Then the probe is mobile and the laptop can be stationary BUT all I get with the radio link is garbage (inverted signal). Baudrate etc is correct a loopback works fine and direct connect to laptop is also fine. So solution seems to be an MM 170 on the probe end to invert and then pass signal on to the HC-12, was hoping to avoid the MM so battery life would be longer. Any comments are welcome. Rob White |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
MAX232 modules are very cheap and a lot easier and lower power than a micromite to invert signals. Jim VK7JH MMedit |
||||
Zonker![]() Guru ![]() Joined: 18/08/2012 Location: United StatesPosts: 767 |
I do think the MM's can be set to use their serial ports in "inverted" mode directly... You could send the RFID data to the MM [with display attached] to check the #'s at the scanner, then, using the other serial port, re-transmit the data to the Bluetooth radio back to the PC in "normal" mode for PC data storage... Should work OK... ![]() |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5091 |
Dear Bizzy, Your system looks like TAG----HC12 - - - - - HC12----PC Please understand that the HC12 needs the signal inverted to work. And the PC needs the inverter to work. So it should look like: TAG---MAX232---HC12 - - - - - HC12---MAX232---PC Hope this helps Volhout PicomiteVGA PETSCII ROBOTS |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Yes thanks Volhout, That is what I had in mind but I will use a more modern laptop so it will be a serial to USB converter on the PC end. Rob White |
||||
srnet Senior Member ![]() Joined: 08/08/2014 Location: United KingdomPosts: 164 |
You can use FT-Prog to invert TX RX on a FTDI adapter. $50SAT is Silent but probably still working. For information on LoRa visit http://www.loratracker.uk/ |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |