RS-232 and RS-232 protocol

nsaspook

Joined Aug 27, 2009
16,353
and before ASR-33 there were old Baudot machines like the model 15 that used high level 60mA current loops instead of voltage levels. They used the 1.5 stop 5 data bits mode of the old 8250 UART if you needed to interface one to a modern device with a RS-232 interface for some strange reason. o_O
|7|6|5|4|3|2|1|0| 2FB, 3FB Line Control Register
| | | | | | `------ word length select bits (see below)
| | | | | `------- 0 = 1 stop bit, 1 = 1.5 or 2 (see note)
| | | | `-------- 0 = no parity, 1 = parity (PEN)
| | | `--------- 0 = odd parity, 1 = even (EPS)
| | `---------- 0 = parity disabled, 1 = enabled
| `----------- 0 = turn break off, 1 = force spacing break state
`------------ 1 = baud rate divisor (DLAB); 0 = RBR, THR or IER

Bits
10 Word length bits

00 = 5 bits per character
01 = 6 bits per character
10 = 7 bits per character
11 = 8 bits per character

- stop bits = 1.5 for 5 bit words or 2 for 6, 7 or 8 bit words
- bit 7 changes the mode of registers 3F8 and 3F9. If set these
registers become the LSB and MSB of the baud rate divisor.
Otherwise 3F8 is the Transmit/Receive Buffer Register and 3F9 is
the Interrupt Enable Register.


 

Thread Starter

Fanfire174

Joined Mar 13, 2018
240
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.
Hardware
  • Hardware Uart
  • Hardware SPI
  • Hardware ADC
  • Hardware CAN
Software
  • Software Uart
  • Software SPI
  • Software ADC
  • Software CAN
If microcntroller don't have hardware so there we will use software program for serial communication right. For example if microcntroller don't have ADC hardware then we will use software ADC right ?

But the question raise in mind why we prefer hardware module then software program ?
 

miniwinwm

Joined Feb 2, 2018
68
Hardware
  • Hardware Uart
  • Hardware SPI
  • Hardware ADC
  • Hardware CAN
Software
  • Software Uart
  • Software SPI
  • Software ADC
  • Software CAN
If microcntroller don't have hardware so there we will use software program for serial communication right. For example if microcntroller don't have ADC hardware then we will use software ADC right ?

But the question raise in mind why we prefer hardware module then software program ?
Never heard of a software ADC. I guess there might be some way to frig it with cunning external analog electronics and a GPIO, but I'm not aware of it.

There are many reasons to use hardware peripherals on a microcontroller if they are available over software simulations of the same thing. Some are...

- Can run faster (much faster)
- Use less electrical and processing power
- Less software development effort
- More reliable
- You've paid for them, so use them!
 

ericgibbs

Joined Jan 29, 2010
21,463
If microcntroller don't have hardware so there we will use software program for serial communication right.
For example if microcntroller don't have ADC hardware then we will use software ADC right ?
hi 174,
It is possible use a bit switching program to send and receive serial data, if the MCU has no hardware UART.
I have never seen a software ADC program.

Using a hardware module for serial or ADC, simplifies the programming required.

E
EDIT:
It is possible to use the hardware UART in a MCU and also to have a second program for serial communication.
 
Last edited:

Ian Rogers

Joined Dec 12, 2012
1,136
hi 174,
It is possible use a bit switching program to send and receive serial data, if the MCU has no hardware UART.
I have never seen a software ADC program.
Hi Eric...

Nigel did it on a digital pin... Just like the old PC joystick... Quite a good resolution if I remember!
 

ericgibbs

Joined Jan 29, 2010
21,463
hi,
I often have a s/w UART on my PIC projects, helps in debugging/monitoring the 'interesting' values.
The h/w UART is part of the main project comms.
E
 

MrChips

Joined Oct 2, 2009
34,889
Hardware
  • Hardware Uart
  • Hardware SPI
  • Hardware ADC
  • Hardware CAN
Software
  • Software Uart
  • Software SPI
  • Software ADC
  • Software CAN
If microcntroller don't have hardware so there we will use software program for serial communication right. For example if microcntroller don't have ADC hardware then we will use software ADC right ?

But the question raise in mind why we prefer hardware module then software program ?
You are going off-topic here.

We can talk about the differences between hardware UART and software UART. Bringing into the discussion software "???" is another matter and calls for a new thread.

(BTW, there is such a thing as software ADC but we need to put this in its proper context in a new thread.)
 
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!
You are reminding me that I have a couple of those chips and the breakout module. For reasons unknown to me, I had it in mind to interface some sensors that use I2C to a PC. Have not done anything except put it on "the list". :)
 
hi 174,
/--/
I have never seen a software ADC program.
/--/
I guess I it is a technicality, but many, many, many years ago, I used a 1-bit ADC (little more than a microphone and an LM324 and a parallel port input bit) to digitize voice for playback through an IBM PC (and a few others) speaker. It was just barely intelligible (more like static) but at the time (~35 years ago) it was novel and software producers actually liked to put that "speech" in games.

Here is an example, almost choked on making the files as I was a devout Bernie Kosar fan :) [ahhh good times]


Edited to add: Yeah this is straying a bit from the topic - sorry.
 
Last edited:

GetDeviceInfo

Joined Jun 7, 2009
2,273
Hardware
  • Hardware Uart
  • Hardware SPI
  • Hardware ADC
  • Hardware CAN
Software
  • Software Uart
  • Software SPI
  • Software ADC
  • Software CAN
If microcntroller don't have hardware so there we will use software program for serial communication right. For example if microcntroller don't have ADC hardware then we will use software ADC right ?

But the question raise in mind why we prefer hardware module then software program ?
software alone will not implement the RS232 standard.

If you are considering a microcontroller, you select one that full fills your needs. If you choose to utilize RS232, then select a micro that contains that module. Most do. Likewise with ADC, CAN, SPI, I2C, etc. Otherwise, you would add a specific hardware device for that function. With the vast offering of micros at very low prices, it would simplify your designs immensely. Once the module is configured, you then implement a protocol which drives data through the port. The caveat is that a voltage translator is required. This may or may not cause you to implement a dedicated device.

In my world, the RS232 standard is the vehicle, and a protocol is the organization and negotiation of data being transmitted. As the RS232 standard does provide for hardware negotiation, the terms will always be confusing
 
Last edited:

ebp

Joined Feb 8, 2018
2,332
The fundamental confusion I see seems to arise from far too common use of "RS-232" when what is actually meant is "aynchronous serial data communication" - since the advent of the desktop computer they have been conflated.

Don't forget 5 bit Baudot. I'd have to dig out some ancient datasheets, but iirc the early UARTs like the AY-5-1013 et al, supported 5 data bits (yup; forgot that the 1013 was specifically spec'd to be TTL and DTL compatible. Sea moss? What the heck does red algae have to do with electronics?

Current loop of course went with teletype but really originated with telegraph. It was easy to optoisolate.

THERE IS NO SUCH THING AS A DB-9 CONNECTOR! None of the standard variants in a size B shell have 9 pins. The E size D-subminiature was a johnny-come-lately, which is why its letter is out of sequence. The push to keep costs down brought us d-subs rated for 15 mating cycles.
 

nsaspook

Joined Aug 27, 2009
16,353
You will have to get all the major manufacturers (Amphenol et-al) to stop using the term then!;)
I think just about everyone who has used RS232 etc, is totally familiar with DB-25, DB9 etc if someone refers to it..
Max.
Officially it's listed as a E shell in the Cinch and most online catalogs.

https://www.peigenesis.com/images/content/pei_tabs/cinch/d-sub-m24308/cinch_d-sub_m24308.pdf

http://www.newark.com/w/c/connector...ard-d-sub-connectors/prl/results?st=DE+shells
 
Last edited:

ebp

Joined Feb 8, 2018
2,332
"DB-9" is like "microchip". Both terms came from outside of the electronics industry. "Hard disk" was never used until after the floppy disk became the standard for boxes on desk tops and then that other kind came along. Prior to that they were just disks. Disk might be removable pack (the vast majority for a long time), fixed-head, Winchester (the new-fangled type that didn't have removable packs and have nothing to do with a popular 2.5 litre jug), but none were ever called "hard."
 

ebp

Joined Feb 8, 2018
2,332
I lied. I knew I should have checked a catalog. There is a 9 position DB - 5 conventional signal pins and 4 co-ax contacts. I'll wager the number of people, even in the electronics industry, who have seen D-subs with power or co-ax contacts is pretty small.

If you want to really confuse people, talk about ribbon connectors and micro ribbon connectors. They think you mean things for ribbon cables, not great hulking things with flat "ribbon" contacts or the micro type often referred to as a "Centronics" connector. At least all the weird stories about what "BNC" stands for have been laid to rest. I'm curious what Messrs. N & C thought about the made-up stuff.
 
Top