Sie sind auf Seite 1von 48

SCROLL PAD

SUBMITTED BY: Raman Bedi Amit Sharma Ashish Dhiman Arvind Chauhan

SCROLL PAD

Implementation Environment

1. Microcontroller
The microcontroller we have used is AT89S52 which belongs to 8052 series of microcontrollers and is a member of 8051 family. The 8052 has all the standard features of 8051 as well as an extra 128 bytes of RAM and an extra timer. In other words, the 8052 has 256 bytes of RAM and 3 timers. It also has 8k bytes of on-chip ROM instead of 4Kbytes. All programs written for the 851 will run on the 8052, but the reverse is not true.

Feature ROM (on-chip program space in bytes) RAM (bytes) Timers I/O pins Serial port Interrupt sources

8051 4K 128 2 32 1 6

8052 8K 256 3 32 1 8

Table i: Comparison between 8051 and 8052

2
SSGPURC,Hoshiarpur

SCROLL PAD

3
SSGPURC,Hoshiarpur

SCROLL PAD

Figure i: Pin configuration of Microcontroller

8052 micro controller has 4 ports. These are port0, port1, port2, port3 which can be accessed as I/0 ports. The pins of the micro controller are explained below. 1. Reset: It resets total 8052 micro controller. 2. RXD: It receives data in serial communication. 3. TXD: It transmits data in serial communication. 4. INT0: External interrupt for timer 0. 5. INT1: External interrupt for timer1 6. T0: Timer0. 7. T1: Timer1. 8. RD: To read into external memory. 9. WR: To write into external memory. 10. XTAL1 & XTAL2: To connect the crystal oscillator. 11. ALE: Address latch enable which is used to access the address locations from external memory. 12. PSEN: Program store enable which is used for storing programming code into the external memory. 13. EA: External Access: 64 KB of ROM is the limit for external memory. The 8052 has an on-chip oscillator but requires an external clock to run it. A quartz crystal oscillator is to be connected to the inputs XTAL1 (pin19) and XTAL2 (pin18). The quartz crystal oscillator also needs two capacitors of 30 pF value.

4
SSGPURC,Hoshiarpur

SCROLL PAD

Figure ii: Oscillators connections. The speed of 8052 refers to the maximum oscillator frequency connected to XTAL. For example a 12-MHz chip must be connected to a crystal with 12 MHz frequency or less. We can observe the frequency on the XTAL2 pin using the oscilloscope RST: RESET pin is an input and is active high (normally low). Upon applying a high pulse to this pin, the microcontroller will reset and terminate all activities. This is often referred to as a power-on reset. Activating a power-on reset will cause all values in the registers to be lost.

In order for the RESET input to be effective, it must have a minimum duration of 2 machine cycles. In other words, the high pulse must be high for a minimum of 2 machine cycles before it is allowed to go low.

5
SSGPURC,Hoshiarpur

SCROLL PAD

Figure iii: Reset circuitry. EA, external access, is an input pin and must be connected to Vcc or GND. The 8051 family members all come with on-chip ROM to store programs. So, EA pin is connected to Vcc. The 8031 and 8032 family members do not have on-chip ROM, so code is stored on an external ROM and is fetched by 8031/32. So, EA pin must be connected to GND to indicate that the code is stored externally. The following two pins are used mainly in 8031-based systems: 1. 2. PSEN, program store enable, is an output pin. This pin is connected to ALE, address latch enable, is an output pin and is active high. the OE pin of the ROM. Port 0 provides both address and data. The 8031 multiplexes address and data through port 0 to save pins ALE pin is used for demultiplexing the address and data by connecting to the G pin of the 74LS373 chip. The four 8-bit I/O ports P0, P1, P2 and P3 each uses 8 pins. All the ports upon RESET are configured as output, ready to be used as input ports. Port 0 is also designated as AD0-AD7, allowing it to be used for both address and data. When connecting an 8051/31 to an external memory, port 0 provides both address and

6
SSGPURC,Hoshiarpur

SCROLL PAD

data. The 8051 multiplexes address and data through port 0 to save pins. ALE indicates if P0 has address or data When ALE=0, it provides data D0-D7 When ALE=1, it has address A0-A7 It can be used for input or output, each pin must be connected externally to a 10K ohm pull-up resistor. This is due to the fact that P0 is an open drain, unlike P1, P2, and P3. Open drain is a term used for MOS chips in the same way that open collector is used for TTL chips

