I understand, what I want is to be able to modify the value to count by means of a keyboard 4x4 and a lcd for not having to reprogram every time that the wants to modify the I number from maximum pulses to count.
For example: to show in a lcd
Push buttom RB0 to increase the value to count
Push buttom RB1 to diminish the value to count
Push buttom RB3 enter to record the value
Somebody can help me.
Thanks
code
TRISB=%00001111 ' Set RB0 to input, others to output
OPTION_REG.7=0 ' Enable internal pull-up on PORTB
LED VAR PORTB.7 ' connected between RB7 and GND via resistor
LED1 VAR PORTB.6
BOT VAR PORTB.1
ClkIn var PORTB.0 ' connected between RB0 and GND
Apulse VAR BYTE ' store the amount of pulse
Apulse1 var byte
data @0,0,0
read 0,apulse
read 1,apulse1
led = 0
led1= 0
paso1:
repeat
if clkin=0 then
while clkin=0 : wend
pause 100
apulse=apulse+1
write 0,apulse
endif
if BOT=0 then
while BOT=0 : wend
pause 100
apulse1=apulse1+1
write 1,apulse1
endif
until (apulse=7) or (Apulse1=5)
if apulse=7 then
led=1
else
led1=1
endif
goto paso1
Bookmarks