Internet PLC Forum

General => Technical support => Topic started by: peterjung on February 10, 2016, 06:39:40 PM

Title: Help with TBasic Syntax
Post by: peterjung on February 10, 2016, 06:39:40 PM
Can someone tell me what is wrong with the following code:

'Get the Set Value of the timer and store in a variable

ElapsedTimeSVFor = getTimerSV(4)
ElapsedTimeSVRev = getTimerSV(5)

'Elapsed Time Forward Display

IF TESTIO(SBX_LSR)=0 '& TESTIO(SBX_LSF)=0 & TESTIO(LSF_LATCH)=0)
THEN
ElapsedTimeDisplay = ElapsedTimeSVFor - TIMERPV[4]
ELSEIF TESTIO(SBX_LSR)=0 & TESTIO(LSF_LATCH)=1
THEN
ElapsedTimeDisplay = ElapsedTimeSVFor - TIMERPV[5]
ELSE
ElapsedTimeDisplay = 0
ENDIF

I get a message:

Error:Syntax error, missing: "]" with the last square bracket after TIMERPV[4] highlighted?

Thanks
Title: Re:Help with TBasic Syntax
Post by: peterjung on February 10, 2016, 07:48:53 PM
OK...I found the problem....

My variable called "ElapsedTimeDisplay" was defined in the "Define Variable Names" table as:

DM[3}

..... where of course it should be:

DM[3]

arrrgghhh!!