Figure iv: Port 0 connections. In 8051-based systems with no external memory connection, both P1 and P2 are used as simple I/O. In 8031/51-based systems with external memory connections, port 2 must be used along with P0 to provide the 16-bit address for the external memory. P0 provides the lower 8 bits via A0 A7. P2 is used for the upper 8 bits of the 16-bit address, designated as A8 A15, and it cannot be used for I/O Port 3 can be used as input or output Port 3 does not need any pull-up resistors. It has the additional function of providing some extremely important signals.

7
SSGPURC,Hoshiarpur

SCROLL PAD

Figure v: Port 3 pins.

1. Information Engineering National Cheng Kung University 28 HANEL


2. Software & Hardware used
As we know that the microcontroller is a programmable device and can perform or give output as per the program burnt into it. The program can be burnt into it using a programmer (hardware) and software installed in a computer. The program can be burnt by connecting the COM port of the computer to the RS 232 port of the programmer using DB9 connector. The programmer burns the program into the microcontroller through its serial communication ports. 8
SSGPURC,Hoshiarpur

SCROLL PAD

Software for programming ASM51 The programs were written in assembly language using notepad as an editor and were saved with .asm as the extension. ASM51 is an assembler which assembles the files with .asm in the folder and generates two files in the same folder with .hex and .list as the extensions. The .hex file contains the hex conversion of the program and the .list file contains the errors if any. It is the .hex file which is burnt into the microcontroller. Software for Simulation Proteus

Proteus is a simulating software which is used to make the circuits and then to check the output according to the programming done. The hex file of the program is loaded into the microcontroller used in the circuit and is simulated to check whether the output is the desired one or not. Software for burning program ISP Flash Programmer 3.0a

9
SSGPURC,Hoshiarpur

SCROLL PAD

ISP Flash Programmer 3.0a is software for burning program into microcontroller. This software basically acts as an interface for setting up the communication between the computer and the programmer in which the microcontroller is plugged. Any one of the COM ports can be used for communication. Usually COM 2 is used as COM 1 is used by the mouse. The software can be set for programming different types of microcontrollers. After setting it for the microcontroller being used, the hex file of the program is loaded and is burnt into the microcontroller with the help of the programmer.

Figure ix: ASM51 working screen

10
SSGPURC,Hoshiarpur

SCROLL PAD

Figure x: Proteus working screen

Figure xi: ISP working screen 11


SSGPURC,Hoshiarpur

SCROLL PAD

Programmer kit A programmer is used to burn the hex file into the ROM of the microcontroller. This programmer can be connected to the COM port of the computer using DB9 connector. The microcontroller is plugged into the socket and then the hex file is burnt into the ROM of the microcontroller with the help of software mentioned above.

12
SSGPURC,Hoshiarpur

SCROLL PAD

Figure xii: Programmer kit

III. Work Done

1. LCD Interfacing LCD

LCD stands for Liquid Crystal Display. It is basically used to display data replacing LEDs (seven segment LEDs or multisegment LEDs). This is due to following reasons: 1. The declining prices of LCDs. 2. The ability to display numbers, characters and graphics. 3. Ease for programming for characters and graphics. We have studied about 16*2 alphanumeric LCD which can display data in 2 lines.

13
SSGPURC,Hoshiarpur

SCROLL PAD

Figure xiii: 16*2 alphanumeric LCD

LCD pin description Pin 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Symbol VSS VCC VEE RS R/W E PB0 PB1 DB2 DB3 DB4 DB5 DB6 DB7 I/O I I I/O I/O I/O I/O I/O I/O I/O I/O I/O Description Ground +5V power supply Power supply to control contrast RS=0 to select command register, RS=1 to select data register. R/W=0 for write, R/W=1 for read Enable The 8 bit data bus The 8 bit data bus The 8 bit data bus The 8 bit data bus The 8 bit data bus The 8 bit data bus The 8 bit data bus The 8 bit data bus 14
SSGPURC,Hoshiarpur

SCROLL PAD

Table i: LCD pin description

Interfacing LCD with MCU

15
SSGPURC,Hoshiarpur

SCROLL PAD

