1
Technical support / TBASIC Input On/Off Question
« on: December 07, 2019, 12:19:19 PM »
I am new to TBASIC. I want to write a simple program that looks to see if a switch is on or off, but when I wrote it in i-TriLOGI 6.x for my FMD88 I found that the Input
IF Input[10]=0 Then SetTimerSV 9, GetTimerSV(16)
Else SetTimerSV 9, GetTimerSV(15)
ENDIF
RETURN
The simulator seems to always return 0 whether the switch is on or off so the code doesn't work. Also, if it is the first time I run it then it might have a 1 until I run it again and then it is back to 0 even though the switch position didn't change. I think it has something to do with refreshing, but I am not sure. I appreciate any help. Thanks.
- =0 treats this as an integer instead of a boolean 0 or 1. I guess I don't understand how the system generates the integer to know what bit to read to see when it is on or off. Here is the code I used:
IF Input[10]=0 Then SetTimerSV 9, GetTimerSV(16)
Else SetTimerSV 9, GetTimerSV(15)
ENDIF
RETURN
The simulator seems to always return 0 whether the switch is on or off so the code doesn't work. Also, if it is the first time I run it then it might have a 1 until I run it again and then it is back to 0 even though the switch position didn't change. I think it has something to do with refreshing, but I am not sure. I appreciate any help. Thanks.