common/pic24_timer.c File Reference

#include "pic24_all.h"

Go to the source code of this file.

Functions

uint16 msToU16Ticks (uint16 u16_ms, uint16 u16_pre)
uint16 usToU16Ticks (uint16 u16_us, uint16 u16_pre)
uint32 usToU32Ticks (uint32 u32_us, uint16 u16_pre)
uint16 getTimerPrescaleBits (uint8 u8_TCKPS)
uint32 ticksToMs (uint32 u32_ticks, uint16 u16_tmrPre)
uint32 ticksToUs (uint32 u32_ticks, uint16 u16_tmrPre)
uint32 ticksToNs (uint32 u32_ticks, uint16 u16_tmrPre)
uint32 computeDeltaTicksLong (uint16 u16_start, uint16 u16_end, uint16 u16_tmrPR, uint16 u16_oflows)
uint16 computeDeltaTicks (uint16 u16_start, uint16 u16_end, uint16 u16_tmrPR)


Detailed Description

To do.

Definition in file pic24_timer.c.


Function Documentation

uint16 computeDeltaTicks ( uint16  u16_start,
uint16  u16_end,
uint16  u16_tmrPR 
)

Computes delta ticks between two Timer register captures Assumes the delta time does not exceeds the timer period

Parameters:
u16_start start tick
u16_end end tick
u16_tmrPR Timer period register
Returns:
delta ticks

Definition at line 214 of file pic24_timer.c.

uint32 computeDeltaTicksLong ( uint16  u16_start,
uint16  u16_end,
uint16  u16_tmrPR,
uint16  u16_oflows 
)

Computes delta ticks between two Timer register captures Assumes long time interval and thus has a parameter for tracking timer overflows

Parameters:
u16_start start tick
u16_end end tick
u16_tmrPR Timer period register
u16_oflows number of timer overflows
Returns:
delta ticks

Definition at line 193 of file pic24_timer.c.

uint16 getTimerPrescaleBits ( uint8  u8_TCKPS  ) 

Given the TCKPS bitfield, return the timer prescale encoded by these bits. Use getTimerPrescale as a convenient way to extract the TCKPS bitfield from a TxCONbits SFT then call this function.

Parameters:
u8_TCKPS TCKPS bitfield from the timer in question
Returns:
Prescale value.

Definition at line 130 of file pic24_timer.c.

uint16 msToU16Ticks ( uint16  u16_ms,
uint16  u16_pre 
)

Converts milliseconds to 16-bit timer ticks.

Parameters:
u16_ms Time, in milliseconds, to convert to ticks
u16_pre Prescale set for this timer. Note that getTimerPrescale can easily determine this.
Returns:
Timer ticks corresponding to the given number of milliseconds.

Definition at line 75 of file pic24_timer.c.

uint32 ticksToMs ( uint32  u32_ticks,
uint16  u16_tmrPre 
)

Converts timer ticks to milliseconds

Parameters:
u32_ticks Timer ticks
u16_tmrPre Timer prescale value
Returns:
time in milliseconds

Definition at line 141 of file pic24_timer.c.

uint32 ticksToNs ( uint32  u32_ticks,
uint16  u16_tmrPre 
)

Converts timer ticks to nanoseconds

Parameters:
u32_ticks Timer ticks
u16_tmrPre Timer prescale value
Returns:
time in nanoseconds

Definition at line 174 of file pic24_timer.c.

uint32 ticksToUs ( uint32  u32_ticks,
uint16  u16_tmrPre 
)

Converts timer ticks to microseconds

Parameters:
u32_ticks Timer ticks
u16_tmrPre Timer prescale value
Returns:
time in microseconds

Definition at line 158 of file pic24_timer.c.

uint16 usToU16Ticks ( uint16  u16_us,
uint16  u16_pre 
)

Converts microseconds to 16-bit timer ticks.

Parameters:
u16_us Time, in microseconds, to convert to ticks
u16_pre Prescale set for this timer. Note that getTimerPrescale can easily determine this.
Returns:
Timer ticks corresponding to the given number of microseconds.

Definition at line 93 of file pic24_timer.c.

uint32 usToU32Ticks ( uint32  u32_us,
uint16  u16_pre 
)

Converts microseconds to 32-bit timer ticks.

Parameters:
u32_us Time, in microseconds, to convert to ticks
u16_pre Prescale set for this timer. Note that getTimerPrescale can easily determine this.
Returns:
Timer ticks corresponding to the given number of microseconds.

Definition at line 112 of file pic24_timer.c.


Generated on Sun Mar 15 11:14:22 2009 for PIC24 Support Libraries by  doxygen 1.5.8