Fma Unit 5 Questions and Answers
Fma Unit 5 Questions and Answers
Write down the steps to be followed to receive a data serially using 8051
microcontroller?
Ans 1. The following steps are followed to receive a data serially using 8051
microcontroller :
1. TMOD register is loaded with value = 20 H, indicating the use of Timer 1
, mode 2 (8-bit auto reload) to set the baud rate.
5 0
0 1 0 1 0 0 0 0
Q2. Write down a short note on interfacing of a GSM module with 8051
microcontroller.
GSM stands for Global System for Mobile Communication. It is a digital cellular
technology used for transmitting mobile voice and data services.
The idea of GSM was developed at Bell Laboratories in 1970. It is a widely used
mobile communication system in the world. GSM is an open and digital cellular
technology used for transmitting mobile voice and data services operate at the
850MHz, 900MHz, 1800MHz, and 1900MHz frequency bands.
GSM module is a device or chip that uses GSM network to establish communication
between electronic devices.
GSM is a standard developed by standard developed by the European
Telecommunications Standards Institute (ETSI).
To communicate with GSM modem, AT commands are required.
Microcontroller sends these commands to the GSM modem, which is then
activated to perform the required operation.
RXD pin of 8051 microcontroller is connected to TXD pin of GSM module and
TXD pin of 8051 microcontroller is connected to RXD pin of GSM module.
AT commands with a GSM modem can be used to access following information and
services:
1. Information and configuration pertaining to MODEM and SIM card.
2. SMS services.
3. MMS services.
4. Fax services.
5. Data and Voice link over mobile network.
Q3. Write a program to transfer a character “P” serially at baud rate of 9600, Use
serial port in Mode 1. Crystal frequency is 11.0592 MHz
Q4. Draw the SCON register and explain use of individual bits of the register in
detail./Write a short note on SCON register.
Ans 4. SCON register is an 8-bit register used to program the start bit, stop bit, and
data bits of data framing , among other things.
SM0 and SM1 are D7 and D6 of SCON register, respectively. These two bits
determine the framing of data by specifying the number of bits per character, and
the start and stop bits. They take the following combinations
Modes of serial communication
SM0 SM1
0 0 Serial Mode 0
0 1 Serial Mode 1, 8-bit data, 1 stop bit , 1 start bit
1 0 Serial Mode 2
1 1 Serial Mode 3
In serial mode 1, for each character a total of 10 bits are transferred , where the
first bit is the start bit , followed by 8 bits of data, and finally 1 stop bit.
SM2
It is the 5th bit of the SCON register. It enables the multiprocessing capability. It will
be set to 0, since it is not used.
REN
It is D4 bit of SCON register called as receive enable. When REN =1, 8051 receives
data on the RxD pin. If REN =0, the receiver is disabled. REN must be set to 1 , in
case of both receive and transfer data.
TB8
TB8(Transfer bit 8) is bit D3 of SCON. It is used for serial mode 2 and 3. It is not
used in our applications, hence it is made as 0.
RB8
RB8(receive bit 8) is bit D2 of SCON. It is used for serial mode 2 and 3. It is not used
in our applications, hence it is made as 0.
TI
TI(Transmit Interrupt) is bit D1 of SCON register, When 8051 finishes the transfer
of the 8-bit character, it raises the TI flag to indicate that it is ready to transfer
another byte. The TI bit is raised at the beginning of the stop bit.
RI
RI(receive interrupt) is bit D0 of SCON register, When 8051 receives data serially
via RxD, it get rid of the start and stop bits and places the byte in the SBUF register.
Then it raises the RI flag bit to indicate that a byte has been received and should be
picked up before it is lost. RI is raised hallway through the stop bit.
5 0
0 1 0 1 0 0 0 0
#include<reg51.h>
void main(void)
{
unsigned char z;
z=0;
TMOD = 0X20;
TH1=0XFA;
SCON = 0X50;
TR1=1;
while(z<10)
{
SBUF ='T';
while(TI==0);
TI=0;
z++;
}
}
Q8. Write short note AT commands required for GSM.
Classification of AT commands
Examples of AT commands
SBUF register :
SBUF is an 8-bit register used for serial communication. For a byte of data to be
transferred via TxD line, it must be placed in the SBUF register. Similarly SBUF holds the
byte of data when it is received by the 8051’s RxD line.
SCON register:
Timer registers
Serial Communication registers of 8051 are programmed to transfer and receive data
serially.
Q10. Explain how Baud Rate is set for serial communication in 8051
microcontroller.
Ans10. The rate of data transfer in serial data communication is stated in bits per
second(bps) and is also called as baud rate. Baud rate is programable and is done with
the help of timer 1 in mode 2, that is 8-bit auto reload. 8051 divides the crystal frequency
by 12 to get the machine cycle frequency. If XTAL = 11.0592 MHz, the machine cycle
frequency is 921.6 kHz (11.0592MHz/12). The 8051’s serial communication UART
circuitry divides the machine cycle frequency of 921.6 kHz by 32 once more before it is
used by Timer 1 to set the baud rate. Therefore, 921.6 kHz divided by 32 gives 28,800 Hz.
For e.g : To set the baud rate of 9600, following calculations need to be performed:
Q11. Write a program to transfer a character “A” serially at baud rate of 4800, Use
serial port in mode 1. Crystal frequency is 11.0592 MHz
Q12. Assuming crystal frequency of 11.0592 MHz, find the value to be loaded in
TH1 to set up the following baud rates 1) 9600 2) 2400 3) 1200