DEVICE = 18F4321
CLOCK = 8
CONFIG MCLRE = off
// some LCD options...
#option LCD_DATA = PORTD.4
#option LCD_RS = PORTd.0
#option LCD_EN = PORTd.1
// import LCD library...
INCLUDE "SetDigitalIO.bas"
INCLUDE "IntOSC8.bas"
INCLUDE "LCD.bas"
INCLUDE "utils.bas"
INCLUDE "Convert.bas"
DIM blue AS portB.7
DIM green AS portb.5
DIM button AS portb.4
DIM time AS WORD
DIM start AS portb.0
time = 0
setalldigital
OUTPUT (blue)
OUTPUT (green)
INPUT(start)
cls
DELAYMS(50)
blue =1
green = 1
start = 1
WHILE true
blue = 0
DELAYMS(3000)
blue = 1
green = 0 //go
REPEAT
DELAYuS(time)
INC (time)
UNTIL button = 0
green = 1
'time = time /1000
WriteAt(1,1,"reaction=",DecToStr(time),"ms",4)
DELAYMS(3000)
time = 0 //reset to zero
WriteAt(1,1,"try again=",DecToStr(time),"ms",4)
WEND