xPCIe-3021 API
xPCIe-3021 Timer functions

Functions

_INT_ i_PCIe3021_InitAndStartTimer (HANDLE h_DeviceHandle, BYTE b_TimerMode, BYTE b_TimeBase, BYTE b_OutputMode, BYTE b_InterruptEnabled, WORD w_ReloadValue)
 
_INT_ i_PCIe3021_StopTimer (HANDLE h_DeviceHandle)
 
_INT_ i_PCIe3021_ReadTimerStatus (HANDLE h_DeviceHandle, PBYTE pb_TimerStatus, PBYTE pb_SoftwareTriggerStatus, PWORD pw_TimerValue)
 
_INT_ i_PCIe3021_ReadTimerValue (HANDLE h_DeviceHandle, PWORD pw_TimerValue)
 
_INT_ i_PCIe3021_TriggerTimer (HANDLE h_DeviceHandle)
 

Detailed Description

Function Documentation

_INT_ i_PCIe3021_InitAndStartTimer ( HANDLE  h_DeviceHandle,
BYTE  b_TimerMode,
BYTE  b_TimeBase,
BYTE  b_OutputMode,
BYTE  b_InterruptEnabled,
WORD  w_ReloadValue 
)

Enables to start the timer.

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_TimerModeSpecifiy the mode of the timer. (PCIE3021_TIMER_MODE_2, PCIE3021_TIMER_MODE_3).
[in]b_TimeBaseSelect the time base (PCIE3021_TIME_BASE_MICROSECONDS, PCIE3021_TIME_BASE_MILLISECONDS, PCIE3021_TIME_BASE_SECONDS)
[in]b_OutputModeSet the way the output will change (PCIE3021_OUTPUT_ENABLED, PCIE3021_OUTPUT_DISABLED, PCIE3021_OUTPUT_INVERTED)
[in]b_InterruptEnabledEnable to use or not use an interrupt (0,1).
[in]w_ReloadValueThe time to count (depend on b_TimeBase) PCIE3021_TIMER_MODE_2: It functions like a divide-by-w_ReloadValue counter. It is used to generate a real time clock interrupt. OUT is initially high after the initialization. When the initial count has decremented to 1, OUT goes low for one CLK pulse. OUT then goes high again, the counter reloads the initial count (w_ReloadValue) and the process is repeated. This action can generate an interrupt.
PCIE3021_TIMER_MODE_3: This mode is similar to mode 2 except for the duty cycle of OUT. OUT will initially be high after the initialisation. When the initial count (ul_ReloadValue) has expired, OUT goes low for the next sequence. When the initial count (ul_ReloadValue) of that sequence has expired, OUT goes high again for the following sequence. The mode is periodic; the sequence above is repeated indefinitely.
Returns
0 : success
-1 : b_TimerMode is invalid
-2 : b_TimeBase is invalid
-3 : b_OutputMode is invalid
-4 : b_InterruptEnabled is invalid
-5 : Error while calling IOCTL function (wrong handle ?)
_INT_ i_PCIe3021_StopTimer ( HANDLE  h_DeviceHandle)

Stops the timer

Parameters
[in]h_DeviceHandleHandle of the board
Returns
0 : No Error
-1 : Error while calling IOCTL function (wrong handle ?)
_INT_ i_PCIe3021_ReadTimerStatus ( HANDLE  h_DeviceHandle,
PBYTE  pb_TimerStatus,
PBYTE  pb_SoftwareTriggerStatus,
PWORD  pw_TimerValue 
)

Reads the timer status

Parameters
[in]h_DeviceHandleHandle of the board
[out]pb_TimerStatusTimer status (0 = disabled, 1 = enabled)
[out]pb_SoftwareTriggerStatusStatus of the software trigger (0 = no software trigger occured, 1 = software trigger occured)
[out]pw_TimerValueCurrent value of the timer
Returns
0 : No Error
-1 : Error while calling IOCTL function (wrong handle ?)
_INT_ i_PCIe3021_ReadTimerValue ( HANDLE  h_DeviceHandle,
PWORD  pw_TimerValue 
)

Read the value of the timer

Parameters
[in]h_DeviceHandleHandle of the board
[out]pw_TimerValueCurrent value of the ´timer
Returns
0 : No error
-1 : Error while calling IOCTL function (wrong handle ?)
_INT_ i_PCIe3021_TriggerTimer ( HANDLE  h_DeviceHandle)

Triggers the timer

Parameters
[in]h_DeviceHandleHandle of the board
Returns
0 : No Error
-1 : Error while calling IOCTL function (wrong handle ?)