This opcode allows defining a trigger for dynamic measurement.
Overview
Opcode: 0x30
Name: opcDT
Function: Define Trigger
Parameter type: String
DLL-Function
Request string to the Irinos-System
#{Trigger number};{Type};{Source};{Scaling factor};{Distance};{Start};{End}#
Trigger number
Number of the trigger. Two independent triggers can be defines. Permissible values are 1 and 2.
Type
T for Time-Trigger
P for Position-Trigger
Source
Position-triggered measurement: Name of the trigger channel (e.g. T7)
Time-triggered measurement: Unused. Use the character * as Source.
Scaling factor
Position-triggered measurement: Floating point value to convert the measurement value of the Trigger-Source into a physical unit, e.g. µm or °. This allows using physical units for the following parameters Distance, Start and End.
Use a scaling factor of 1 to use the measurement value unit (-> increments or digits).
The scaling factor can also be -1 in order to change the sign.
Time-triggered measurement: Unused. Always use the value 1.
Distance
Position-triggered measurement: Distance between 2 trigger-positions (floating point value). E.g. 1°.
Time-triggered measurement: Time period between two sample in ms, e.g. 0.1 for 100µs or 1 for 1ms.
The time-period must be a multiple of the sample periods of the Irinos-Boxes involved. The minimum value is 0.1 (=100 µs).
Most Irinos-Boxes have an internal sample period of 50µs. Thus valid values are for example 0.1, 0.25, 0.85, 1, 1.5, 12, etc.
Start
Position-triggered measurement: The measurement starts after this value has been exceeded (floating point value).
Time-triggered measurement: Delay until the start of the dynamic measurement in ms (floating point value).
End
Position-triggered measurement: The measurement will end, if this value is exceeded (floating point value). This also applied, if the maximum number of dynamic measurement values has not been reached yet.
Alternatively the character * can be used for this parameter. The dynamic measurement will then be active, until the maximum number of dynamic measurement values has been reached (or until it is stopped manually).
Time-triggered measurement: Duration of the dynamic measurement in ms (since start). It is recommended not to use an end-value by writing the character * into this parameter. A time-triggered measurement should be limited by the maximum number of measurement values as defined for the dynamic measurement (see opcDDMx).
Response string from the Irinos-System
#0# Success
#-n# Invalid parameter no n
#-99# General syntax error of the request string
Example parameter strings for position controlled measurement
#1;P;T2;20.0;0.1;50.0;*#
This string defines Trigger No. 1 as position-based. The position is taken from measurement channel T2, which could be for example the incremental encoder 2.
The binary measurement value (increments) must be divided by 20.0 to get the position value in mm.
The trigger shall occur 10 times / mm (every 0.1mm) and the first trigger-pulse shall be generated at the position 50.0mm (-> first values are sampled at 50.0mm).
No end is defined. Instead the character * tells the Irinos-System that the end-parameter is not used.
#2;P;T17;-1.0;10.0;0.0;3600.0#
This string defines Trigger No. 2 as position-based. The position is taken from measurement channel T17 (for example an incremental encoder with 3600 increments / rotation).
The measurement value of T17 shall not be converted to a physical unit. However, the measurement shall be performed into the negative direction. Therefore the sign is negated by the negative scale factor -1.0.
The trigger shall occur every 10 increments, which equals 1°-steps. The first pulse starts at 0 increments (= 0°). After 3600 increments (= 360°) the dynamic measurement shall be stopped.
Examples for time-triggered measurement
#2;T;*;1.0;1.0;0.0;*#
This string defines Trigger No. 2 as time-based. The sample period is 1.0ms, which equals 1 kSamples/s.
The dynamic measurement shall be started immediately (0.0ms).
Since no end value is used (character *), the dynamic measurement runs until the defined number of measurement values has been recorded (see opcDDMx) or until it is stopped manually via one of the opcodes opcIT or opcDDMx.
#1;T;*;1.0;0.2;500.0;*#
This string defines Trigger No. 1 as time-based. The sample period is 0.2ms, which equals 5 kSamples/s.
The start of the dynamic measurement shall be delayed by 500.0ms.
Since no end value is used (character *), the dynamic measurement runs until the defined number of measurement values has been recorded (see opcDDMx) or until it is stopped manually via one of the opcodes opcIT or opcDDMx.
Comments
If a Position-Trigger is used, the values for scale, distance, start and end can be negative. For a Time-Trigger, these can only be positive.
It is possible to define an end-value for the trigger. The number of sampled measurement values is defined by the opcode opcDDMx. If an end-point is defined, the dynamic measurement will be stopped automatically, if the end point is reached. This can lead to problems, if a defined number of samples is expected and the trigger has stopped the dynamic measurement before. In this case the defined number of samples will never be reached. Hence it is recommended to define either a end-value for a trigger OR a defined number of samples for the dynamic measurement.
A copy of the trigger configuration is made at the start of a dynamic measurement. If the trigger configuration is changed, this has no effect on an active dynamic measurement. It will become effective at the start of the next dynamic measurement.
Typically a separate trigger is used for each dynamic measurement (e.g. trigger 1 for dynamic measurement 1 and trigger 2 for dynamic measurement 2). Nevertheless, it is possible to use the same trigger for both dynamic measurements.