The Edit Controls: the actual position, actual velocity, and command velocity
After we get the actual position and actual velocity, we need to display them. In the sample, we use two Edit Controls to do this. First we declare the CString variable ReadStr, and then write the value of actual position and actual velocity into ReadStr. We then use SetWindowText to show the value in the Edit Control.
CString ReadStr;
ReadStr.Format(_T("%d"), PositionValue[Mindex]);
GetDlgItem(IDC_ACT_POS)->SetWindowText(ReadStr);
ReadStr.Format(_T("%d"), VelocityValue[Mindex]);
GetDlgItem(IDC_ACT_VEL)->SetWindowText(ReadStr);
The command velocity is controlled by the variable m_CMD_VEL, which is the velocity of the jog motion. The default value is 10000. This value can be changed to meet your needs. We use the DDX_Text function to deliver the input value to IDC_CMD_VEL
, which is the Edit Control of Command Velocity, and use DDV_MinMaxDouble to limit the range of the input value.
m_CMD_VEL(10000)
DDX_Text(pDX, IDC_CMD_VEL, m_CMD_VEL);
DDV_MinMaxDouble(pDX, m_CMD_VEL, -1000000000, 1000000000);