communication between MCU and PC

Thread Starter

King2

Joined Jul 17, 2022
163
I am being badly confused with terms like Rs232, TTL, interface, converter, protocol between PC and MCU in serial communication. I can't understand the difference between each of them.

I understand that if we want to send/receive data from MCU to PC or send/receive data from PC to MCU, we need a hardware circuit between PC and MCU. I think we call it hardware interface like usb to ttl, usb to rs232 interface between PC and MCU.
 
Last edited:

Papabravo

Joined Feb 24, 2006
21,158
If you want to connect two devices together, they have to use the same signaling method. This is mostly a matter of the voltage levels you use and how you use those voltage levels to define a '1' and a '0'. If you can wrap your head around that concept, we can proceed to the next concept which is: "what do the strings of '1's and '0's actually mean"?
 

Thread Starter

King2

Joined Jul 17, 2022
163
This is mostly a matter of the voltage levels you use and how you use those voltage levels to define a '1' and a '0'. If you can wrap your head around that concept, we can proceed to the next concept
Whatever data will be sent or received, it should be in the form of logic "1" or logic "0"

logic "1" is +5V (or +3.3V) and logic "0" is 0V.
 

Papabravo

Joined Feb 24, 2006
21,158
Whatever data will be sent or received, it should be in the form of logic "1" or logic "0"

logic "1" is +5V (or +3.3V) and logic "0" is 0V.
Yes, that is one possible way, but it could also be the reverse, with the higher voltage being a '0' and the lower voltage being a '1'. Differential signaling is also a possibility. In most simple interface methods, digital data is composed of fixed length strings of '1's and '0's. Data can be made into a sequential string of '1's and '0's in two different ways. It can be Most Significant Bit (MSB) first, or Least Significant Bit (LSB) first. It is essential that both ends of a communication link be able to agree on this point.
 

Thread Starter

King2

Joined Jul 17, 2022
163
It can be Most Significant Bit (MSB) first, or Least Significant Bit (LSB) first. It is essential that both ends of a communication link be able to agree on this point.
I do not understand the voltage level for RS232.

Valid RS-232 signals are either in the range of +3 V to +15 V or the range −3 V to −15 V
This statement is confusing me.The microcontroller can only output zero to 5 volts. I don't understand what 15 volts indicates.
 

ronsimpson

Joined Oct 7, 2019
2,985
This statement is confusing me. The microcontroller can only output zero to 5 volts. I don't understand what 15 volts indicates.
There are "RS232" transceiver ICs that has 0/5V on the computer side and +/- 10V on the cable.
Some of the ICs need +12V and -12V supplies and some types take the 5v and make the needed supplies inside the IC.

The higher voltage, stronger signal travels better on a long wire.
 

Papabravo

Joined Feb 24, 2006
21,158
On the RS-232 Cable the negative voltage in the range -3VDC to -25VDC is referred to as the "MARK" level and is equivalent to a logical '1'. The positive voltage in the range +3VDC to +25VDC is referred to as the "SPACE" level and is equivalent to a logical '0' When these levels a passed through a logical inverter they are transformed into:
  1. MARK → +5VDC (3.3VDC)
  2. SPACE → 0VDC
The voltage range from -3VDC to +3VDC is a no man's land or transition region where the notion of '1' and '0' is undefined. This is not usually a problem since bits are transmitted at a fixed rate and they are sampled near the middle of the bit. Even if the clocks of the receiver and transmitter are at slightly different frequencies this does not matter over a small number of bits, for example 10-15 bits. This would not be true for longer strings of bits.

The 50V P-P maximum swing allows for significant attenuation of the signal voltage on a long cable run at low bit rates. Using lower voltage for the maximum P-P voltage on the RS-232 cable means that we are limited to shorter cables.
 

WBahn

Joined Mar 31, 2012
29,976
Whatever data will be sent or received, it should be in the form of logic "1" or logic "0"

logic "1" is +5V (or +3.3V) and logic "0" is 0V.
You need to separate the logical signal (a '1' and a '0' -- or a 'True' and a 'False') from the physical signal. The physical signal that is used to represent each logic level depends on the interface specification that is used. For those of us working at low speed with hobbyist-type projects that fit on the desk, we often use the positive supply voltage for a logic '1' and 0 V for logic '0'. But if we want to send that signal a long distance, we often need larger signals to do so reliably. At the other end, as we work with interfaces that operate faster and faster and that need to dissipate less and less power, those voltages come down a lot. Another thing that is common is the use of differential signals in which, perhaps, +100 mV is a '1' and -100 mV is a '0'.

So the first thing that needs to be decided (or looked up) when creating an interface is what are the signals (also knows as the symbols) that are allowed.

After that, the question is how those symbols need to be arranged. In what order do they need to be transmitted? Then, what method is used to mark the beginning and the end of transmission. If the transmission is continuous, how does the receiver manage to synchronize to the transmitted data? There are many different ways to do all of these. That is where "protocols" come into play -- these are simply the rules that both sides agree to regarding all of these things, and more.
 
Top