Inconsistency between I2CIN and I2COUT
Posted: Thu May 11, 2023 8:39 pm
IOI have been testing multiple commands using ISCOUT without an issue. There has been no problem doping simple value assign to OUTlist with decimal values i.e. OUTlist(0) = 254 Note no quotes required around 254 even though OUTlist is defined as String
However when I try to do the same thing with OUTlist in I2CIN I get a compile errors for an expected string character.
Here is the sub I am trying to run to test keypad presses.
Sub GetKeypad(keypadchar)
Dim i as Integer
DIM LCD_CMD(8) as String
DIM LCD_DATA(16) as String
LCD_CMD(0) = 254
LCD_CMD(1) = 38 ' get last keypress value
i = 1
Do Until i = 30
I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
print "Data0 = "; LCD_DATA(0)
print "Data1 = "; LCD_DATA(1)
print "Data2 = "; LCD_DATA(2)
print "Data3 = "; LCD_DATA(3)
print "Data4 = "; LCD_DATA(4)
print "Data5 = "; LCD_DATA(5)
print "Data6 = "; LCD_DATA(6)
print "Data7 = "; LCD_DATA(7)
print "Data8 = "; LCD_DATA(8)
print "Data9 = "; LCD_DATA(9)
print "Data10 = "; LCD_DATA(10)
print "Data11 = "; LCD_DATA(11)
print "Data12 = "; LCD_DATA(12)
print "Data13 = "; LCD_DATA(13)
print "Data14 = "; LCD_DATA(14)
print "Data15 = "; LCD_DATA(15)
If LCD_DATA(0) = "" then goto EXIT1
elseif LCD_DATA(0) = "a" then goto EXIT1
elseif LCD_DATA(0) = "b" then goto EXIT1
elseif LCD_DATA(0) = "c" then goto EXIT1
elseif LCD_DATA(0) = "d" then goto EXIT1
elseif LCD_DATA(0) = "e" then goto EXIT1
elseif LCD_DATA(0) = "g" then goto EXIT1
elseif LCD_DATA(0) = "h" then goto EXIT1
endif
wait(1000)
i = i + 1
Loop
EXIT1:
keypadchar = LCD_DATA(0)
print "keypad = ";keypadchar
RETURN
End Sub
And here is a sample of the error messages:
-ERROR F:/Enterprise Processor/test3.txt: 202: Expected End Of Line
Do Until i = 30
-WARNING I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-WARNING 203: Can only be initialized to 0
-WARNING I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-WARNING 203: Can only be initialized to 0
-WARNING I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-WARNING 203: Can only be initialized to 0
-WARNING I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-WARNING 203: Can only be initialized to 0
-ERROR F:/Enterprise Processor/test3.txt: 203: Expected string variable
I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-ERROR F:/Enterprise Processor/test3.txt: 203: Expected End Of Line
I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-W op=62,61d print "Data0 = "; LCD_DATA(0)
-ERROR F:/Enterprise Processor/test3.txt: 205: Unreachable statement
?? I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-W op=94,61d print "Data0 = "; LCD_DATA(0)
-ERROR F:/Enterprise Processor/test3.txt: 205: Unreachable statement
?? I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-W op=1a,61d print "Data0 = "; LCD_DATA(0)
-ERROR F:/Enterprise Processor/test3.txt: 205: Unreachable statement
?? I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-W op=68,61d print "Data0 = "; LCD_DATA(0)
Do I have to put 254 as "254" and 38 as "38" or do I have to use their character equivalents
However when I try to do the same thing with OUTlist in I2CIN I get a compile errors for an expected string character.
Here is the sub I am trying to run to test keypad presses.
Sub GetKeypad(keypadchar)
Dim i as Integer
DIM LCD_CMD(8) as String
DIM LCD_DATA(16) as String
LCD_CMD(0) = 254
LCD_CMD(1) = 38 ' get last keypress value
i = 1
Do Until i = 30
I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
print "Data0 = "; LCD_DATA(0)
print "Data1 = "; LCD_DATA(1)
print "Data2 = "; LCD_DATA(2)
print "Data3 = "; LCD_DATA(3)
print "Data4 = "; LCD_DATA(4)
print "Data5 = "; LCD_DATA(5)
print "Data6 = "; LCD_DATA(6)
print "Data7 = "; LCD_DATA(7)
print "Data8 = "; LCD_DATA(8)
print "Data9 = "; LCD_DATA(9)
print "Data10 = "; LCD_DATA(10)
print "Data11 = "; LCD_DATA(11)
print "Data12 = "; LCD_DATA(12)
print "Data13 = "; LCD_DATA(13)
print "Data14 = "; LCD_DATA(14)
print "Data15 = "; LCD_DATA(15)
If LCD_DATA(0) = "" then goto EXIT1
elseif LCD_DATA(0) = "a" then goto EXIT1
elseif LCD_DATA(0) = "b" then goto EXIT1
elseif LCD_DATA(0) = "c" then goto EXIT1
elseif LCD_DATA(0) = "d" then goto EXIT1
elseif LCD_DATA(0) = "e" then goto EXIT1
elseif LCD_DATA(0) = "g" then goto EXIT1
elseif LCD_DATA(0) = "h" then goto EXIT1
endif
wait(1000)
i = i + 1
Loop
EXIT1:
keypadchar = LCD_DATA(0)
print "keypad = ";keypadchar
RETURN
End Sub
And here is a sample of the error messages:
-ERROR F:/Enterprise Processor/test3.txt: 202: Expected End Of Line
Do Until i = 30
-WARNING I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-WARNING 203: Can only be initialized to 0
-WARNING I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-WARNING 203: Can only be initialized to 0
-WARNING I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-WARNING 203: Can only be initialized to 0
-WARNING I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-WARNING 203: Can only be initialized to 0
-ERROR F:/Enterprise Processor/test3.txt: 203: Expected string variable
I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-ERROR F:/Enterprise Processor/test3.txt: 203: Expected End Of Line
I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-W op=62,61d print "Data0 = "; LCD_DATA(0)
-ERROR F:/Enterprise Processor/test3.txt: 205: Unreachable statement
?? I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-W op=94,61d print "Data0 = "; LCD_DATA(0)
-ERROR F:/Enterprise Processor/test3.txt: 205: Unreachable statement
?? I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-W op=1a,61d print "Data0 = "; LCD_DATA(0)
-ERROR F:/Enterprise Processor/test3.txt: 205: Unreachable statement
?? I2CIN(10,11,80,2,LCD_CMD,16,LCD_DATA)
-W op=68,61d print "Data0 = "; LCD_DATA(0)
Do I have to put 254 as "254" and 38 as "38" or do I have to use their character equivalents