Senin, 29 September 2008

Moving Display


In this lesson, we are going to drive 8 x7 segmen, in this way you can write eight character on multi 7 segmen. We used a multiplexing methode to transfer data for driver transistor consequtively.

Step 1st
Build the circuit as shown in figure 2.3.5. As you seen on figure 2.3.5. P2.0 trough P2.7 is connected to driver transistor, and all eight 7 segment is connected to P0.0 trough P0.6 parallelly. Remember, that all we want to do with this lesson is to write ( k-O-n-P-U-t-E-r ) to 1st, 2nd, 3rd, 4th, 5th, 6th, 7th and 8th 7 segmen each sifting the word to the left.

Step 2nd
In this step, you must tipe the assembly program to make your 7 segmen shown some number on 7 segmen, we assume that you have already known the editor, we used RIDE-51 to edit the program.

       org 0h
Begin: mov r1,#150
start1: mov dptr,#word1
mov r5,#8
mov r2,#01111111b
again1: clr A
movc A,@A+dptr
inc dptr
mov p2,A
mov A,r2
mov p3,A
rr A
mov r2,A
acall delay
mov p2,#11111111b
djnz r5,again1
djnz r1,start1
mov r1,#150
start2: mov dptr,#word2
mov r5,#8
mov r2,#01111111b
again2: clr A
movc A,@A+dptr
inc dptr
mov p2,A
mov A,r2
mov p3,A
rr A
mov r2,A
acall delay
mov p2,#11111111b
djnz r5,again2
djnz r1,start2
mov r1,#150
start3: mov dptr,#word3
mov r5,#8
mov r2,#01111111b
again3: clr A
movc A,@A+dptr
inc dptr
mov p2,A
mov A,r2
mov p3,A
rr A
mov r2,A
acall delay
mov p2,#11111111b
djnz r5,again3
djnz r1,start3
mov r1,#150
start4: mov dptr,#word4
mov r5,#8
mov r2,#01111111b
again4: clr A
movc A,@A+dptr
inc dptr
mov p2,A
mov A,r2
mov p3,A
rr A
mov r2,A
acall delay
mov p2,#11111111b
djnz r5,again4
djnz r1,start4
mov r1,#150
start5: mov dptr,#word5
mov r5,#8
mov r2,#01111111b
again5: clr A
movc A,@A+dptr
inc dptr
mov p2,A
mov A,r2
mov p3,A
rr A
mov r2,A
acall delay
mov p2,#11111111b
djnz r5,again5
djnz r1,start5
mov r1,#150
start6: mov dptr,#word6
mov r5,#8
mov r2,#01111111b
again6: clr A
movc A,@A+dptr
inc dptr
mov p2,A
mov A,r2
mov p3,A
rr A
mov r2,A
acall delay
mov p2,#11111111b
djnz r5,again6
djnz r1,start6
mov r1,#150
start7: mov dptr,#word7
mov r5,#8
mov r2,#01111111b
again7: clr A
movc A,@A+dptr
inc dptr
mov p2,A
mov A,r2
mov p3,A
rr A
mov r2,A
acall delay
mov p2,#11111111b
djnz r5,again7
djnz r1,start7
mov r1,#150
start8: mov dptr,#word8
mov r5,#8
mov r2,#01111111b
again8: clr A
movc A,@A+dptr
inc dptr
mov p2,A
mov A,r2
mov p3,A
rr A
mov r2,A
acall delay
mov p2,#11111111b
djnz r5,again8
djnz r1,start8
ljmp begin
;
delay: mov r3,#10
delay1: mov r4,#10
djnz r4,$
djnz r3,delay1
ret
;
word1: db 10001010b,11000000b,11001000b,10001100b
db 11000001b,10000111b,10000110b,11001110b
word2: db 11000000b,11001000b,10001100b,11000001b
db 10000111b,10000110b,11001110b,10001010b
word3: db 11001000b,10001100b,11000001b,10000111b
db 10000110b,11001110b,10001010b,11000000b
word4: db 10001100b,11000001b,10000111b,10000110b
db 11001110b,10001010b,11000000b,11001000b
word5: db 11000001b,10000111b,10000110b,11001110b
db 10001010b,11000000b,11001000b,10001100b
word6: db 10000111b,10000110b,11001110b,10001010b
db 11000000b,11001000b,10001100b,11000001b
word7: db 10000110b,11001110b,10001010b,11000000b
db 11001000b,10001100b,11000001b,10000111b
word8: db 11001110b,10001010b,11000000b,11001000b
db 10001100b,11000001b,10000111b,10000110b
end
end

Step 3rd
Safe your assembly program above, and name it with *.asm (for example) Compile the program that you have been save by using RIDE-51, see the software instruction.

Step 4th
Download your hex file ( *.hex ) into the microcontroller by using Microcontroller Laros ATMEL ISP software, see the instruction.After download this hex file you'll see the action of the 7 segmen( of course if your cable connection and your program are corrected ).

Tidak ada komentar: