File reading/writing seems to be a really challenging thing on Codesys: libraries are not well documented, frequently they are not in sync with their last documentation, and examples are really rare to find.
In this forum I found @ l viewtopic.php?t=5575 l an example of async reading. For sake of semplicity I'll attach the project below.
I've some questions:
1) where in the code am I supposed to read data? Maybe in the STATE_CATCHEVENT section?
2) since data seem to be stored in the "event" ARRAY, I should be able to read the whole array at time, right?
if this is true, is there any sup limitations to its size?
The most important thing, however, is that I still have not managed to run correctly this program; simply it gets stuck at STATE_READ because "state" variable is always 0 and never changes. Why?
Maybe there are some problems in the Task configuration? It seems to use the task name for doing strange things; I've set the taskName variable according to the task's name but doesn't work. Have I to set event-based task or something like this?
Please, since I'm relatively new to Codesys I'd like to have a complete answer on this problem, especially if a real solution is found.
Hi all.
File reading/writing seems to be a really challenging thing on Codesys: libraries are not well documented, frequently they are not in sync with their last documentation, and examples are really rare to find.
In this forum I found @ l viewtopic.php?t=5575 l an example of async reading. For sake of semplicity I'll attach the project below.
I've some questions:
1) where in the code am I supposed to read data? Maybe in the STATE_CATCHEVENT section?
2) since data seem to be stored in the "event" ARRAY, I should be able to read the whole array at time, right?
if this is true, is there any sup limitations to its size?
The most important thing, however, is that I still have not managed to run correctly this program; simply it gets stuck at STATE_READ because "state" variable is always 0 and never changes. Why?
Maybe there are some problems in the Task configuration? It seems to use the task name for doing strange things; I've set the taskName variable according to the task's name but doesn't work. Have I to set event-based task or something like this?
Please, since I'm relatively new to Codesys I'd like to have a complete answer on this problem, especially if a real solution is found.
Best regards,
Luigi Ferrara.
reading.project [116.66 KiB]
For those interested,
synchronous reading/writing worked for me, take a look @ l viewtopic.php?f=11&t=7847 l .
Luigi Ferrara
Originally created by: Viacheslav Mezentsev
Try to update the CoDeSys and the libraries.