hi all
Currently im doing a project for my final year. My project have two infrared sensor. Which i put sensor 1 at entrance and sensor 2 at the exit. I mean like visitor counter. I use atmel 8052 microcontroller (AT89S52) and i program it in assembly language. I program port 2 as sensor input,port 1 is output and port 3 as counter which give 8 bit binary code from P3.0 to P3.7. Im stuck with the counter part only. The others all ok. I want to display from 00 to 99. So,the 8 bit binary will display until 99. I already done with two common anode 7 segment display and two SN74LS47N ic which is BCD to 7 segment decoder. The display will display from 0 to F. In BCD,it just display 0 to 9 right? how do i skip from A to F? I mean,i just want to display 0 to 9 only. I also try using common cathode 7 segment with 74HC4511.The ic is the same with 74LS47. The result is the same. But when the counter reach 10 to 15. It will give blank display for A,B,C,D,E,F and come back to 0. so it will count until 15 too. Suppose after 9 it will display 0 and another one 7 segment will display 1. it will display 10 by using two 7 segment and it will count until 99. Can anyone please help me.. how do i skip A(1010),B (1011),C (1100),D (1101),E (1110), F (1111) and just displaying 0 to 9. Another things is how do i convert from binary to BCD? someone expert in assembly please help me. Sorry for my bad english.
here is my program i wrote in keil μvision assembly.
please help me to convert from binary to bcd.
thanks in advance.
Currently im doing a project for my final year. My project have two infrared sensor. Which i put sensor 1 at entrance and sensor 2 at the exit. I mean like visitor counter. I use atmel 8052 microcontroller (AT89S52) and i program it in assembly language. I program port 2 as sensor input,port 1 is output and port 3 as counter which give 8 bit binary code from P3.0 to P3.7. Im stuck with the counter part only. The others all ok. I want to display from 00 to 99. So,the 8 bit binary will display until 99. I already done with two common anode 7 segment display and two SN74LS47N ic which is BCD to 7 segment decoder. The display will display from 0 to F. In BCD,it just display 0 to 9 right? how do i skip from A to F? I mean,i just want to display 0 to 9 only. I also try using common cathode 7 segment with 74HC4511.The ic is the same with 74LS47. The result is the same. But when the counter reach 10 to 15. It will give blank display for A,B,C,D,E,F and come back to 0. so it will count until 15 too. Suppose after 9 it will display 0 and another one 7 segment will display 1. it will display 10 by using two 7 segment and it will count until 99. Can anyone please help me.. how do i skip A(1010),B (1011),C (1100),D (1101),E (1110), F (1111) and just displaying 0 to 9. Another things is how do i convert from binary to BCD? someone expert in assembly please help me. Sorry for my bad english.
here is my program i wrote in keil μvision assembly.
Rich (BB code):
ORG 0000H
MOV P0,#0H
MOV P1,#0H
MOV P2,#0H
MOV R3,#0H
MAIN: JB P2.0, INCRES
JB P2.1, DECRES
SJMP MAIN
INCRES: INC R3
MOV P3,R3
ACALL DELAY
SJMP MAIN
DECRES: DEC R3
MOV P3,R3
ACALL DELAY
SJMP MAIN
DELAY: MOV R0,#20
LOOP3: MOV R1,#255
LOOP2: MOV R2,#255
LOOP1: DJNZ R2,LOOP1
DJNZ R1,LOOP2
DJNZ R0,LOOP3
RET
END
thanks in advance.