This program to count the people in a lab ( max 9 people ). it has 2 sensors one for increment and the other for decrement.
The problem now is when it reach 9 and the increment sensor work it still count and when it reach 0 and the decrement sensor work it count also showing symbols.
I want to make it when it reach 9 and the sensor work it ignore it and still show 9
and the same with the 0
Rich (BB code):
include<p16f628a.inc>
CBLOCK H'20'
COUNT1
COUNT2
COUNT3
LCD_POINTER
LAB_COUNT
endc
#define LCD_RS PORTA,0
#define LCD_RW PORTA,1
#define LCD_E PORTA,2
#define IN_ PORTA,3
#define OUT_ PORTA,4
clrf PORTA
clrf PORTB
clrf COUNT1
clrf LAB_COUNT
movlw H'07'
movwf CMCON
bsf STATUS,RP0
movlw b'11111000'
movwf TRISA
movlw b'00000000'
movwf TRISB
bcf STATUS,RP0
call Delay_L
movlw b'00001100'
call Send_CMD
movlw b'00111000'
call Send_CMD
call Text1
call Disp_C
Start
btfsc IN_
goto INC_LAB
btfsc OUT_
goto DEC_LAB
goto Start
INC_LAB
incf LAB_COUNT,f
call Disp_C
goto Start
DEC_LAB
decf LAB_COUNT,f
call Disp_C
goto Start
Disp_C movlw b'10000100'
call Send_CMD
call Delay_L
movf LAB_COUNT,w
iorlw H'30'
call Send_CHR
return
Text1
clrf LCD_POINTER
Text1L movf LCD_POINTER,w
call TextM1
call Send_CHR
incf LCD_POINTER,w
xorlw d'4'
btfsc STATUS,Z
return
incf LCD_POINTER,f
goto Text1L
Puls_E
bsf LCD_E
nop
bcf LCD_E
return
Send_CMD
bcf LCD_RS
bcf LCD_RW
movwf PORTB
call Puls_E
call Delay_S
return
Send_CHR
bsf LCD_RS
bcf LCD_RW
movwf PORTB
call Puls_E
call Delay_S
return
Delay_S
Loop1 deCfsz COUNT1,f
goto Loop1
return
Delay_L
Loop2 call Delay_S
deCfsz COUNT2,f
goto Loop2
return
TextM1
addwf PCL,f
dt "LAB:",0
end
The problem now is when it reach 9 and the increment sensor work it still count and when it reach 0 and the decrement sensor work it count also showing symbols.
I want to make it when it reach 9 and the sensor work it ignore it and still show 9
and the same with the 0
Last edited by a moderator: