I want to link real time can variables to the signals and its various parameters present in some other external file say txt , csv or excel; within Codesys project using codesys programming system or some other method.
for eg.
i am feching CAN data in my project using CAN config. in Global variables and on the other side I am also fetchin various signals and its parameters from external txt file into codesys programming system. And now I want to link both of them such that if there is some changes in my external text file it is reflected dynamically to corresponding global variable also carrying CAN data.
Can some1 tell me how to do this Dynamically.
Any reply or ideas will be appreciated.
Cheers n Regards,
Rajat Bansal
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello evry1..
I want to link real time can variables to the signals and its various parameters present in some other external file say txt , csv or excel; within Codesys project using codesys programming system or some other method.
for eg.
i am feching CAN data in my project using CAN config. in Global variables and on the other side I am also fetchin various signals and its parameters from external txt file into codesys programming system. And now I want to link both of them such that if there is some changes in my external text file it is reflected dynamically to corresponding global variable also carrying CAN data.
Can some1 tell me how to do this Dynamically.
Any reply or ideas will be appreciated.
Cheers n Regards,
Rajat Bansal
If you want to assign variables dynamicly from a file (CVS or TXT)
you can use an array of a structure, the struct looks like this:
use the name or number to search for the correct variable, this name/number is read from the file
assigning vars:
read a varname from the file (like var1) find the name in the struct of filevars and save the index
now read the data from the file to the actual var
SysFileRead(dwFileHandle,astFileVars[INDEX].dwDataPTR,XXbytes);
I hope this is what you where looking for and that you can make heads or tails of it :p
Related
Talk.ru: 1