Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

serial interfacing question on MCU ( clocking )

Status
Not open for further replies.

hm_fa_da

Full Member level 5
Joined
Sep 16, 2003
Messages
287
Helped
10
Reputation
20
Reaction score
4
Trophy points
1,298
Activity points
3,217
hi all ,


i am going to design a circuit which connects to PC through com port ,i have a question on serial interface of 8051 MCU ,when we adjust serial clock of transmiter to fore example 9600 bps , then serial data line exports data bits on each serial clock line signal ,

my question is if i adjust serial clock of MCU to 9600bps , then my receiver samples input on each signal on clock line or it samples from data line only according to theadjuasted baud rate (about each 104 uS ) ?

i mean in this way , the data of incoming to MCU should be exactly 9600 bps , or it
can be asynchronous and according to the signal on clock line and MCU samples from input on each signal of clock line ???

thanks for your help,
Regards.
 

The data frame (start bit + data + stop bit) is synchronized with the start bit and checked with the stop bit. That is, when the receiver jumps from "idle state" then starts to count 1/BPS times and samples each bit (normally at the middle of the time).
All the bits of each frame must be transmitted with 1/BPS duration.
Each frame can be transmitted randomly (depending on UART implementation).

dpsm
 

thanks for your help dear ,

so in this serial interface , there is no clock line and receiver samples from input according to the start bit with an adjusted speed ( 1/bps ) ,

how about in RS232 , is it also like this , and doesn't have clock line , only TR data , and RX data ?

and in mcu ,when we connect 2 MCUs , does it (receiver) function like this ( synchronized with the start bit ) in all modes ?


thanks ,
Regards.
 

Timing for "bit-banged" Serial I/O is often performed by detecting the leading edge of the start bit, waiting 1/2 bit time (52-usecs for 9600 baud) and then sampling the middle of each bit every 104-usecs (1 bit time)...

Another method that works well if it's difficult to detect the start bit leading edge is to sample the Rx line at 3 times the bit rate (34.5 usecs for 9600 baud) and after detecting the start bit signal level, sampling each bit in the middle third of its bit time (33%-66%)...

Microcontrollers with built-in hardware UART peripherals do this automatically...

Regards, Mike
 

Dear hm_fa_da:
When you asked about serial interface, I thought about an UART interface; in this case, the answer is yes.
The RS232 standar, specifies only the "physical" layer of the interface, that is voltage levels, threshold, etc.

When you connect two or more MCUs, SPI or I2C interfaces are more desirable. In both of them you have a separate CLOCK signal sync devices.

Regards,

dpsm
 

thanaks for your helps ,

which method is used in UART ? waiting for leading edge bit and then wait for half of bit time and ... OR sampling input at 3 times bit rate to detect start bit ?

as i understood , we can't use UART receiver in MCU for recieving signal from an out source with unknown speed , we should know the out source transmitter baud rate before we initialize receiver in MCU . this way we should use software serial ( a program ) that samples input on each clock line ( clocking time could vary each time ) not according to start bit .

Regards .
 

In hardware UART the bit is usually sampled at half the bit time (depends on the implementation)

About the other question, there are some algorithms to autodetect the UART speed, but I had never evaluate them. In most UARTs you can change speed with only a few instructions, so... It may not be necessary to do it with a software UART.

You may look at:
https://focus.ti.com/docs/mcu/catal...tract.jhtml?familyId=342&abstractName=slaa215

regards,

dpsm
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top