EPB Manual
EPB Manual
EPB Manual
User’s Manual
Edutech Systems
304, Sarjan Complex
Pratap Road
Baroda-390 001
Tel. (0265) 438317
Email: [email protected]
Site: www.edutechonline.com
Terms and Conditions for use of the EPB/SLK-51
For the purposes of this document, the term THE PRODUCT shall be used
to refer to EPB/SLK-51 (Educational Practice Board/Self-Learning
Card).
1) You agree to use THE PRODUCT entirely at your own risk, and
assume all responsibility for such use. The author and distributors of
THE PRODUCT do not warrant it fit or suitable for any particular
purpose.
Chapter 10 FAQ 81
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, it’s a quick
platform for building a circuit and applying the logic.
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.
Features of EPB/SLK-51:
7) All port pins brought to general-purpose area along with power supply
to enable quick and easy circuit building.
9) Low cost & specially designed for students undergo 8051 curriculum &
projects.
Packing List:
2) Component box
3) Programming cable
4) CD ROM
5) Feedback/Registration Card
S U P P LY
x 9 10 9 10 P O .0
S W IT C H P 2 .1 11 12 11 12 P 2 .2
P 2 .3 13 14 13 14 P 2 .4
P 2 .5 P 2 .6
15 16 15 16
P 2 .7 ALE
Chapter 4
17 18 17 18
5V 19 20 19 20 GND
PRO G
C P U
P89051R D 24B P
O G R EEN LED P 1 .0 JP2 P 1 .1
1 2 1 2
PC
P 3 .5 15 16 15 16 P 3 .6
P 3 .7 X
17 18 17 18
IN T E R F A C E
+5V 19 20 19 20 GND
P 3 .7
P 3 .6
P 3 .5
P 3 .4
P 3 .3
P 3 .2
P 3 .1
P 3 .0
P 1 .7
P 1 .6
P 1 .5
P 1 .4
P 1 .3
P 1 .2
P 1 .1
P 1 .0
P 2 .7
P 2 .6
P 2 .5
P 2 .4
P 2 .3
P 2 .2
P 2 .1
P 2 .0
P 0 .7
P 0 .6
P 0 .5
P 0 .4
P 0 .3
P 0 .2
P 0 .1
P 0 .0
9
Understanding the EPB/SLK-51
Block Description:
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 CPU -
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:
Switch:
32 Port Lines
The availability
of +5 volts and ground on to the general-purpose area makes the
interfacing more easy and simple. The breadboard has many strips.
The first block contains all the port line from P0.0 to P3.7. Remaining 4
block consists of general-purpose area. Ground and +5v are also
available. The arrangement hole is such that vertically the holes are short.
This makes the insertion of the component easy and more number of
components can be connected easily. Thus in the first block, 3 holes
vertically are shorted while in remaining block 4 holes are shorted
vertically.
P O .0 JP1 P O .1
1 2 1 2
P O .2 P O .3
3 4 3 4
P O .4 5 6 5 6 P O .5
P O .6 7 8 7 8 P O .7
x 9 1 0 9 1 0 P O .0
P 2 .1 11 1 2 11 1 2 P 2 .2
P 2 .3 P 2 .4
13 1 4 13 1 4
P 2 .5 P 2 .6
15 1 6 15 1 6
P 2 .7 ALE
17 1 8 17 1 8
5V GN D
19 2 0 19 2 0
P 1 .0 JP2 P 1 .1
1 2 1 2
P 1 .2 3 4 3 4 P 1 .3
P 1 .4 P 1 .5
5 6 5 6
P 1 .6 7 8 7 8 P 1 .7
x P 3 .0
9 1 0 9 1 0
P 3 .1 P 3 .2
11 1 2 11 1 2
P 3 .3 P 3 .4
13 1 4 13 1 4
P 3 .5 15 1 6 15 1 6 P 3 .6
P 3 .7 17 1 8 17 1 8 X
+5V 19 2 0 19 2 0 GN D
Chapter 5
Virtual Programmer
EPB/SLK-51 User Manual 14
The EPB/SLK-51 has to be connected to the PC using the serial cable.
The program that is developed using the development tools is to be
downloaded to the board.
To start using the virtual program first you have to install the utility from the
CD provided with the pack. You can click the WINISP.exe to install the
program. Follow the instructions on the screen and complete the
installation. You can restart the computer if required. The program then
can be accessed from the start menu and program option you can even
create a shortcut on the desktop. Now let us see the virtual programmer
screen layout. The screen shows the layout of the WINISP utility.
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.
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’.
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.
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 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.
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.
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
org 0000h
sjmp main
org 0060h
main: clr pin
mov a,#4
acall delay
setb pin
mov a,#4
acall delay
sjmp main
delay:
sjmp $
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.
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.
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.
Introduction
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.
8K
16K
32K
48K
64K
The Embedded Driver routines on the chip can be referred using their
direct address. To simplify the addressing of these routines, the locations
are mapped to some variable names. These names can be directly
mentioned in the programs. To make the programming still simpler,
separate header files are provided which can be included in the main
program.
The first header file is “location.h”. This file is to be included in the main
program. It defines the location of various embedded drivers incorporated
in the chip. With this feature you can access the driver routine using a
specific name instead of numeric value of the location. There are two
advantages of using this header file. Firstly you need not remember the
numeric locations while using the embedded routines and secondly in
case of upgradation of these embedded routines, your main programs
need not to be modified.
The Embedded.h file links the embedded routines and the pin
assignments. You have to mention the allocation of port pins in the main
program written by you. Thus you must include this header file when you
use the embedded driver features while interfacing the components.
The following lines describe how to use the header files for writing a
application program.
MOV R0, #lcd8d ; Variable for LCD Data Lines as per embedded.h
MOV @R0, #00h ; 00h defines port - 0
MOV R0, #lcd8en ; Variable for LCD Enable Line as per embedded.h
MOV @R0, #10h ; 10h defines port pin P1.0
MOV R0, #lcd8rs; Variable for LCD Register Select Line as per
;embedded.h
MOV @R0, #11h ; 11h defines port pin P1.1
The following table enlists different drivers embedded into the chip. The
table consists of Component/Function name, description of the embedded
routine, variable name used in location.h file and program location.
Table2:
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.
Parallel ADC (8 bit) padcadr ADC address line(port) first three pins will get configured
padcsoc ADC start of conversion line(port pin)
padceoc ADC end of conversion line(port pin)
padcale ADC ALE line(port pin)
padcdat ADC data(port)
HEADER FILES:
Location.h:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DELAY
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LCD4
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LCD8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RTC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; P_ADC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; COUNTER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; S_ADC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EEPROM
;;;;;;;;;;;;;;;;;;;LCD 4 bit;;;;;;;;;;;;;;;;;
lcd4d equ a0h ;lcd4 data(port) first four pins will get configured
lcd4en equ a1h ;lcd4 enable(port pin)
lcd4rs equ a2h ;lcd4 register select(port pin)
;;;;;;;;;;;;;;;;;;;LCD 8 bit;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;Keyboard 5x5;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;Keyboard 4x4;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;Keyboard 2x2;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;7segment;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;ADC 8-bit;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;Graphic LCD;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;I2C RTC;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;I2C ADC;;;;;;;;;;;;;;;;;
Chapter 9
EPB/SLK-51 User Manual 37
Embedded Driver Description & Example Programs
1. Delay:
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 ;LCD initialization routine
This LCD embedded driver is meant for 8-bit data bus interface. As
mentioned above it also consists of three subroutines: (i) LCD initialization,
(ii) LCD command and (iii) LCD data. These routines are to be called from
the main program by using the appropriate variable name. The details of
these routines are as follows:
Test Program:
include embedded.h
include location.h
org 00h
This routine is meant to detect the pressed key. The main routine checks if
the flag bit 2f.7h is high. In the embedded routine the flag bit 2f.7h is made
high if a valid key is pressed. If you are using loop means you want to
consecutively check the pressed key, make sure that flag 2f.7h is cleared
before entering in to the loop. If you want to check the pressed key only
once, no need to clear the flag 2f.7h. After the key pressed, the key code
is available at RAM location 71h. Here key code means row/column
combination is moved to 71h.
For eg.
If you press F1 key then 22h is moved to 71h,here 22h means 2 nd
row and 2nd column.
Test Program:
include embedded.h
include location.h
org 0
mov sp,#7fh
mov sp, #7fh
mov r0, #lcd4d
mov @r0, #02h
mov r0, #lcd4en
mov @r0, #24h
mov r0, #lcd4rs
mov @r0, #25h
mov 70h,#'K'
lcall lcd4_dat
mov 70h,#'e'
lcall lcd4_dat
mov 70h,#'y'
lcall lcd4_dat
mov 70h,#'='
lcall lcd4_dat
mov a,71h
anl a,#0fh
add a,#30h
mov 70h,a
lcall lcd4_dat
ljmp again
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.
Test Program:
include embedded.h
include location.h
org 00h
lcall lcd4_init
agn:
lcall keybrd_4
jb 2fh.7,ok
sjmp agn
This routine is for 3 x 3 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.
Test Program:
EPB/SLK-51 User Manual 49
include embedded.h
include location.h
org 00h
lcall lcd4_init
agn:
lcall keybrd_3
jb 2fh.7,ok
sjmp agn
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.
Test Program:
org 00h
lcall lcd4_init
agn:
lcall keybrd_2
jb 2fh.7,ok
sjmp agn
org 000bh
ljmp seg_int
reti
Test Program:
include embedded.h
include location.h
org 0000h
ljmp main
org 000bh
lcall seg_int ;interrupt routine
reti
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
push 03h
push 06h
push 07h
mov r3,#9
d3: mov r6,#0ffh
d2: mov r7,#0ffh
d1: nop
djnz r7,d1
djnz r6,d2
djnz r3,d3
pop 07h
pop 06h
pop 03h
ret
This driver routine can be used to interface the RTC chip to the
microcontroller. It consists of two different routines: (i) to write the RTC
timekeeper registers and (ii) to read value of these registers. The RTC
timekeeper registers include seconds, minutes, hours, day, date, month
and year. During initialization the parameters are to be mentioned at the
given address. When the RTC is read, the parameters are returned at the
same locations as mentioned.
NOTE:
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
lcall lcd4_init
loop:
lcall rtc_read ;rtc read
mov 70h,#80h
lcall lcd4_cmd ;lcd cmd
mov a,68h
anl a,#0fh
add a,#30h
mov 70h,a
lcall lcd4_dat
mov 70h,#20h
lcall lcd4_dat
mov a,69h
anl a,#0fh
add a,#30h
mov 70h,a
lcall lcd4_dat
mov 70h,#20h
lcall lcd4_dat
mov 70h,#020h
lcall lcd4_dat
mov 70h,#0c0h
lcall lcd4_cmd
ljmp loop
end:sjmp end
There are two operations to interface the serial EEPROM: (i) to write
EEPROM and (ii) to read EEPROM. The data to be written to the memory
is stored at fixed location. The write routine is used to store the data at
fixed location in the memory.
In the Read operation also, the routine is called from the main program.
This routine reads the data stored in the EEPROM and sends it at fixed
locations, which then can be read.
NOTE:
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
mov 70h,#20h
lcall lcd4_dat
mov a,7eh
mov 70h,a
lcall lcd4_dat
sjmp $
The description for this routine is per the previous one. However this driver
routine is provided to make ASK card compatible with embedded routines.
NOTE:
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 $
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.
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
Now let us write a program to read the digital data from ADC and display it
on LCD.
include embedded.h
include location.h
org 00h
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 70h,#31h
lcall lcd4_dat ;lcd dat
mov 70h,#87h
lcall lcd4_cmd
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
This driver routine can be used to interface the serial ADC (ADS 1286)
with microcontroller.
Since this ADC is 12-bit serial ADC, we have to the received digital data
from serial ADC in two fixed locations.
NOTE:
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 ;LCD initialization routine
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
The description for this routine is per the previous one. However this driver
routine is provided to make ASK card compatible with embedded routines.
NOTE:
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 ;LCD initialization routine
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
Graphic LCD Display On routine: This routine can be used to make the
Graphic LCD screen on.
Graphic LCD Display Off routine: This routine can be used to turn off the
Graphic LCD screen.
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.
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.
Graphic LCD Clear screen routine for Chip Section 1:This routine can
be used to clear the chip section 1 of the Graphic LCD.
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.
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.
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.
Graphic LCD Clear screen routine for Chip Section 2:This routine can
be used to clear the chip section 2 of the Graphic LCD.
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.
To make all this stuff clear, let us look at a sample program. Suppose the
Graphic LCD is connected as per following connections
Test Program
include embedded.h
include location.h
org 00h
mov sp, #7fh
mov r0, #glcddat
mov @r0, #00h
mov r0, #glcddi
mov @r0, #20h
mov r0, #glcden
mov @r0, #21h
mov r0, #glcdcs1
mov @r0, #22h
mov r0, #glcdcs2
mov @r0, #23h
mov r0, #glcdrst
mov @r0, #24h
mov r0, #glcdrw
mov @r0, #26h
lcall glcd_clr1
lcall glcd_clr2
sec1:
mov 73h, #00h
lcall glcd_srtlin1 ;cs1 startline
mov 75h,#00h
lcall glcd_yadd1 ;cs1 yadr
sjmp nxt
agn2: clr a
EPB/SLK-51 User Manual 74
movc a, @a+dptr
inc dptr
cjne a, #eom, cont2
sjmp $
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
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 ;;;;;data to print
lcall print
sjmp agn
exit: sjmp $
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 ser1_init
lcall lcd4_init
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
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
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.
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.
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.
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.
7) What is WINISP?
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.
The basic module i.e., the EPB/SLK-51 can be interfaced with number of
modules. There exist two different types of modules for institutes &
individual user. However, there is no much differ in this construction.
But we do, however recommend that the CPU chip should not be removed
from the socket since it is likely to get damaged by static electricity.
The EPB/SLK-51 has 32 i/o lines. All the ports pins are made available to
the user.
These days, the use of controller has increased a lot and they are applied
in different consumer item, industrial equipments and even toys. Also
these days, industry is also not doing well. Hence if you are really through
in the concepts you have learnt in your curriculum and if you can apply
those concepts learnt, you will survive. Also if you plan to start on your
own and develop applications that are required by the society or try to
have some maintenance related job that involves controllers (areas like
consumer electronics, Medical electronics, Automobile etc) you need to be
through in the concept.
SLK-51 is the product designed for you to make you a complete engineer
who can interface and apply controller to solve problems.
We are sure that with this faith & dedication, you should be successful in
your life. SLK-51 is meant for that.
The EPB/SLK-51 pins are perfectly suited for digital input and output with
TTL/CMOS level (0 to 5 V) signals. You can use it to generate PWM
signals and apply them. More details of applications can be studied by
referring the data sheet of the CPU.
15) Can I use the I/O pins to control relays, solenoids and other
similar devices?
Yes, simply use a 470 ohm resistor in series with the LED to limit the
current drawn through the i/o pin. Also keep in mind that most LED,
require a lot of current in relation to what the EPB/SLK-51 can provide. If
you attach more LEDs at one time from and power the i/o pins of
EPB/SLK-51, you all likely to see flaky and unpredictable results caused
by voltage sag, i/o pin damage and/or hardware resets. Either driver
circuitry or low current LEDs will need to be used if you require such an
application.
You can use the WINISP, a virtual programmer provided with the package
to program the EPB/SLK-51.
You need to serially connect the EPB/SLK-51 to the serial port of PC. The
programming cable is provided to do the interface.
19) What other tools can be used to develop program for EPB/SLC-
01?
A part from assembler provided with the package, you can even write
program in C-language or both C – and assembly language and use tools
like C-Cross Compiler. You can also use utilities like simulator to check
your program.
The embedded driver routines can be used to test the program logic.
These drivers can be called when require & their output can be checked.
Thus the routines are useful to test the program as well as to develop
application easily.
No. You can use these embedded drivers if you wish. You can write your
own routines and use the first 32kb flash memory. The last 32kb memory
is reserved for embedded routines.
There exists different driver embedded into the card. These drivers are
designed for interfacing LCD, keyboard, ADC, RTC, E 2PROM etc. also
delay, counter, routines are available. You can also use the serial
transmission and reception routines. All these routines can be combined
as per the requirements & used to develop project.
Every driver embedded into the card has own unique address. You can
therefore call these routines from your main program. The embedded
routines return you certain values at particular location, which can be
checked in the main program.