Set bit in word with Siemens SCL

Join Date
Jan 2010
Location
east
Posts
3
I got problem to set a bit in a word with symbolic name.
When I juse the DB adress its works( DB1.DBX4.3 := 1; )

Can somebody help me with the right expression?

This is my code but it will not work.

FUNCTION FC1: VOID
BEGIN
DB1.DBX4.3 := 1; //This is ok

"Test".X.UT[0] := 1; //This is ok when I set the word

"Test".X.UT[0].3 := 1; //This is not ok when I set the bit

END_FUNCTION
 
When you say it doesn't work you mean the code does not compile. Here's a possible work around:

Code:
FUNCTION FC1: VOID
VAR_TEMP
abData: ARRAY[0..15] OF BOOL;
wData AT abData: WORD;
END_VAR

BEGIN
DB1.DBX4.3 := 0; //This is ok

"Test".X.UT[0] := 0; //This is ok when I set the word

wData:="Test".X.UT[0];
abData[3]:=1;
"Test".X.UT[0] := wData; 

END_FUNCTION
 
Last edited:

Similar Topics

I have a project where a Micro820 was supplied by another vendor. I need to read status of the outputs of the M820 via Ethernet/IP from my...
Replies
1
Views
2,143
I'm starting to learn some basic ladder logic. I'm on an AB Micrologix 1000 PLC. I'm wondering if the OTU instruction will work on an entire...
Replies
3
Views
2,123
Hi Gents, I am new to Unity Pro and have to work in Funciton block. I have worked extensively in ladder with Ge-Fanuc. I am trying to find an...
Replies
2
Views
4,145
Hi I am having a brain ache. What is the instruction to set a bit in a word, kinda like (set bit 2 of word D2) or (reset bit 2 of word D2). I...
Replies
3
Views
3,204
What is the best way to set a bit over an ethernet/IP network on an Allen-Bradley ControlLogix Series PLC from a Windows PC. We have a program...
Replies
7
Views
2,105
Back
Top Bottom