Hello dear reader
I want to measure the time between revolution wheel.I use UGN3113(Hall Sensor Effect)
I try to write code
IS my code works propper?
...
symbol hall_sensor=portb.1
define OSC 12
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTD
'DEFINE LCD_EBIT 2
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
overflow var byte
time var byte
pause 200
trisb=%00011110
t1con=%0011001
pir1.0=0
pie1=%00000001
on interrupt goto ISR
intcon=%11000000
main:
LCDOUT $FE,1
LCDOUT "Overflow:",#overflow
time=(17*overflow)/100
LCDOUT $FE,$C0
LCDOUT "time:",#time
pause 100
goto main
ISR:
if hall_sensor=0 then
overflow=overflow+1
else
overflow=0
endif
pir1.0=0
resume
enable
end
Can you help and guide me for making it correct and better.I used an LCD for checking my code.But LCD only shows below things:
Overflow:255
time:43
Iam waiting for your helpful reply
Bookmarks