Oh God, here we go...
What's double zero in decimal?
If you divide by double zero do you get double infinity?
I think a double zero counts 50 points against you.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Oh God, here we go...
What's double zero in decimal?
If you divide by double zero do you get double infinity?
Going to locate the switches I have (3p3t) to swap the ICSP to RX/TX without removing any cables etc. Maybe a simple development board using a 40 pin dip ?
USART.Write ("Key pressed = ", decToStr(Keypressed), 13, 10)
keypress1 = Keypressed //sum_total is previous total
DELAYMS(2000)
USART.Write ("sum = ", decToStr(keypress1), 13, 10)
Total = keypress1
Keypressed = 0 // zero out the keypressed
keypress1 = 0
Total = Total +Total
'WriteAt(2,1,"sum Total= ",DecToStr(sum_total,2))//, " Cnt: "))//,DecToStr(Counter,2))
USART.Write ("total = ", decToStr(Total), 13, 10)
DELAYMS(2000)
'total1 = total + keypress1
'USART.Write ("total1 = ", decToStr(total1), 13, 10)
Keypressed = 0
'keypress1=0
'total2= total1 + total
'USART.Write ("total2 = ", decToStr(total2), 13, 10)
END IF
Device = 18f25k22
Clock = 20
Config 'for K-series device
FOSC = HSHP ,'HS oscillator (high power > 16 MHz)
PLLCFG = Off ,'Oscillator used directly
PRICLKEN = Off ,'Primary clock can be disabled by software
FCMEN = Off ,'Fail-Safe Clock Monitor disabled
IESO = Off ,'Oscillator Switchover mode disabled
'PWRTEN = Off ,'Power up timer disabled
PWRTEN = on ,'Power up timer enabled
BOREN = Off ,'Brown-out Reset disabled in hardware and software
'BOREN = on ,'Brown-out Reset enabled
BORV = 285 ,'VBOR set to 2.85 V nominal
WDTEN = Off ,'Watch dog timer is always disabled. SWDTEN has no effect.
WDTPS = 256 ,'1:256
PBADEN = Off ,'PORTB<5:0> pins are configured as digital I/O on Reset
HFOFST = Off ,'HFINTOSC output and ready status are delayed by the oscillator stable status
MCLRE = EXTMCLR ,'MCLR pin enabled, RE3 input pin disabled
STVREN = On ,'Stack full/underflow will cause Reset
'LVP = On ,'Single-Supply ICSP enabled if MCLRE is also 1
LVP = Off ,'Single-Supply ICSP disabled
XINST = Off ,'Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
Debug = Off'Disabled
Include "keypad16pullup.bas"
Include "usart.bas"
Include "convert.bas"
Dim Keypressed As Byte
Dim Keyvalue As Byte
dim Total as word
SetBaudrate(br9600)
DelayMS(5000)
USART.Write ("Test program",13, 10, 10)
Keypressed = 0
total = 0
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
USART.Write ("Key pressed = 00"," Total = ", dectostr(total), 13, 10)
else
total = total + keypressed
USART.Write ("Key pressed = ", decToStr(Keypressed), " Total = ", dectostr(total), 13, 10)
end if
End If
Wend
delayms(100)
While Keypressed <> 0 'loop until key not pressed
Keypressed = Keypad16.Value
Wend
Wend
Test program
Key pressed = 1 Total = 1
Key pressed = 2 Total = 3
Key pressed = 3 Total = 6
Key pressed = 4 Total = 10
Key pressed = 5 Total = 15
Key pressed = 6 Total = 21
Key pressed = 7 Total = 28
Key pressed = 8 Total = 36
Key pressed = 9 Total = 45
Key pressed = 10 Total = 55
Key pressed = 11 Total = 66
Key pressed = 12 Total = 78
Key pressed = 13 Total = 91
Key pressed = 14 Total = 105
Key pressed = 15 Total = 120
Key pressed = 00 Total = 170
WHILE True
Keypressed = Keypad16.Value
IF Keypressed<>0 THEN
DELAYMS(50)
USART.Write ("Key pressed = ", decToStr(Keypressed), 13, 10)
delayms(1000)
END IF
total = total + keypressed
delayms(1000)
USART.Write ("total = ", decToStr(Total), 13, 10)
delayms(500)
WEND
WHILE True
keypressed = Keypad16.Value
IF keypressed<>0 THEN
DELAYMS(1000) // kept getting key bounce
'USART.Write ("Key pressed = ", decToStr(Keypressed), 13, 10)
WriteAt(1,1,"key = ",DecToStr(keypressed,2))
DELAYMS(10)
END IF
if keypressed = 16
then total = total + 50 - keypressed
end if
Total = keypressed + Total
DELAYMS(10)
'USART.Write ("total = ", decToStr(Total), 13, 10)
WriteAt(2,1,"Total= ",DecToStr(Total,2))
DELAYMS(10)
WEND
WHILE True
keypressed = Keypad16.Value
IF keypressed<>0
THEN
DELAYMS(1000) // kept getting key bounce
WriteAt(1,1,"key = ",DecToStr(keypressed,2))
DELAYMS(10)
END IF
if keypressed = 16
then total = total + 50 - keypressed
WriteAt(1,1,"double blank=",DecToStr(double0,2))// double0 = 50
end if
Total = keypressed + Total
DELAYMS(10)
WriteAt(2,1,"Total= ",DecToStr(Total,4))
DELAYMS(10)
WEND