electrofriends.com  

...bringing innovative minds together       | HOME | ABOUT US | ARTICLES | SOURCE CODES | PROJECTS | EBOOKS |  FEEDBACK |  

DIGITAL IC TESTER

Software program for master IC 

          setb p2.7

          mov r0,#30h

          mov p1,#0ffh

          mov r7,#01

start:  mov p0,#0                  ;Clear first digit

wait:  setb p1.3                    ;Keyboard interfacing

          setb p1.4                   ;Enable all rows

          setb p1.5

          setb p1.6

          jb p1.0,key                 ;Check whether key is pressed

          jb p1.1,key

          jb p1.2,key

          jmp wait                    ;If not, check again

 

key:   mov r2,#0a0h

d:       djnz r2,d               

          mov r1,#01                 ;Pressed digit

          mov r2,#01

nextrow:cjne r2,#01,nextr1

          setb p1.6                     ;Enable first row

          clr p1.5                       ;Disable other rows

          clr p1.4

          clr p1.3

          jmp over

nextr1: cjne r2,#02,nextr2

       setb p1.5                     ;Enable second row

       clr p1.6                       ;Disable other rows

       clr p1.4

       clr p1.3

       jmp over

nextr2: cjne r2,#03,nextr3

        setb p1.4                  ;Enable third row

        clr p1.5                    ;Disable other rows

        clr p1.6

        clr p1.3

        jmp over

nextr3:  setb p1.3

        clr p1.5                   ;Enable fourth row

        clr p1.4                   ;Disable other rows

        clr p1.6         

  over:  jb p1.0,col1            ;If key is pressed in particular row, check

        jb p1.1,col2            ; for corresponding column

        jb p1.2,col3

        mov a,#03

        add a,r1

        mov r1,a

        inc r2

        jmp nextrow

 

 col1:  jnb p1.0,over

          jmp done

 col2:  jnb p1.1,over

         inc r1

         jmp done

col3:  jnb p1.2,over

        mov a,#02

        add a,r1

        mov r1,a

 done:  mov a,r1

          cjne a,#0bh,enter

          mov r1,#0

          jmp down

enter: mov a,r1

          cjne a,#0ch,down

          jmp out

down: mov @r0,r1

          inc r0

          mov a,#01

          xrl a,r7

          jz noshift

          clr p3.4

          mov r2,#0ffh

here: djnz r2,here

           setb p3.4

       

noshift: mov r7,#00

            mov p0,r1

wait1: jb p1.0,wait1

           jb p1.1,wait1

           jb p1.2,wait1

           mov r2,#0ffh

delay2: djnz r2,delay2

wait2:  jmp wait

 

out:   cjne a,#0ch,wait2

          clr p2.4

          mov r2,#0ffh

here1: djnz r2,here1

          setb p2.4

          mov a,#0

          mov p0,a

out1:  jb p1.0,out1

          jb p1.1,out1

          jb p1.2,out1

          mov a,r0

          subb a,#02

          mov r0,a

          mov a,@r0

          swap a

          mov r5,a

          inc r0

          mov a,@r0

          add a,r5

          mov r5,a

          cjne r5,#0,nor

          mov a,#1

          jmp x

nor:   cjne r5,#02,and

         mov a,#2

         jmp x

and:  cjne r5,#08,or

        mov a,#3

        jmp x

or:   cjne r5,#32h,xor

        mov a,#4

        jmp x

xor: cjne r5,#86h,else

        mov a,#5

        jmp x

else: mov a,#0fh

x:    mov p2,#00

        jnb a.0,nextb1

        setb p2.0

 

nextb1: jnb a.1,nextb2

             setb p2.1

nextb2: jnb a.2,nextb3

             setb p2.2

nextb3: jnb a.3,ove

             setb p2.3

ove:      clr p2.7

 

end:    jmp end

| Previous page | Next page |

Other Microcontroller projects and articles

 Automatic Railway Gate Control

 Car parking system using 8051 Microcontroller

 Interfacing an LCD to the 8051 Microcontroller

 8051 microcontroller Instruction Set

 8051 Microcontroller port programming

 Programmable number lock system

 Water level indicator cum controller

 Robotic car

 Intelligent Train Engines

 DC Motor Controlling System using PIC

 For more projects click here

 

 

 | HOME | ABOUT US | ARTICLES |  SOURCE CODES | PROJECTS |  SITEMAP |  EBOOKS | FEEDBACK |   



  Copyrights © 2005-2007 electrofriends.com, All rights reserved. webmaster@electrofriends.com