Figure xiv: Interfacing LCD with MCU From the above picture it is clear that the data pins of the LCD are connected to P1 of the microcontroller. The control pins i.e. RS, R/W and E of the LCD are connected to P2.5, P2.4 and P2.3 respectively. The program for displaying SCROLL PAD on the LCD is given below.

16
SSGPURC,Hoshiarpur

SCROLL PAD

Program: $include(mod51) org mov mov acall acall mov acall acall mov acall acall mov acall acall mov acall acall mov again: mov acall inc djnz here: command: sjmp mov clr clr setb 0000h dptr, a, command delay a, command delay a, command delay a, command delay a, command delay r0, a, datawrt dptr r0, here p1, p2.5 p2.4 p2.3 17
SSGPURC,Hoshiarpur

#100h #38h

; Dptr pointing SCROLL PAD. ; 2 lines, 5 x 7 matrix. ; Calling command subroutine. ; Giving LCD some time.

#0eh

; Display on, cursor on.

#01h

; Clear LCD.

#06h

; Shift cursor right.

#80h

; Cursor at line 1, position 1.

#10 #0 @a+dptr

; Counter for 10 characters. ; Character loaded in accumulator. ; Calling display subroutine. ; Incrementing for next character.

movc a,

again a

;Repeat till all characters are displayed. ; Stay here. ; Command subroutine.

SCROLL PAD

acall clr ret datawrt: mov setb clr setb acall clr ret delay: here2: here1: mov mov djnz djnz ret org db end

delay p2.3 p1, p2.5 p2.4 p2.3 delay p2.3 r2, r3, r3, r2, 0100h #10 #255 here1 here2 a ; Display subroutine.

'SCROLL PAD'

18
SSGPURC,Hoshiarpur

SCROLL PAD

4. Project Description

Scroll pad
19
SSGPURC,Hoshiarpur

SCROLL PAD

Introduction What is Scroll pad? It is 8052 based device which can type alphabets, numerals and some other characters into the LCD with just a finger scroll. The finger is to be scrolled on a particular pattern made on the pad in the shape of the character you want to be type. Need and use of Scroll pad? Today we are living in the world full of hi-tech gadgets which perform different tasks efficiently and with minimum human effort. Scroll pad is such a gadget although not so hi-tech but good enough to sense the motion of a finger resembling English alphabets, numerals and some other characters and displays the corresponding character on the LCD fixed above it. Hence this scroll pad reduces human effort as compared to typing the same text using a keyboard. Moreover with further advancements in this scroll pad, the usage of the keyboards having large number of keys on it as compared to just few touch sensors of the scroll pad can be eliminated. Once the text has been written into the LCD, it can be transferred to a distant LCD for data presentations. This facility can be used by the professors to deliver the lectures by writing on the scroll pad in place of boards and then displaying the written data on a distant LCD for the students to view it. Now, as the lecture delivered has been converted into electrical form so it can be saved or can be converted into a hard copy. The concept of sending the data from scroll pads LCD to a distant LCD can be used for writing the data into the LCD or LED screens used as notice boards. Hence the data can be written into these screens from a distant place and also without the use of computers. These could be the few uses of the scroll pad, which could be increased in numbers with the further advancements in it.

20
SSGPURC,Hoshiarpur

SCROLL PAD

Overview

Scroll pad is a set of ten touch sensors. Eight out of which are arranged in a particular pattern and other two are used for giving commands. These are DISPLAY and TRANSFER. All these touch sensors are made by using BC547 which is an npn transistor. The pattern made by the arrangement of eight touch sensors senses the motion of a finger being scrolled upon it. Once the scrolling is finished, touch DISPLAY. If the motion of the finger resembles any of the English alphabets (A to Z) or any of the numerals (0 to 9), then the corresponding character will displayed on the LCD fixed above it. Along with the alphabets and numerals $, *, -, +, =, < and > can also be sensed and displayed by the scroll pad. After the text has been written into the LCD, it can be transferred to a distant LCD. The command for transmission is be given with just a touch on TRANSFER.

Figure xix: Circuit Model of Scroll pad Block Diagram of Scroll pad 21
SSGPURC,Hoshiarpur

SCROLL PAD

22
SSGPURC,Hoshiarpur

SCROLL PAD

