This command sets OPC options for the current data entry session.
Syntax
OPC_OPT server_number, setting, "value"
The server_number is an integer from 1 to 10 assigning a number to the OPC server connection. It should be the same server_number used by the OPC_CONNECT command to connect to this OPC server.
Valid options for the setting and "value" parameters include the following:
setting |
explanation |
"value" |
description |
|
1 |
Enable or disable an OPC receive buffer so that each time the value of an OPC channel changes (and the Quality of that value is good), that channel number and value will be added to the end of the queue in the OPC receive buffer. This is useful when you need to monitor many OPC channels on a server but only need to know when their values change. If the OPC receive buffer is already enabled, you can clear its contents by executing the command to enable it again. This command should be executed after using OPC_INIT to initialize one or more channels with receive_mode set to "Y" for this server_number and then using OPC_CONNECT to connect to this server_number. |
"Y" |
Enables the OPC receive buffer and clears its contents.
|
|
"N" |
Disables the OPC receive buffer (the default setting). |
Return value
If this command was executed successfully, it will return the number 1.
If this command was executed with an invalid setting parameter, it will return the number 0.
Any other return value represents an OPC error code.
Notes
See also: OPC Server Support
Example
OPC_INIT 1, 1, "Card.Node.I01", -1, -1, "Y" :
OPC_INIT 1, 2, "Card.Node.I02", -1, -1, "Y" :
OPC_CONNECT 1, "{C5123F69-65AA-11D1-AE80-00609703A0D6}", "NT_SERVER1" :
OPC_OPT 1, 1, "Y" :
MyNVar "Channel" = OPC_RCVBUFFER 1 :
IF MyNVar "Channel" > 0, MySVar "Value" = MySVar "OPC_RB"
This formula initializes two channels for server_number 1, establishes the connection to server_number 1, and enables the OPC receive buffer for server_number 1.
Then it reads the first channel number from the OPC receive buffer. If this channel number is >0, then this formula sets MySVar "Value" to the new data value on that channel.