Вы находитесь на странице: 1из 15

EMBEDDED SYSTEMS

LAB-6
Date: 12/03/18
Hardware kit :

Hardware kit has got AT89S8253 Microcontroller . The Atmel AT89S8253 is an


8051 based Full Static CMOS controller with Three-Level Program Memory
Lock, 32 I/O lines, 3 Timers/Counters, 9 Interrupts Sources, SPI, Watchdog
Timer, 2 DPTRs, 12K Flash Memory, 2k EEPROM, 256 Bytes On-chip RAM.
EMBEDDED SYSTEMS

The Easy8051A development system is a high-quality development system used


for programming 8051 compatible microcontrollers manufactured by Atmel. In
addition to chip programming, this system enables all the parts of the program to
be tested as it contains most components which are normally built in real devices.
The Easy8051A development system consists of:

 Sockets for placing microcontrollers in (14, 16, 20 and 40- pin packages)
 Connector for external power supply (DC 12V)
 USB programmer
 Power Supply Selector (external or via USB cable)
 8 Mhz Quartz Crystal Oscillator
 32 LEDs for output pin state indication
 32 push buttons for input pin activation
 Four 7-segment LED displays in multiplex mode
 Graphic LCD display
 Alphanumeric LCD display (4- or 8- bit mode)
 Connector and driver for serial communication RS232
 Digital thermometer DS1820
 12- bit A/D converter (MCP3204)
 12- bit D/A converter (MCP4921)
 Reference voltage source 4.096V (MCP1541)
 Multiple-pin connectors for direct access to I/O ports
EMBEDDED SYSTEMS

Components on Hardware kit :

Programmer :

The purpose of the programmer is to transfer HEX code from PC to appropriate


pins and provide regular voltage levels during chip programming as well. For this
development system, the programmer is built in it and should be connected to PC
via USB cable. When the process of programming is completed, pins used for it
are automatically available for other application.
EMBEDDED SYSTEMS

Development system power supply :


There is a connector on the development board enabling commection to external
power supply source (AC/DC, 8-16V). Besides, voltage necessary for device
operation can also be obtained from PC via USB cable. Jumper J5 is used for
power supply selection.

8MHz Oscillator :
The EASY8051A development system has built-in oscillator used as a clock signal
generator. The frequency of this oscillator is stabilized by 8Hz quartz crystal.
Besides, it is also possible to select internal RC oscillator during chip
programming,.
EMBEDDED SYSTEMS

LEDs for output pin state indication :


Each I/O port pin is connected to one LED which enables visual indication of its
logic state. In the event that the presence of directly polarized LEDs and serial
resistors is not acceptable in some applications, DIP switch SW2 enables them to
be disconnected from the port.

Push buttons for input pin activation :


Similar to LEDs, each I/O port pin is connected to one push button on the
development board. It enables simple activation of input pins. Jumper J6 is used
for selecting voltage polarity (+ or -) brought to pins by pressing appropriate push
button.
EMBEDDED SYSTEMS

7-segment LED displays :


Being often applied in the industry, four high-performance LED displays set in
multiplex mode belong to the development system. Display segments are
connected to the port P0 via resistors. Transistor drivers used for activating
individual digits are connected to the first four port P1 pins. It enables programs
using 7-segment displays to be tested with minimum use of I/O ports. Similar to
LEDs, DIP switch SW2 enables transistor drivers to be disconnected from
microcontroller pins.

LCD displays :
The EASY8051A development system provides connection to eather graphic or
alphanumeric LCD display. Both types of displays are connected by being placed
into appropriate connector and by switching position of the jumper J8. If displays
are not in use, all pins used for their operation are available for other applications.
Apart from connectors, there is also a potentiometer for contrast regulation on the
board.
EMBEDDED SYSTEMS

Serial communication via RS232


Similar to other built-in circuits, electronics supporting serial communication can
be enabled or disabled by using jumpers J9 and J10. In order to enable programs
using serial communication to be tested, the development system has built in
standard 9-pin SUB-D connector. The MAX232 is used as a voltage regulator.

