Several things might go wrong:
1) It seems you are not calling Test. Maybe you want to call the FB like:
Test();
Otherwise nothing is executed.
2) In PC programming it might work that you stay in the WHILE loop, but this is pretty dangerous in PLC programming, because your I/O will not be updated. Besides that, most FB's are acyclic, which means it might take several scans before the Test() FB is Done, or an Error will happen.
Therefore you might want to consider using another way of calling this, and not staying in the while loop.
3) xDone, xBusy, xError will never be TRUE at the same time. Normally you keep xExecute TRUE untill xDone OR xError is TRUE. Then you can set xExecute to FALSE.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
can somebody help me with a sample for the LogRecord function in Codesys.
1. i have created a DataLogManager and a Dataprotcol (Test).
if i set Test.xExecute := TRUE xDone and xError are not going to TRUE?
so what make i worng?
Thanks
Bruno
Several things might go wrong:
1) It seems you are not calling Test. Maybe you want to call the FB like:
Test();
Otherwise nothing is executed.
2) In PC programming it might work that you stay in the WHILE loop, but this is pretty dangerous in PLC programming, because your I/O will not be updated. Besides that, most FB's are acyclic, which means it might take several scans before the Test() FB is Done, or an Error will happen.
Therefore you might want to consider using another way of calling this, and not staying in the while loop.
3) xDone, xBusy, xError will never be TRUE at the same time. Normally you keep xExecute TRUE untill xDone OR xError is TRUE. Then you can set xExecute to FALSE.