Supported platforms: CODESYS 2.3, CODESYS 3.5
JCD_Pedal function block is used for a basic pedal. It includes functionality for calibrating, progression and diagnostics.
FB uses:
JCD_CompensatedVoltages to adjust pedal calibration voltages to apply with supply voltage.
JCD_Scale to scale (calibrate) the analog input value to the control signal value. Dead band is included in scaling.
JCD_Progression to change the curve shape of the scaled and filtered control signal. If Progression is set to zero, the function is not called.
JCD_ParamCheck to check that calibration parameters, dead band, progression and samples parameters are within the valid range and that calibration values increase logically: Maximum > minimum.
If i_Enable is inactive or in case of a parameter error or AI Voltage error, the control signal is set to zero. Controlling is disabled, until the error is fixed and the joystick has been centered (AI value has been within dead band range). This prevents unexpected control of movement after power on or error situation.
Calibration has 2 operation modes: - Voltage mode: Input parameters are given in volts and pedal supply voltage is not compensated. - Percentage mode: Input parameters are given in percentage of pedal supply voltage. Due to that, changes in pedal supply voltage are compensated. |
In voltage mode ( i_ParameterType = G_JCType.Voltage), both output and input calibration parameters are handled as volts (1000 = 10,00V). In percentage mode ( i_ParameterType = G_JCType.Percentage), both output and input calibration parameters are handled as proportion (1000 = 100,0%) of pedal supply voltage. |
Joystick and pedal must be connected to voltage input. |
When i_ParameterType = G_JCType.Voltage and voltage values are used for pedal calibration, there is a reference voltage monitoring feature built in to detect drop of reference voltage level. In such case, o_Control signal output is reset and can be used again after rising edge of i_Enable. This monitoring feature can however detect only sudden drop of ref voltage level. |
It is highly recommended to set i_ParameterType to G_JCType.Percentage and to use percentage values for pedal calibration. This ensures that unexpected dropping of reference voltage level doesn’t cause o_ControlSignal output changing and unwanted response in controlled actuator. |
Input variable name |
Data type |
Range |
Description |
i_Enable |
BOOL |
FALSE/TRUE |
Enables controlling of o_ControlSignal output |
i_AISignal |
UINT |
Hardware specific |
Analog input signal |
i_AIType |
BYTE |
0..G_ADScaleArrMax |
Analog input type and range |
i_AISupply |
UINT |
Hardware specific |
Pedal supply voltage measurement. |
i_AISupplyType |
BYTE |
0..G_ADScaleArrMax |
Pedal supply voltage type and range. |
i_ParameterType |
BYTE |
G_JCType.Percentage, G_JCType.Voltage |
G_JCType.Voltage: No voltage compensation, calibrated values are in volts. G_JCType.Percentage: Voltage compensation is in use. Calibrated values are percentage of supply voltage. |
i_CalibratedMax |
UINT |
Hardware and calibration type specific |
Maximum calibration value of joystick. Value is given in voltage (1000 = 10,00V) or percentage (1000 = 100,0%), range depends on used hardware type. |
i_CalibratedMin |
UINT |
Hardware and calibration type specific |
Minimum calibration value of joystick. Value is given in voltage (1000 = 10,00V) or percentage (1000 = 100,0%), range depends on used hardware type. |
i_Deadband |
BYTE
|
0…100%
|
Dead band of pedal, value given in percentage of max-min range. |
i_Progression |
SINT |
-100…100 |
Progression curve factor |
i_AIErrorTolerance |
INT |
-1, 0…250 or -1, 0…500 depending on calibration type |
Defines how many volts AI signal is allowed to be out of calibrated range. Value is given in voltage (250 = 2,50V) or percentage of supply voltage (500 = 50,0%), range depends on selected value type. With value -1, diagnostics is not used. |
i_ErrorDelay |
UINT |
0…65535 ms |
The time that AI signal is allowed to exceed tolerated range before error outputs are activated. |
Input variable name |
Data type |
Range |
Description |
i_Enable |
BOOL |
FALSE/TRUE |
Enables controlling of o_ControlSignal output |
i_AISignal |
UINT |
Hardware specific |
Analog input signal |
i_AIType |
ADData |
G_AIType struct |
Analog input type and range |
i_AISupply |
UINT |
Hardware specific |
Pedal supply voltage measurement. |
i_AISupplyType |
ADData |
G_AIType struct
|
Pedal supply voltage type and range. |
i_ParameterType |
BYTE |
G_JCType.Percentage, G_JCType.Voltage |
G_JCType.Voltage: No voltage compensation, calibrated values are in volts. G_JCType.Percentage: Voltage compensation is in use. Calibrated values are percentage of supply voltage. |
i_CalibratedMax |
UINT |
Hardware and calibration type specific |
Maximum calibration value of joystick. Value is given in voltage (1000 = 10,00V) or percentage (1000 = 100,0%), range depends on used hardware type. |
i_CalibratedMin |
UINT |
Hardware and calibration type specific |
Minimum calibration value of joystick. Value is given in voltage (1000 = 10,00V) or percentage (1000 = 100,0%), range depends on used hardware type. |
i_Deadband |
BYTE
|
0…100%
|
Dead band of pedal, value given in percentage of max-min range. |
i_Progression |
SINT |
-100…100 |
Progression curve factor |
i_AIErrorTolerance |
INT |
-1, 0…250 or -1, 0…500 depending on calibration type |
Defines how many volts AI signal is allowed to be out of calibrated range. Value is given in voltage (250 = 2,50V) or percentage of supply voltage (500 = 50,0%), range depends on selected value type. With value -1, diagnostics is not used. |
i_ErrorDelay |
UINT |
0…65535 ms |
The time that AI signal is allowed to exceed tolerated range before error outputs are activated. |
Output variable name |
Data type |
Range |
Description |
o_ControlSignal |
INT |
0..32767 |
Calibrated control signal value |
o_AISignalTooHigh |
BOOL |
FALSE/TRUE |
AI signal input value is higher than maximum tolerated value |
o_AISignalTooLow |
BOOL |
FALSE/TRUE |
AI signal input value is lower than minimum tolerated value |
o_ParameterError |
BOOL |
FALSE/TRUE |
True when incorrect parameter value in any of the monitored parameters. |
Source file Topic000358.htm
Last updated 21-Feb-2025