read

read — reads the value of a point.

Synopsis

       
(read point_name [update])
	

Parameters

point_name

The name of an existing point.

update

(optional) If t, an attempt is made to refresh the point data from the device before reading. Otherwise, the existing data in the buffer is returned. See the Description (below) for details.

Returns

If there are no errors, the value of the named point is returned, formatted as:

(read point_name type value)

where value is the ASCII representation of the point value (if possible) and dependent on type. The following types are defined:

typetype of value
2floating point
3integer
5digital (0 or 1)

If the point has no value (no data has ever been written to it), then the response is:

 (read point_name 0 "out of range") 

If an error occurs due to invalid point name, point disabled, point not readable, or data type has no ASCII representation, then a corresponding error is returned, formatted as follows:

(error "read DR_ERR_PNT_NOT_FOUND (time)
 point not found: point_name")

(error "read DR_ERR_PNT_NOT_ENABLED (time)
 point not enabled: point_name")

(error "read DR_ERR_PNT_NOT_READABLE (time)
 point not readable: point_name")

(error "read DR_ERR_PNT_TYPE_NO_REP (time)
 point type has no representation: point_name type")

If the optional update parameter is set to t, and an error is detected, the following is returned:

(error "read DR_ERR_CARD_IO_FAILURE (time) I/O failure (-22) on device: point_addr_card_id")

This error usually signifies that the fieldbus is not active. This may be due to a connection or configuration problem.

Description

This command reads the current value of the named point. The transfer of data from the card buffers (which received field input device data via the fieldbus) to the driver buffers is dependent on the mode of the card, which can be either polled or interrupt driven (see cardPoll and cardInit commands). Then the transfer of data from the buffers to the points is dependent on the cardGroup command and the association of points with groups.

If the optional update parameter is set to t, and the card mode is polled, then:

    The driver buffers are updated from the card buffers (those specified by the point address).

    The point value is updated from the buffer data.

This command is typically sent as a command and not used in configuration file.

Example

(read Pushbutton)