0% found this document useful (0 votes)
15 views

Tutorials On 8051

The document outlines specifications for a microcontroller-based temperature monitoring and control system for livestock housing, including turning on LED indicators based on temperature and displaying messages on an LCD. It provides details on an LM35 temperature sensor and the need for signal conditioning to work with an ADC. The system is to be designed and code developed using an 8051 microcontroller to monitor temperature and control LEDs and LCD display accordingly.

Uploaded by

DuoDrench
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Tutorials On 8051

The document outlines specifications for a microcontroller-based temperature monitoring and control system for livestock housing, including turning on LED indicators based on temperature and displaying messages on an LCD. It provides details on an LM35 temperature sensor and the need for signal conditioning to work with an ADC. The system is to be designed and code developed using an 8051 microcontroller to monitor temperature and control LEDs and LCD display accordingly.

Uploaded by

DuoDrench
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

A farmer wants to use a low-cost measurement and control system to help address heat and cold stresses in

confined livestock production to maintain the optimal indoor temperature of 18° to 20°C. As a founder of a start
–up company, you are given an opportunity to design and develop a microcontroller based system to meet the
customer specifications as given below.

Customer Specifications
 Turn on Blue LED, if temperature is lower than the optimal range
 Turn ON RED LED, if Temperature is higher than the optimal range and display the message “HIGH” to
alert the stock handlers to take appropriate control action.
 Turn ON GREEN LED, if temperature is within the optimal range.

The ambient temperature can be sensed by LM 35 sensor whose specifications are given as below. The signal
conditioning circuit / amplifier to be introduced to enable the operation of ADC 0808 to its full scale voltage
range. It is sufficient to mention the gain requirements without getting into the details of designing an
amplifier circuit.

LM 35 Specifications:

 Useful range is +2°C to 150°C


 The accuracy specifications of the LM35 temperature sensor are given with respect to a simple linear
transfer function: VOUT = 10 mV /°C × T
Where VOUT is the temperature sensor output voltage in millivolts (mV) and T is the temperature in °C.
(20mV to 1500mV)

Develop a main program and an interfacing circuit to

 Keep LCD ready to receive data for display by Initialising LCD for 2 lines, 5X7 matrix char. display,
turning on LCD & cursor, clear display, and so on... through a calling program labelled “ ACALL
COMMAND”.
 Sense the temperature and initiate the required action to be taken as per the above
specifications. (Note: Make a provision to include a calling program labelled “Display” for
sending the message to be displayed as per the specification.)
As part of an industrial automation system two wheels are driven by two separate motors, motor A
and motor B. The rotation sensors give a logic low level as the wheel magnet passes the sensor. Each
motor can be turned on or off by providing a logic signal as indicated in Figure 3B. An 8051 is to be
used to control these motors, where a motor can be turned ON and allowed run for N rotations and
then turned OFF. The sensor signals will cause timer/counter interrupts. Write an 8051-assembly
language program which will turn on the two motors at the same time. Motor A will do 20 rotations
and will then be stopped. Motor B will do 200 rotations and will then be stopped
ORG 0000H

Both timer 1 (Motor B - 200 rotation-P1.7) and timer 0 MOV TMOD, #66H
(Motor A -20 rotation-P1.6) as counters in mode 2
SETB P3.4
ORG 0000H
LJMP MAIN SETB P3.5
0RG 000BH
MOV TH1, #00H
LJMP ISRT0
ORG 001BH MOV TH0, #00H
LJMP ISRT1 SETB P1.6

SETB P1.7
MAIN: MOV TMOD, #66H
SETB P3.4 SETB TR1
SETB P3.5
SETB TR0
MOV TH1, #38H //for 200 rotation
MOV TH0, #0ECH // 20 rotation AGAIN: MOV R0, TL0
MOV IE, #10001010B CJNE R0, #20, AGAIN
SETB TR0
CLR P1.6
SETB TR1
SETB P1.6 CLR TR0
SETB P1.7 AGAIN1: MOV R0, TL1
LOOP: SJMP LOOP
CJNE R0, #200, AGAIN1
ISRT0: CLR TR0 CLR P1.7
CLR P1.6
CLR TR1
RETI
END
ISRT1: CLR TR1
CLR P1.7
RETI
The Figure 4B shows a D/A (digital to analog) converter which drives a dc motor. Assume the power
stage is included in the D/A converter so that the motor can be driven directly by Vout. An 8051
microcontroller has this D/A converter connected to an I/O port P1. The 8051 is connected to a
Computer via the serial port. When 8-bit data character is received from the Computer, it interrupts
the 8051 through the 8051’s serial port interrupt and the received 8-bit data value is passed to the
D/A converter so that the Computer is effectively controlling the motor speed. Write an 8051-
assembly language program to implement this system. Assume a serial data baud rate of 9,600 baud.
Baud rate calculation for value to load 9600 – FDH
ORG 0000H
LJMP MAIN
ORG 0023H
LJMP ISRSERIAL
ORG 0030H
MAIN: MOV TMOD, #20H
MOV TH1, #0FDH
MOV SCON, #50H
MOV IE, #10010000B
SETB TR1
ORG 0100H
ISRSERIAL: JNB R1, NEXT
MOV A, SBUF
MOV P1, A
NEXT: RETI
END