12-bit A/D converter MCP3204 :


A built-in 12-bit AD Converter MCP3204 has four input channels connected to on-
board connectors. Data are interchanged with the microcontroller via SPI serial
communication system using pins P1.5, P1.6, P1.7 and P3.5. If A/D converter is
not in use, these pins can be used for other applications (DIP switch SW1). In order
to check operation, there is a potentiometer on the development board used as a
variable voltage source. It can be brought to the converter’s input pins using one of
four jumpers J12. As a special convenience, a reference voltage source MCP1541
(4,096V) is built in. Jumper J11 is used to select whether converter will use this
voltage or 5V.
EMBEDDED SYSTEMS

12-bit D/A converter MCP4921 :


Digital to analog conversion (D/A) is another operation ofen performed by the
microcontroller in practice. For this reason, there is a special on-board chip which
interchanges data with the microcontroller via SPI communication system. It can
also generate analog voltage in 12-bit resolution on its output pin. When it is not in
use, all microcontroller pins are available for other applications using DIP switch
SW1. Similar to A/D converter, jumper J11 is used for selecting reference voltage.

Connectors for direct access to I/O ports :


In order to enable microcontroller ports to be directly connected to additional
components, each of them is connected to one on-board connector. Besides, two
pins of each connector are connected to power supply voltage while each pin can
be connected to + or - polarity of voltage via resistors (pull up or pull
EMBEDDED SYSTEMS

down resistors). Presence and connection of these resistors are determined by


jumpers. Jumper J3 which controls port P3 is shown in figure on the right.

Q1) Write 8051 c and assembly code to blink the LED on port p1.0 with some
delay

C-Code :

#include<reg51.h>

sbit kir=P1^0;

void msdelay(unsigned int x)

{ unsigned int i,j;

for(j=0;j<=x;j++)

{ for(i=0;i<1257;i++)

int main(void)

{
EMBEDDED SYSTEMS

while(1)

kir = 1;

msdelay(500);

kir = 0;

msdelay(500);

Assembly code :

org 0h

k : mov r3,#0fh

setb p1.0

back : djnz r3,back

mov r2,#0fh

clr p1.0

h:djnz r2,h

jmp k

End

Contents of port p1 when led is on Contents of port p1 when led is off


EMBEDDED SYSTEMS

Interfacing port p1.0 to led:

Port 1.0 is used as a output pin to blink the led after every 0.5 seconds
Microcontroller P1.0 is connected internally to a resistor and then to a LED .
So when this pin goes high led lights and after some delay it gets off.
Led in off state : Led in on state :
EMBEDDED SYSTEMS

Q2) Write 8051 c and assembly code to display number 2 on 7 segment display.

C-Code :

#include<reg51.h>

void msdelay(unsigned int x)

{ unsigned int i,j;

for(j=0;j<=x;j++)

{ for(i=0;i<1257;i++)

int main(void)

{
EMBEDDED SYSTEMS

P1= 0x00;

while(1)

P1 = 0x6b;

msdelay(500);

P1 = 0x00;

msdelay(500);

}}

Assembly code :

org 0h

k : mov r3,#0fh

mov 90h,#00h

back : djnz r3,back

mov r2,#0fh

mov 90h,#6bh

h:djnz r2,h

jmp k

end

Contents before execution : Contents after execution


EMBEDDED SYSTEMS

Interfacing Port p1 to display :

All 7 segments displays on hardware kit are connected to port p1. So when number
equivalent to 0-9 is given to p1 , it displays on 7 segment display.

So to dispaly number 2 on it equivalent hex number is 6B (hgfe dcba = 0101 1011)

Number 2 on display :
EMBEDDED SYSTEMS

Conclusion : By using USB_RS232 cable the hardware kit is connected to pc .


Hex file can be created by selecting options of Target 1 and by clicking on output
window and than checking create hex file box, a hex file is created . A Hex file
generated in PC should be loaded and written into Hardware kit.

Вам также может понравиться