SOLVED - How many bits micro transfer on uart bus

Papabravo

Joined Feb 24, 2006
21,159
Like in i2c communication multiple slave devices can be connected to i2c bus, can UART do the same ?

I don't think multiple slaves can be contacted to UART bus. because it will be difficult to identify each slave in uart communication.

RS233
If you use 4-wrie RS-485 you can do full-duplex. With 2-wire RS485 transceivers you have to use half-duplex because you can only have one transmitter at a time. Half-duplex can be done with RS-232, but it is harder and usually not worth the effort.
 

Thread Starter

Sparsh45

Joined Dec 6, 2021
143
Definition says parity bit is used for error checking. I don't understand what it means.

let's say this sequence.

baud : 9600
start bit : 0
data bits : 0101 0101
parity bit : even
stop bit : 1

How to find out which bit has an error in sequence ?
 

MrChips

Joined Oct 2, 2009
30,712
A 1-bit parity check is used to detect corruption of a single bit. It cannot determine which bit is in error.
It cannot detect errors in 2 bits.

Byte-wise parity check plus longitudinal parity check (i.e. 2-D parity check) would be able to identify a single bit error.
 

Thread Starter

Sparsh45

Joined Dec 6, 2021
143
UART fram with even parity, 8 bits, 1 start and 1 stop bits

0 0001001 1 1
Number of 1s in data bits is 2 even number, no error in sequence

0 0101001 1 1
Number of 1s in data bits is 3 odd number, error in sequence

Do both of my examples define parity ?

Edit : typo corrected
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,156
The parity bit is used to make the number of 1s in the data bits plus the parity bit, either even or odd. So your example should be:


0 0001001 0 1
Number of 1s in data bits plus parity bit is 2. With the protocol set to even, no error in sequence

0 0101001 1 1
Number of 1s in data bits plus parity is 4. With protocol set to even parity, no error in sequence
 

MrChips

Joined Oct 2, 2009
30,712
UART fram with even parity, 8 bits, 1 start and 1 stop bits

0 0001001 1 1
Number of 1s in data bits is 2 even number, no error in sequence

0 0101001 1 1
Number of 1s in data bits is 3 odd number, error in sequence

Do both of my examples define parity ?

Edit : typo corrected
Ignore the start and stop bits. They are not included in the parity check

8-bit data + even parity
00010011 + 1 = correct parity
01010011 + 0 = correct parity
01010011 + 1 = parity error
 

djsfantasi

Joined Apr 11, 2010
9,156
Ignore the start and stop bits. They are not included in the parity check

8-bit data + even parity
00010011 + 1 = correct parity
01010011 + 0 = correct parity
01010011 + 1 = parity error
I missed the part of ignoring the start and stop bits. I just did so automatically out of practice. But it is an important part of the algorithm.
 

Thread Starter

Sparsh45

Joined Dec 6, 2021
143
Would you @MrChips please visit the old post #18 and #20.

How do you communicate with different slaves on the same bus?

Can multiple slaves be connected in same bus with rs232 interface also ?
 

MrChips

Joined Oct 2, 2009
30,712
Would you @MrChips please visit the old post #18 and #20.

How do you communicate with different slaves on the same bus?

Can multiple slaves be connected in same bus with rs232 interface also ?
There are various means of identifying different slaves.
One method is to send a SLAVE SELECT signal to individual slaves.
Another method is to broadcast a SLAVE SELECT id to all slaves. Each slave decides if it is the intended recipient of the message.
 

Thread Starter

Sparsh45

Joined Dec 6, 2021
143
I have done this in Modbus, the first word contains the slave address/number.
You have mentioned modbus that means you have deep knowledge of it so I want to ask you some questions which can clear my confusion.

Can we test modbus operation by writing code if there are following parts:

  • Microcontroller
  • PC
  • MAXR232 IC, caps, resistors
  • usb to DB9 connector
 

Thread Starter

Sparsh45

Joined Dec 6, 2021
143
Yes. I use these devices for communicating with VFD's that have Modbus control.
There is quite a lot of information on line dealing with Modbus.
It is found on google that VFD is used to control the speed of the AC motor.

It means that if sending characters from microcontroller to PC or receiving data from PC to microcontroller, the same hardware will be used, but it can be achieved by either uart or modbus.
 

MaxHeadRoom

Joined Jul 18, 2013
28,619
Modbus is just the data format and protocol, it can be sent by different transmission standards .
e.g. RS232, RS485, RS422 etc., as long as the RX/TX systems are the same.
 
Top