An 8051 based system constantly outputs a square wave at some frequency through an I/O port
bit. The frequency is timed based on an 8-bit timer of 8051. The 8051 is connected to a PC via
the serial port. When an 8-bit data character is received from the PC, it interrupts the 8051
through the 8051’s serial port interrupt and the received 8-bit data value is passed to the timer
so as to re-specify the frequency. Thus a PC programmable frequency generator is achieved.
Write an 8051 assembly language program to implement this system. Assume a serial data
baud rate of 9,600 baud. Show all configuration of the UART, timer. 8051 is crystalled at
11.0596 MHz.

A thermal power plant requires constant temperature monitor of heating core to avoid any
catastrophic failure causing harm to workers in the power plant. A thermo-couple based
temperature sensing unit is setup at the plant. As a student on internship there, you are
required to develop an emergency evacuation setup using 8051 microcontroller with the
following specifications.
The setup up contains input from temperature sensor in voltage, ADC and an LCD display to
show the status, two LEDs RED and GREEN, A buzzer alarm warning for evacuation.

 Temperature <800 C, turn ON green LED only.


 Temperature 800C to 1000C, Turn ON red LED and display ‘CRITICAL’ at the beginning
of first line of LCD.
 Temperature >1000C, TURN ON red LED, Turn ON BUZZER, and display ‘EVACUATE’ at
the beginning of first line of LCD.
 Temperature sensor characteristics is shown in the figure.

Draw the interfacing circuit and write an assembly language program to execute the required
conditions.
Solution:

800C = 4V = CCH
ORG 0000H

START: MOV A, #38H ;LCD initial


ACALL COMMAND
MOV A, #0EH
ACALL COMMAND
MOV A, #01H
ACALL COMMAND
MOV A, #06H
ACALL COMMAND
MOV A, #80H
ACALL COMMAND

MOV P1, #0FFH ;ADC Program


SETB P0.7
MOV P0, #00H
SETB P0.5
SETB P0.6
NOP
CLR P0.6
CLR P0.5
WAIT1: JNB P0.7, WAIT1
SETB P0.4
MOV A, P1

MOV 30H, A
SUBB A, #0FFH ;1000C check
JNC BUZZ
MOV A, 30H
SUBB A,#0CCH ;800C check
JNC RED
SETB P2.4 ; green do
CLR P2.3
SJMP START
BUZZ: SETB P2.3 ; buzzer, red led do
SETB P2.5
MOV DPTR, # TABLE1 ; display evacuate
AGAIN: CLR A
MOVC A,@A+DPTR
JZ SKIP
MOV P3, A
ACALL DATA1
INC DPTR
SJMP AGAIN
SKIP: NOP
WAIT: SJMP WAIT

RED: SETB P2.3 ; red do


CLR P2.4
MOV DPTR, # TABLE2 ;display critical
AGAIN1: CLR A
MOVC A,@A+DPTR
JZ SKIP1
MOV P3, A
ACALL DATA1
INC DPTR
SJMP AGAIN1
SKIP1: SJMP START

COMMAND: ACALL BUSY


CLR P2.0
CLR P2.1
MOV P3, A
SETB P2.2
NOP
CLR P3.5
RET
DATA1: ACALL BUSY
SETB P2.0
CLR P2.1
MOV P2, A
SETB P2.2
NOP
CLR P2.2
RET
BUSY: SETB P3.7
CLR P2.0
SETB P2.1
WAIT2: CLR P2.3
NOP
SETB P2.3
JB P3.7, WAIT2
RET
ORG 1000H
TABLE1: DB "EVACUATE",0
TABLE2: DB "CRITICAL",0
END

You might also like