en:software:devices:epicpos

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:software:devices:epicpos [2016/11/16 17:42] – [5.4. States] qem103en:software:devices:epicpos [2020/07/13 14:54] (current) qem103
Line 1: Line 1:
 +====== DEVICE EPICPOS ======
 +
 +
 +====== - Introduction ======
 +
 +  * The internal device EPICPOS is one tool that resides in the CPU that allows to manage the movement of a mechanical axis with an analog control epicicloidal ramps.
 +  * The main function of the device is to generate a trajectory or "speed profile" that, suitably converted into a proportional voltage signal, commands a driving and then the axis attached to it.
 +  * The speed profile has a epicicloidal trends (trend of progressive soft and progressive) that reduces the stress and the strain of mechanical parts.
 +  * The device also includes a feed-back process on the measurement taken from the transducer This measure appropriately compared is used to generate the feedback. The control voltage for operation is generated by a DAC hardware (Digital to Analogic Converter) present to BUS QMOVE.
 +  * To sync the position detected from the device with the actual axis position, is there a special procedure for movement such "preset search".
 +  * The feed-back is the PID+FF type (proportional, integral, derivative and feed-forward).
 +
 +{{ :software:devices:epicpos:epicpos_01.png?nolink700 |}}
 +
 +
 +===== - Installation =====
 +
 +==== - Device declaration in the configuration file (.CNF) ====
 +
 +In the configuration file (.CNF), the BUS section must be declared so that you have the hardware resources required for the implementation of the EPICPOS device. There must be at least a bi-directional meter and a 16-bit resolution analog output. The device can also be used with an input and an interrupt line for preset search functions.\\
 +In the INTDEVICE section of the .CNF file must be add the following definition:
 +<code QCL>
 +;---------------------------------
 +; Internal device declaration
 +;---------------------------------
 +INTDEVICE
 +..
 +<device_name>  EPICPOS  TCamp  ICont  IntL  IAZero  IOutA
 +</code>
 +
 +^:info:^It is necessary that each definition are present on the same line. In case you do not want to assign a resource, for example IAZero, you must enter in the appropriate field the string X.X.^
 +
 +where:
 +|<device name>|The name given to the device.|
 +|EPICPOS|Keyword that identifies the epicicloidal positioner devices.|
 +|TCamp|Time sampling device (1÷255 ms).|
 +|ICont|Bidirectional counter input.|
 +|IntL|Number of the interrupt line dedicated to the encoder zero pulse during the phase of presets search.\\ Allowed values: 1÷8 (to prevent the device uses this resource, enter the character X).|
 +|IAZero|Input of enable to acquire the the transducer's zero pulse during the preset search (to prevent the device uses this resource enter characters X.X)|
 +|IOutA|Hardware address of the DAC from analog output.|
 +
 +=== - Example ===
 +
 +<code QCL>
 +;---------------------------------
 +; Internal device declaration
 +;---------------------------------
 +INTDEVICE
 +Axis_X   EPICPOS     2.CNT02     3.INP01   3.AN01
 +</code>
 +
 +
 +===== - Operation =====
 +
 +==== - Position detection ====
 +
 +The EPICPOS device acquires the position of the axis via bi-directional transmitter signals of transducer; these signals are used by an internal counter. The value of this counter not express, genereally, directly the position of the axis in the unit of measure required by your application. The cntratio parameter is used then to express the relationship between the impulses the transducer and the corresponding application units. The permitted values for this parameter are 0,00374 ÷ 4 with five digits of precision. The report must be introduced in the parameter as an integer value, and then multiplied by 100000.\\
 +//cntratio// = (value in um) x 10 <sup>decimal digits</sup> / (corresponding transductor pulse) x 100000
 +
 +=== - Decimal point ===
 +
 +If for the selected unit of measure is also provided for the presence of a decimal point, the locations must be represented as an integer value and represent space in units without decimal point. The resolution must be calculated with the same formula and the numerator the greatness without decimal point. The decimal point will be then inserted in the value representing the time viewers (example: as properties in the HMI).
 +
 +=== - Speed ===
 +
 +The speeds are always expressed in whole units of measure in the unit of time choice. From this it emerges that the device must know the location of the decimal point of the unit of measure and this is done with the //decpt// parameter. This parameter can take values 0÷3.
 +
 +=== - Example ===
 +
 +^:tip:^To activate this device send the INIT command.^
 +
 +  * You want to represent the positions in centimeters with a decimal point.
 +  * In the space of 18,2 cm the transducer generates 500 pulses.
 +
 +As told to calculate the resolution you have to consider the space runs represented in terms of the measuring unit mm. The resolution is:\\
 +cntratio = (18.2 x 101 / 500) x 100000 = 36400
 +
 +The settings must be:
 +//Axis:cntratio// = 36400
 +//Axis:decpt// = 1
 +
 +To run a placement at 146 cm, must type
 +//Axis:setpos// = 1460
 +
 +To set a speed of 10 centimeters per second, must type :
 +//Axis:unitvel// = 1
 +//Axis:setvel// = 10
 +
 +==== - Analog output adjustment ====
 +
 +^:tip:^Before starting actual placements you must make sure that electrical connections and mechanical appliances have not of malfunctions cause.^
 +
 +For the axis managing, the EPICPOS device using an analog output range ±10 V and 16 bit resolution with sign; with the calibration function this analog output can be command with a costant value in order to test links and functionality.
 +
 +=== - Preliminary motion ===
 +
 +  * Remove the emergency condition with the //RESUME// command.
 +  * The state //st_emrg// = 0
 +  * Enable calibration axis status with the //CALON// command; the //st_cal// state must take a value 1.
 +  * Now you can set the analog voltage with the //vout// parameter; the value is expressed in tenths of a volt (-100 ÷ 100 = -10 ÷ 10 V). It is recommended to introduce low values (5, 10, 15 ... equal to 0.5, 1, 1,5 V).
 +  * When the axis is moving the //frq// parameter indicates the frequency in Hz of the transducer phases.
 +  * The //posit// parameter that shown the position, varies indicating the space covered by axis.\\ If setting a positive voltage the count will decrements, It is necessary to invert the phases of the transducer or reverse the direction in driving.
 +  * You can reverse the direction of the count using the //CNTREV// command.
 +  * If output voltage equal to zero the axis is not stopped, adjust the //offset// parameter pto correct the tension until movement does not stop. The inserted value (each bit corresponds to approximately 0.3 mV), will be added algebraically to the value of the analogue output; This operation allows to compensate for any drift of electronic component, from the QMOVE output and in the driver input. The value is expressed in bits with sign.\\ For an optimal result of calibration this operation must be performed with the system to temperature capacity.
 +  * To disable calibration status send the //CALOFF// command.
 +  * The state //st_cal// = 0
 +
 +=== - Output adjustment ===
 +
 +The EPICPOS device generate the voltage value of the analogue output on the basis of a ratio between the maximum velocity of the axis and the maximum output voltage. Proportionality is obtained with the //maxvel// parameter, maximum axis speed representative on the analog voltage (10 V). Obviously the axle must behave symmetric compared to analog voltage zero value, Therefore the speed must be the same on both the positive and negative voltages at maximum.\\
 +Before to determining the value of maximum velocity, We must establish the unit of time to use for the representation of the velocity in the device; the //unitvel// parameter defines the unit of time of speed (Um/min or Um/s).
 +
 +=== - Theoretical method for the determination of the maximum speed ===
 +
 +The theoretical method is a calculation that was performed on the basis of maximum motor speed. Once established the maximum revolutions per minute declared on the motor, We get the maximum velocity is expressed in the unit of measure the unit of time chosen.\\
 +Enter the value of maximum velocity calculated in the //maxvel// parameter.
 +
 +=== - Practical method for determining the maximum speed ===
 +
 +The practical method is based on the reading of the speed detected by the device in the //vel// parameter, provide at the drive a known voltage. To provide the voltage to drive the device should be placed in a position of calibration as described in the previous paragraph. If the system permits, supply voltage operation 10 V and read the speed value in the //vel// parameter. If, on the other hand, is an excerpt of the output voltage (1, 2, ... 5 V), calculate the maximum velocity with a proportion.\\
 +Enter the maximum speed value found in //maxvel// parameter.
 +
 +==== - Movement ====
 +
 +^:tip:^Before movement the axis, check the proper operation of emergency equipment and protection.^
 +
 +The procedures described here have allowed us to complete the first phase of setting parameters for the device. Now you can execute the simple movement of the axis.
 +  * Move the axis in a position where we can make a specific area without touching the maximum quota limits.
 +  * Set the current position of the axis to zero, by setting the parameter //posit// = 0.
 +  * Set up the parameters that define the position of the limit switches software: //minpos// = 0 and //maxpos// at the value of the maximum stroke of the axis.
 +  * Set the parameter that defines the time the axis to reach the maximum speed //taccdec// = 100. This parameter is expressed in hundredths of a second (100 = 1 sec.)
 +  * Set the speed of positioning with the //setvel// parameter.
 +  * Set the target quota with the //setpos// parameter.
 +  * Set the parameter //feedforward// = 1000 (100%)
 +  * If the device is in state of emergency (//st_emrg// = 1) give the //RESUME// command.
 +  * Start positioning with the //START// comand. To stop the movement give the //EMRG// command.
 +
 +This first movement was done without the feedback of space. The placement may have been executed with some error introduced by the non-linearity of the components or an imperfection in the maximum velocity calibration. Subsequently enabling space feedback this error goes away.
 +
 +==== - PID+FF adjustment ====
 +
 +The placement runs in the preceding paragraph has been made without considering any position errors.\\
 +To check the correct position of the axis continuously and automatically, you need to have a feed-back on the position; for this reason introduces the PID+FF control algorithm including proportional, integral, derivative and feed-forward actions; the value of the analog output is given by the summation of feed forward, proportional, derivative and integrative actions.\\
 +Without going into the merits of a technical description of the theory of regulation, This section describes a series of actions to adjust the parameters that affect this control.\\
 +In order to achieve a satisfactory adjustment is sufficient to use only the feedforward and proportional actions; integral and derivative actions are used only for adjustments under special conditions.
 +
 +{{ :software:devices:epicpos:epicpos_02.png?nolink600 |}}
 +
 +=== - Feed forward action ===
 +
 +The feed-forward helps make the system more ready on placements, by providing the analog output voltage proportional to the theoretical speed of positioning. In practice it is the component which you performed the placements of the previous chapter.\\
 +The contribution of this action can be adjusted with the //feedfw// parameter; This parameter is expressed as 1/1000 speed theoretical portion; so, to introduce such as 98.5% you must set 985 (thousandths).
 +
 +{{ :software:devices:epicpos:epicpos_03.png?nolink600 |}}
 +
 +=== - Proportional action ===
 +
 +This action provides an output proportional to the instantaneous axis position error. The extent of the proportional action is defined by the //pgain// parameter that defines the sensitivity of the system.\\
 +The //pgain// parameter is introduced in thousandths; the unit value of the gain (1000) provides an analog output to maximum value (10 V) relative to the maximum speed error. For maximum speed error means the space covered by axis - at he maximum speed - for the duration of the sampling time of the device.
 +
 +{{ :software:devices:epicpos:epicpos_04.png?nolink600 |}}
 +
 +=== - Integral action ===
 +
 +Integrates the position error of the system over time set in //integt// parameter updating the release until the error is not canceled.\\
 +More lower the integration time of the error, more faster the recovery system error, but the system can become unstable, tending to swing.
 +
 +{{ :software:devices:epicpos:epicpos_05.png?nolink600 |}}
 +
 +=== - Derivative action ===
 +
 +Anticipates the change of the motion of the system tends to eliminate the overshoot of the positioning. The magnitude of change is calculated over time set in //derivt// parameter.\\
 +More higher the time of derivation of error and more faster the transient error recovery system, but if you enter a value that is too high the system becomes unstable, tending to fluctuate.
 +
 +{{ :software:devices:epicpos:epicpos_06.png?nolink600 |}}
 +
 +==== - Preset search ====
 +
 +Searching for presets is a procedure to synchronize the count (//posit// parameter) with the real position of the axis. Can be execute in 3 different ways according to the //prsmode// parameter.
 +
 +=== - Preliminary considerations ===
 +
 +  * In order to perform a search preset is need a input (acquired through the BUS QMOVE) we define “enabling zero transducer”. In its path, the axis must turn this entry into a particular point.
 +  * The preset search procedure is started with the //PRESET// command; at the initial stage the count acquired from QMOVE can have any value and can be located anywhere.
 +  * The axis must direct towards the cam allows the upload of preset. Not knowing which way to direct the axis to meet the enable input, search for preset lets you choose with the prsdir parameter two solutions:\\ prsdir = 0 0 the axis will always a forward movement\\ prsdir = 1 1 the axis will always a back movement
 +  * If during the preset search execution is give again the //PRESET// command, the direction of motion of the axis is reversed.
 +  * It is to be noted that the presets quota contained in the //prspos// parameter must always be between the minimum and the maximum quota and that, after you load the preset quota, the axis is automatically positioned to the preset.
 +  * During the preset search the software limits //maxpos// and //minpos// are not enable.
 +  * When you set the search speed zero pulse - //sprsvel// - we must consider that in Mode 0 the input has a hardware filter that delays the acquisition and so influence the precision of the loading. In the 1 mode, the acquisition is execute on interrupt input so the speed is not determinative. We must ensure, however, that the time of zero impulse duration is sufficient to be acquired from the card. In order to know the acquisition time of the entrance and the minimum time of zero pulse signal refer to the technical documentation of the used cards.
 +
 +Once you start search presets with the //PRESET// command, the axis towards the position where the zero pulse enable input transducer with speed //defined by prsvel//. The //st_prson// state you turn to report the current preset. When, in its rush, the active axis this input, reverses direction and starts with speed //sprsvel//.\\
 +At this point the behavior depends on the manner of loading selected (Mode 0 or Mode 1).
 +
 +=== - Preset search - Mode 0 ===
 +
 +^:info:^This procedure involves the movement of the axis and the use of the zero pulse enable input transducer.^
 +
 +To the deactivation of the zero-pulse enable trasducer input, the preset quota is loaded on the counting (parameter //posit=prspos//).
 +Next, you disable the //st_prson// status and active the //st_prsok// state to signal the end of search. This State remains active until the starting of a new presets procedure; when the system is powered this State is always zero. See picture 1.
 +
 +|Picture 1: preset loading using the only enabling cam.|
 +|{{ :software:devices:epicpos:epicpos_07.png?nolink500 |}}|
 +
 +=== - Preset search - Mode 1 ===
 +
 +^:info:^This procedure involves the movement of axis and using the zero pulse inputs and enabling zero-pulse transducer.^
 +
 +To the deactivation of the zero-pulse enable transducer input, enables reading of the first zero-pulse provided by the transducer and, on this signal, it loads the preset quota in counting (parameter //posit = prspos//). To To allow the load of the preset quota with “Mode 1”, the card which is attached to the zero-pulse translator must transmit this signal on one of the 8 hardware interrupt lines. Moreover, the device must have been defined to use the same hardware interrupt line (See definition in the file .CNF).\\
 +Subsequently, the axis place at the preset quota, it disable the //st_prson// status and active the //st_prsok// state to signal the end of search; this State remains active until the start of a new process of presets. At the power on of the system //st_prsok// is always to zero. See picture 2. 
 +
 +|Picture 2: loading preset using the enable cam and zero-pulse transducer.|
 +|{{ :software:devices:epicpos:epicpos_08.png?nolink500 |}}|
 +
 +=== - Search preset - Mode 2 ===
 +
 +^:info:^This procedure does NOT provide for the handling of the axis and the use of the zero-pulse transducer enable input.^
 +
 +With this procedure, the preset search does not execute any positioning. The preset quota load command is supply from the activation of the enable input zero encoder and the //st_prsok// state is set to one.\\
 +If the input is a continuous load remains activated while, if at power up the input is already active, the first upload is executed only after its deactivation and activation. 
 +
 +===== - Special functions =====
 +
 +==== - Multi axis management ====
 +
 +In some applications you are prompted to place a large number of axes by moving a single axis at a time. The design choice falls on installing just one drive that depending on the axis to be placed electrically connects the motor interested in positioning; the transducer is always bound to its axis.\\
 +The EANPOS device allows you to control access to the DAC device using the //REGON// and //REGOFF// commands. In this way through the QCL application defines a set of device many axes to be placed; in the definition, all devices use the same DAC resource (//IOutA//).\\
 +Normally all devices must be in the //st_regoff// = 1 state so you will not have access to the DAC device. Before you start positioning, with the //REGON// command, the device is brought to the //st_regoff// = 0 state. Runs the placement and completion,the device is returned in the state of //st_regoff// = 1 with the //REGOFF// command. For no reason two devices simultaneously must be found in the //st_regoff// = 0 state. When the device is placed in the position of //regoff//, the analog output remains fixed at the last voltage value called before the //REGOFF// command.
 +
 +==== - Change quota and counting in motion ====
 +
 +^:tip:^Changing the quota is accepted only if the new position is reached with management in use and if the axis is not already when slowing down to reach the quota previously set.^
 +
 +In some applications you are prompted to define the target quota during placement, according to external events to the device. This means you can also write to the //setpos// parameter with placements occurring.
 +
 +{{:software:devices:epicpos:epicpos_09.png?nolink500|}}
 +
 +When positioning you can also change the value of the //posit// count. This function is usually used when a device must, under special conditions, continue a speed profile for a very long time, that exceeds the time axis takes to reach the limit quota (//maxpos// or //minpos//). 
 +
 +==== - Change speed and moving ramp time ====
 +
 +When positioning it is possible to vary the speed of the axis without affecting the location to get to. This can lead to an increase or a decrease in velocity, even more points with the same placement. This is accomplished with new writing in the //setvel// parameter.
 +
 +{{:software:devices:epicpos:epicpos_10.png?nolink500|}}
 +
 +When positioning can be varied even acceleration/deceleration times. For example, the device can start a placement with a very short ramp and, reached the speed set, the //tacc// parameter is changed and executed a change of speed with a very long ramp.\\
 +For special applications the ramp time can be varied even during a change of speed, in this case the new time is put into execution immediately.
 +
 +{{:software:devices:epicpos:epicpos_11.png?nolink500|}}
 +
 +==== - Delta count ====
 +
 +^:tip:^The command can be sent only if the axis is stopped, condition of st_still = 1.^
 +
 +The device always shows the absolute position of the axis; to execute incremental placements it is necessary to have a tool to subtract or add some value to the count (posit) without introducing errors. The change can also count with a direct writing to the new value in the //posit// parameter.\\
 +Wanting to steal 100 units of measure you can count:\\
 +//Axis:posit// = //Axis:posit - 100//
 +
 +^:info:^The changing of the value of resolution (//cntratio//) or write to the //posit// variable, causes the reset of the remnants of the conversion.^
 +
 +This operation introduces an error because it imposes the location "//posit// = -100", when the axis could have an intermediate position between a unit of measurement and subsequent (example 100.3). This fraction (0.3) is lost and the repetition of these steps will the accumulation of a considerable error.\\
 +The //DELCNT// command, count sum an amount equal to the //delta// parameter without losing the fraction part of the position:\\
 +//Axis:delta = -100//\\
 +//DELCNT Axis//\\
 +The //DELCNT// command may be sent only with stationary axis (//st_still//=1)
 +
 +=== - Example ===
 +
 +Reading the position of the axis is of 2 units and is located at point A. You want to add to the //posit// count three units of measure.\\
 +With the instructions:\\
 +//Axis:posit = Axis:posit + 2//\\
 +the axis takes the new position B.\\
 +With the instructions:\\
 +//Axis:delta = 2//\\
 +//DELCNT Axis//\\
 +C position is reached.
 +
 +{{:software:devices:epicpos:epicpos_12.png?nolink400|}}
 +
 +Note that with the first instructions the axis took a delta less than 3 units and then introduced an error.\\
 +If you need to send //DELCNT// commands in succession, It is convenient to calculate the size to be summed and send once the command; otherwise beware not to send subsequent commands without a read statement on device parameter.
 +
 +=== - Example ===
 +
 +//Axis:delta = 3//\\
 +//DELCNT Axis//\\
 +//WAIT Axis:st_init//\\
 +//Axis:delta = 40//\\
 +//DELCNT Axis//
 +
 +
 +===== - Commands and parameters table =====
 +
 +==== - Symbols used ====
 +
 +The **name** of the parameter, state or command is shown on the left of the table.
 +
 +**R**\\
 +Indicates whether its parameter or state is retentive (upon initialization of the device maintains the previously defined), or the state assumes upon initialization of the device.\\
 +If the device does not need to initialize the field "R" indicates the value that the parameter or state accept at the power up of the card.\\
 +R = Retentive\\
 +0 = Upon initialization of the device the value is forced to zero.\\
 +1 = Upon initialization of the device the value is forced to one.\\
 +- = Upon initialization of the device is presented significant value.
 +
 +**D**\\
 +Indicates **the size of the parameter**.\\
 +F = Flag\\
 +B = Byte\\
 +W = Word\\
 +L = Long\\
 +S = Single Float
 +
 +=== - Conditions ===
 +
 +Are describes all the **conditions necessary for the parameter is considered correct or because the command is accepted**.\\
 +In some cases, limit values are specified for the acceptance of the parameter: If any values outside the limits set, the data is still accepted; therefore appropriate controls of the application must be provided to ensure the proper functioning.\\
 +To execute a command, all the conditions must be met; otherwise the command does not execute.\\
 +
 +**A**\\
 +Indicates the **access mode**.\\
 +R = Read.\\
 +W = Write.\\
 +RW = Read / Write.
 +
 +==== - Commands ====
 +
 +The commands were ranked by decreasing priority. For example, in the case of contemporary //INIT// and //EMRG// commands, is acquired first the //INIT// command.
 +
 +^ Name       ^ Conditions                                                              ^ Description                                                                                                                                                                                                                                                                                                                                                              ^
 +| INIT       | st_init = 0                                                             | **Initialization**\\ Initializing command device.\\ If the device is not initialized does not execute the calculations related to the axis and then sits idle. To power up you can download all parameters in DPR; Subsequently, with the INIT command the axis will be initialized, by performing the calculations only once.\\ Activate the //st_init// state.  |
 +| EMRG       | st_init = 1                                                             | **Emergency**\\ Put the axis in emergency mode, interrupting without deceleration ramp, any ongoing positioning. It also disabled the reaction space of the axis.                                                                                                                                                                                   |
 +| RESUME     | st_init = 1\\ st_emrg = 1                                               | **Resume**\\ Restore of emergency condition of axis; is reenabled the reaction of space.\\ To the acquisition of the start, the axis get again the placement.                                                                                                                                                                                             |
 +| START      | st_init = 1\\ st_regoff = 0\\ st_emrg = 0\\ st_emrg = 0\\ st_still = 1  | **Start**\\ Control the positioning to the setpos quota and //setvel// speed.                                                                                                                                                                                                                                                                                           |
 +| STOP       | st_init = 1\\ st_regoff = 0\\ st_emrg = 0\\ st_cal = 0\\ st_still = 0   | **Stop**\\ Stops any ongoing axis positioning. The axis stopped follows the deceleration ramp in use. The axis remains in reaction to space.                                                                                                                                                                                        |
 +| LOOPON     | st_init = 1                                                             | **Loop ON**\\ Enables the reaction of space axis.\\ The analog output contrast every external action that attempts to move the axis from the position reached (drift, operator, ...). This operation resets any following error //follerr//                                                                                                          |
 +| LOOPOFF    | st_init = 1                                                             | **Loop OFF**\\ Disable the reaction of space axis.\\ The axis can be moved from its position without that the analogue output contrasts the movement.                                                                                                                                                                                                              |
 +| CNTLOCK    | st_init = 1                                                             | **Counter lock**\\ Blocks the acquisition of axis count even if the transducer continues to send signals. At this stage the possible movement of the axis is not detected. Disables loading of presets quota on count.\\ Activates the //st_cntlock// state.                                                                                  |
 +| CNTUNLOCK  | st_init = 1                                                             | **Counter unlock**\\ Unlock the axis count.\\ Resumes reading of the signals sent from the transducer and the counter updating.\\ Disable the //st_cntlock// state.                                                                                                                                                                                |
 +| CNTREV     | st_init = 1                                                             | **Counter reverse**\\ Invert the phases of the transducer inside the card.\\ Viene quindi invertito il senso del conteggio (incremento/decremento).\\ Activates the //st_cntrev// state.                                                                                                                                                                  |
 +| CNTDIR     | st_init = 1                                                             | **Counter direct**\\ The counting of the axis is not reversed.\\ Disable the //st_cntrev// state.                                                                                                                                                                                                                                                                     |
 +| PRESET     | st_init = 1\\ st_regoff = 0\\ st_emrg = 0)\\ st_cal = 0\\ st_still = 1  | **Preset**\\ Start Search presets axis.\\ Preset search procedure is run with the manner set by the prsmode and prsdir parameters. If the preset search is already running, the command performs the reverse search.\\ Activates the //st_prson// state and disable the //st_prsok// state.                                          |
 +| CALON      | st_init = 1                                                             | **Calibration ON**\\ The analog output is used as a voltage source; in this case you cannot use it to position the axis. The output value is settable at will through the //vout// variable.                                                                                                                                              |
 +| CALOFF     | st_init = 1\\ st_cal = 1                                                | **Calibration OFF**\\ The analog output is not manage as voltage generator, so it can be used for managing placements.                                                                                                                                                                                                         |
 +| MANFW      | st_init = 1\\ st_regoff = 0\\ st_prson = 0\\ st_still = 1               | **Manual forward**\\ Controls the forward manual positioning (towards maxpos) at the set speed.                                                                                                                                                                                                                                                                 |
 +| MANBW      | st_init = 1\\ st_regoff = 0\\ st_prson = 0\\ st_still = 1               | **Manual backwar**\\ Controls the backward manual positioning (towards minpos) at the set speed.                                                                                                                                                                                                                                                               |
 +| REGOFF     | st_init = 1\\ st_still = 1                                              | **Regulation ON**\\ Disable the adjustment and upgrading the DAC, and all the movement commands.                                                                                                                                                                                                                                                            |
 +| REGON      | st_init = 1\\ st_regoff = 1                                             | **Regulation OFF**\\ Re enable and updating the DAC, and all the movement commands.                                                                                                                                                                                                                                                            |
 +| DELCNT     | st_init = 1\\ st_still = 1                                              | **Delta counter**\\ This command is accepted only if the axis is stopped; the count (axis position) changes, adding algebraically the value specified in the delta variable.                                                                                                                                                              |
 +
 +==== - Parameters ====
 +
 +^ Name        ^ D  ^ R  ^ A    ^ Conditions                                                                                                                                                                                                                                                                                   ^ Descriptions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ^
 +| cntratio    | L  | R  | R-W  | st_still = 1                                                                                                                                                                                                                                                                                 | **Counter ratio**\\ Defines how the transducer pulses must be multiplied so that the acquisition of movements is expressed in the unit of measure desired. By setting 100000 the count variation is 1 bit per pulse transducer.\\ Valid range: 347 ÷ 400000                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
 +| maxpos      | L  | R  | R-W  | st_still = 1                                                                                                                                                                                                                                                                                 | **Maximum position**\\ Defines the maximum quota reached by the axis; the value set is to be considered also as an upper limit for the introduction of quotas of work. Value expressed in units of measurement (Um).\\ Valid range: -999999 ÷ 999999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
 +| minpos      | L  | R  | R-W  | st_still = 1                                                                                                                                                                                                                                                                                 | **Minimum position**\\ Defines the minimum quota reached by the axis; the set value is considered as the lower limit for the introduction of quotas of work. Value expressed in units of measurement (Um).\\ Valid range: -999999 ÷ 999999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
 +| prspos      | L  | R  | R-W  | st_still = 1                                                                                                                                                                                                                                                                                 | **Preset position**\\ Defines the value that is loaded on the counting with the preset search procedure.\\ Valid range: minpos÷maxpos                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
 +| maxvel      | L  | R  | R-W  | st_still = 1                                                                                                                                                                                                                                                                                 | **Maximum velocity**\\ Defines the maximum axis speed (relative at the analogue reference +/-10V). The input value is per unit of time of speed impostata Velocity unit.\\ Valid range: 0 ÷ 999999 (Um/s or Um/min)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
 +| prsvel      | L  | R  | R-W  | st_still = 1                                                                                                                                                                                                                                                                                 | **Preset velocity**\\ Defines the speed of the axis during the search procedure of presets. The input value is per unit of time of the set speed (Velocity unit).\\ Valid range: 0 ÷ maxvel                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
 +| sprsvel     | L  | R  | R-W  | st_still = 1                                                                                                                                                                                                                                                                                 | **Preset search velocity**\\ In the preset search procedure, defines the speed of the axis in the acquisition phase of zero-pulse. The input value is per unit of time of the set speed (Velocity unit).\\ Valid range: 0 ÷ prsvel                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
 +| toll        | L  | R  | R-W  | st_still = 1                                                                                                                                                                                                                                                                                 | **Tolerance**\\ Defines a count range around the positioning quotas. If the placement ends within this range, it is considered correct. Value expressed in units of measurement (Um).\\ Valid range: -999999 ÷ 999999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
 +| maxfollerr  | L  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Maximum following error**\\ Defines the maximum acceptable deviation between the theoretical position and the actual position of the axis.The input value is expressed in bits transducer multiplied by 4.\\ Valid range: 0 ÷ 2147483648                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
 +| rampmode    | B  | R  | R-W  | if st_still = 1 writing always\\ enable, if st_still = 0 the new\\ value is saved but\\ processed only if the new times\\ of acceleration\\ and deceleration\\ make it possible to reach\\ the set quota.                                                                                 | **Acceleration/deceleration time mode**\\ Used when choosing between acceleration and deceleration ramps equal or differentiated.\\ Allowed values:\\ **0** = equal ramps\\ **1** = differentiated ramps                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
 +| taccdec     | W  | R  | R-W  | if st_still = 1 writing always\\ enable, if st_still = 0 the new\\ value is saved but\\ processed only if the new times\\ of acceleration\\ and deceleration\\ make it possible to reach\\ the set quota.                                                                                | **Acceleration/deceleration time**\\ Is the time required to go from speed 0 to maximum velocity and vice versa; the parameter is used if rampmode = 0. Value expressed in hundredths of a second.\\ Valid range: from 0 to 999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
 +| tacc        | W  | R  | R-W  | if st_still = 1 writing always\\ enable, if st_still = 0 the new\\ value is saved but\\ processed only if the new times\\ of acceleration\\ and deceleration\\ make it possible to reach\\ the set quota.                                                                                                  | **Acceleration time**\\ Defines the time it takes to accelerate from zero-axis (axis stopped) at maximum speed. The input value is expressed in hundredths of a second.\\ Valid range: from 0 to 999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
 +| tdec        | W  | R  | R-W  | if st_still = 1 writing always\\ enable, if st_still = 0 the new\\ value is saved but\\ processed only if the new times\\ allows you to reach\\ the quota set.                                                                                                  | **Deceleration time**\\ Definisce il tempo necessario all'asse per decelerare dalla velocità massima a zero (condition of axis stopped). The input value is expressed in hundredths of a second.\\ Valid range: from 0 to 999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
 +| tinv        | W  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Direction inversion delay**\\ Is used to avoid mechanical stress caused by too rapid reversals of direction of motion. The input value is expressed in hundredths of a second.\\ Valid range: from 0 to 999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
 +| rtype       | B  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Reduction type**\\ **0** = The acceleration and deceleration times remain those of the speed set and is decreased proportionally speed.\\ **1** = Are lowered the values of both acceleration and deceleration times and speed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
 +| stopt       | B  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Stop type**\\ **0** = When is execute the braking ramp, is completed before speeding up and then braking.\\ **1** = Is immediately executed braking                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
 +| toldly      | W  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Tolerance delay**\\ Defines the time between the arrival of the axis in the tolerance range and its status report. Value expressed in hundredths of a second.\\ Valid range: from 0 to 999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
 +| pgain       | W  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Proportional ga**\\ By setting the value 1000, the coefficient is 1.000\\ Is the coefficient that is multiplied against the tracking error produces the proportional portion of control output.\\ Valid range: from 0 to 32767                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
 +| feedfw      | W  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Feed forward**\\ By setting the value 1000, the perecentage is 100%.\\ Is the coefficient percentage multiplied by the speed, generates the feed-forward control output.\\ Valid range: from 0 to 32767                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
 +| integt      | W  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Integral time**\\ Is the time, in milliseconds, that produces the basic integration of tracking error. The integration of that error multiplied by that coefficient generate the integral part of the control output.\\ Valid range: from 0 to 32767                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
 +| derivt      | W  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Derivative time**\\ Is the time, in milliseconds, that produces the derivative coefficien of the following error. The derivation of that error multiplied by that coefficient generate the integral part of the control output.\\ Valid range: from 0 to 32767                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
 +| prsmode     | B  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Preset mode**\\ Defines the type of preset search:\\ **0** = For research enabling zero-pulse, the axis begins the movement in fast mode, meet the cam, reverses direction slowing and, on the face of descent on the cam signal, and load the preset quota.\\ **1** = For research enabling zero-pulse, the axis begins the movement, meet the cam by enabling, reverses the direction and slowly acquires the first zero-pulse (after disabling the cam signal).\\ **2** = Does not activate the search procedure presets with axis movement. The count is updated to the presets quota to the activation of the enabling zero-pulse.  |
 +| prsdir      | B  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Preset direction**\\ Defines the direction of movement of the cam research axis zero pulse enable.\\ **0** = the axis goes forward.\\ **1** = the axle goes backward                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
 +| unitvel     | B  | R  | R-W  | st_still = 1                                                                                                                                                                                                                                                                                 | **Velocity unit**\\ Defines if time unit of speed is expressed in minutes or seconds.\\ **0** = Um/min\\ **1** = Um/sec                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
 +| decpt       | B  | R  | R-W  | st_still = 1                                                                                                                                                                                                                                                                                 | **Decimal point**\\ Defines the accuracy with which you wish to set the presets and view the counts in relation to axis.\\ Valid range: from 0 to 3.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
 +| offset      | W  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Offset**\\ Offset DAC output in bits.\\ Defines the value in bits of the correction concerning the analogue output to compensate for any drift in the system. Value, in bits DAC.\\ Valid range: from -32768 to 32                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
 +| setpos      | L  | R  | R-W  | if st_still = 1 writing\\ always enabled, if st_still\\ = 0 write enabled if\\ new quota can be\\ reached with the same\\ positioning direction.\\ The parameter is altered\\ if execute the search\\ preset with prsmode = 0 or 1.                          | **Setted position**\\ Defines the placement quota reached from the x axis at velocity //setvelx//.\\ Valid range: from minpos to maxpos\\ **N.B.** The value is altered if you command the search presets procedure with prsmode = 0 or 1.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
 +| setvel      | L  | R  | R-W  | if st_still = 1 writing\\ always enabled, if st_still = 0 the new\\ value is stored but\\ processed only if the axis\\ is not decelerating for\\ meet the set quota.\\ The parameter is altered if\\ execute the search preset\\ with prsmode = 0 or 1.  | **Setted velocity**\\ Is the value of positioning speed.\\ Value expressed in Um/s or Um/min.\\ Valid range: 0 ÷ //maxvel//                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
 +| vout        | B  | 0  | R-W  | st_cal = 1                                                                                                                                                                                                                                                                                   | **Volt out**\\ Is the value of the output voltage, expressed in tenths of a volt, to be used in the calibration procedure. Value expressed in tenths of a V.\\ Valid range: -100 ÷ 100                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
 +| vel         | L  | 0  | R    | No                                                                                                                                                                                                                                                                                      | **Velocity**\\Is the value of the instantaneous speed of the axis.\\ Value expressed in Um/s or Um/min.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
 +| frq         | L  | 0  | R    | No                                                                                                                                                                                                                                                                                      | **Frequency**\\ Is the value of the instantaneous frequency of the axis.\\ Value expressed in Hz.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
 +| posit       | L  | R  | R-W  | if st_still = 1 writing\\ always enabled, if st_still = 0\\ il the new\\ value is stored but\\ processed only if the axis\\ is not decelerating for\\ meet the set quota\\ set.                                                                                                        | **Actual position**\\ Is the value of the instantaneous position of the axis. Value expressed in units of measurement (Um).\\ Valid range: -999999 ÷ 999999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
 +| follerr     | L  | 0  | R    | No                                                                                                                                                                                                                                                                                      | **Following error**\\ Is the instantaneous value of the following error.\\ Value expressed in bits transducer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
 +| ffwdreg     | L  | 0  | R    | No                                                                                                                                                                                                                                                                                      | **Feed-forward register**\\ Is the instantaneous value of feed-forward expressed in bits.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
 +| propreg     | L  | 0  | R    | No                                                                                                                                                                                                                                                                                      | **Proportional register**\\ Is the instantaneous value of the proportional register expressed in bits.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
 +| intreg      | L  | 0  | R    | No                                                                                                                                                                                                                                                                                      | **Integral register**\\ Is the instantaneous value of integral register expressed in bits.\\ Valid range: 0 ÷ 1024                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
 +| derreg      | L  | 0  | R    | No                                                                                                                                                                                                                                                                                      | **Derivative register**\\ Is the instantaneous value of the register derivative expressed in bits.\\ Valid range: 0 ÷ 1024                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
 +| delta       | L  | R  | R-W  | No                                                                                                                                                                                                                                                                                      | **Delta counter**\\ Is the value that is added to the count when sending a DELCNT command. Value expressed in units of measurement(Um).\\ Valid range: -999999 ÷ 999999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
 +
 +==== - States ====
 +
 +^ Name        ^ D  ^ R  ^ A  ^ Conditions  ^ Description                                                                                                                                                                                                                                                               ^
 +| st_init     | F  | 0  | R  | No     | **Initialization**\\ Reporting of device initialized\\ **0** = device is not initialized.\\ **1** = device inizialized.                                                                                                                                             |
 +| st_emrg     | F  | 0  | R  | No     | **Emergency**\\ Emergency signaling axis.\\ **0** = axis not in emergency.\\ **1** = axis in emergency                                                                                                                                                           |
 +| st_toll     | F  | 0  | R  | No     | **Tolerance**\\ Reporting of axis in tolerance in relation to the quota put running from the START command. Signaling axis in tolerance may be delayed with toldly parameter.\\ **0** = axis not in tolerance.\\ **1** = axis in tolerance.  |
 +| st_prsok    | F  | 0  | R  | No     | **Preset Ok**\\ Reporting of preset search procedure OK..\\ **0** = preset search not execute.\\ **1** = preset search execute.  |
 +| st_still    | F  | 1  | R  | No     | **Still**\\ Signalling of stopped axis.\\ **0** = axis moving.\\ **1** = axis stopped.                                                                                                                                                                                |
 +| st_prson    | F  | 0  | R  | No     | **Preset ON**\\ Reporting of research ongoing axis preset\\ **0** = preset search not in progress.\\ **1** = preset search in progress.                                                                                                                           |
 +| st_movdir   | F  | 0  | R  | No     | **Movement direction**\\ Indication of direction of movement.\\ **0** = forward.\\ **1** = backward                                                                                                                                                                 |
 +| st_loopon   | F  | 0  | R  | No     | **Loop ON**\\ Reporting of axis in reaction to space.\\ **0** = axis not in reaction to space.\\ **1** = axis in reaction to space.                                                                                                                                 |
 +| st_foller   | F  | 0  | R  | No     | **Following error**\\ Axis following error signal (withholding 500 ms).\\ **0** = axis not in following error.\\ **1** = axis in following error.                                                                                           |
 +| st_regoff   | F  | 0  | R  | No     | **Regulation**\\ Indicates that the adjustment is disabled and that upgrading the DAC is not execute.\\ **0** = adjustment enabled.\\ **1** = adjustment disabled.                                                                                       |
 +| st_cal      | F  | 0  | R  | No     | **Calibration**\\ Reporting of axis as voltage generator\\ **0** = voltage source off\\ **1** = voltage source on.                                                                                                         |
 +| st_cntlock  | F  | R  | R  | No     | **Counter locked**\\ Reporting of axis blocked\\ **0** = axis count unlocked\\ **1** = axis count blocked.                                                                                                                                                  |
 +| st_cntrev   | F  | R  | R  | No     | **Counter reversed**\\ Inverted axis count report\\ **0** = Axis count not inverted.\\ **1** = Axis count inverted.                                                                                                                               |
 +
 +
 +===== - Limitations =====
 +
 +  * The //setvel// parameter can be written only if the axis is in constant speed
 +  * The //rampm//, //tacc//, //tdec// and //taccdec// parameters can be written only if the axis is at constant speed; otherwise, the new value will be processed only when building the next ramp whose time is changed.
 +
 +
 +===== - Application example =====
 +
 +==== - Configuration file ====
 +
 +<code QCL>
 +;*************************************************************************************
 +; Module Name: Ex_Epic.CNF                    Progject: Ex_EPICPOS
 +; Autor: QEM srl                              Date: 01/05/99
 +; System: QMove1 / QCL3                       Library: 1LIB3B04
 +; Functionality: Manage EPICPOS example       Release: 0
 +;------------------------------------- Note ------------------------------------------
 +; [1] - Sample application using device EPICPOS
 +;*************************************************************************************
 +
 +;-------------------------------------------------------------------------------------
 +; Constants definition
 +;-------------------------------------------------------------------------------------
 +CONST
 +
 +;-------------------------------------------------------------------------------------
 +; Variable Definition SYSTEM
 +;-------------------------------------------------------------------------------------
 +SYSTEM
 +slQuotaPos    L                               ;Variable for placement quota
 +slVelAsse                                   ;Variable for axis speed
 +
 +;-------------------------------------------------------------------------------------
 +; Variable Definition GLOBAL
 +;-------------------------------------------------------------------------------------
 +GLOBAL
 +gfMovMan      F                               ;Flag signaling ongoing
 +                                              ;manual movements
 +gfMovAuto                                   ;Flag signaling ongoing
 +                                              ;automatic movements
 +
 +;-------------------------------------------------------------------------------------
 +; Variable Definition TIMER
 +;-------------------------------------------------------------------------------------
 +TIMER
 +
 +;-------------------------------------------------------------------------------------
 +; DATAGROUP Definition
 +;-------------------------------------------------------------------------------------
 +;DATAGROUP
 +
 +;-------------------------------------------------------------------------------------
 +;Bus Configuration
 +;-------------------------------------------------------------------------------------
 +BUS
 +      1   1CPUB      02
 +      2   1MIXA      00
 +      3   .
 +      4   .
 +
 +;-------------------------------------------------------------------------------------
 +; Variable Definition INPUT
 +;-------------------------------------------------------------------------------------
 +INPUT
 +ifAvMan         2.INP01                     ;Forward manual input
 +ifInMan         2.INP02                     ;Backward manual input
 +ifStart         2.INP03                     ;START axis input
 +ifStop        F   2.INP04                     ;STOP axis input
 +
 +;-------------------------------------------------------------------------------------
 +; Variable Definition OUTPUT
 +;-------------------------------------------------------------------------------------
 +OUTPUT
 +ofToll        F   2.OUT01                     ;output axis in tolerance
 +ofAxeFermo    F   2.OUT02                     ;output axis in stopped
 +
 +;-------------------------------------------------------------------------------------
 +; Internal device declaration
 +;-------------------------------------------------------------------------------------
 +INTDEVICE
 +;Name   Type     TCamp    Counter    Inter    AbilZero   OutAnal
 +Axis    EPICPOS  0004     2.CNT01           2.INP01    2.AN01
 +
 +END
 +</code>
 +
 +==== - EPICPOS management ====
 +
 +<code QCL>
 +;-------------------------------------------------------------------------------------
 +; File Name  : TASK_00.MOD
 +; Project    : EX_EPICPOS
 +; Description: Positioning Management
 +;-------------------------------------------------------------------------------------
 +
 +;-------------------------------------------------------------------------------------
 +; Initialization work Axis
 +;-------------------------------------------------------------------------------------
 +
 +Axis:cntratio = 100000                       ;Encoder resolution = space in 1 round
 +                                             ;encoder(Um) / pulse for 1 round encoder
 +Axis:maxvel = 100000                         ;Maximum speed = Axis speed with
 +                                             ;analog output to 10V (CALON / vout=100)
 +Axis:maxpos = 999999                         ;Maximum quota
 +Axis:minpos = -999999                        ;Minimum quota
 +Axis:maxfollerr = 10000                      ;Following error
 +Axis:unitvel= 0                              ;Unit time speed
 +Axis:decpt = 0                               ;Decimal digits
 +Axis:rampmode = 0                            ;Ramps type used
 +Axis:taccdec = 100                           ;Acceleration and deceleration time
 +Axis:tacc = 0                                ;Acceleration time (not used)
 +Axis:tdec = 0                                ;Deceleration time (not used)
 +Axis:tinv = 0                                ;Inversion time Axis
 +Axis:toll = 5                                ;Tolerance
 +Axis:toldly = 10                             ;Delay time reporting
 +                                             ;tolerance
 +Axis:rtype = 1                               ;Reduction type profile
 +Axis:stopt = 1                               ;Type of stop
 +Axis:prsmode = 0                             ;Type of preset search
 +Axis:prspos = 0                              ;Preset quota
 +Axis:prsdir = 0                              ;Preset search direction
 +Axis:prsvel = (20 * Axis:maxvel)/100         ;Preset speed (20% of the maximum speed)
 +Axis:sprsvel = (10 * Axis:maxvel)/100        ;Search speed zero pulse
 +                                             ;(10% of the maximum speed)
 +Axis:offset = 0                              ;Offset voltage
 +Axis:pgain = 10                              ;Proportional gain
 +Axis:feedfw = 1000                           ;Feedforward
 +Axis:integt = 0                              ;Integral time
 +Axis:derivt = 0                              ;Derivative time
 +INIT Axis                                    ;Initializes the device
 +WAIT Axis:st_init                            ;Wait until the device is initialized
 +CNTUNLOCK Axis                               ;Unlock count
 +WAIT NOT Axis:st_cntlock                     ;Wait until the count is unlocked
 +CNTDIR Axis                                  ;Sets the direction of the count
 +WAIT NOT Axis:st_cntrev                      ;Wait until it has the sense of
 +                                             ;count
 +REGON Axis                                   ;Enable the adjutment
 +WAIT NOT Axis:st_regoff                      ;Wait for enabling adjustment
 +RESUME Axis                                  ;Remove the axis from the emergency state
 +WAIT NOT Axis:st_emrg                        ;Wait for theaxis is not in emergency
 +LOOPON Axis                                  ;Hook the loop of axis reaction
 +WAIT Axis:st_loopon                          ;Wait that is hooked on loop
 +                                             ;axis reaction
 +IF (slVelAxis EQ 0)                          ;In case the set of speed
 +                                             ;the axle is zero
 +  slVelAxis = 50                             ;Sets a positioning speed
 +ENDIF
 +IF (slQuotaPos EQ 0)                         ;In the event that the placement quota
 +                                             ;of the axis is zero
 +  slQuotaPos = 2000                          ;Sets a quota of positioning
 +ENDIF
 +
 +;-------------------------------------------------------------------------------------
 +; Positioning operations
 +; --------------------------------- variables used -----------------------------------
 +; slVelAxis: Adjustable variable that represents the speed of the axis
 +; (expressed in % of the maximum speed)
 +; slQuotaPos: Adjustable variable that represents the quota of axis positioning
 +; ----------------------------------- flag sed ---------------------------------------
 +; gfMovMan: Manual operation in progress
 +; gfMovAuto: Automatic movement in progress
 +;-------------------------------------------------------------------------------------
 +MAIN:
 +
 +;-------------------------------------------------------------------------------------
 +; Managing outputs
 +;-------------------------------------------------------------------------------------
 +ofToll = Axis:st_toll                         ;Forced out of tolerance as the
 +                                              ;tolerance state
 +ofAxisStopped = Axis:st_still                 ;Set the axis output stopped as the state of
 +Axis stopped
 +
 +;-------------------------------------------------------------------------------------
 +; Managing automatic movements
 +;-------------------------------------------------------------------------------------
 +IF ifStart                                    ;Waits for the START input
 +  IF NOT gfMovMan                             ;Check that there are no manual
 +                                              ;movements
 +    IF Axis:st_still                          ;Check that the axis is stopped
 +      Axis:setvel=(slVelAxis*Axis:maxvel)/100 ;Sets the speed of the axis
 +      Axis:setpos = slQuotaPos                ;Sets the placement quota
 +      START Axis                              ;Execute the start of the axis
 +      gfMovAuto = 1                           ;Automatic movement in progress reports
 +    ENDIF
 +  ENDIF
 +ENDIF
 +
 +IF ifStop                                     ;Waits for the STOP input
 +  IF NOT Axis:st_still                        ;Check that the axis is not stationary
 +    STOP Axis                                 ;Execute the stop of the Axis
 +  ENDIF
 +ENDIF
 +
 +IF gfMovAuto                                  ;Check reporting ongoing
 +                                              ;automatic movement
 +  IF Axis:st_still                            ;Check that the axis is stopped
 +    gfMovAuto = 0                             ;Resets the status of automatic movement
 +  ENDIF
 +ENDIF
 +
 +;-------------------------------------------------------------------------------------
 +; Management manual movements
 +;-------------------------------------------------------------------------------------
 +IF ifAvMan                                    ;Awaiting the input of manual operation
 +  IF NOT (gfMovAuto OR gfMovMan)              ;Check that there are no movements
 +                                              ;automatic or manual
 +    IF Axis:st_still                          ;Check that the axis is stopped
 +      Axis:setvel=(slVelAxis*Axis:maxvel)/100 ;Sets the speed of the axis
 +      MANFW Axis                              ;Forward axis in manual
 +      gfMovMan = 1                            ;Manual movement in progress reports
 +    ENDIF
 +  ENDIF
 +ENDIF
 +IF ifInMan                                    ;Awaiting the input of manual operation
 +  IF NOT (gfMovAuto OR gfMovMan)              ;Check that there are no movements
 +                                              ;automatic or manual
 +    IF Axis:st_still                          ;Check that the axis is stopped
 +      Axis:setvel=(slVelAxis*Axis:maxvel)/100 ;Sets the speed of the axis
 +      MANBW Axis                              ;Forward axis in manual
 +      gfMovMan = 1                            ;Manual movement in progress reports
 +    ENDIF
 +  ENDIF
 +ENDIF
 +IF gfMovMan                                   ;If the axis moves in manual
 +  IF NOT (ifAvMan OR ifInMan)                 ;If the forward or backward inputs
 +                                              ;manual are OFF
 +    STOP Axis                                 ;Stop the axis
 +    gfMovMan = 0                              ;Remove the manual movement
 +                                              ;axis report
 +  ENDIF
 +ENDIF
 +
 +;-------------------------------------------------------------------------------------
 +; Final operations
 +;-------------------------------------------------------------------------------------
 +  WAIT 1
 +  JUMP MAIN
 +  
 +END
 +</code>
 +