RS-232 and RS-232 protocol

cmartinez

Joined Jan 17, 2007
8,788
I was sorry to see it replaced by USB, it is handy for long distance shop use, I recall using LSI UART ic's in conjunction with MC1488/89 to implement RS232 level.
Many MoBo's such as Asus, still have the port on the board should it be required.
Max.
I see what you mean... but RS232 is very slow and unreliable compared to USB, although it can work at far greater distances. At this point, I'm building circuits using the MCP2221A (which costs less than $2 dlls) which converts from USB to UART, and I'm getting a flawless throughput of 115,200 Bauds. I've tested it night and day without a single error in transmission!
 

MaxHeadRoom

Joined Jul 18, 2013
30,693
I see what you mean... but RS232 is very slow and unreliable compared to USB, although it can work at far greater distances. At this point, I'm building circuits using the MCP2221A (which costs less than $2 dlls) which converts from USB to UART, and I'm getting a flawless throughput of 115,200 Bauds. I've tested it night and day without a single error in transmission!
How would it stand up for e.g. in a (electrically noisy) shop floor manuf. facility for part program distribution to various machines?
Generally the maximum for this application is 9600 baud, I assume the MCP2221 output could be translated to RS232?
Max.
 

cmartinez

Joined Jan 17, 2007
8,788
How would it stand up for e.g. in a (electrically noisy) shop floor manuf. facility for part program distribution to various machines?
Generally the maximum for this application is 9600 baud, I assume the MCP2221 output could be translated to RS232?
Max.
Most certainly yes, it can easily be turned into RS232... but the MCP221A has a fixed protocol of 8-bits, one stop bit and no parity, and that cannot be changed. It's a bummer because in some of my designs I'm using automatic MCU identification through the use of a 9-bit protocol. But there are workarounds for that.

On the other hand, keep in mind that USB, although it's a low voltage signal, is differential, and it's more resistant to noise than most people realize.
 

MrChips

Joined Oct 2, 2009
34,889
Yes, TS should be totally confused by now.

UART implements UART protocol.
MAX232 implements RS-232 protocol.
DB-25S and DE-9P implements DTE/DCE TIA-232 protocol.
MODBUS RTU (RS-232 or RS-485) implements MODBUS protocol.

What is there that is so difficult to understand?
 

cmartinez

Joined Jan 17, 2007
8,788
What is there that is so difficult to understand?
It's difficult for me because RS-232 is the standard for a physical, electric signal, while UART is a series of logic steps taken to accomplish serial communications. For me at least, a protocol is the definition of logic steps, and is independent of the medium used to implement them.
 

MrChips

Joined Oct 2, 2009
34,889
It's difficult for me because RS-232 is the standard for a physical, electric signal, while UART is a series of logic steps taken to accomplish serial communications. For me at least, a protocol is the definition of logic steps, and is independent of the medium used to implement them.
So let's stop calling it RS-232 protocol and call it RS-232 standard, when referring to MAX232-type level-converter chips, for example.
 

cmartinez

Joined Jan 17, 2007
8,788
So let's stop calling it RS-232 protocol and call it RS-232 standard, when referring to MAX232 type level-converter chips, for example.
Agreed 100% ... for example, I'm currently using RS485 chips to convert a 5V output signal from an encoder into a differential one and transmit it through a long distance.... it's convenient because it makes the signal highly immune to noise, and that has nothing to do with any protocol of any kind.
 

MrChips

Joined Oct 2, 2009
34,889
Perhaps this is what is confusing the TS.

Suppose there is an imaginary engineer that has two devices, A and B, that are communicating with each other. Then someone comes along and asks the question, "What serial communication protocol are you using?"

The engineer responds, "I'm using RS-232 protocol".

Here is what the engineer meant to say or could have said:

1. I am using a UART, at 9600 baud, 8 data bits, 1 stop bit, even parity.
2. I am using MAX232 level shifters.
3. I am using a DE-9 connector with RTS, CTS, control flow handshake.
4. I am using MODBUS ASCII protocol.

In summary, whereas there is an RS-232 standard, there is no RS-232 protocol.
 

MaxHeadRoom

Joined Jul 18, 2013
30,693
Most certainly yes, it can easily be turned into RS232... but the MCP221A has a fixed protocol of 8-bits, one stop bit and no parity, and that cannot be changed. It's a bummer
On the other hand, keep in mind that USB, although it's a low voltage signal, is differential, and it's more resistant to noise than most people realize.
The problem is that RS232 has always been the method for shop floor/CNC machine downloading, and most shops do not replace machines every year, so there are many machines that are still around that are using it.
Max.
 

cmartinez

