WHILE 1 = 1
WHILE Keypressed = 0 'print key and exit when key pressed
Keypressed = Keypad16.Value
IF Keypressed <> 0 THEN
IF Keypressed = 16 THEN 'Keypressed = double zero
Total = Total + 50 //50 added here for 00 //<----you can see here that 50 is added to the total when key 16 is pressed.
//WriteAt(1,1,"key pressed =",DecToStr(Keypressed,2)) // double0 = 50 <----- MrDEB's original line
WriteAt(1,1,"Double Zero!!")) // <--- no need to set a variable = 50 and print the string of it.
// Above line writes the key pressed to the first line of the LCD
WriteAt(2,1,"total=",DecToStr(Total,2)) // <---- MrDEB did not include this line, so the total when 00 is pressed is not updated
ELSE
Total = Total + Keypressed
WriteAt(1,1,"key pressed =",DecToStr(Keypressed,2)) // <----- MrDEB did not include this line, so keypressed is never updated if not 16.
WriteAt(2,1,"total=",DecToStr(Total,2)) // <---- 'this line only updates the second line of the LCD
END IF
delayms(500) // <---- added to address key bounce
END IF
WEND
DELAYMS(100)
WHILE Keypressed <> 0 'loop until key not pressed
Keypressed = Keypad16.Value
WEND
WEND