Академический Документы
Профессиональный Документы
Культура Документы
Users Manual
Edutech Systems
304, Sarjan Complex
Pratap Road
Baroda-390 001
Tel. (0265) 438317
Email: info@edutechonline.com
Site: www.edutechonline.com
CONTENTS:
Chapter 1
Introduction to EPB/SLK-51
04
Chapter 2
Features of EPB/SLK-51
06
Chapter 3
07
Chapter 4
09
Chapter 5
15
Chapter 6
Operating Steps
16
Chapter 7
18
Chapter 8
23
Chapter 9
38
Chapter 10
FAQ
81
Chapter 1
Introduction to Educational Practice Board
(EPB)/Self Learning Card (SLK-51)
Edutech Systems, Welcomes you to Educational Practice Board
(EPB)/Self-Learning Card (SLK-51) the first of its kind of approach to
learn, test and apply microcontroller.
This board is available in two versions. The first one is Educational
Practice Board (EPB) & the second version is the Self Learning Card
(SLK-51). Both the versions are basically same but only differ on the basis
of certain features.
The EPB is a complete learning platform designed to learn, test and apply
microcontroller 8051 based activities. This board has an extra breadboard
facility enabling the users to insert different components like LEDs,
Switches, 7-segment LEDs, Transistors, Relays, and ICs from 8 to 40 pins
etc and then interface with the 8051 controller. Also the EPB comes with a
wooden box package along with component box, hook up wires and
manual. This board is specially designed for institutes where large
numbers of students are suppose to use the platform. The breadboard
facility enables different users to test and apply number of components
with microcontroller 8051 which can again be reused.
The SLK-51 is also Educational Practice Board, which is a very low price
edition exclusively for students. For those working alone, its a quick
platform for building a circuit and applying the logic.
The SLK-51 contains a general-purpose area instead of a breadboard.
Here you can mount the component temporary or solder your circuit that is
to be interfaced with the controller. Also it does not come in wooden
packing.
The SLK-51 is the first of its kind of platform designed for users who are
undergoing 8051 curriculum. Large number of exercises can be tried out
on SLK-51 board, which will enable the users to confidently undertake
their projects and application development.
Also both the EPB/SLK-51 has the capability of in-circuit programming
which will eliminate the need of any external programmer or eraser. You
can write and erase the chip memory (64K) for number of times.
This approach will lead you to develop your project in the way
professionals do.
Generally, you should try to develop any idea or project in a modular way.
You should divide the application into different modules and first try them
individually. Later you can club these modules once tested into a full fledge
application.
This exercises requires number of writing and erasing actions, which can
be easily done on this boards. Also all the port pins are available at your
dispersal and you can use them as per your requirement.
Thus unlike a conventional kit it does not restrict you to use only limited
features and lets you work to derive a truly single chip solution.
Chapter 2
Features of EPB/SLK-51
Chapter 3
Before you install
Packing List:
Before installing the EPB/SLK-51 take a moment to enable your package
content to make sure you received everything.
In addition to this manual, the Educational Practice Board package
should include:
1) The EPB packed in a wooden box
2) Component box
3) Programming cable
4) CD ROM containing examples and utilities
5) Product Registration/Feedback card
System Requirement:
The EPB/SLK-51 card has to be connected to the PC using the
programming cable provided with the pack. The programs are to be
developed on the PC using the utility tools provided and then transferred
to the EPB/SLK-51. Hence the PC should have the following specification:
Pentium PC with available serial port
Microsoft Windows 95/98 or above
CD drive for installation
10 MB Hard disk space
16 MB RAM (32 MB or above preferred)
Windows compatible mouse
P 1 .0
P 1 .2
P 1 .4
P 1 .6
x
P 3 .1
P 3 .3
P 3 .5
P 3 .7
+5V
P 2 .3
P 2 .7
P 1 .0
P 1 .1
P 3 .4
P 3 .5
P 3 .7
P 3 .6
PRO G
O R ED LED
O G R EEN LED
R UN
1
3
5
7
9
11
13
15
17
19
P 2 .1
S W IT C H
P 2 .2
1
3
5
7
9
11
13
15
17
19
2
4
6
8
10
12
14
16
18
20
2
4
6
8
10
12
14
16
18
20
JP2
JP1
P 0 .5
P 3 .0
P 3 .1
P 3 .2
P 3 .3
S U P P LY
P 0 .7
C P U
1
3
5
7
9
11
13
15
17
19
1
3
5
7
9
11
13
15
17
19
P 0 .2
P89051R D 24B P
P 0 .1
P O .0
P O .2
P O .4
P O .6
x
P 2 .1
P 2 .3
P 2 .5
P 2 .7
5V
2
4
6
8
10
12
14
16
18
20
2
4
6
8
10
12
14
16
18
20
P 1 .1
P 1 .3
P 1 .5
P 1 .7
P 3 .0
P 3 .2
P 3 .4
P 3 .6
X
GND
P O .1
P O .3
P O .5
P O .7
P O .0
P 2 .2
P 2 .4
P 2 .6
ALE
GND
Chapter 4
Understanding the EPB/SLK-51
PC
IN T E R F A C E
P 0 .0
P 0 .6
P 2 .0
P 2 .5
P 2 .4
P 2 .6
P 1 .2
P 1 .3
P 1 .4
P 1 .6
P 1 .5
P 1 .7
Block Description:
The power supply:
The EPB/SLK-51 card works on a +5 volt supply. The power unit provided
along with the package consists of an adapter, which takes 230V as input
and gives 9V AC as output. This 9V AC supply is plugged into the card.
The onboard power circuit rectifies and generates a regulated +5V supply.
The supply is also made available at the general-purpose area to enable
easy interface. It is also made available to the expansion slot so that the
same power supply can be used for powering the additional interface
cards. These cards can be either third party cards or proprietary
interfacing cards provided by Edutech Systems. Some of these cards
include LCD/keyboard, EEPROM, RTC, 7-segment, ADC, DAC, stepper
motor interfacing cards etc.
The CPU The EPB/SLK-51 contains 89C51RD2 controller from Philips. This
controller is pin-to-pin compatible with our conventional 8051/89C51 CPU.
The card has been designed to support 89C51 variants.
Due to various advantages and unique features, we have selected
89C51RD2. Though it is costly compared to 89C51, we have selected it to
provide the users, the exposure of latest trend in the industry and also
make the user aware of different features that eliminate certain
conventional requirement.
The EPB/SLK-51 has a unique feature of In-circuit programming. Because
of this feature, you can write and erase the chip without even removing it
from the socket. Thus you need not require any programmer unit to
program or erase the on-board chip.
10
Also you enjoy a full 64KB of flash program memory. Thus you can design
application that requires more program memory. Also because of the
facility of allowing number of write/erase operation, you can easily develop
your programs in modular way. These modules can be loaded and tested
individually and later they can be merged with the main program. Thus
because of these features, you can easily do your R & D activity.
Moreover for those users who are new to the concept and are learning &
applying controller for the first time, can find this feature useful as they can
easily rectify & modify errors in their development programs.
Apart from these features, the chips have lot of other advantages. Details
can be studied referring to the data sheets.
Serial Port:
Since the EPB/SLK-51 is required to be connected to the PC, there exists
an on-board serial port. The program has to be developed using an IBMPC. Different tool sets can be used to develop the programs and convert
them to hex file format. The hex file is then copied to the board through the
serial port. Because there is a facility of in-circuit programming, we can
directly transfer the hex file to the board. The transfer is possible with the
help of virtual soft-programmer. More details of this virtual soft
programmer can be referred in the coming chapter.
To facilitate the downloading of the programs to the board, a programming
cable is provided in the pack.
Switch:
A special switch is provided on-board to select the mode of operation.
Because as discussed earlier, there is a facility of downloading a program
to the board and also to erase this program. Hence there are two modes
of operations i.e., the RUN mode and the Programming mode. In the
RUN mode, the program downloaded to the board executes. In the
program mode, you can either erase the on-board program or download a
new program.
11
12
P3.7
P0.0
32 Port Lines
G
N
D
G
N
D
+
+5 V
5V
13
Expansion Slots:
Connecting other cards provided by Edutech Systems or any other third
party can further expand the EPB/SLK-51 card. The expansion slots have
got all the port-pins along with supply signal. These exist, two such slots
(JP1 and JP2) whose details are given below. JP1A and JP2A replicates
JP1 & JP2 for further use.
P O .0
P O .2
P O .4
P O .6
x
P 2 .1
P 2 .3
P 2 .5
P 2 .7
5V
P 1 .0
P 1 .2
P 1 .4
P 1 .6
x
P 3 .1
P 3 .3
P 3 .5
P 3 .7
+5V
1
3
5
7
9
11
13
15
17
19
2
4
6
8
1
1
1
1
1
2
1
3
5
7
9
11
13
15
17
19
2
4
6
8
1
1
1
1
1
2
JP1
0
2
4
6
8
0
JP2
0
2
4
6
8
0
1
3
5
7
9
11
13
15
17
19
2
4
6
8
1
1
1
1
1
2
1
3
5
7
9
11
13
15
17
19
2
4
6
8
1
1
1
1
1
2
0
2
4
6
8
0
0
2
4
6
8
0
P O .1
P O .3
P O .5
P O .7
P O .0
P 2 .2
P 2 .4
P 2 .6
ALE
GN D
P 1 .1
P 1 .3
P 1 .5
P 1 .7
P 3 .0
P 3 .2
P 3 .4
P 3 .6
X
GN D
We provide different cards like LCD/keyboard interface, 7segment/keyboard interfaces, E2PROM/RTC interface, ADC/DAC interface
etc. These different cards can be directly plugged with the EPB/SLK-51
and can be used to study and perform exercises using particular cards.
For more details you can contact us on info@edutechonline.com or visit
our site: www.edutechonline.com
Chapter 5
Virtual Programmer
EPB/SLK-51 User Manual
14
15
Chapter 6
Operating Steps
Instructions to use the
Educational Practice Board (EPB) / Self Learning Card (SLC)
The Educational Practice Board/ SLC is a general-purpose experiment
board designed to interface any relevant circuit and check the program
execution. This board is accompanied with different accessories like the
power unit, the programming cable and a CD-ROM. To use this board,
follow the following procedure:
1) From the CD provided, install the WINISP program to your computer.
This is a virtual programmer used to program the on-board CPU. You can
also use the Integrated Programming Tool (ITP) provided on the CD ROM
for accessing the virtual programmer utility. The CPU provided on the
board is having a unique In-System Programming facility so that you can
write and erase number of your test programs without removing the chip
from the circuit.
2) Now connect the board to the serial port of your PC using the
Programming cable provided.
3) From the Start option on your PC, run the WINISP program. You can
also use the IPT utility to execute the WINISP program. Select the proper
chip: 89C51RD2 from the chip select option. Select the communication
port and the crystal frequency (6 MHz in our case).
4) You will find a switch (Blue in color) called as the mode switch. This
switch when pressed enables the card in either (a) Run mode green
LED ON or (b) Program mode Red LED ON. To erase the memory, the
chip should be in the program mode and to execute the program, the chip
should be in the RUN mode.
Note that the power supply should be made OFF when the mode is
changed from RUN to PROGRAM or vice-versa.
16
5) After selecting the PROGRAM option, on the board click on the Erase
Block option and select the first block sing the WINISP program.
Note: Do not select the Full Chip Erase option. Erase the selected block
by choosing the Erase block option. This will indicate the block erasure. If
there is any communication error, check the port connection and selection.
Switch the power supply OFF and then make it ON again and retry.
6) Now click on LOAD FILE & load the required hex file. Status
displays File loaded. This HEX file can be generated by using the
Assembler tool or the IDE provided with the package. Now click the
Program Part and wait till the status displays Programming Successful.
Caution: DO NOT TOUCH THE MISC BLOCK.
7) Now switch OFF the power & change the mode to execution mode
(green LED ON) by pressing the mode switch once. Now switch ON the
power supply and you can see the green LED ON. Also observe the
execution of the program.
17
Chapter 7
Integrated Programming Tool
By this time, you must be conversant with the EPB/SLK-51 card. Now let
us try to understand how write a program, assemble it and transfer it to the
EPB/SLK-51.
There exists various tools like Assembler, Text editor, C-cross compiler,
Simulator/Debugger, Terminal software etc. which can be used to develop
8051 program on PC.
The CD enclosed in the package for EPB/SLK-51 consists of a utility - the
Integrated Programming Tool. This tool is an interface, which allows you to
write a program in note pad assemble the programs to generate .bin, .prn
and .hex files and further allows you to transfer the hex file to the EPB.
The utility is available on the CD (IPT folder). You have to copy this folder
to the windows directory of your systems. The ipt.exe file can be copied to
the folder of your choice or you can create a shortcut for easy access. The
IPT folder consists of different tools like notepad, winisp, assembler and
bin2hex converter utility. The assembler and the bin2hex converter utility
are DOS based utilities and hence it requires you to go to the DOS
prompt. T
The IPT-utility software allows the user to edit and assemble .asm
programs and than convert into HEX file on just one click!. This software is
developed to reduce the time needed to assemble the ASM program and
then converting that assembled program to HEX file. Generally, we have to
do this from DOS Prompt, since assembler and hex converters are DOS
based program. But using this software, you need not have to go to DOS
prompt every time you want to generate .bin and then .hex file from your
.asm files. For more details about the IPT, refer the help file provided with
the IPT.
18
19
To start with, we will use the assembler provided with the pack to write our
first program.
In this case, we try to write a program to interface a simple LED to the port
pin P1.0 of the EPB/SLK-51. The LED is provided along with the package.
You can connect to the LED to the port pin P1.0 as shown.
Vc c
O N 8051
K IT
470
P 1 .0
R
LED
To momentary check the program, you can connect the LED to the port
directly. Now we write a program such that the LED connected to the port
pin P1.0 blinks continuous at the rate of 1 second.
Follow the following procedure to develop the first program.
1. Copy the IPT folder to windows directory and then run the ipt.exe file.
2. Give the program name and then type the following program in the
notepad window, which will be automatically invoked.
Program:
pin bit p1.0
EPB/SLK-51 User Manual
20
main:
org 0000h
sjmp main
org 0060h
clr pin
mov a,#4
acall delay
setb pin
mov a,#4
acall delay
sjmp main
delay:
again: mov r5,#250
sec: mov r7,#0a6h
onemil: nop
nop
nop
nop
djnz r7,onemil
djnz r5,sec
dec a
jnz again
ret
sjmp $
3. Click the respective buttons on the screen to generate the required
output. Once the hex file is generated, we transfer it to the EPB/SLK51 card. Select the program mode option (Red LED ON) and power on
the board. Using the WinISP button the virtual programmer is invoked.
Proper selection of chip, crystal frequency (6 MHz in our case),
communication port is made. The file generated is opened using the
menu. The block 0 is first erased and run the program is loaded into
the board using program port option. The screen indicates successful
completion of the task. If not recheck the cable connection, switch off
the EPB/SLK-51 power and resect the above procedure. Note that the
selection has to be in Program mode.
21
4. Now switch off the power and change the mode to RUN mode and
make the power ON again. The Green LED should glow.
5. Observe the LED. It should be blinking so that, if you can now try more
exercises and use the EPB/SLK-51 to learn more programming
concepts, interface number of component and finally carry out your
project work using the EPB/SLC.
Note: If you are using the IDE tool, type the program in the editor & then
save it as .asm file. From the compile menu, select Assembler a file
option. This will generate a hex file, which can be further downloaded in
the EPB/SLK-51.
If you have any difficulty, please contact us.
You can write number of programs using the Educational Practice Board
and interfaced number of interface devices using the general-purpose
board. You can also refer to the Curriculum Workbook for more practice
examples.
Also the EPB/SLK-51 is an embedded study kit with number of embedded
routines for interfacing different components like the LCD, keyboard, ADC,
Serial EEPROM, RTC etc. You can use these embedded routines to
develop project based application or some real time applications using the
EPB. These routines will enable you to develop applications and
appreciate the strength of Microcontroller.
These routines can also be best used for testing the hardware developed
by you. You can interface the interface hardware to the EPB and write the
program using the embedded routines and assure that the hardware
developed by you is working properly.
Let us try to understand the embedded routines and see how to write the
interface related programs using these routines. Note that you have to
define the hardware port pin allocation in the program itself as the
embedded routines are generalized routines. Thus you can use these
routines to test and develop programs for your own hardware.
Following chapter discusses more on these embedded routines and
demonstrates some interface program examples. You can refer the
curriculum workbooks for more practice examples or write to us at
info@edutechonline.com for any assistance needed for developing your
project-based applications using the embedded routines.
22
Chapter 8
Embedded Driver Routines
Introduction
The Educational Practice Board/SLK-51 optionally contains embedded
driver routines. These routines can be used to study different concepts of
8051 programming. They can also be used to directly interface devices
like LCD and Keyboard etc.
The EPB/SLK-51 has a 64KB of on-chip flash memory. These drivers are
embedded into the chip memory. Thus part of the flash memory is used in
embedding these drivers. As a result, the first 32KB of flash program
memory can be used for writing your programs.
You have to note that the last 32KB of program memory should not be
erased. This memory space contains the driver routines as well as the
serial-communication routines need to upload or download the programs
from the PC. Erasing the last 32KB of memory content will result in the
erasure of the embedded programs and the chip will function as normal
89C51 chip. You then will require external programmer since the WINISP
will not communicate with the chip.
To be more precise, the last 32KB of space is divided into two parts of
16KB each (last two memory blocks as seen from the WINISP). The first
16KB i.e. the 3rd block contains the drivers and the last block contains the
communication routines. If the 3rd block is erased, the driver routines will
be lost. You can still use this space to save your programs.
Thus, its better to avoid using/erasing the last 32KB of memory space.
23
Memory map:
0
8K
16K
32K
48K
64K
24
25
Table1:
Component / Function
Description Of Embedded
Routine
Variable Used
Program
Location
Delay
Delay in millisecond
delay_ms
80ffh
LCD
(4 bit data bus)
LCD Initialization
LCD command
LCD data
lcd4_init
lcd4_cmd
lcd4_dat
812ch
81b0h
8217h
LCD
(8 bit data bus)
LCD Initialization
LCD command
LCD data
lcd8_init
lcd8_cmd
lcd8_dat0
8289h
82eeh
8334h
Key detect
keybrd_5
837ah
Key detect
keybrd_4
846bh
Key detect
keybrd_3
853fh
Key detect
keybrd_2
85feh
7 segment
7 segment initialization
7 segment interrupt
seg_init
seg_int
86b9h
86e9h
RTC write
RTC read
rtc_write
rtc_read
87a0h
8727h
EEPROM (connected at
p3.6 & p3.7)
EEPROM write
EEPROM read
write_srom
read_srom
8669h
88b0h
ADC read
adc_read
8980h
ssadc_read
8a3bh
26
Component /
Function
Graphic LCD
Printer
Counter
Serial
Communication
(Mode 1)
Serial
Communication
(Mode 2)
Serial ADC
(connected at p0.1
& p0.2)
EEPROM
(connected at p0.6
& p0.7)
Description Of Embedded
Routine
Graphic LCD initialization
Graphic LCD display on
Graphic LCD display off
Graphic LCD start line (cs1)
Graphic LCD start line (cs2)
Graphic LCD page (cs1)
Graphic LCD y-Address (cs1)
Graphic LCD page (cs2)
Graphic LCD y-address (cs2)
Graphic LCD Data (cs1)
Graphic LCD Data (cs2)
Graphic LCD clear screen (cs1)
Graphic LCD clear screen (cs2)
glcd_init
glcd_dispon
glcd_dispoff
glcd_srtlin1
glcd_srtlin2
glcd_page1
glcd_yadd1
glcd_page2
glcd_yadd2
glcd_send1
glcd_send2
glcd_clr1
glcd_clr2
Program
Location
8a7ah
8ae6h
8b43h
8ba0h
8beah
8c34h
8c7eh
8cc8h
8d12h
8d5ch
8da0h
95f5h
9629h
Printer initialization
Print character
Counter initialization
Serial communication initialization
Transmit character
Receive character
Serial communication initialization
Transmit character
Receive character
Serial ADC read
pri_init
print
counter
ser1_init
transmit1
receive1
ser2_init
transmit2
receive2
sadc_read
8e8fh
8eaah
8ee1h
8f08h
8f19h
8f23h
8f2eh
8f3fh
8f42h
949fh
EEPROM write
EEPROM read
write_rom
read_rom
94deh
9525h
27
Variable Used
The following table enlists the register or location that must be used to
pass / receive the parameter in order to access the embedded drive
routine. Further note that we should not use the particular associated
location in your main program elsewhere.
Table2:
Component / Function
LCD
Related Register /
Location
70h
71h
7 Segment
60h
61h
62h
63h
64h
65h
66h
67h
RTC
68h
69h
6ah
6bh
6ch
6dh
6eh
Second (write/read)
Minute (write/read)
Hour (write/read)
Day (write/read)
Date (write/read)
Month(write/read)
Year (write/read)
EEPROM
(All types)
7bh
7ch
7dh
7eh
Data 1
Data 2
Data 3
Data 4
Parallel ADC
79h
7ah
Channel selection
Data (read)
Serial ADC
(All types)
5eh
5fh
Data(lower byte)
Data(higher byte)
28
Parameter
Component / Function
Related Register /
Location
72h
73h
74h
75h
76h
77h
78h
Data (CS1/CS2)
Startline (CS1)
Page (CS1)
Y-address (CS1)
Startline (CS2)
Page (CS2)
Y-address (CS2)
Printer
6fh
Data (write)
Counter
5ch
5dh
5bh
Lower byte
Higher byte
Transmit/Receive
Graphic LCD
Serial Communication
(All types)
Parameter
The following table enlists the variable name that must be used to defined
the port or port pin at which the desired component is required to be
connected. Reference to the programs given in Project Essentials
workbook will make it clear how to use these variable names.
29
Table3:
Component
Variable
Used
Lcd4d
Lcd4en
Lcd4rs
LCD
(8 bit data bus)
Lcd8d
Lcd8en
Lcd8rs
lcd8 data(port)
lcd8 enable(port pin)
lcd8 register select(port pin)
Matrix Keyboard
(5x5)
kbrd5c1
kbrd5c2
kbrd5c3
kbrd5c4
kbrd5c5
kbrd5r1
kbrd5r2
kbrd5r3
kbrd5r4
kbrd5r5
Matrix Keyboard
(4x4)
kbrd4c1
kbrd4c2
kbrd4c3
kbrd4c4
kbrd4r1
kbrd4r2
kbrd4r3
kbrd4r4
LCD
(4 bit data bus)
Description
30
Component
Variable
Used
Description
kbrd3c1
kbrd3c2
kbrd3c3
kbrd3r1
kbrd3r2
kbrd3r3
Matrix Keyboard
(2x2)
kbrd2c1
kbrd2c2
kbrd2r1
kbrd2r2
7 segment
segdat
seldig
7 segment data
Selects Digit in which data is to be displayed(port)
padcadr
padcsoc
padceoc
padcale
padcdat
Graphic LCD
Glcddat
Glcddi
glcden
glcdcs1
glcdcs2
glcdrst
glcdrw
Printer
prdat
pbusy
pinit
pstrob
Printer data(port)
Printer busy(port pin)
Printer initialization(port pin)
Printer strobe(port pin)
Matrix Keyboard
(3x3)
31
The following is the listing of the header files that is required during the
assembly of the program. You may refer to the 'Project Essentials'
workbook where more than 100 program examples are discussed
demonstrating the usage of the embedded driver routines. We are sure
that the reference of the Project Essentials workbook you will acquaint
yourself with the strength of the embedded routine and start developing
practical applications.
HEADER FILES:
Location.h:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DELAY
delay_ms
equ
80ffh
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LCD4
lcd4_init
lcd4_cmd
lcd4_dat
equ
equ
equ
812ch
81b0h
8217h
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LCD8
lcd8_init
lcd8_cmd
lcd8_dat
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
equ
8289h
equ
82eeh
equ
8334h
KEYBOARD 5*5
keybrd_5
equ
837ah
equ
846bh
equ
853fh
equ
85feh
32
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7-SEGMENT
seg_init
seg_int
equ
equ
86b9h
86e9h
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RTC
rtc_write
rtc_read
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
write_srom
read_srom
equ
equ
87a0h
8727h
8669h
88b0h
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; P_ADC
adc_read
equ
8980h
equ
8a3bh
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
8a7ah
8ae6h
8b43h
8ba0h
8beah
8c34h
8c7eh
8cc8h
8d12h
8d5ch
8da0h
95f5h
9629h
33
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PRINTER
pri_init
print
equ
equ
8e8fh
8eaah
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; COUNTER
counter
equ
8ee1h
equ
equ
equ
8F08h
8F19h
8F23h
equ
equ
equ
8F2Eh
8F3Fh
8F42h
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; S_ADC
sadc_read
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
write_rom
read_rom
equ
949fh
EEPROM
equ
equ
94deh
9525h
34
Embedded.h:
;;;;;;;;;;;;;;;;;;;LCD 4 bit;;;;;;;;;;;;;;;;;
lcd4d
lcd4en
lcd4rs
equ a0h
equ a1h
equ a2h
;;;;;;;;;;;;;;;;;;;LCD 8 bit;;;;;;;;;;;;;;;;;
lcd8d
lcd8en
lcd8rs
equ a3h
equ a4h
equ a5h
;lcd8 data(port)
;lcd8 enable(port pin)
;lcd8 register select(port pin)
;;;;;;;;;;;;;;;;;;;Keyboard 5x5;;;;;;;;;;;;;;;;;
kbrd5c1
kbrd5c2
kbrd5c3
kbrd5c4
kbrd5c5
kbrd5r1
kbrd5r2
kbrd5r3
kbrd5r4
kbrd5r5
equ a6h
equ a7h
equ a8h
equ a9h
equ aah
equ abh
equ ach
equ adh
equ aeh
equ afh
;;;;;;;;;;;;;;;;;;;Keyboard 4x4;;;;;;;;;;;;;;;;;
kbrd4c1
kbrd4c2
kbrd4c3
kbrd4c4
kbrd4r1
kbrd4r2
kbrd4r3
kbrd4r4
equ b0h
equ b1h
equ b2h
equ b3h
equ b4h
equ b5h
equ b6h
equ b7h
35
;;;;;;;;;;;;;;;;;;;Keyboard 3x3;;;;;;;;;;;;;;;;;
kbrd3c1
kbrd3c2
kbrd3c3
kbrd3r1
kbrd3r2
kbrd3r3
equ b8h
equ b9h
equ bah
equ bbh
equ bch
equ bdh
;;;;;;;;;;;;;;;;;;;Keyboard 2x2;;;;;;;;;;;;;;;;;
kbrd2c1
kbrd2c2
kbrd2r1
kbrd2r2
equ beh
equ bfh
equ c0h
equ c1h
;;;;;;;;;;;;;;;;;;;7segment;;;;;;;;;;;;;;;;;
segdat
seldig
equ c2h
equ c3h
;7 segment data
;Selects Digit in which data is to be
;displayed(port)
;;;;;;;;;;;;;;;;;;;ADC 8-bit;;;;;;;;;;;;;;;;;
padcadr
equ c4h
padcsoc
padceoc
padcale
padcdat
equ c5h
equ c6h
equ c7h
equ c8h
;;;;;;;;;;;;;;;;;;;Graphic LCD;;;;;;;;;;;;;;;;;
glcddat
glcddi
glcden
glcdcs1
glcdcs2
glcdrst
glcdrw
equ c9h
equ cah
equ cbh
equ cch
equ cdh
equ ceh
equ cfh
36
;;;;;;;;;;;;;;;;;;;Printer;;;;;;;;;;;;;;;;;
prdat
pbusy
pinit
pstrob
equ d0h
equ d1h
equ d2h
equ d3h
;Printer data(port)
;Printer busy(port pin)
;Printer initialization(port pin)
;Printer strobe(port pin)
;;;;;;;;;;;;;;;;;;;I2C RTC;;;;;;;;;;;;;;;;;
irtcdat
irtcscl
equ d4h
equ d5h
;;;;;;;;;;;;;;;;;;;I2C ADC;;;;;;;;;;;;;;;;;
iadcadr
equ d6h
iadcdat
iadcscl
equ d7h
equ d8h
Chapter 9
EPB/SLK-51 User Manual
37
812ch
lcd4_init
38
39
8289h
lcd8_init
40
41
42
5 X 5 Matrix Keyboard
Column1 of Keyboard
Column2 of Keyboard
Column3 of Keyboard
Column4 of Keyboard
Column5 of Keyboard
Row 1 of Keyboard
Row 2 of Keyboard
Row 3 of Keyboard
Row 4of Keyboard
Row 5 of keyboard
43
44
mov 70h,#'K'
lcall lcd4_dat
mov 70h,#'e'
lcall lcd4_dat
mov 70h,#'y'
lcall lcd4_dat
mov 70h,#'='
lcall lcd4_dat
wait: lcall keybrd_5
jb 2fh.7, kb
sjmp wait
kb:
mov a,71h
45
anl a,#0f0h
swap a
add a,#30h
mov 70h,a
lcall lcd4_dat
mov a,71h
anl a,#0fh
add a,#30h
mov 70h,a
lcall lcd4_dat
ljmp again
5. The 4 x 4 Matrix Keyboard driver:
This routine is for 4 x 4 matrix keyboard. All the concepts similar to that of
5 x 5 matrix keyboard driver routine. Here also flag 2f.7h becomes high
when a key is pressed. After the key pressed, the key code is available at
RAM location 71h.
Program location: 846bh
Location name:
keybrd_4
Key code location: 71h
Let us make clear how to use this routine by considering following
program.
Suppose 4 x 4 matrix keyboard is connected as per the following
connections.
8051 Port Pins
P0.0
P0.1
P0.2
P0.3
P0.5
P0.6
P0.7
P2.6
4 X 4 Matrix Keyboard
Column1 of Keyboard
Column2 of Keyboard
Column3 of Keyboard
Column4 of Keyboard
Row 1 of Keyboard
Row 2 of Keyboard
Row 3 of Keyboard
Row 4 of Keyboard
46
;p0.0
;p0.1
;p0.2
;p0.3
;p0.5
;p0.6
;p0.7
;p2.6
47
;p0.0
;p0.1
;p0.2
;p0.3
;p0.5
;p0.6
;p0.7
;p2.6
lcall lcd4_init
agn:
lcall keybrd_4
jb 2fh.7,ok
sjmp agn
ok:
mov 70h,#01h
lcall lcd4_cmd
mov a,71h
anl a,#0f0h
swap a
add a,#30h
mov 70h,a
lcall lcd4_dat ;lcd dat
mov a,71h
anl a,#0fh
add a,#30h
mov 70h,a
lcall lcd4_dat
sjmp agn
;lcd cmd
48
3 X 3 Matrix Keyboard
Column1 of Keyboard
Column2 of Keyboard
Column3 of Keyboard
Row 1 of Keyboard
Row 2 of Keyboard
Row 3 of Keyboard
;p0.0
;p0.1
;p0.2
;p0.5
;p0.6
;p0.7
Test Program:
EPB/SLK-51 User Manual
49
include embedded.h
include location.h
org 00h
mov sp, #7fh
mov r0, #lcd4d
mov @r0, #02h
mov r0, #lcd4en
mov @r0, #24h
mov r0, #lcd4rs
mov @r0, #25h
mov r0, #kbrd3c1
mov @r0, #00h
mov r0, #kbrd3c2
mov @r0, #01h
mov r0, #kbrd3c3
mov @r0, #02h
mov r0, #kbrd3r1
mov @r0, #05h
mov r0, #kbrd3r2
mov @r0, #06h
mov r0, #kbrd3r3
mov @r0, #07h
;p0.0
;p0.1
;p0.2
;p0.5
;p0.6
;p0.7
lcall lcd4_init
agn:
lcall keybrd_3
jb 2fh.7,ok
sjmp agn
ok:
mov 70h,#01h
lcall lcd4_cmd
;lcd cmd
mov a,71h
anl a,#0f0h
swap a
add a,#30h
mov 70h,a
lcall lcd4_dat ;lcd dat
mov a,71h
anl a,#0fh
50
add a,#30h
mov 70h,a
lcall lcd4_dat
sjmp agn
7. The 2 x 2 Matrix Keyboard driver:
This routine is for 2 x 2 matrix keyboard. All the concepts similar to that of
5 x 5 matrix keyboard driver routine. Here also flag 2f.7h becomes high
when a key is pressed. After the key pressed, the key code is available at
RAM location 71h.
Program location: 85feh
Location name: keybrd_2
Key code location: 71h
Let us make clear how to use this routine by considering following
program.
Suppose 2 x 2 matrix keyboard is connected as per the following
connections.
2 X 2 Matrix Keyboard
Column1 of Keyboard
Column2 of Keyboard
Row 1 of Keyboard
Row 2 of Keyboard
;p0.0
;p0.1
;p0.5
;p0.6
51
include embedded.h
include location.h
org 00h
mov sp, #7fh
mov r0, #lcd4d
mov @r0, #02h
mov r0, #lcd4en
mov @r0, #24h
mov r0, #lcd4rs
mov @r0, #25h
mov r0, #kbrd2c1
mov @r0, #00h
mov r0, #kbrd2c2
mov @r0, #01h
mov r0, #kbrd2r1
mov @r0, #05h
mov r0, #kbrd2r2
mov @r0, #06h
;p0.0
;p0.1
;p0.5
;p0.6
lcall lcd4_init
agn:
lcall keybrd_2
jb 2fh.7,ok
sjmp agn
ok:
mov 70h,#01h
lcall lcd4_cmd
;lcd cmd
mov a,71h
anl a,#0f0h
swap a
add a,#30h
mov 70h,a
lcall lcd4_dat ;lcd dat
mov a,71h
anl a,#0fh
add a,#30h
mov 70h,a
lcall lcd4_dat
sjmp agn
8. The 7-segment LED Interface Driver:
EPB/SLK-51 User Manual
52
This routine can be used to interface the 7-segment LED to the controller.
Here there are two routines viz. the segment initialization routine and the
interrupt routine for refreshing the 7-segment LEDs. The Timer 0 is used to
generate the interrupt. Hence whenever the interrupt is generated, the
refreshing action takes place. This can be written as:
org 000bh
ljmp seg_int
reti
Program location for initialization:
Location name for initialization:
Program location for interrupt:
Location name for interrupt routine:
Location for data in respective digit:
86b9h
seg_init
86e9h
seg_int
60h, 61h, 62h, 63h, 64h, 65h,
66h, 67h
53
;interrupt routine
mov 60h,#3fh
lcall delay
mov 61h,#06h
lcall delay
mov 62h,#5bh
lcall delay
mov 63h,#4fh
sjmp $
;delay routine
delay:
EPB/SLK-51 User Manual
54
d3:
d2:
d1:
push 03h
push 06h
push 07h
mov r3,#9
mov r6,#0ffh
mov r7,#0ffh
nop
djnz r7,d1
djnz r6,d2
djnz r3,d3
pop 07h
pop 06h
pop 03h
ret
Let us understand with a test program that first loads all the parameters to
the RTC and then displays the clock and other parameters on LCD.
Test Program:
EPB/SLK-51 User Manual
55
include location.h
include embedded.h
org 0000h
mov sp, #7fh
mov r0, #lcd4d
mov @r0, #02h
mov r0, #lcd4en
mov @r0, #24h
mov r0, #lcd4rs
mov @r0, #25h
lcall lcd4_init
mov 68h,#00h
mov 69h,#60h
mov 6ah,#11h
mov 6bh,#07h
mov 6ch,#15h
mov 6dh,#06h
lcall rtc_write
;sec data
;minute data
;hour data
;day
;date
;month
;rtc write
loop:
lcall rtc_read ;rtc read
mov 70h,#80h
lcall lcd4_cmd
;lcd cmd
56
57
mov 70h,#20h
lcall lcd4_dat
mov a,6ch ;date
anl a,#0f0h
swap a
add a,#30h
mov 70h,a
lcall lcd4_dat
mov a,6ch
anl a,#0fh
add a,#30h
mov 70h,a
lcall lcd4_dat
mov 70h,#0c0h
lcall lcd4_cmd
mov a,6dh ;month
anl a,#0f0h
swap a
add a,#30h
mov 70h,a
lcall lcd4_dat
mov a,6dh
anl a,#0fh
add a,#30h
mov 70h,a
lcall lcd4_dat
ljmp loop
end:sjmp end
58
59
Test Program
include location.h
include embedded.h
org 0000h
mov sp, #7fh
mov r0, #lcd4d
mov @r0, #02h
mov r0, #lcd4en
mov @r0, #24h
mov r0, #lcd4rs
mov @r0, #25h
lcall lcd4_init
mov 7bh,#30h
mov 7ch,#32h
mov 7dh,#35h
mov 7eh,#37h
lcall write_rom
;write ROM
mov 7bh,#0h
mov 7ch,#0h
mov 7dh,#0h
mov 7eh,#0h
lcall read_rom
;read ROM
mov a,7bh
mov 70h,a
lcall lcd4_dat
mov 70h,#20h
lcall lcd4_dat
mov a,7ch
mov 70h,a
lcall lcd4_dat
mov 70h,#20h
lcall lcd4_dat
60
mov a,7dh
mov 70h,a
lcall lcd4_dat
mov 70h,#20h
lcall lcd4_dat
mov a,7eh
mov 70h,a
lcall lcd4_dat
sjmp $
11. Serial EEPROM (as per ASK):
The description for this routine is per the previous one. However this driver
routine is provided to make ASK card compatible with embedded routines.
Location for Write operation: 94deh
Location Name for Write operation: write_rom
Location for Read operation: 9525h
Location Name for Read operation: read_rom
Data location (Read/Write): 7bh, 7ch, 7dh, 7eh
NOTE:
To use this Embedded Routine, the following interface connection
must be carried out between the Controller and the EEPROM chip,
while using ASK:
8051 Port Pins
P0.6
P0.7
61
Test Program
include location.h
include embedded.h
org 00h
mov sp, #7fh
mov r0, #lcd4d
mov @r0, #02h
mov r0, #lcd4en
mov @r0, #24h
mov r0, #lcd4rs
mov @r0, #25h
lcall lcd4_init
mov 7bh,#'s'
lcall write_rom
lcall read_rom
mov 70h,7bh
lcall lcd4_dat
sjmp $
12. Parallel ADC
This driver routine is designed to interface the 8-bit ADC to the
microcontroller.
Here the channel has to be first selected and then the ADC routine has to
be called. This ADC routine will store the ADC output data to a fixed
location, which can be accessed in the main program.
Location for ADC routine: 8980H
Location Name for ADC routine: adc_read
Channel Select Address (00H to 07H) location: 79H
ADC output location: 7aH
Let us make clear how to use this routine by considering following
program.
Suppose ADC - 0809 is connected as per the following connections.
62
63
Test Program
include embedded.h
include location.h
org 00h
mov sp, #7fh
mov r0, #lcd4d
mov @r0, #02h
mov r0, #lcd4en
mov @r0, #24h
mov r0, #lcd4rs
mov @r0, #25h
lcall lcd4_init
mov r0,#padcadr
mov @r0,#00h
mov r0,#padcsoc
mov @r0,#03h
mov r0,#padcale
mov @r0,#04h
mov r0,#padceoc
mov @r0,#05h
mov r0,#padcdat
mov @r0,#01h
mov 79h, #07h
;ADC channel
;lcd dat
lcall adc_read
;ADC read
mov 70h,#87h
lcall lcd4_cmd
64
mov a, 7ah
;ADC data
anl a,#0f0h
swap a
mov dptr,#table
movc a,@a+dptr
mov 70h,a
lcall lcd4_dat
mov a, 7ah
anl a,#0fh
movc a,@a+dptr
mov 70h,a
lcall lcd4_dat
ljmp again
table:
db 30h;0
db 31h;1
db 32h;2
db 33h;3
db 34h;4
db 35h;5
db 36h;6
db 37h;7
db 38h;8
db 39h;9
db 41h;a
db 42h;b
db 43h;c
db 44h;d
db 45h;e
db 46h;f
65
8a3bh
ssadc_read
5eh, 5fh
NOTE:
To use this Embedded Routine, the following interface connection
must be carried out between the Controller and the ADC chip:
8051 Port Pins
P0.0
P3.6
P3.7
Let us make clear how to use this routine by writing a program to display
digital data from serial ADC.
Test Program
include embedded.h
include location.h
org 00h
mov sp, #7fh
mov r0, #lcd4d
mov @r0, #02h
mov r0, #lcd4en
mov @r0, #24h
mov r0, #lcd4rs
mov @r0, #25h
lcall lcd4_init
66
;ADC read
mov a,5eh
anl a,#0f0h
swap a
mov dptr,#table
movc a,@a+dptr
mov 70h,a
lcall lcd4_dat
mov a,5eh
anl a,#0fh
movc a,@a+dptr
mov 70h,a
lcall lcd4_dat
mov a,5fh
anl a,#0fh
movc a,@a+dptr
mov 70h,a
lcall lcd4_dat
ljmp again
table:
db 30h;0
db 31h;1
db 32h;2
db 33h;3
db 34h;4
db 35h;5
db 36h;6
db 37h;7
db 38h;8
db 39h;9
db 41h;a
db 42h;b
db 43h;c
db 44h;d
db 45h;e
db 46h;f
EPB/SLK-51 User Manual
67
949fh
sadc_read
5eh, 5fh
NOTE:
To use this Embedded Routine, the following interface connection
must be carried out between the Controller and the EEPROM chip,
while using ASK:
8051 Port Pins
P0.0
P0.1
P0.2
Let us make clear how to use this routine by writing a program to display
digital data from serial ADC.
Test Program
include embedded.h
include location.h
org 00h
mov sp, #7fh
mov r0, #lcd4d
mov @r0, #02h
mov r0, #lcd4en
mov @r0, #24h
mov r0, #lcd4rs
mov @r0, #25h
lcall lcd4_init
68
;ADC read
mov a,5eh
anl a,#0f0h
swap a
mov dptr,#table
movc a,@a+dptr
mov 70h,a
lcall lcd4_dat
mov a,5eh
anl a,#0fh
movc a,@a+dptr
mov 70h,a
lcall lcd4_dat
mov a,5fh
anl a,#0fh
movc a,@a+dptr
mov 70h,a
lcall lcd4_dat
ljmp again
table:
db 30h;0
db 31h;1
db 32h;2
db 33h;3
db 34h;4
db 35h;5
db 36h;6
db 37h;7
db 38h;8
db 39h;9
db 41h;a
db 42h;b
db 43h;c
db 44h;d
db 45h;e
db 46h;f
69
8a7ah
glcd_init
Graphic LCD Display On routine: This routine can be used to make the
Graphic LCD screen on.
Program location:
Location name:
8ae6h
glcd_dispon
Graphic LCD Display Off routine: This routine can be used to turn off the
Graphic LCD screen.
Program location:
Location name:
8b43h
glcd_dispoff
Graphic LCD Startline routine for Chip Section 1:This routine can be
used to assign the startline value in chip section 1 of the Graphic LCD.
Program location: 8ba0h
Location name:
glcd_srtlin1
Startline command location: 73h
Graphic LCD Page Address routine for Chip Section 1:This routine can
be used to assign the starting page adddress value for chip section 1 of
the Graphic LCD.
Program location: 8c34h
Location name:
glcd_page1
Page Address command location: 74h
70
Graphic LCD Y-Address routine for Chip Section 1: This routine can be
used to assign the Y-address value for chip section 1 of the Graphic LCD.
Hence the starting column where the first data is to written, can be defined
by using this routine.
Program location: 8c7eh
Location name:
glcd_yadd1
Y-Address command location: 75h
Graphic LCD Clear screen routine for Chip Section 1:This routine can
be used to clear the chip section 1 of the Graphic LCD.
Program location:
Location name:
95f5h
glcd_clr1
Graphic LCD Data routine for Chip Section 1:This routine can be used
to send data at the defined location in chip section 1 of the Graphic LCD.
Program location:
Location name:
Data location:
8d5ch
glcd_send1
72h
Graphic LCD Startline routine for Chip Section 2:This routine can be
used to assign the startline value in chip section 2 of the Graphic LCD.
Program location: 8beah
Location name:
glcd_srtlin2
Startline command location: 76h
Graphic LCD Page Address routine for Chip Section 2:This routine can
be used to assign the starting page adddress value for chip section 2 of
the Graphic LCD.
Program location: 8cc8h
Location name:
glcd_page2
Page Address command location: 77h
71
Graphic LCD Y-Address routine for Chip Section 2: This routine can be
used to assign the Y-address value for chip section 2 of the Graphic LCD.
Hence the starting column where the first data is to written, can be defined
by using this routine.
Program location: 8d12h
Location name:
glcd_yadd2
Y-Address command location: 78h
Graphic LCD Clear screen routine for Chip Section 2:This routine can
be used to clear the chip section 2 of the Graphic LCD.
Program location:
Location name:
9629h
glcd_clr2
Graphic LCD Data routine for Chip Section 2:This routine can be used
to send data at the defined location in chip section 2 of the Graphic LCD.
Program location: 8da0h
Location name:
glcd_send2
Startline command location: 72h
To make all this stuff clear, let us look at a sample program. Suppose the
Graphic LCD is connected as per following connections
8051 Port Pins
P0
P2.0
Graphic LCD
GLCD Data Lines
GLCD D/I pin
P2.1
GLCD EN pin
P2.2
P2.3
P2.4
P2.6
GLCD RW pin
72
73
lcall glcd_init
lcall glcd_dispon
;glcd initialization
;glcd display on
lcall glcd_clr1
lcall glcd_clr2
sec1:
mov 73h, #00h
lcall glcd_srtlin1
;cs1 startline
mov 75h,#00h
lcall glcd_yadd1
;cs1 yadr
mov 75h,#14
lcall glcd_yadd1
;cs1 yadr
;cs1 page
agn2: clr a
EPB/SLK-51 User Manual
74
movc a, @a+dptr
inc dptr
cjne a, #eom, cont2
sjmp $
cont2: mov 72h, a
lcall glcd_send1
sjmp agn2
msg: db 00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,80h,80h,c0h
db c0h,e0h,f0h,f0h,f8h,f8h,f8h,fch,fch,feh,feh,feh,feh,ffh,ffh,ffh,ffh,ffh,ffh,ffh,ffh
db ffh,ffh,ffh,ffh,ffh,ffh,ffh,ffh,feh,feh,feh,fch,fch,fch,f8h,f0h,e0h,80h,00h,00h,00h
db 00h,00h
db 00h,00h,00h,00h,00h,00h,00h,80h,c0h,e0h,f0h,f0h,f0h,04h,06h,e7h,e7h,e7h,e7h,e7h,e7h
db 67h,67h,e7h,e7h,e7h,e7h,e7h,e7h,e7h,e7h,cfh,8fh,1fh,1fh,7fh,f7h,07h,07h,f7h,ffh,ffh
db ffh,ffh,ffh,f7h,07h,07h,f7h,ffh,ffh,ffh,ffh,ffh,ffh,ffh,ffh,3fh,1fh,00h,00h,00h,00h
db 00h
db 40h,60h,70h,78h,7ch,7eh,7fh,7fh,7fh,7fh,7fh,7fh,3fh,00h,00h,1fh,1ch,1ch,1ch,1ch,1ch
db 18h,18h,1fh,1fh,1fh,1fh,1fh,1fh,1fh,1fh,0fh,47h,40h,40h,70h,78h,40h,00h,3fh,7fh,7fh
db 7fh,7fh,7fh,3fh,00h,00h,3fh,1fh,0fh,07h,07h,07h,03h,01h,00h,00h,00h,00h,00h,00h,00h
db 00h,eom
msg1:db 01h,01h,ffh,01h,01h
db ffh,99h,99h,81h,81h
db 7eh,81h,81h,81h,42h
db ffh,18h,18h,18h,ffh,eom
75
16. PRINTER
This routine can be used to interface the printer to the microcontroller.
There are two routines viz. (i) printer initialization and (ii) print routine. In
the printer initialization routine necessary communication protocol is being
set. By using the second driver routine i.e. print routine, you can print the
message on paper without engaging your PC for printing purpose. The
data is stored to a fixed location and the printer routine is called.
Location for printer initialization:
Location Name for printer initialization:
Location for print routine:
Location Name for printer initialization:
Data location (Write):
8e8fh
pri_init
8eaah
print
6fh
PRINTER
Printer data port
Printer strobe pin
P2.6
P2.7
76
Test Program:
include location.h
include embedded.h
eom equ 0ffh
org 00h
mov r0, #prdat
mov @r0, #00h
mov r0, #pbusy
mov @r0, #27h
mov r0, #pinit
mov @r0, #26h
mov r0, #pstrob
mov @r0, #24h
lcall pri_init
mov dptr, #msg
agn: mov a, #00h
movc a, @a+dptr
inc dptr
cjne a, #eom, go
sjmp exit
go:
mov 6fh, a
lcall print
sjmp agn
exit: sjmp $
msg:db
db
;;;;;data to print
77
8f08h
ser1_init
8f19h
transmit1
8f23h
receive1
5bh
78
mov 70h,#01h
lcall lcd4_cmd
again:
mov 5bh, #x
lcall transmit1
lcall receive1
mov 70h,#80h
lcall lcd4_cmd
mov a,5bh
mov 70h,a
lcall lcd4_dat
sjmp again
18. SERIAL COMMUNICATION USING MODE 2
This routine can be used to communicate controllers in mode 2. Here also
there are three routines viz. (i) Serial communication initialization, (ii)
Transmission routine and (iii) Reception routine. All the concepts are then
as per the previous one. The only benefit is that you need not to engage
your timer to set baud rate for serial communication.
Location for Serial Communication Initialization:
Location Name for Serial Communication Initialization:
Location for Transmission routine:
Location Name for Transmission initialization:
Location for Reception routine:
Location Name for Reception initialization:
8f2eh
ser2_init
8f3fh
transmit2
8f42h
receive2
5bh
79
Test Program:
include embedded.h
include location.h
org 0000h
mov sp, #7fh
mov r0, #lcd4d
mov @r0, #02h
mov r0, #lcd4en
mov @r0, #24h
mov r0, #lcd4rs
mov @r0, #25h
lcall ser2_init
lcall lcd4_init
mov 70h,#01h
lcall lcd4_cmd
again:
mov 5bh, #x
lcall transmit2
lcall receive2
mov 70h,#80h
lcall lcd4_cmd
mov a,5bh
mov 70h,a
lcall lcd4_dat
sjmp again
80
Chapter 10
FAQ
1) What is SLK-51?
The SLK-51 is a self-learning card specially designed for students who are
studying 8051 as their curricular subject. This card is designed to make
you confident enough to learn, test & apply 8051.
2) What is the difference between EPB & SLK-51?
Both the cards are same. Only the difference is the bread-board which is
available with the EPB. Also it is in a kit from packed in a wooden box. The
EPB is generally designed for institute labs where the components are
required to be inserted & not soldered so as to reuse them. However, SLC
is having a general-purpose area, where soldering of components is
possible and user can do project related activities.
3) Does the EPB/SLC loose its program when powered off?
No, the program does not loose even if the power is OFF. The program is
stored in the flash program memory and not in the RAM.
4) How many times can I write and erase program using the
EPB/SLC board?
The CPU chip manufacturer specifies that the Write/Erase operations can
be carried out for about 10,000 times which can be considered as pretty
high.
5) What precaution should I take while using the EPB/SLK-51?
First of all, try to read the user manual thoroughly before starting the kit.
Also do not remove the chip from the socket if possible. It is likely that the
static charge might damage the chip. Also make the power supply OFF
while change from program and Run mode.
81
You also need same basic components like the LEDs, Resistors, hook up
wires, Keys etc, to interface to the CPU. If you are interested to use the
SLK-51 in your project and you need more interfacing devices, you can
purchase different available options separately. It is best to purchase
various other available self learning cards (which include manual, software
and cables) that suit your requirements.
We however, recommended to purchase the LCD/key SLC-02 interface kit
along with the SLK-51, so that you can do lot of practice exercise, learn
how LCD is interface & do almost any project assignment.
82
SLC-02
SLC-03
SLC-04
SLC-05
SLC-06
83
84
85
86