Tmod,Tcon,Scon

April 2, 2018 | Author: Amy Oliver | Category: Timer, Microcontroller, Computer Architecture, Electrical Engineering, Digital Electronics


Comments



Description

Microcontroller Timers80c51 Intel Microcontroller has Two 16-bit timers/counters, Timer 0 and Timer 1. TMOD and TCON registers are used for setting and using these timers/counters. Both can be configured to operate either as timers or as event counters. In the case of timers, register is incremented once every machine cycle. Hence timer is considered as counter which counts machine cycles. One machine cycle has about 12 oscillator periods. The count rate is about (1/12)Oscillator frequency. In the case of Counter, register is incremented in response to a 1-0 transition to its corresponding external input pin. In this function, the external input is sampled during S5-P2 of the every machine cycle. Microcontroller TMOD register(Not bit addressable) M1 M0 Operating Mode 0 0 13 bit timer 0 1 16 bit timer/counter 1 0 8 bit auto-reload timer/counter TL0 is an 8 bit timer/counter controlled by standard timer 0 control bits, TH0 is an 8 bit timer controlled 1 1 by timer 1 control bits. GATE- When GATE=1 and TRx(in TCON) is set, Timer/Counter-x will run while INT-x pin is set high(Hardware Control). When GATE=0, Timer/Counter-x will run only while TRx=1(software control). C/(T)- Set 0 for timer operation and Set 1 for counter operation M1- Mode Selector bit M0- Mode Selector bit The serial port can operate in 4 modes as mentioned below.0-Interrupt 0 type control bit Microcontroller Serial Communication 8051 has a serial port which is full duplex. due to this port can start receiving byte before the previous bytes has already been read from the register SBUF. The port is a receive buffered. BIT Addressable .hence it can transmit and receive simultaneously.7-Timer1 overflow flag • TR1-TCON. The serial port receive/transmit registers are both accessed at SBUF.5-Timer0 overflow flag • TR0-TCON.6-Timer1 run control bit • TF0-TCON. There will be collision if the byte arrives in SBUF before the previous byte is read from it.1-External interrupt 0 edge flag • IT0-TCON.3-External interrupt 1 edge flag • IT1-TCON.2-Interrupt 1 type control bit • IE0-TCON.4-Timer0 run control bit • IE1-TCON. SCON(Serial Control Register).Microcontroller TCON register(Bit addressable) • TF1-TCON. Serial port mode specifier(Table-1) SM2-SCON. TI-SCON.3.4.In mode2/3.1.Serial port mode specifier(Table-1) SM1-SCON. if SM2=0. Table-1 Based on SM0 and SM1 various baudrates are selected as shown in the table below.Set/clear by software to enable/disable reception TB8-SCON.0.7. it is not used. set by hardware and must be cleared by software. REN-SCON.The serial port control and status register is the Special Function Register SCON. SM0-SCON. In mode 0.Transmit Intterupt flag. . This register contains not only the mode selection bits. and the serial ports interrupt bits (TI and RI). RB8 is the stop bit that was received.Enable multiprocessor communication in modes 2/3. In mode 1. set by hardware at the end of 8th bit time in mode 0.6. at the beginning of the stop bit in the other modes. RI-SCON. it must be cleared by software. it is the 9th bit that was received.2. set/clear by software RB8-SCON. but also the 9th data bit for transmit and receive (TB8 and RB8).The 9th bit that will be transmitted in mode2/3.5.receive Interrupt flag. 9 bit UART.Variable 2. SM SM 0 1 Mode/Description/Baud rate 0 0 0.shift register.8 bit UART.(Fosc./12) 0 1 1. Transmission via SBUF . it initializes timer 0 for delay and timer 1 for baud rate of 9600 bps.9 bit UART. Variable Microcontroller Serial Port Initialization C program As shown in the C program./32) 1 1 3./64) OR 1 0 (Fosc.(Fosc. /* One character at a time/* for(i=0.i<max.i++) { SBUF=transmit_array[i++]. TI=0. /* Transmitting character array/* while(!TI). TI=0. while(!TI). } .SBUF='S'.
Copyright © 2024 DOKUMEN.SITE Inc.