Saturday, January 30, 2016

Penyalaan seven segment 3 switch



org         0h
                                jmp        HENKY

henky:                  mov       dptr,#angka
                                mov       r5,#10
loop:                     
                                jb            p1.0,hyun
                                CLR         A
                                movc     a,@A+DPTR
                                mov       p2,a
                                mov       p0,#0c0h
                                acall       delay
                                inc          dptr
                                djnz       r5,loop
                                sjmp      HENKY
angka:                   db           0c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h
hyun:                    mov       dptr,#angka1
                                mov       r5,#10
loop1:                  
                                jb            p1.1,HAO
                                CLR         A
                                movc     a,@A+DPTR
                                mov       p2,a
                                mov       p0,#0c0h
                                acall       delay
                                inc          dptr
                                djnz       r5,loop1
                                sjmp      HYUN
angka1:                                db           90h,80h,0f8h,82h,92h,99h,0b0h,0a4h,0f9h,0c0h
hao:
                                JB            P1.2,XX
                                mov       p0,#0c0h
                                acall       delay
                                mov       p2,#0c0h
                                acall       delay
                                sjmp      HAO
XX:                         SJMP     HENKY
delay:                    mov       r0,#200
delay1:                 mov       r1,#255
delay2:                 djnz       r1,delay2
                                djnz       r0,delay1
                                ret
                                end
                               

No comments:

Post a Comment