Figure xx: Block Diagram of Scroll Pad. Touch Sensors The touch sensors used here are made up of BC547 npn transistors. We know that whenever npn transistor in CE configuration is supplied with a small value of current at its base terminal, it acts as a switch i.e. conduction between collector and emitter takes place. This property of npn transistor is used here. In a touch sensor, the current to the base is provided by the touch of a finger. The finger should also be in contact with Vcc. Here, the conductive nature of human body comes into play.

Now, here a question could arise that Can we use a conductor in place of finger? The answer to the question is NO. Because if a conductor is used then the current flowing into the base will not be in small amount and will destroy the transistor. In other words, applying directly +5v to the base of npn transistor in CE configuration will destroy it as a result of short circuit.

23
SSGPURC,Hoshiarpur

SCROLL PAD

Now, the circuit of this basic touch sensor is slightly modified in order to get a more useful touch senssor which can be used in the main circuit.

Here, when the biasing is provided, the conduction between C and E takes place and the output will be approximately 0v as all the voltage will drop across 10 k resistor. And when the biasing is not provided, there will be no conduction between C and E and hence the output will be approximately +5v. The output we get from this touch sensor is in analog form whereas we require a digital one. For this a comparator is used, which compares the analog voltage with a fixed reference voltage and gives digital voltage which can be fed directly to the microcontroller.

24
SSGPURC,Hoshiarpur

SCROLL PAD

Analog to digital conversion The output of the sensor we get will be analog in nature. So, if we are using this output to drive microcontroller, we will need to convert this to a digital signal first. That can be done in two ways: 1. using comparators. 2. using ADCs(Analog-to-Digital Converters). I will be using the comparator as its very easy to handle and also cheap. After the comparator, we will get a signal that can be directly fed to the micro-controller.

Figure xxiii: LM324 Comparator

25
SSGPURC,Hoshiarpur

SCROLL PAD

Pin Diagram of LM324 This device consists of four independent precision voltage comparators with an offset voltage specifications as low as 2mV. This comparator is designed to specifically operate from a single power supply over a wide range of voltages. Operation from split power supplies is also possible. This comparator also has a unique characteristic which is that the input common-mode voltage range includes ground even though operated from a single power supply voltage.

26
SSGPURC,Hoshiarpur

SCROLL PAD

Figure xxiv: Pin Diagram of LM324

Touch Sensor Circuit

Figure xxv: Touch Sensor circuit The analog output that we get from the transistor will be compared with a fixed reference voltage. This reference voltage is set by varying the slider of the potentiometer. If the transistors ouptput voltage is greater than the reference voltage then the outout will be +5v and viceversa. Hence, the analog voltage has been converted into digital form which can be fed directly to the microcontroller. In the scroll pad 10 touch sensors will be used. So, it is not convenient to touch the base terminal of the transistors directly. Thus a surface for touch is developed on a copper clad PCB using PCB printing technique. This has also helped in arranging the sensors 27
SSGPURC,Hoshiarpur

SCROLL PAD

according to a fixed pattern. The pattern developed on the PCB looks like the figure shown below.

Figure xxvi: Scroll Pads Pattern. As we can see that the red color represents Vcc. It is along this pattern the finger should be scrolled. During scrolling the finger already touching Vcc will come in contact with the two adjacent touch sensors. As the finger is moved, the set of two adjacent sensors keep on changing. Hence, different signals will be generated while scrolling. These sets of signals are continuously saved by the mic. At last the mic will display the 28
SSGPURC,Hoshiarpur

SCROLL PAD

corresponding character if the scrolled set matches with a stored set. The character will be displayed only if DISPLAY is touched. Once the character has been displayed, it can be sent to a distant LCD with the touch on TRANSFER. Microcontroller The AT89S52 is a low-power, high-performance CMOS 8-bit microcomputer with 8Kbytes of Flash Programmable and Erasable Read Only Memory (PEROM). The device is manufactured using Atmels high density nonvolatile memory Technology. The on-chip Flash allows the program memory to be reprogrammed insystem or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications. The AT89S51 provides the following standard features: 8Kbytes of Flash, 256 bytes of RAM, 32 I/O lines, three 16-bit timer/counters, five vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset.

29
SSGPURC,Hoshiarpur

SCROLL PAD

Onboard Pin Connections Scroll Pad

30
SSGPURC,Hoshiarpur

SCROLL PAD

31
SSGPURC,Hoshiarpur

SCROLL PAD

32
SSGPURC,Hoshiarpur

SCROLL PAD

Circuit Diagram of SROLL PAD

Figure xxvii: Scroll Pad 33


SSGPURC,Hoshiarpur

SCROLL PAD

Construction Procedure of APSPS Step 1: Circuit diagram of the proposed system is designed and finalized Step 2: All the components and software platform to be used are selected which are also mentioned above. Step 3: The scroll pads pattern is designed and then developed on the copper clad PCB. Step 4: All the hardware components are soldered on PCB with the help of soldering ion, solder and flux. Step 5: Code/program of the proposed system is developed using assembly language with the help of software platform (Keil u vision3).The coding could be seen in section. Step 6: The hex code of the program being created by the software platform is burnt into the flash code memory of our microcontroller IC AT89C52. Step 7: Testing is done at various levels to finalize the appropriate program for the most proper working of the system.

34
SSGPURC,Hoshiarpur

SCROLL PAD

Program

Scroll Pad
; p0 =====> SCROLL PAD, is a matrix of 8 touch sensors to sense scrolling

; on 16 different lines. Each line is sensed by a set of 2 particular sensors. ; p2.0 =====> TRANSFER, is a touch sensor for transferring data from scroll

; pad's LCD to a distant LCD through RF communication. ; p2.1 =====> DISPLAY, is a touch sensor for comparing the lines being

; scrolled upon with the previously stored set of lines (representing different ; characters). And then displaying the corresponding character on scroll pad's LCD. ; p2.2 =====> LED, it glows after a line is being scrolled upon, while touching

; DISPLAY, TRANSFER and while transferring the data to a distant LCD. ; p2.3 =====> ; p2.4 =====> ; p2.5 =====> ; p1 =====> E (scroll pad's LCD) R/W (scroll pad's LCD) RS (scroll pad's LCD) Data Lines (scroll pad's LCD) 35
SSGPURC,Hoshiarpur

SCROLL PAD

;-------------------------------------------------------------------------------------------------------;-----------------------------------------------------------------------------------------------------$include(mod51) org mov lcall main: ; mov ; mov ; r2, #0 30h, #0 mov 0000h p0, r1, #0ffh #31h ; For p0 as an i/p port. ; Initial RAM address where the lines being scrolled upon will be stored. ; Initialised to zero for comparison purposes. ; Counter for counting the lines being scrolled upon. LCD_init

again: ;

mov mov cjne

dptr, a, a, p2.1, p2.0, again p2.2 delay2 p2.1, label p2.2

#lines p0 #0ffh, label

; Dptr pointing the lines stored in ROM for comparison. ; Getting a byte from the scroll pad. line_match ; Checking for any touch on scroll pad.

; jnb jnb sjmp label: ; lcall jb sjmp label1: setb label1 clr

; Checking for a touch on DISPLAY.

transfer; Checking for a touch on TRANSFER. ; LED is switched on, representing DISPLAY has been touched. ; Checking if DISPLAY is released. ; LED is switched off, representing 36
SSGPURC,Hoshiarpur

SCROLL PAD

; mov cjne ; sjmp label2: ; sjmp transfer: ; lcall jb sjmp transfer1: mov cjne ; setb sjmp transfer2: ; ; mov ; mov inc trsfr1: mov mov mov r3, r3 r4, a, r0, #4 r6 a 37 a a, r7 mov p2.2 again r6, #41h delay2 p2.0, transfer a, a, r7 #0, transfer1 clr ch_mtch_dsp p2.2 mov again dptr, #characters a, a, r2 #0,

DISPLAY has been released. label2 ; Checking the counter, if lines are stored in RAM. ; Dptr ponting sets of lines (representing characters) stored in ROM. ; LED is switched on, representing TRANSFER has been touched. ; Checking if TRANSFER is released.

transfer2

; Checking the cursor's counter, if any character ; is displayed on LCD.

; Initial RAM address where the characters displayed (to be transferred) are be stored. ; Counter representing the number of characters have been displayed.

SSGPURC,Hoshiarpur

SCROLL PAD

mov trsfr: ; rrc mov clr lcall setb lcall djnz inc djnz setb sjmp line_match: again1: mov mov mov cjne ; sjmp match1: clr subb cjne ; ; clr ; rrc mov

a, a p3.7, a p3.6, p3.5 delay1 p3.5 delay1 r4, r6 r3, p2.2 main r3, r4, a, a, again c a, a,

