Structure
All functions are collected in the axis proto type package. The proto type package consists only of the one axis function that is demonstrated. If multiple functions are used in one project the additional proto type packages can be copied and pasted into the existing proto type package.
Each axis function is build in way that it can be used independently from other functions. Each axis function comes with its own variable and type definitions. All code is in structure text language and encapsulated in an action.
Adding a function to a task
To add a function to a specific task follow this procedure.
![]() |
The folder AxisProto contains all files necessary for the specific function. In the first project you can copy the entire AxisProto folder from the sample project into your project. For additional functions just copy the folder for new axis function (Brake) into the existing AxisProto folder. It is recommended to reference the files from the AxisProto type folder to your task instead of making copy. A reference makes it easier to update the files in the future. |
![]() |
All axis functions communicate to the outside world through a structure. Most functions need some initial parameters, for example the axis reference MpLink. This code can be executed in the _INIT of the task. The action that drives the function is then called in the _CYLCIC part of the task. |
Coding guidelines
Here are some general coding guidelines used to develop the samples.
- All axis functions come with its own type and variable declaration and code file.
- All variables that are not relevant for the outside world are added to an internal structure [FunctionName]Internal.
- There is no dependency to any other module.
- All data exchange is done through one structure.
The structure for the data exchange follows the following guidelines
Description | Notation |
---|---|
A command that triggers an action | Cmd{Get|Set}{What} Example: CmdSetMotor |
mappMotion axis reference | MpLink |
Parameter or configuration values. Parameters can be two directional but it is recommended to see parameters as write only. | Par{What} Example: ParMotorSynchronous |
Status values are read only and are only changed by the prototype code. | Sta{What} Example: StaMotorSynchronous |
Error code | ErrID |