Sensoray 2410 API User Manual
Page 35
Sensoray 24xx Programming Guide
31
Model 2426 Multi-Function I/O Module
Example:
// Set count rate to 4x the encoder frequency, with no preload upon index active edge.
u32 err = ERR_NONE;
if
( !s2426_WriteEncoderMode( sess, &err, QUADRATURE_X4, ENC_PRELOAD_DISABLE ) )
printf( "Error: %s\n", s24xx_ErrorText(err) );
7.4.3 s2426_WriteEncoderPreload()
Function:
Store a value in the encoder interface preload register.
Prototype:
BOOL s2426_WriteEncoderPreload( SESSION sess, u32 *err, u32 preload );
Returns:
True if the operation was successful, otherwise False is returned and
err
will contain the associated error code.
Example:
// Set preload register to 100.
u32 err = ERR_NONE;
if
( !s2426_WriteEncoderPreload( sess, &err, 100 ) )
printf( "Error: %s\n", s24xx_ErrorText(err) );
7.4.4 s2426_ReadEncoderPreload()
Function:
Return the contents of the encoder interface preload register.
Prototype:
BOOL s2426_ReadEncoderPreload( SESSION sess, u32 *err, u32 *preload );
Returns:
True if the operation was successful, otherwise False is returned and
err
will contain the associated error code.
Example:
// Read preload register.
u32 err = ERR_NONE;
u32 preload;
if
( !s2426_ReadEncoderPreload( sess, &err, &preload ) )
printf( "Error: %s\n", s24xx_ErrorText(err) );
else
printf( "Preload counts: %d\n", preload );
Argument
Description
sess
Session handle obtained from
s24xx_SessionOpen()
.
err
Pointer to error code. See Section 4.3.1 for details.
preload
Value to be written to the preload register.
Argument
Description
sess
Session handle obtained from
s24xx_SessionOpen()
.
err
Pointer to error code. See Section 4.3.1 for details.
preload
Pointer to buffer that will receive preload value.