@r0 c ; Character is being transferred with 2 bits at a time, starting from LSB. c

trsfr trsfr1

a #0 r4 @a+dptr #0,

; Storing the received byte. ; Counter for line matching.

movc a,

match1

; Checking for null character.

r3 #0, next_line ; Checking whether the line is matched.

p2.2

; LED is switched on, representing a line has been scrolled upon. 38


SSGPURC,Hoshiarpur

SCROLL PAD

acall setb mov mov mov mov mov mov cjne mov mov inc inc ljmp line_check: mov dec clr subb cjne ; ; ; ljmp line_save: djnz mov mov inc inc ljmp next_line: inc

delay1 p2.2 a, r3, a, r0, a, r4, a, a, @r1, r1 r2 again a, r0 c a, a, @r0 #0, line_save ; Checking if the line is stored earlier. Save it if not saved earlier otherwise jump to again. again r4, a, @r1, r1 r2 again r4 39
SSGPURC,Hoshiarpur

; LED is switched off. r4 a r1 a r2 a #0, r3 a ; One line has been stored in RAM. ; Next RAM location. ; Incrementing the counter. r3 ; Copying counter's value. line_check ; Copying RAM address. ; Storing the matched line.

line_check r3 a ; Line has been stored in RAM. ; Next RAM location. ; Incrementing the counter. ; Repeat process.

SCROLL PAD

sjmp

again1

;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ch_mtch_dsp: clr mov mov mov clr subb cjne ; mov again2: mov mov dec mov mov again3: mov cjne mov cjne ; mov cjne a, a, r7 #0, 40
SSGPURC,Hoshiarpur

a @a+dptr a #1 @a+dptr a r2 #0, #2 r1 a r2 a r6 @a+dptr #0, r3 #'/', display ; '/' is for deleting the character. first_line ; Jump to main if the match2 ; Checking for null char. ; Storing RAM counter. ; Storing RAM address. below5 ; Checking whether the counter is equal to that in r1. r6, a, r0, r0 a, r5, a, a, a, a, ; For first line of the stored character. ; Storing ROM counter. ; Storing character. r3, a, r4, c a, a,

movc a,

movc a,

movc a,

SCROLL PAD

; ljmp below5: first_line: ; ; mov acall acall sjmp del_char1: mov acall acall del_char2: mov setb clr setb acall clr mov acall acall dec dec stay: mov cjne jnb jnb sjmp ; 41 a, delay del_char2 a, delay p1, p2.5 p2.4 p2.3 delay p2.3 a, delay r7 40h a, a, p2.1, p2.0, stay p0 #0ffh, below2 below3 below1 #10h command #' ' #10h #8fh command sjmp cjne main next_char a, #16, del_char1

cursor is at initial position.

; Jump to last position of 1st line if the cursor is at 1st position of 2nd line.

; For deleting the character.

command

; Stay here untill DISPLAY is touched or any line is scrolled upon.


SSGPURC,Hoshiarpur

SCROLL PAD

below1: below2: below3: display:

ljmp ljmp ljmp mov cjne mov acall acall

main label transfer a, a, a, delay a, #32, display2 ; Initialise the LCD if the 16th position of 2nd line has been written. r7 #16, #0c0h display1 ; Forcing the cursor to 1st position of 2nd line.

command

display1: ; ;

cjne

lcall display2: mov setb clr setb acall clr inc mov mov mov inc sjmp match2: clr subb cjne ; ; inc

LCD_init p1, p2.5 p2.4 p2.3 delay p2.3 r7 r0, a, @r0, 40h stay c a, a, @r0 #0, next ; Checking if the lines of the character in ROM matches with the lines stored in RAM. r6 42
SSGPURC,Hoshiarpur

r3

; Displaying the char.

40h r3 a

; Incrementing for next line in ROM.

SCROLL PAD

ljmp next: ; next_char: mov add mov incr: ; djnz clr cjne ; ljmp below4: LCD_init: ; ; mov ; mov mov acall acall mov acall acall mov acall ljmp mov inc dec djnz

again2 r0 r5, a, a, r4, dptr r4, a @a+dptr #'!', below4 ; Checking for an invalid set of scrolled lines. main ch_mtch_dsp r7, #0 ; Counter for LCD's cursor position or for counting the number of characters that have been displayed. 40h, 41h, a, delay a, delay a, #01h command 43
SSGPURC,Hoshiarpur

