AlfredoQuintero
Lifetime Supporting Member
Hello. I have struggled all my Saturday with this one issue, and it is clear that only someone far more knowledgeable than me on CoDeSys can possibly clarify this to me. Please feel free to scold me and educate me. I prefer to sacrify my dignity if I can get this right.
I purchased a library from CoDeSys which has a number of functions to read and write text files. I was able to get the write part relatively painlessly, but I am having an issue with reading data from CSV files.
One particular function (CSV.NextElement) does not work in my program the way it does in the sample provided by CoDeSys with the product. In the CoDeSys sample, when the function is called if there are no errors the xDone and xBusy bits go TRUE and then FALSE, and it can be called again, reading the data as expected from the configured CSV file.
But in my program, after it calls the CSV.NExtElement function, the xDone bit remains TRUE. I found that if I call the same function instance again with the "xExcute := FALSE", then calling the same instance will read the next element of my CSV file, which is what I need.
Why? What can I be possibly doing wrong for this function's behaviour to look different in the sample and mine.
Thanks. Below is an illustration.
I purchased a library from CoDeSys which has a number of functions to read and write text files. I was able to get the write part relatively painlessly, but I am having an issue with reading data from CSV files.
One particular function (CSV.NextElement) does not work in my program the way it does in the sample provided by CoDeSys with the product. In the CoDeSys sample, when the function is called if there are no errors the xDone and xBusy bits go TRUE and then FALSE, and it can be called again, reading the data as expected from the configured CSV file.
But in my program, after it calls the CSV.NExtElement function, the xDone bit remains TRUE. I found that if I call the same function instance again with the "xExcute := FALSE", then calling the same instance will read the next element of my CSV file, which is what I need.
Why? What can I be possibly doing wrong for this function's behaviour to look different in the sample and mine.
Thanks. Below is an illustration.