<< Click to Display Table of Contents >> Navigation: NmxDLL Referenz > API (programming interface) > Miscellaneous > NMX_ChannelSetParameter_1 |
This function allows changing a channels parameters during operation. The parameters depend on the measurement channel type. It is used for selected measurement channels, e.g. for incremental encoders.
Definition
NMX_STATUS NMX_ChannelSetParameter_1(
NMX_PHANDLE pHandle,
unsigned long ulChannelNo,
char* pcStringTx, unsigned long ulSizeofTxString,
char* pcStringRx, unsigned long ulMaxSizeofRxString, unsigned long* pulSizeofRxString);
Parameter
pHandle
ulChannelNo
Number of the measurement channel.
The first channel has the number 0.
Having a device with 8 measurement channels, these are numbered 0..7.
pcStringTx
ASCII-encoded string, which shall be send to the device.
ulSizeofTxString
Size of pcStringTx in characters/bytes.
pcStringRx
Buffer for the response-string, which is received from the device.
ulMaxSizeofRxString
Size of the buffer pcStringRx in characters/bytes.
pulSizeofRxString
Length of the response-string, which has been received from the devices.
Typical function call (C example)
char acStrTx[] = "#0;REFOFF#";
NMX_ChannelSetParameter_1(pHandleNmx, 2, acStrTx, strlen(acStrTx), acStrRx, sizeof(acStrRx), &ulRxSize);
Strings, which can be sent to incremental en-/decoder channels
#{Position};{Reference index on/off}#
Position
•New position value for this measurement channel. This allows setting the position of the measurement channel.
•* if the position of the measurement channel shall not be changed. This is required, if only the reference index shall be turned on or off.
•~ in order to reset the gain- and offset-control of the measurement channel. The position value will be reset to 0. This makes only sense for 1Vpp channels.
Reference index on/off
Permissible parameter values:
•REFON to enable the reference index.
In addition, the statusbit "Refmark" (see HardwareStatus) will be enabled now, if the reference index is crossed.
•REFOFF to disable the reference index.
If the reference index is enabled, the position of the measurement channel will be set to 0, if the index is crossed.
Response string from the measurement system / measurement channel for incremental encoder
#0# Success
#-2# Position parameter in string invalid
#-3# Position parameter in string invalid
#-99# General syntax error of the request string
Response string from the Irinos-System / measurement channel does not support this opcode
#-98#
Examples for request strings to incremental measurement channels
#-2000;REFOFF#
The current position of the selected measurement channel will be set to -2000. The reference index will be disabled.
#*;REFON#
The reference index of the selected measurement channel will be enabled. The position will not be changed.
#~;REFOFF#
The gain- and offset control of the selected measurement channel will be reset. The position will be set to 0. The reference index will be disabled.
.Net DLL specific implementation
NMX_MSTATUS ChannelSetParameter_1(System::IntPtr pHandle, System::UInt32 ulChannelNo, System::String ^%strExchange);
•Since strExchange is a managed string, no additional string length information must be provided in the function call.
•The string strExchange is send to the device.
On success, the received string will be returned via the same parameter strExchange.
•Make sure to use only ASCII-characters. The conversion from unicode to ASCII is made within the wrapper DLL.
Comments for incremental measurement channels
The error flags and the status bit "Refmark" will be cleared (these can be readout via the hardware status). Exception: This does not apply, if the character * is used for the parameter "position".
Notes for 1Vpp measurement channels:
If an error is detected at the 1Vpp-inputs, the signal levels of the incremental encoder are or have been out of specification. After an error has occurred, it is recommended to reset the gain- and offset-control by using the character ~ as the position parameter.
After resetting the gain- and offset-control, it takes a few signal periods until the control has determined the optimal parameters. During this process, the interpolation accuracy is limited. The measurement values can be inaccurate (however, no increments are lost). Further, the signal tolerance is limited during this process.