Joined Jan 17, 2007
8,788
The problem is that RS232 has always been the method for shop floor/CNC machine downloading, and most shops do not replace machines every year, so there are many machines that are still around that are using it.
Max.
I doubt that RS232 is going to be completely displaced anytime soon (although I prefer RS485). There will always be a need for wired devices, and networked protocols such as ethernet are convenient, but are more complicated (electronically-wise) and require the use of switches or routers, and have an overhead that affect their response time.
 

ericgibbs

Joined Jan 29, 2010
21,463
I was sorry to see it replaced by USB, it is handy for long distance shop use, I recall using LSI UART ic's in conjunction with MC1488/89 to implement RS232 level.
hi,
I also used the 'old' 6402 UART 88/89's until MCU's and MAX232 became available.
 

cmartinez

Joined Jan 17, 2007
8,788
I, for one, will not miss the clunky DB9 connectors... although the USB connectors are annoying in that they have to be oriented the right way, the new USB3 standard is going to do away with that too.

Ever heard this joke?:

When the inventor of the USB stick dies they'll gently lower the coffin, then pull it back up, turn it the other way, then lower it again.
 

ebp

Joined Feb 8, 2018
2,332
It would help if the TS would explain a bit about what he wants to actually do, if the question is not just very general. It sounds to me like there is confusion between asynchronous serial data communication and the details of RS-232.
 

MaxHeadRoom

Joined Jul 18, 2013
30,693
I, for one, will not miss the clunky DB9 connectors... .
Now a days If coming off of a 9 pin MB connection or a custom type UART out, you can usually do it with a Null modem 3 wire connection and a 3 pin plug/socket arrangement as the need for turning on/off a remote devices etc, is pretty much gone.
If some device does requires to see the H.S. etc, it can be jumpered out locally and use software H.S. = XON/XOFF if necessary.
Max.
 
Last edited:

be80be

Joined Jul 5, 2008
2,395
MCP221A Is just a locked 18F13k50 or 18F14k50

At one time there was code for those chips and it dose the same stuff so my bet is they program them and locked them.

But you can program a 18f13k50 and do anything you would want that the MCP221A can't do.
 

cmartinez

Joined Jan 17, 2007
8,788
MCP221A Is just a locked 18F13k50 or 18F14k50

At one time there was code for those chips and it dose the same stuff so my bet is they program them and locked them.

But you can program a 18f13k50 and do anything you would want that the MCP221A can't do.
Very interesting, the 18f13k50 datasheet matches the mpc2221a in every aspect but its pin count.

Is there an 8051 chip out there in dip package with usb/uart capability?
 

Thread Starter

Fanfire174

Joined Mar 13, 2018
240
There is something called "bit banging".

If you do not have hardware UART you can still send and receive UART "protocol" using software "bit banging".
Is this what you are referring to?
Software Uart vs Hardware Uart

When we need to transmit/receive data on microcontroller we use Uart. We connect microcontroller to PC using usb to rs232 cable so that both device can communicate with each other.
  • if microcontroller have uart module then we write program for serial communication this process known as hardware uart
  • if microcontroller don't have uart module available then we setup the pin of microcontroller using software program because the pin of microcontroller are software configurable. We can set either input or output. So when we don't have uart module available on microcontroller then we use software Uart.
For example PC has uart but microcontroller don't have Uart then we set pin of microcontroller by programming for serial communication

Does it happen in really ?
 

cmartinez

Joined Jan 17, 2007
8,788
Yes, this can happen. But now it is becoming rare.
Most MCUs today have hardware UART. High end MCUs will have multiple UARTs. The MCU I am using today has four UARTs.
Also, serial ports on pc's have more sophisticated uarts, with features like configurable read/write buffers, for instance.
 
Having worked with RS232 noting was "standard" once the PC came out and put those 9 pin connectors on it.
With the 25 pin connectors, usually you needed a null modem adapter or a gender changer. When the 9 pins stuff came out, you needed a breakout box. Some flipped RTS/CTS and DTR/DSR. In other words DTR was RTS.

then there is 134.5 baud for the IBM selectric typewriter. So, you have 1, 1.5 or 2 stop bits; you have even, odd or no parity; You have 7 data bits and a parity bit or 8 data bits. You had baud rates all over the place.
then don't forget it was 3 to 25 v and -3 to -25V, so people thought you could communicate long distances with +-5V - Fat chance.

You now have to worry something called TTL RS232; which again is nonsense. Then there is the serial current loop interface.

You can cross a few wires here and there "most of the time" and make an RS422 device talk to an RS232 device except when it doesn't work.

About the only thing protocolish is hardware and software handshaking, but even that gets hairy because ^S is stop and ^Q was start, but someone made any character start in some cases. ^S and ^Q was used initially to start and stop a paper tape reader. On an ASR-33 teletype you could only type so fast.

Then there is the break sequence.
 
Top