ORSO2001 Posted June 13, 2019 Report Share Posted June 13, 2019 Dear All, I have a Struct that have 13 variables (String, Bit, and uint32); I created 4 global variablea to record these datas; I have created a DTI with a single row to take these information and save into a file if some event arise. When the event arise I don't have to record all the informations as these are but I have to modify a litte; then when the event arise I store one of the global struct into a local struct (same struct) , write this in the DTI and copy (append) this DTI in the file (already present). what I have is that if I use a LOCAL struct the data is store with "wrong value" (strange characters) and also the last value that is a BIT is stored in a 14th column in the csv file that don't exist; if I use a global Struct (convert the local to global) all works. I don't tried to "reset" the local Struct, to inizialized, before populate it...but until now (other projects), if I well remember, was not necessary. I am using last version of Unilogic 1.26. Link to comment Share on other sites More sharing options...
AlexUT Posted June 13, 2019 Report Share Posted June 13, 2019 Hi, Local structure lost/corrupt data outside of subroutine . When you require to save data to SD, Ladder leave routine and cannot pass right data to SD driver. This is how local variables are working. Use Global structure. Than it will work. B.R. Link to comment Share on other sites More sharing options...
ORSO2001 Posted June 13, 2019 Author Report Share Posted June 13, 2019 Hi AlexUT, thanks for the answer...one thing is not clear (for me)...before write the SD file I store the local struct to the DTI...is not like save in a "global variable" (DTI) and use this to write the information to the file? Link to comment Share on other sites More sharing options...
Saragani Posted June 13, 2019 Report Share Posted June 13, 2019 Can you are a small project that reproduces the problem? Link to comment Share on other sites More sharing options...
ORSO2001 Posted June 13, 2019 Author Report Share Posted June 13, 2019 I will try to do a single UDFB project to replicate the issue...otherwise I can send the project, is not so big, and I will highlight where I do this. Link to comment Share on other sites More sharing options...
Saragani Posted June 13, 2019 Report Share Posted June 13, 2019 OK. Link to comment Share on other sites More sharing options...
ORSO2001 Posted June 13, 2019 Author Report Share Posted June 13, 2019 hi Saragani, I sent a mail to the support that include the project and the .csv file that show the problem. the object of the mail is the same of this thread I confirm that if the local struct is "reset", see the first row of the UDFB where the problem arise, that in the copy that I sent is disabled, the problem is not present; seems a problem with one of the strings of this struct that exceed its lenght...if you will check the .csv file will see that the not inizialized strings take "strange" characters. thanks and regards Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now