Javascript error in Beckhoff HMI

nightline

Member
Join Date
Feb 2010
Location
Prinsenbeek
Posts
425
Hi gents,
I'm building an Beckhoff HMI where I have to set an array of booleans to true by pressing a button.
Therefore I created the following code in Javascript:

for (var i = 0; i < 49; i=i+2) {
'PLC1.prgS0.HMI_MG.abHMI_AxisActive' = true ;
}

When testing this code, I got a SyntaxError: Invalid left-hand side in assignment

Can anyone tell me what's wrong?

Thanks in advance!

Jack
 
In meantime I modifeid the code to:

{
TcHmi.Symbol.writeEx ( "%s%PLC1.prgS0.HMI_MG.abHMI_AxisActive[0]%/s%", true );
}

Which works for bit 0.
But I've set 24 bits of the array, so I put the above code into the FOR LOOP and nested the VAR i

for (var i = 0; i < 49; i=i+2)
{
TcHmi.Symbol.writeEx ( "%s%PLC1.prgS0.HMI_MG.abHMI_AxisActive['i']%/s%", true );
}

Now I get the following error: SyntaxError: missing ) after argument list

Is this way of nesting wrong???
 
1) Perhaps this will work:
TcHmi.Symbol.writeEx ( "%s%PLC1.prgS0.HMI_MG.abHMI_AxisActive["+i+"]%/s%", true );


2) Sidebar: that code assigns 25, not 24, bits of an array (0,2,4,6,8,...,48).
 

Similar Topics

Hello Experts I am working on a project with WinCC Unified v16 PC system and want to create an option on the screen to export logs to the...
Replies
0
Views
53
Newbie question for an EXOR Jmobile javascript problem. I want to access at least one of the system values, but I am stumped on which javascript...
Replies
3
Views
1,693
Hi all ; if someone here can help me to convert this code to python code: public static libnodave.daveOSserialType fds; public static...
Replies
11
Views
3,902
This is another question for the Red Lion guys out there. I am working on the custom website for my Data Station Plus and have a question about...
Replies
2
Views
1,851
Hi there, I'm new to plc programming and was wondering why I get this error code when I run my simulation for these temperature sensors? What I'm...
Replies
1
Views
32
Back
Top Bottom