op_esys_interface_value_set()
Abstract
Writes a single value to an esys interface or to a specified element of a vector interface.
Syntax
op_esys_interface_value_set (interface, schedule_time, value, index)
| Argument | Type | Description |
|---|---|---|
interface |
Esys_Interface |
esys interface ID of the esys interface whose value is to be set The esys interface can be a vector interface or a non-vector interface. You can get the esys interface ID from several KPs in the Topo and Id packages, including op_topo_child() and op_id_from_name().] |
schedule_time |
double |
scheduled time to write the data to the esys interface (see Details for available constants) |
value |
void* |
value to be placed on the esys interface [This argument can accept any of the standard C data types. The data type of the value must match the data type of the esys interface that is to be set.] |
index |
int |
element of a vector interface that is to be set [This argument is required if the esys interface is a vector interface; it is treated as a placeholder otherwise.] |
Return Type
Evhandle
Handle to the OPC_INTRPT_ESYS_INTERFACE_EXT interrupt scheduled to set the interface, if one was scheduled; OPC_NIL otherwise.
Example
/* lock driver. */
if (op_intrpt_type () == OPC_INTRPT_SELF)
{
switch (op_intrpt_code ())
{
case CLOCK_HIGH:
/* Assert clock signal at the current simulation time. */
op_esys_interface_value_set (clock_interface, op_sim_time (), '1', 0);
/* Schedule for the signal to be deasserted after 100 ns. */
op_esys_interface_value_set (clock_interface, op_sim_time () + (1e-7),
'1', 0);
break;
}
}
Details
This procedure places an event on the application’s event list. At the scheduled time, value appears on the esys interface or vector interface element specified.
The schedule_time argument can be an explicit time or one of the following special values:
- OPC_ESYS_NOTIFY_IMMEDIATELY—the interface value is delivered to the registered callback (if any) right away
- OPC_ESYS_NOTIFY_NEVER—the interface value is updated, but any registered callback is not invoked
Purpose
Provide a mechanism to write single values to esys interfaces.
Errors
- Program Abort: Segmentation violation. (due to incompatible esys interface data type and value)
- Recoverable Error: Interface handle is invalid.
- Recoverable Error: Attempt to set a value on an esys input interface (
<id>). - Recoverable Error: Attempt to set a value on a vector interface (
<id>) using invalid index. - Recoverable Error: Attempt to set a value on an unconnected esys interface (
<id>). - Recoverable Error: Insufficient memory to set value on esys interface (
<id>). - Recoverable Error: Specified time (
<schedule_time>) is less than current time.
Reference
- Use the KP op_intrpt_esys_interface() to get the esys interface ID for an esys interface
- Use the KP op_esys_interface_value_get() to retrieve single values from esys interfaces
- Use the KP op_esys_interface_array_set() to place elements from an array onto a vector interface
- Use the KP op_esys_interface_vector_set() to place elements from a value vector onto a vector interface