You are here:
Print

The reference from an analog input can have values from 0 to 65535, or from -32768 to +32767. Depending on the position feedback resolution,  this range can be insufficient, e.g. for a rotary incremental encoder with 2000 lines per revolution the analog input range corresponds to  +/- 4.096 rotations.

The workaround for this limitation is using a TML program that reads the analog input and then scales it as required (while in the automated mode the reference is limited to 16 bit, in TML we can increase it to 32 bit).

Attached to this article are some TML code sequences (inside the “Analog reference scaling to a 32-bits position or speed reference” ZIP archive) which read the analog reference (0V … 5V) and scale it to a position or to a speed command. The programs can be customized as follows:

1. iPOS drives – Read the position command from the analog reference input
– “max_no_counts” from the group named “Variables initialization sequence”. It specifies the maximum position reference value when the analog reference is at a maximum. The “max_no_counts” is expressed in encoder counts, i.e. internal units (IU)
– “VARFIL_ADR” and “VARFIL_CFG” from the group named “Variables initialization sequence” are related to the 1st order filter that is applied to the AD5 variable (the output of the analog to digital convertor connected to the drive Reference analog input). “VARFIL_ADR” should contain the address of the variable that needs to be filtered (AD5 in this case) while the “VARFIL_CFG” contains the filtration level (a value between 0 and 32767, where 0 means total attenuation and 32767 means no filtering at all) that can be modified by the user according to the application requirements. For more details see the related article (“Variables initialization sequence”).
– the acceleration and speed used during the movement can be set from the group named “Set the position profile”.

2. iPOS drives – Read the speed command from the analog reference input
– “max_speed” from the group named “Variables initialization“. It specifies the maximum speed reference value when the analog reference is at a maximum. The “max_speed” is expressed in encoder counts per. slow loop sampling period, i.e. internal units (IU).
– with “DeadBandPoint” and “DeadBandRange“, from the group named “Variables initialization”,  you define a dead band in which the analogue reference is kept constant, equal with value corresponding to the “Dead band point”. The limits of the dead band interval are set by positive and negative values of “Dead band range” parameter. The DeadBandPoint can have a value between 0 and 4096, where 0 corresponds to an analog signal of 0V and 4096 to an analog signal of 5V.
– “VARFIL_ADR” and “VARFIL_CFG” from the group named “Variables initialization” are related to the 1st order filter that is applied to the AD5 variable (the output of the analog to digital convertor connected to the drive REFERENCE analog input). “VARFIL_ADR” should contain the address of the variable that needs to be filtered (AD5 in this case) while the “VARFIL_CFG” contains the filtration level (a value between 0 and 32767, where 0 means total attenuation and 32767 means no filtering at all) that can be modified by the user according to the application requirements. For more details see the related article (“Variables initialization sequence”).
– the acceleration used during the movement can be set from the group named “Set the motion profile and the initial parameters”.

3. Others drives – Read the position command from the analog reference input
– max_no_counts from the group named “Variables initialization”. It specifies the maximum position reference value when the analog reference is at a maximum. The max_no_counts is expressed in encoder counts, i.e. internal units (IU).
– filter, from the group named “Variables initialization”, represent the filtration level used by the 1st order filter that applies to the AD5 variable, in which is read the analog signal. It can have a value between 0 and 1, where 0 means total attenuation and 1 means no filtering at all.
– the accelerationand speed used during the movement can be set from the group named “Set motion profile”.

4. Others drives – Read the speed command from the analog reference input
– “max_speed” from the group named “Variables initialization“. It specifies the maximum speed reference value when the analog reference is at a maximum. The “max_speed” is expressed in encoder counts per. slow loop sampling period, i.e. internal units (IU).
– with “DeadBandPoint” and “DeadBandRange“, from the group named “Variables initialization”,  you define a dead band in which the analogue reference is kept constant, equal with value corresponding to the “Dead band point”. The limits of the dead band interval are set by positive and negative values of “Dead band range” parameter. The DeadBandPoint can have a value between 0 and 4096, where 0 corresponds to an analog signal of 0V and 4096 to an analog signal of 5V.
– filter, from the group named “Variables initialization”, represent the filtration level used by the 1st order filter that applies to the AD5 variable, in which is read the analog signal. It can have a value between 0 and 1, where 0 means total attenuation and 1 means no filtering at all.
– the acceleration used during the movement can be set from the group named “Set motion profile”.

The titles above will be founded in the attached archive as ” * .msq ” files. To import them in your project you need first to restre the ZIP archive content to your PC and then to open your project and to select the “Import” button form the “Project” window (see the picture below).

Remark: After you will press the “Import” button a dialog will open, requesting you to browse for the needed  ” * .msq ” file and select it. Select the need file and press OK. The code inside the ” * .msq ” file will be imported to your project. For details, see the picture below.

Demo-Homing-to-the-positive-mechanical-limit.m.zip
Previous General purpose low pass filter
Next How to stop the motor vibrations at motion complete