Write Discrete with Status
[cmdchars] = !M
Description
The Write Discrete with Status command drives targeted discrete output channels ON or OFF on the addressed FieldPoint module. The command also returns the status of targeted channels to enable error checking.
Use the Read Module Status (!N) command or the Read Channel Status (!O) command for details about an error condition of a bad channel.
Syntax
!M[positions][data]
Use !o!M for modules with 32 channels.
[positions] | Four ASCII-hex characters specify the targeted channels. A "1" in any bit means that the command writes to the corresponding channel. A zero in any bit means that the corresponding channel is not targeted. If you send !o!M, [positions] must contain eight ASCII-hex characters. Targeting an input channel or a channel that does not exist causes the command to return an error. |
[data] | Four ASCII-hex characters specify all of the output levels to be written. A "1" in any bit means ON. A zero in any bit means OFF. The command ignores bits that correspond to untargeted channels. If you send !o!M, [data] must contain eight ASCII-hex characters. |
Success Response
A
[status] | Four ASCII-hex characters specify the status of all targeted channels. The most significant bit represents channel 15 and the least significant bit represents channel 0. A "1" in any bit means that the status of the corresponding channel is bad, and a zero in any bit means either that the status of the corresponding channel is good or that the corresponding channel was not targeted by the command. If you send !o!M, [status] contains eight ASCII-hex characters in the response. |
Error Responses
E_INVALID_CMD | Undefined command. |
E_INSUFF_CHARS | Data field error. An insufficient or incorrect number of characters were received for the command. |
E_INV_LIMS_GOT | Specified limits invalid for the command. |
E_ILLEGAL_DIGIT | One or more characters in the command could not be properly converted to a digit (hex or decimal). |
E_INV_CHNL | One or more channels specified in the command either do not exist or do not support the specified operation. |
E_NO_MODULE | There is no module at the specified address. |
Refer to FieldPoint Responses for other possible error responses, error numbers, and error descriptions.
Example
The following command turns channel 0 OFF on the FieldPoint module at address 51 (0x33). The command also reads the status of channelĀ 0.
>33!M00010000[checksum][cr]
The response is as follows:
>A0000[checksum][cr]
The response indicates that the channel status is good.
The following command turns channel 17 ON on the FieldPoint module at address 51 (0x33). Note that all the other "1" bits in [data] are ignored.
>33!o!M00020000FFFFFFFF[checksum][cr]
The response is as follows:
>A00000000[checksum][cr]
The response indicates that the channel status is good.