xPCIe-3121 API
xPCIe-3121 Timer functions

Functions

_INT_ i_PCIe3121_InitAndStartTimer (HANDLE h_DeviceHandle, BYTE b_TimerNb, BYTE b_TimerMode, BYTE b_TimeBase, BYTE b_OutputMode, BYTE b_InterruptEnabled, WORD w_ReloadValue, BYTE b_WatchdogEnabled)
 
_INT_ i_PCIe3121_StopTimer (HANDLE h_DeviceHandle, BYTE b_TimerNb)
 
_INT_ i_PCIe3121_ReadTimerStatus (HANDLE h_DeviceHandle, BYTE b_TimerNb, PBYTE pb_TimerStatus, PBYTE pb_SoftwareTriggerStatus, PWORD pw_TimerValue)
 
_INT_ i_PCIe3121_ReadTimerValue (HANDLE h_DeviceHandle, BYTE b_TimerNb, PWORD pw_TimerValue)
 
_INT_ i_PCIe3121_TriggerTimer (HANDLE h_DeviceHandle, BYTE b_TimerNb)
 

Detailed Description

Function Documentation

◆ i_PCIe3121_InitAndStartTimer()

_INT_ i_PCIe3121_InitAndStartTimer ( HANDLE  h_DeviceHandle,
BYTE  b_TimerNb,
BYTE  b_TimerMode,
BYTE  b_TimeBase,
BYTE  b_OutputMode,
BYTE  b_InterruptEnabled,
WORD  w_ReloadValue,
BYTE  b_WatchdogEnabled 
)

Enables to start the timer.

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_TimerNbSpecify the timer to be used. (0 or 1).
[in]b_TimerModeSpecify the mode of the timer. (PCIE3121_TIMER_MODE_2, PCIE3121_TIMER_MODE_3).
[in]b_TimeBaseSelect the time base (PCIE3121_TIME_BASE_MICROSECONDS, PCIE3121_TIME_BASE_MILLISECONDS, PCIE3121_TIME_BASE_SECONDS)
[in]b_OutputModeSet the way the output will change (PCIE3121_OUTPUT_ENABLED, PCIE3121_OUTPUT_DISABLED, PCIE3121_OUTPUT_INVERTED)
[in]b_InterruptEnabledEnable to use or not use an interrupt (0,1).
[in]w_ReloadValueThe time to count (depend on b_TimeBase)
[in]b_WatchdogEnabledSpecify if the watchdog is used (0,1).
PCIE3121_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.
PCIE3121_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_TimerNb is invalid
-2 : b_TimerMode is invalid
-3 : b_TimeBase is invalid
-4 : b_OutputMode is invalid
-5 : b_InterruptEnabled is invalid
-6 : b_WatchdogEnabled is invalid
-7 : Error while calling IOCTL function (wrong handle ?)

◆ i_PCIe3121_StopTimer()

_INT_ i_PCIe3121_StopTimer ( HANDLE  h_DeviceHandle,
BYTE  b_TimerNb 
)

Stops the timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_TimerNbSpecify the timer to be used. (0 or 1).
Returns
0 : No Error
-1 : b_TimerNb is invalid
-2 : Error while calling IOCTL function (wrong handle ?)

◆ i_PCIe3121_ReadTimerStatus()

_INT_ i_PCIe3121_ReadTimerStatus ( HANDLE  h_DeviceHandle,
BYTE  b_TimerNb,
PBYTE  pb_TimerStatus,
PBYTE  pb_SoftwareTriggerStatus,
PWORD  pw_TimerValue 
)

Reads the timer status

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_TimerNbSpecify the timer to be used. (0 or 1).
[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 : b_TimerNb is invalid
-2 : Error while calling IOCTL function (wrong handle ?)

◆ i_PCIe3121_ReadTimerValue()

_INT_ i_PCIe3121_ReadTimerValue ( HANDLE  h_DeviceHandle,
BYTE  b_TimerNb,
PWORD  pw_TimerValue 
)

Read the value of the timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_TimerNbSpecify the timer to be used. (0 or 1).
[out]pw_TimerValueCurrent value of the ´timer
Returns
0 : No error
-1 : b_TimerNb is invalid
-2 : Error while calling IOCTL function (wrong handle ?)

◆ i_PCIe3121_TriggerTimer()

_INT_ i_PCIe3121_TriggerTimer ( HANDLE  h_DeviceHandle,
BYTE  b_TimerNb 
)

Triggers the timer

Parameters
[in]h_DeviceHandleHandle of the board
[in]b_TimerNbSpecify the timer to be used. (0 or 1).
Returns
0 : No Error
-1 : b_TimerNb is invalid
-2 : Error while calling IOCTL function (wrong handle ?)