Hello guys,
C# developer here, and I've been dropped into the middle of the PLC programming sea and I need to fix a lifeboat asap
Hardware:
Wago 750-852,
* 750-1400 input boards
* 750-1500 output boards
Codesys 2.3
So, my questions are (CoDeSys):
Is there a way to pass an input to a function (not just the boolean value) ?
Like I see i can get the address of on input with BITADR(IX0.0), but how can i go the other way.
In pseudo Code:
myVal : DWORD;
myVal := BITADR(IX0.0); // Get the address of the input
// read the status of the next input
IF INPUT_FROM_ADDRESS(myVal + 1) = TRUE THEN
// The next input is high, so set output 7 to high.
GET_OUTPUT_FROM_ADDRESS(6) := TRUE;
END_IF
My goal is that when ever a given Input (IX0.0...) changes it's state, I want to run a method that then applies some logic.. and ends up doing what not..
Right now I have the same code copy pasted over and over again to handle the events (with only the input and output variables changed), hopefully this isn't the correct way to do this, and i have to adjust the code every time i setup a plc with more or fewer input boards in..
Thanks in advance!
C# developer here, and I've been dropped into the middle of the PLC programming sea and I need to fix a lifeboat asap
Hardware:
Wago 750-852,
* 750-1400 input boards
* 750-1500 output boards
Codesys 2.3
So, my questions are (CoDeSys):
Is there a way to pass an input to a function (not just the boolean value) ?
Like I see i can get the address of on input with BITADR(IX0.0), but how can i go the other way.
In pseudo Code:
myVal : DWORD;
myVal := BITADR(IX0.0); // Get the address of the input
// read the status of the next input
IF INPUT_FROM_ADDRESS(myVal + 1) = TRUE THEN
// The next input is high, so set output 7 to high.
GET_OUTPUT_FROM_ADDRESS(6) := TRUE;
END_IF
My goal is that when ever a given Input (IX0.0...) changes it's state, I want to run a method that then applies some logic.. and ends up doing what not..
Right now I have the same code copy pasted over and over again to handle the events (with only the input and output variables changed), hopefully this isn't the correct way to do this, and i have to adjust the code every time i setup a plc with more or fewer input boards in..
Thanks in advance!