Jump to content
OMRON Forums

Read from flle


RafaelFalcaro

Recommended Posts

Hi,

 

What would be the best way to read the contents of a txt file and use it on my system?

 

I'm already saving in a .txt the last commanded position of a Motor, and at my controller startup (in case of a reboot) I would like to set Motor.HomePos as the value saved in the file.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

If you are trying to just read PMAC commands, you can issue the Linux command "gpascii -i/"

 

So if you have a text file named "Commands.txt" loaded into the "Documentation" folder of your project (already downloaded onto PMAC), you could issue in the terminal:

 

system gpascii -i/var/ftp/usrflash/Project/Documentation/Commands.txt

 

Note that issuing this from a PLC or Motion Program would use the "system" command and require quotation marks, though the above syntax should work in the terminal.

 

 

 

Depending on what the parameters are, you could also look into using "pp_custom_save.tpl" along with the "fsave" and "fload" commands--so if you wanted to back up Motor[1].JogSpeed, you would:

 

1. Put "Motor[1].JogSpeed" into "pp_custom_save.tpl", then download the project

2. Set Motor[1].JogSpeed to the desired value

3. Issue "fsave"

4. Do other tasks, including possibly changing the jog speed or power cycling the PMAC

5. Issue "fload" to re-load the saved values

 

 

 

 

Now, if you need to parse the text file (ie, if it isn't formatted properly to be directly issued to PMAC), then you would likely need a custom C Application that could parse it and issue the correct commands, but that would be a different task.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...