omron — Reading Device Data

Reading Device Data Reading Device Data The DEVICE real-valued function returns information about the encoder error status, position, and velocity. The scale factor, offset, and limits defined by the SETDEVICE instruction affect the velocity and position values returned. The syntax for this function is DEVICE(0, unit, error, select) The value returned depends upon the value of the select parameter, as described in the following table. Select Parameter Values eV+Language User's Guide, v2.x, 18318-000 Rev A Page 220 select Description 0 Read Hardware Status The error status of the encoder unit is returned as a 24-bit value. The valid error bits for this device are listed below.

The corresponding error listed is the one eV+ would report if the error occurred while tracking a belt encoder. Bit # Bit Mask Corresponding Error Message and Code 19 ^H040000 *Lost encoder sync* (-1012) 20 ^H080000 *Encoder quadrature error* (-1013) 21 ^H100000 *No zero index* (-1011) Only bit #20, for encoder quadrature error, is detected by the error parameter of the DEVICE function to generate an error. 1 Read Position The current position of the encoder (in millimeters) is returned, subject to the scale factor, offset, and limits defined by the SETDEVICE instruction. The value returned is computed by:

position = scale*(encoder-offset) position = MAX(position, lower limit) _ position = MIN(position, upper limit) _ 2 Read Velocity The current value of the encoder velocity (in millimeters per second) is returned, subject to the scale factor defined by the SETDEVICE instruction. The value returned is computed by: velocity = scale*encoder velocity _