Download Register description

Transcript
JetMove 2xx at the JetControl
15.6 Sample Program "Length Measurement"
// Basic configuration of the conveyor belt axis:
// The axis is set as a linear modulo axis; i.e. it is an endless axis
// of the positioning unit mm.
//
//
// Example of Modulo Setting:
JM_Axis.Ax_nm_AxisType:= cn_Ax_AxisType_Lin;
JM_Axis.Ax_nm_ModuloAxis := cn_Ax_ModuloAxis_Yes;
JM_Axis.Ax_fm_GearRatioMotor := 4;
// Gear Ratio - Motor
JM_Axis.Ax_fm_GearRatioLoad := 1;
// Gear Ratio - Mechanism
// Linear / Rotation Ratio:
// e.g. 30 mm, i.e. one revolution of the gearbox results in a linear
// motion of 30 mm.
JM_Axis.Ax_fm_LeadScrewPitch :=30;
JM_Axis.Ax_fm_TravelPosMin := 0;
// Travel Limit - Negative:
JM_Axis.Ax_fm_TravelPosMax := 10000;
// Travel Limit - Positive:
...
// Setting up the "Position Capture" function:
// Deactivate the capture function:
JM_Axis.DI_nm_CapCmdClr := 0x10E;
When Bit_Clear (JM_Axis.JM_nm_State, cb_State_Busy) Continue;
...
Process
...
// Cycle: Measure the length of the
packet
While True Do
// Set the polarity of the digital input INPUT to 24 V = logical 1.
// This means that the rising edge will trigger the Capture event.
JM_Axis.DI_nm_CapEdge := 0x0100;
// Activate the "Position Capture" function (R513.Bit8 = 0 is set):
JM_Axis.DI_nm_CapCmdSet := 0x0100;
// Wait, until the Capture event takes place:
When Bit_Set(JM_Axis.DI_nm_CapStatus, 8) Continue;
// Temporarily store the first capture position value in a floating// point register.
CapPos := JM_Axis.DI_fm_CapPosInt;
// Set the polarity of the digital input INPUT to 0 V = logical 1.
// This means that the falling edge will trigger the Capture event.
JM_Axis.DI_nm_CapEdge := 0x0000;
// Activate the "Position Capture" function (R513.Bit8 = 0 is set):
JM_Axis.DI_nm_CapCmdSet := 0x0100;
// Wait, until the Capture event takes place:
When Bit_Set(JM_Axis.DI_nm_CapStatus, 8) Continue;
// Calculate the length:
// Check for position overflow
If JM_Axis.DI_fm_CapPosInt > CapPos Then
//
No position overflow.
Length = JM_Axis.DI_fm_CapPosInt - CapPos;
ELSE
//
Position overflow:
//
Calculate the difference between the positive maximum
//
position and the latest measuring.
Overflow1 := JM_Axis.Ax_fm_TravelPosMax - REG CapPos;
Jetter AG
331