again3 r4 #3 a

; Decrementing r4 & r5 for previous line stored in RAM.

; Incrementing dptr for next character stored in ROM. incr

movc a, a,

#42h #'!' #38h

; Initial RAM address for storing the characters to be transferred. ; For comparison purpose. ; LCD's initialisation.

command #0eh

command

SCROLL PAD

acall mov acall acall mov acall acall ret command: mov clr clr setb acall clr ret delay: here2: here1: mov mov djnz djnz ret

delay a, delay a, delay p1, p2.5 p2.4 p2.3 delay p2.3 r0, r4, r4, r0, #10 #255 here1 here2 a #80h command #06h command

delay1: here4: here3:

mov mov djnz djnz ret

r0, r5, r5, r0, r0, r3, r4,

#255 #255 here3 here4 #2 #255 #255 44


SSGPURC,Hoshiarpur

delay2: here7: here6:

mov mov mov

SCROLL PAD

here5:

djnz djnz djnz ret

r4, r3, r0,

here5 here6 here7

;--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

org lines: db characters: db db db db db db db db db db db db db db db db db db

0300h 'A',8,1,2,3,4,7,8,12,16,0 'B',10,1,2,3,4,5,6,7,8,12,16,0 'C',6,1,2,5,6,7,8,0 'D',7,3,4,5,6,7,12,16,0 'E',8,1,2,5,6,7,8,12,16,0 'F',6,1,2,7,8,12,16,0 'G',8,1,2,4,5,6,7,8,12,0 'H',6,3,4,7,8,12,16,0 'I',6,1,2,5,6,10,14,0 'J',6,1,2,6,7,10,14,0 'K',4,10,11,13,14,0 'L',4,5,6,7,8,0 'M',6,3,4,7,8,9,11,0 'N',6,3,4,7,8,9,13,0 'O',8,1,2,3,4,5,6,7,8,0 'P',7,1,2,3,7,8,12,16,0 'Q',9,1,2,3,4,5,6,7,8,13,0 'R',8,1,2,3,7,8,12,13,16,0 45
SSGPURC,Hoshiarpur

0ffh,0fah,0f6h,0edh,0f9h,0ddh,0f5h,0beh,7eh,7bh,0f3h,0e7h,0ebh,0dbh,0d7h,0b7h,3fh,0

SCROLL PAD

db db db db db db db db db db db db db db db db db db db db db db db db db space: delete: invalid:db db db '!' END

'S',8,1,2,4,5,6,8,12,16,0 'T',4,1,2,10,14,0 'U',6,3,4,5,6,7,8,0 'V',2,9,11,0 'W',6,3,4,7,8,13,15,0 'X',4,9,11,13,15,0 'Y',3,9,11,14,0 'Z',6,1,2,5,6,11,15,0 '0',6,2,3,4,5,10,14,0 '1',2,10,14,0 '2',8,1,2,3,5,6,7,12,16,0 '3',8,1,2,3,4,5,6,12,16,0 '4',5,3,4,8,12,16,0 '5',5,2,4,5,10,12,0 '6',9,1,2,4,5,6,7,8,12,16,0 '7',4,1,2,11,15,0 '8',7,2,3,4,5,10,12,14,0 '9',7,1,2,3,4,8,12,16,0 '$',10,1,2,4,5,6,8,10,12,14,16,0 '*',8,9,10,11,12,13,14,15,16,0 '+',4,10,12,14,16,0 '-',2,12,16,0 '<',2,11,13,0 '=',4,1,2,12,16,0 '>',2,9,15,0 ' ',2,5,6,0 '/',2,11,15,0

46
SSGPURC,Hoshiarpur

SCROLL PAD

V. References
Books referred: 1) The 8051 Microcontroller and Embedded Systems Using Assembly and C By Muhammad Ali Mazidi, Janice Gillispie Mazidi & Ro lin D. McKinlay Websites referred: 1) Atmel Corp. Makers of the AVR microcontroller www.atmel.com 2) One of the best sites AVR site www.avrfreaks.net 3) One of the best sites for Microcontroller projects 47
SSGPURC,Hoshiarpur

SCROLL PAD

www.kmitl.ac.th 4) Keil, the developer of Keilvision www.keil.com

48
SSGPURC,Hoshiarpur

Das könnte Ihnen auch gefallen