titi_nicolas
Member
Hello,
I am developing with TwinCAT-PLC on Beckhoff.
I have a FB with a VAR_IN_OUT variable (lets say "code :INT") and I want to know if I can bit access this variable as I usually do when the variable is not a VAR_IN_OUT (eg "code.5 :=TRUE").
I am asking because I read here that (I quote):
[FONT=Arial,Bold][FONT=Arial,Bold]
I gave a try on a Beckhoff system and the code compiles without errors and runs fine. But still, I am afraid of missing something important and I don't want to get, one day, a "memory corruption" or something else strange.
Thank you if somebody can help!
I am developing with TwinCAT-PLC on Beckhoff.
I have a FB with a VAR_IN_OUT variable (lets say "code :INT") and I want to know if I can bit access this variable as I usually do when the variable is not a VAR_IN_OUT (eg "code.5 :=TRUE").
I am asking because I read here that (I quote):
[FONT=Arial,Bold][FONT=Arial,Bold]
Addressing bits in variables
[/FONT][/FONT]In integer variables, individual bits can be accessed. For this, the index of the bit to be addressed is appended to the variable, separated by a dot. The bit-index can be given by any constant. Indexing is 0-based. Example:
a : INT;
b : BOOL;
...
a.2 := b;
...
A bit access must not be assigned to a VAR_IN_OUT variable!
---------------------------------------------------------------------------------------------------------------
Is this right?
The quote is NOT from a beckhoff manual and I could not find such warning anywhere else. That is why I am asking here!
a : INT;
b : BOOL;
...
a.2 := b;
...
A bit access must not be assigned to a VAR_IN_OUT variable!
---------------------------------------------------------------------------------------------------------------
Is this right?
The quote is NOT from a beckhoff manual and I could not find such warning anywhere else. That is why I am asking here!
I gave a try on a Beckhoff system and the code compiles without errors and runs fine. But still, I am afraid of missing something important and I don't want to get, one day, a "memory corruption" or something else strange.
Thank you if somebody can help!