User: alciro    User
 Original    Translate to:  Deutsch  English  Français  中文  
 

Microcontroladores 8051

7. Serial communications

Serial communications is RS-232 communications interface for serial data transmission between electronic devices such as computers, modems, etc. RS-232C standard established by the EIA (Electronic Industries Alliance) determines the physical characteristics of binary data communication between devices, DTE (Data Terminal Equipment or Data Terminal Equipment) normally associated with a computer and devices DCE (Data Communication Equipment or Data Communication Equipment) for peripherals such as modems or quipos automata.

Sequence of bits of the RS-232

Bps bits per second.

The speed of data transmission in serial communications measured in bits per second bps (bit rate), ie the number of bits that are transferred in 1 second. If the time of a bit corresponds to the time spent by a logical state, the transmission speed is the inverse of time of 1 bit.

bps\ =\ \frac{1}{t}\ bits\ por\ segundo

In many cases it makes a direct equivalence between bps (bit rate) and BPS (baud rate or baud per second) and this is only true when the symbol is transmitted corresponds to a bit.

The baud (baud rate) is the number symbols are transmitted per second, it all depends on understanding as a symbol, if this corresponds to 1 a match but both terms baud can be represented by several bits.

7.1. The Timer 1 as Baud rate generator

The TMOD register (89h, 137)

Registry settings Timers / Counters Timer 0 and Timer 1.

MSB LSB
GATE C / T M1 M0 GATE C / T M1 M0
Timer 1 Timer 0

M0 and M1. Selecting the operating mode of the timer.

M1 M0 Operation mode selection
0 0 Mode 0 Timer / Counter 13 bit
0 1 Mode 1 Timer / Counter 16 bit
1 0 Mode 2 Timer / counter with 8-bit Auto-Recharge
1 1 Mode 3 Several counters

C / T. Functioning as a counter or timer.

0 -> counter, the pulses are taken from the clock signal.
1
-> Timer, Pulse Tx terminal.

GATE. Set the timer control.

0 -> Makes the Timer is controlled by the TRx bit. If TRx is 1 turns the Timerx macha and TRx to 0 for (x identifies the timer 0 or 1).
1 -> The hardware timer is controlled by the state of the input (pin) INTx.

For the Timer 1 baud rate generator operation has to be configured in Mode 2 (8-bit Timer with Auto-Recharge).

Timer Mode 2, auto-reload 8-bit

    Timer 1 in mode 2, 8-bit Timer with Auto-Recharge

    Baud (bits per second)

    If using the Timer 1 as baud rate generator when working in Mode 1 and 3 (variable speed UART) the calculation of oa baud rate per second is set after the following formula:

    Baudios\ =\ \frac{2^{SMOD}}{32}*\frac{Frecuencia\ oscilador}{12*(256-TH1)}

    In the table below you can see the comparison of configurations of recharge values of Timer 1 as a function of the different speeds of communication possible. To obtain a set of standard communication speed is necessary to use a quartz crystal 11.0592 MHz.

    Baud (bits per second) Clock Frequency SMOD Timer 1
    C / T Mode Reload value
    Mode 0: 1 M (max) 12 MHz X X X X
    Mode 2: 375 K 12 MHz 1 X X X
    Mode 1, 3: 62.5 K 12 MHz 1 0 2 FFH
    19200 11.0592 MHz 1 0 2 FDH
    9600 11.0592 MHz 0 0 2 FDH
    4800 11.0592 MHz 0 0 2 FAH
    2400 11.0592 MHz 0 0 2 F4H
    1200 11.0592 MHz 0 0 2 E8H
    137500 11.0592 MHz 0 0 2 1DH
    110000 6 MHz 0 0 2 72H
    110000 12 MHz 0 0 1 FEEBH

    Loading
    copyright © 2007-2021  www.alciro.org  All rights reserved.         
    Share |