|
over:cjne a,#1,next2
;NAND
call gateic
mov a,r3
rl a
mov r2,#07h
xrl a,r2
jnz checkg12
setb p1.2
checkg12: mov a,r4
rl a
mov r2,#07h
xrl a,r2
jnz checkg13
setb p1.3
checkg13: mov a,r5
rl a
mov r2,#07h
xrl a,r2
jnz checkg14
setb p1.4
checkg14: mov a,r5
rl a
mov r2,#07h
xrl a,r2
jnz end2
setb p1.5
jmp end2
next2: cjne
a,#2,next3 ;NOR
call gateic
mov a,r3
rl a
mov r2,#01h
xrl a,r2
jnz checkg22
setb p1.2
checkg22: mov a,r4
rl a
mov r2,#01h
xrl a,r2
jnz checkg23
setb p1.3
checkg23: mov a,r5
rl a
mov r2,#01h
xrl a,r2
jnz checkg24
setb p1.4
checkg24: mov a,r5
rl a
mov r2,#01h
xrl a,r2
jnz end1
setb p1.5
end2: jmp end1
next3: cjne
a,#3,next4 ;AND
call gateic
mov a,r3
rl a
mov r2,#08h
xrl a,r2
jnz checkg32
setb p1.2
checkg32: mov a,r4
rl a
mov r2,#08h
xrl a,r2
jnz checkg33
setb p1.3
checkg33: mov a,r5
rl a
mov r2,#08h
xrl a,r2
jnz checkg34
setb p1.4
checkg34: mov a,r5
rl a
mov r2,#08h
xrl a,r2
jnz end1
setb p1.5
jmp end1
next4: cjne
a,#4,next5 ;OR
call gateic
mov a,r3
rl a
mov r2,#0Eh
xrl a,r2
jnz checkg2
setb p1.2
checkg2: mov a,r4
rl a
mov r2,#0Eh
xrl a,r2
jnz checkg3
setb p1.3
checkg3: mov a,r5
rl a
mov r2,#0Eh
xrl a,r2
jnz checkg4
setb p1.4
checkg4: mov a,r5
rl a
mov r2,#0Eh
xrl a,r2
jnz end3
setb p1.5
end1: jmp end3
next5: cjne a,#5,end2
;XOR
call gateic
mov a,r3
rl a
mov r2,#06h
xrl a,r2
jnz checkg52
setb p1.2
checkg52: mov a,r4
rl a
mov r2,#06h
xrl a,r2
jnz checkg53
setb p1.3
checkg53: mov a,r5
rl a
mov r2,#06h
xrl a,r2
jnz checkg54
setb p1.4
checkg54: mov a,r5
rl a
mov r2,#06h
xrl a,r2
jnz end
setb p1.5
end3: jmp end
gateic: mov r0,#25h
mov a,#24h
mov @r0,a
inc r0
mov a,#2Dh
mov @r0,a
inc r0
mov a,#36h
mov @r0,a
inc r0
mov a,#3Fh
mov @r0,a
mov r1,#30h
mov a,#92h
mov @r1,a
inc r1
mov a,#B6h
mov @r1,a
inc r1
mov a,#DAh
mov @r1,a
inc r1
mov a,#FEh
mov @r1,a
mov r0,#25h
mov r1,#30h
mov r3,#0
mov r4,#0
mov r5,#0
mov r6,#0
mov r7,#4
nextcnd:mov a,@r0
inc r0
mov p0,a
mov a,r3
jnb p0.2,g2
setb a.3
g2: rr a
mov r3,a
mov a,r4
jnb p0.5,g3
setb a.3
g3: rr a
mov r4,a
mov a,@r1
inc r1
mov p2,a
mov a,r5
jnb p2.1,g4
setb a.3
g4: rr a
mov r5,a
mov a,r6
jnb p2.4,overcnd
setb a.3
overcnd:rr a
mov r6,a
djnz r7,nextcnd
ret
end: clr p3.6
stop: jmp stop
This program is assembled using DASM assembler and the
hex file is downloaded to the 8951 microcontroller.
For queries on the above please contact
ranjith@electrofriends.com
|
Previous 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
|