Tutorial Microcontroller 8051
 
 
 
 
 
   

BACK NEXT

2.4.4. Moving Character on LCD
This lesson is learn how to make you word on LCD moving arround, actualy it's just a simple case, by executing sift right or left instruction. see table cursor of display sift

Step 1st
Build the circuit as shown in figure 2.11. As you seen on figure 2.11. P0.0 trough P0.7 is connected to DB0 - DB7,and P2.0- P2.1. is connected to RS and EN each. Remember, that all we want to do with this lesson is write " Hello World ", in the first line of LCD Character

Step 2nd
In this step, you must tipe the assembly program to make your LCD Character shown the word, we assume that you have already known the editor, we used MIDE-51 to edit the program. ( Download File asm : exp244.zip , Download Complete Circuit File : LCDCharacter.PDF ))

       org 0h
       call init_LCD
start: call write_char; writing a word ;
mov R2,#10 ; number data tobe sift siftR: call sift2right djnz R2,siftR ; counting down number data ; mov R2,#10
siftL: call sift2right
djnz R2,siftR
sjmp start ; write_char:
mov dptr,#word1 ;DPTR = [ address word1 ]
mov r3,#16 ;R3=16,number character to be display
mov r1,#80h ;R1=80h,address DDRAM start position
acall write_inst
; write1:clr a ; A = 0
movc a,@a+dptr ; A = [A+ DPTR]
mov r1,A ; R1 = A
inc dptr ; DPTR = DPTR +1
acall write_data; djnz r3,write1 ; R3 = R3-1,
ret
; Init_lcd: mov r1,#00000001b ;Display clear acall write_inst ; mov r1,#00111000b ;Function set, ;Data 8 bit,2 line font 5x7 acall write_inst ; mov r1,#00001100b ;Display on,
;cursor off,cursor blink off acall write_inst mov r1,#00000110b ;Entry mode, Set increment acall write_inst ret
;
Write_inst:
clr P2.0 ; RS = P2.0 = 0, write mode instruction
mov P0,R1 ; D7 s/d D0 = P0 = R1
setb P2.1 ; EN = 1 = P2.1
call delay; call delay time
clr P2.1 ; EN = 0 = P2.1
ret ; Write_data:
setb P2.0 ; RS = P2.0 = 1, write mode data
mov P0,R1 ; D7 s/d D0 = P0 = R1
setb P2.1 ; EN = 1 = P2.1
call delay; call delay time
clr p2.1 ; EN = 0 = P2.1
ret ; sift2left:
mov R1,#00011011b ;R1 = sift2left
call write_inst
call ldelay
ret
; sift2Right:
mov R1,#00011111b ;R1 = sift2right
call write_inst
call ldelay
ret ; delay: mov R0,#0
delay1:mov R7,#0fh
djnz R7,$
djnz R0,delay1
ret ; Ldelay:mov R6,#030h
Ld1: call delay
djnz R6,Ld1
ret ; word1: DB ' Welcome Home '; here is the data to be look up
; end
Best Link

 

BACK NEXT

 

Lesson 1:
T o o l
1.1. Programmer
1.2.
Edsim 51
1.3. MIDE-51
1.4. ATMEL ISP

Lesson 2:
Input Output
2.1.LED
2.2.Swicht
2.3.7 Segmen
2.4.LCD Character
2.5.ADC
2.6.DAC
2.7.Motor Stepper
2.8.Keypad

Lesson 3:

Timer Counter

3.1.Basic
3.2.Mode 0
3.3.Mode 1
3.4.Mode 2
3.5.Mode 3

Lesson 4:

Serial Comm.

4.1.Basic
4.2.LED
4.3.Rotate LED
4.2 ADC
4.3.LCD

Lesson 5:
Interuption

5.1.Basic
5.2.Timer
5.2.External