Hello,
I managed to get a value in my URCaps (that the user input) and write this value in the output register via a script inside the URCaps. (So I can read it via PLC.)
The problem is that I need to do a handshake with the PLC, therefore, the PLC will write in the input registers, and I need to access theses values inside my URCaps.
The code to write in the output registers I successfully implemented, and it works.
@Override
public void generateScript(ScriptWriter writer) {
writer.appendLine("write_output_integer_register(0," + model.get(VALOR_VAR, 0d) + ")");
writer.appendLine("write_output_integer_register(1," + model.get(VALOR_VAR1, 0d) + ")");
writer.appendLine("write_output_integer_register(2," + model.get(VALOR_VAR2, 0d) + ")");
writer.appendLine("write_output_integer_register(3," + model.get(VALOR_VAR3, 0d) + ")");
writer.appendLine("write_output_integer_register(4," + model.get(VALOR_VAR4, 0d) + ")");
writer.appendLine("write_output_integer_register(5," + model.get(VALOR_VAR5, 0d) + ")");
writer.appendLine("write_output_integer_register(6," + model.get(VALOR_VAR6, 0d) + ")");
writer.appendLine("write_output_integer_register(7," + model.get(VALOR_VAR7, 0d) + ")");
writer.appendLine("write_output_integer_register(8," + model.get(VALOR_VAR8, 0d) + ")");
writer.appendLine("write_output_integer_register(9," + model.get(VALOR_VAR9, 0d) + ")");
writer.appendLine("write_output_integer_register(10," + model.get(VALOR_VAR10, 0d) + ")");
writer.appendLine("write_output_integer_register(11," + model.get(VALOR_VAR11, 0d) + ")");
}
As this is a write only method, it is declared as a void, because I need no returns.
The problem I am facing now, is that I didn’t find a way to send the “read_input_integer_register”, get the value, and assign it to public variable. It seems that the ScriptWriter is only void. Is it correct? How is it done to read the input registers inside my URCaps?
Thank you.