Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue "save" command using PLC cmd
Is it possible to use the cmd instruction in a script PLC to issue a "save" command to the PMAC command parser?

I've tried to do this in a script PLC on a Power Pmac running firmware v1.5.8.0 and Ldata.CmdStatus will return a -20, which indicates an invalid syntax.

cmd "save"; // Moves CMD to local CMD program buffer & waits if full

If I try:
cmd "sav"; // Moves CMD to local CMD program buffer & waits if full

CmdStatus returns 0, but the save does not appear to work. After rebooting, any Saved Data Structures that were altered prior to executing the cmd instruction revert to their pre-altered values.

I also tried adding carriage return and newline escape characters to the string ("save\r"). Same results as without the escape sequence.

Does the online "save" command not work when used via the cmd instruction, or do I actually have the syntax wrong in some way?

The "Save" command can only be issued from the IDE as the databases must be synchronized.
Is there any other way to save data structures to the PMAC from a script or C program?

Our machine UI allows an operator to modify a rotary motor reference (zero) position, the motor uses an absolute encoder as feedback. The reference position needs to changed when tooling is mounted to the equipment. When they press a button on the UI a script PLC modifies the Motor[i].HomeOffset position accordingly. Since this is part of a saved data structure, I would like it automatically saved to the PMAC when they do this.

I can't hard-code the values into the PMAC because they will change as tooling is added/removed from the machine, but I would like the changes to be retained in the event the controller is reset.

I know I can have them start the IDE and issue a save from there, but I would prefer to not have them mucking about in the IDE if at all possible. In the past we've had our UI software save P-variable parameters in a settings file, but for some reason, I don't like the idea of external software downloading data to saved data structures on the PMAC.

We have done similar things using this method from a capp or cplc.
1. Have a file in the project named z_usersettings.pmh. The z is important as you want it to be loaded last when project is loaded.
2. Have all the changing user structures or variables in this file.
3. Each time the value must be changed you can directly edit this file which is at opt/pmac/usrflash/Project/Pmac Script Language/z_usersettings.pmh and the one in active memory at var/ftp/Pmac/Project/Pmac Script Language/z_usersettings.pmh

each time ppmac boots the data from ths file will be loaded.

Forum Jump:

Users browsing this thread: 1 Guest(s)