Synchronization problem with STRINGs

Hello,

I have a routine that uses the ONCHANGE event to read variables from an Allen-Bradley PLC (CompactLogix) via the IO SERVERS ABLOGIX.

ONCHANGE "EWON_MD_Usure_Ctrl_CompteurDepart", "@MD_MAJ_ReadValues ​​()"

In the FUNCTION, I read a series of 4 variables (1 integer, 1 float and 2 string). In the PLC, the 4 variables are updated at the same time. My trigger is on the integer variable (EWON_MD_Usure_Ctrl_CompteurDepart).

FUNCTION MD_MAJ_ReadValues ​​()
  PRINT EWON_MD_Usure_Ctrl_CompteurDepart @ // Integer
  PRINT EWON_MD_Usure_Data_TypeUsure @ // String
  PRINT EWON_MD_Usure_Data_EquipementNumero @ // String
  PRINT EWON_MD_Usure_Data_Valeur @ / Float
ENDFN

Once in the routine started, the integer and float variables are up to date, but not the strings. I changed the trigger on the first string, it is now up to date, but the second doesn’t necessarily.

Is this normal?
Is there a way to ensure that all the variables are up to date before doing the processing?

Thank you
Christian

I guess one thing that could be done would be to have that trigger turn on a timer and then have the timer set to something like

tset 1, 15

Then do ontimer to trigger you function MD_MAJ_ReadValues and turn the timer off at the end of the function

Hi @CFrancoeur,

Did adding the delay like I mentioned above help with this issue?

-Tim

Hello Tim,

The problem is only with the STRINGs.
To ensure synchronization without using time, I return a copy of the String type varibles to the PLC. When they are equal, I activate my trigger for the EVENT.

Christian

That should work fine, let me know if you run into issues with it