xPCI-1710 API
xPCI-1710 pulse encoder functions

Functions

_INT_ i_PCI1710_InitPulseEncoder (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_PulseEncoderNbr, BYTE_ b_InputLevelSelection, BYTE_ b_TriggerOutputAction, DWORD_ dw_StartValue)
 
_INT_ i_PCI1710_EnablePulseEncoder (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_PulseEncoderNbr, BYTE_ b_CycleSelection, BYTE_ b_InterruptHandling)
 
_INT_ i_PCI1710_DisablePulseEncoder (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_PulseEncoderNbr)
 
_INT_ i_PCI1710_ReadPulseEncoderStatus (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_PulseEncoderNbr, PBYTE_ pb_Status)
 
_INT_ i_PCI1710_ReadPulseEncoderValue (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_PulseEncoderNbr, PDWORD_ pdw_ReadValue)
 
_INT_ i_PCI1710_WritePulseEncoderValue (HANDLE h_DeviceHandle, BYTE_ b_ModuleNbr, BYTE_ b_PulseEncoderNbr, DWORD_ dw_WriteValue)
 

Detailed Description

Function Documentation

_INT_ i_PCI1710_InitPulseEncoder ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_PulseEncoderNbr,
BYTE_  b_InputLevelSelection,
BYTE_  b_TriggerOutputAction,
DWORD_  dw_StartValue 
)

Configure the pulse encoder operating mode selected via b_ModulNbr and b_PulseEncoderNbr. The pulse encoder after each pulse decrements the counter value from 1.

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrModule to configure (0 to 3)
[in]b_PulseEncoderNbrPulse encoder selection (0 to 3)
[in]b_InputLevelSelectionInput level selection (0 or 1)
  • 0: Pulse encoder counts low edges
  • 1: Pulse encoder counts high edges
[in]b_TriggerOutputActionDigital trigger output action
  • 0: No action
  • 1: Set the trigger output pulse to high
  • 2: Set the trigger output pulse to low
[in]dw_StartValuePulse encoder start value (1 to 4294967295)
Return values
0: No error
-1: The device handle parameter is wrong
-2: The module is not a pulse encoder module or b_ModuleNbr is wrong
-3: Pulse encoder selection is wrong
-4: Input level selection is wrong
-5: Digital trigger output action selection is wrong
-6: Pulse encoder start value is wrong
_INT_ i_PCI1710_EnablePulseEncoder ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_PulseEncoderNbr,
BYTE_  b_CycleSelection,
BYTE_  b_InterruptHandling 
)

Enable the selected pulse encoder (b_PulseEncoderNbr) from selected module (b_ModuleNbr). Each input pulse decrements the pulse encoder counter value from 1. If you enable the interrupt (b_InterruptHandling), an interrupt is generated when the pulse encoder has run down.

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrModule to configure (0 to 3)
[in]b_PulseEncoderNbrPulse encoder selection (0 to 3)
[in]b_CycleSelection
  • APCI1710_SINGLE: If the counter is set on "0", the pulse encoder is stopped.
  • APCI1710_CONTINUOUS: Each time the counting value is set on "0", the pulse encoder load the start value after the next pulse.
[in]b_InterruptHandlingInterrupt can be generated when the pulse encoder has run down.
  • APCI1710_DISABLE: Interrupt is disabled
  • APCI1710_ENABLE: Interrupt is enabled
Return values
0: No error
-1: The device handle parameter is wrong
-2: The module is not a pulse encoder module
-3: Pulse encoder selection is wrong
-4: Pulse encoder is not initialized. See function "i_PCI1710_InitPulseEncoder"
-5: Cycle selection mode is wrong
-6: uc_InterruptHandling selection is wrong
-7: Interrupt routine is not installed. See "i_PCI1710_SetBoardIntRoutine" function
_INT_ i_PCI1710_DisablePulseEncoder ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_PulseEncoderNbr 
)

Disable the selected pulse encoder (b_PulseEncoderNbr) from selected module (b_ModuleNbr).

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrModule to configure (0 to 3)
[in]b_PulseEncoderNbrPulse encoder selection (0 to 3)
Return values
0: No error
-1: The device handle parameter is wrong
-2: The module is not a pulse encoder module
-3: Pulse encoder selection is wrong
-4: Pulse encoder not initialized. See "i_PCI1710_InitPulseEncoder" function
_INT_ i_PCI1710_ReadPulseEncoderStatus ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_PulseEncoderNbr,
PBYTE_  pb_Status 
)

Reads the pulse encoder status from selected pulse encoder (b_PulseEncoderNbr) from selected module (b_ModulNbr)

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrModule to configure
[in]b_PulseEncoderNbrPulse encoder selection (0 to 3)
[out]pb_StatusPulse encoder status
  • 0: No overflow occurs
  • 1: Overflow occurs
Return values
0: No error
-1: The device handle parameter is wrong
-2: Module selection is wrong
-3: Pulse encoder selection is wrong
-4: Pulse encoder not initialized. See "i_PCI1710_InitPulseEncoder" function
_INT_ i_PCI1710_ReadPulseEncoderValue ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_PulseEncoderNbr,
PDWORD_  pdw_ReadValue 
)

Reads the pulse encoder value from selected pulse encoder (b_PulseEncoderNbr) from selected module (b_ModulNbr)

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrModule to configure
[in]b_PulseEncoderNbrPulse encoder selection (0 to 3)
[out]pdw_ReadValuePulse encoder value
Return values
0: No error
-1: The device handle parameter is wrong
-2: Module selection is wrong
-3: Pulse encoder selection is wrong
-4: Pulse encoder not initialized. See "i_PCI1710_InitPulseEncoder" function
_INT_ i_PCI1710_WritePulseEncoderValue ( HANDLE  h_DeviceHandle,
BYTE_  b_ModuleNbr,
BYTE_  b_PulseEncoderNbr,
DWORD_  dw_WriteValue 
)

Writes a 32 bits value (dw_WriteValue) into the selected pulse encoder (b_PulseEncoderNbr) from selected module (b_ModulNbr) This operation sets the new start pulse encoder value.

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_ModuleNbrModule to configure
[in]b_PulseEncoderNbrPulse encoder selection (0 to 3)
[in]dw_WriteValue32-bit value to be written
Return values
0: No error
-1: The device handle parameter is wrong
-2: Module selection is wrong
-3: Pulse encoder selection is wrong
-4: Pulse encoder not initialized. See "i_PCI1710_InitPulseEncoder" function