Parts Needed:
- Switch
- 16x2 lcd
- 8051 microcontroller
- Buzzer
1.Switch:
2.16*2 LCD:
3.8051 microcontoller:
4.Buzzer:
HOW ITS WORKS:
This machine records the number of times a each key is pressed. It can count upto 100 digits. Once the button Total is pressed, this machine will display the results through LCD.
CIRCUIT DIAGRAM:
CODE:
org 0x00
mov r7,#38h
call command
mov r7,#0eh
call command
mov r7,#06h
call command
jmp loop
start:
mov a,#00h
mov 50h,a
mov 52h,a
mov r0,#3h
mov r7,#01h
call command
mov r7,#'W'
call data
mov r7,#'E'
call data
mov r7,#'L'
call data
mov r7,#'C'
call data
mov r7,#'O'
call data
mov r7,#'M'
call data
mov r7,#'E'
call data
jmp loop
loop:
jnb p1.0,start
jnb p1.1,poll1
jnb p1.2,poll2
jnb p1.3,total
jmp loop
poll1:
inc 50h
clr p0.0
call delay
call delay
call delay
call delay
setb p0.0
mov r7,#01h
call command
mov r7,#'N'
call data
mov r7,#'E'
call data
mov r7,#'X'
call data
mov r7,#'T'
call data
call delay
jmp loop
poll2:
inc 52h
clr p0.0
call delay
call delay
call delay
setb p0.0
mov r7,#01h
call command
mov r7,#'N'
call data
mov r7,#'E'
call data
mov r7,#'X'
call data
mov r7,#'T'
call data
call delay
jmp loop
total:
mov a,50h
mov b,#10
div ab
orl a,#30h
mov r4,a
mov a,b
orl a,#30h
mov r3,a
mov r7,#01h
call command
mov r7,#'c'
call data
mov r7,#'1'
call data
mov r7,#':'
call data
mov a,r3
mov r7,a
call data
mov r7,#' '
call data
mov r7,#' '
call data
mov r7,#'c'
call data
mov r7,#'2'
call data
mov r7,#':'
call data
mov a,52h
mov b,#10
div ab
orl a,#30h
mov r4,a
mov a,b
orl a,#30h
mov r3,a
call delay
call delay
call delay
call delay
djnz r0,total
jmp loop
command:clr p3.6
mov p2,r7
setb p3.7
call delay
clr p3.7
ret
data:setb p3.6
mov p2,r7
setb p3.7
call delay
clr p3.7
ret
delay:mov r1,#255
loop2:mov r5,#255
loop1:djnz r5,loop1
djnz r1,loop2
ret
end
HEX CODE:
:100000007F381201127F0E1201127F0612011202B6
:020010000045A9
:100012007400F550F55278037F011201127F5712D6
:02002200011EBD
:100024007F4512011E7F4C12011E7F4312011E7F69
:010034004F7C
:1000350012011E7F4D12011E7F4512011E02004551
:100045003090CA30910930923730936202004505ED
:01005500505A
:10005600C28012012A12012A12012A12012AD28012
:100066007F011201127F4E12011E7F4512011E7F73
:010076005831
:1000770012011E7F5412011E12012A020045055269
:10008700C28012012A12012A12012AD2807F01128C
:02009700011254
:100099007F4E12011E7F4512011E7F5812011E7FDD
:0100A9005402
:1000AA0012011E12012A020045E55075F00A844425
:0100BA003015
:1000BB00FCE5F04430FB7F011201127F6312011E3D
:1000CB007F3112011E7F3A12011EEBFF12011E7FC0
:0100DB002004
:1000DC0012011E7F2012011E7F6312011E7F32123D
:0200EC00011EF3
:1000EE007F3A12011EE55275F00A844430FCE5F0A9
:1000FE004430FB12012A12012A12012A12012AD8B7
:01010E00A44C
:10010F00020045C2B68FA0D2B712012AC2B722D2BF
:01011F00B629
:100120008FA0D2B712012AC2B72279FF7DFFDDFE70
:03013000D9FA22D7
:00000001FF
Output Image:
No comments:
Post a Comment