Question.
' {$STAMP BS2}
' {$PBASIC 2.5}
' Project: GT60-Phone Systen
' Group members: Chia Kok Kuang 0604912F
' : Song Chan Meng 0607862J
'======================================================================================
a VAR Byte
SETUP:
INPUT 1 'Set PIN 1 to INPUT
INPUT 2 'Set PIN 2 to INPUT
INPUT 3 'Set PIN 3 to INPUT
INPUT 4 'Set PIN 4 to INPUT
BINARYCHECK:
IF IN1 = 1 AND IN2 = 0 AND IN3 = 0 AND IN4 = 0 THEN a = 1
IF IN1 = 0 AND IN2 = 1 AND IN3 = 0 AND IN4 = 0 THEN a = 2
IF IN1 = 1 AND IN2 = 1 AND IN3 = 0 AND IN4 = 0 THEN a = 3
IF IN1 = 0 AND IN2 = 0 AND IN3 = 1 AND IN4 = 0 THEN a = 4
IF IN1 = 1 AND IN2 = 0 AND IN3 = 1 AND IN4 = 0 THEN a = 5
IF IN1 = 0 AND IN2 = 1 AND IN3 = 1 AND IN4 = 0 THEN a = 6
IF IN1 = 1 AND IN2 = 1 AND IN3 = 1 AND IN4 = 0 THEN a = 7
IF IN1 = 0 AND IN2 = 0 AND IN3 = 0 AND IN4 = 1 THEN a = 8
IF IN1 = 1 AND IN2 = 0 AND IN3 = 0 AND IN4 = 1 THEN a = 9
IF IN1 = 0 AND IN2 = 0 AND IN3 = 0 AND IN4 = 0 THEN a = 0
DEBUG CR, "Binary Code sense a " a "."
PAUSE 200
GOTO BINARYCHECK
How do I display the value of 'a' in this code?
;]
' {$PBASIC 2.5}
' Project: GT60-Phone Systen
' Group members: Chia Kok Kuang 0604912F
' : Song Chan Meng 0607862J
'======================================================================================
a VAR Byte
SETUP:
INPUT 1 'Set PIN 1 to INPUT
INPUT 2 'Set PIN 2 to INPUT
INPUT 3 'Set PIN 3 to INPUT
INPUT 4 'Set PIN 4 to INPUT
BINARYCHECK:
IF IN1 = 1 AND IN2 = 0 AND IN3 = 0 AND IN4 = 0 THEN a = 1
IF IN1 = 0 AND IN2 = 1 AND IN3 = 0 AND IN4 = 0 THEN a = 2
IF IN1 = 1 AND IN2 = 1 AND IN3 = 0 AND IN4 = 0 THEN a = 3
IF IN1 = 0 AND IN2 = 0 AND IN3 = 1 AND IN4 = 0 THEN a = 4
IF IN1 = 1 AND IN2 = 0 AND IN3 = 1 AND IN4 = 0 THEN a = 5
IF IN1 = 0 AND IN2 = 1 AND IN3 = 1 AND IN4 = 0 THEN a = 6
IF IN1 = 1 AND IN2 = 1 AND IN3 = 1 AND IN4 = 0 THEN a = 7
IF IN1 = 0 AND IN2 = 0 AND IN3 = 0 AND IN4 = 1 THEN a = 8
IF IN1 = 1 AND IN2 = 0 AND IN3 = 0 AND IN4 = 1 THEN a = 9
IF IN1 = 0 AND IN2 = 0 AND IN3 = 0 AND IN4 = 0 THEN a = 0
DEBUG CR, "Binary Code sense a " a "."
PAUSE 200
GOTO BINARYCHECK
How do I display the value of 'a' in this code?
;]
Comments
DEBUG CR, "Binary Code sense a " a "."
to
DEBUG CR, "Binary Code sense a ", DEC a,"."
It wasn't part of the question, but you may replace,
all with the much simpler expression...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
What does the expression mean?
like this?
EDIT 2:
Shouldn't it be:
if I want it to count starting from 0, and ends at 9?
[noparse]:)[/noparse]
Post Edited (Passerby) : 1/9/2009 6:34:04 AM GMT
Post Edited (agfa) : 1/9/2009 4:18:26 PM GMT