Go to the source code of this file.
Defines | |
#define | getTimerPrescale(TxCONbits) getTimerPrescaleBits(TxCONbits.TCKPS) |
#define | MS_TO_TICKS(ms, pre) ((FCY/1000L/(pre))*ms) |
#define | T1_ON 0x8000 |
#define | T1_OFF 0x0000 |
#define | T1_OFF_ON_MASK (~T1_ON) |
#define | T1_IDLE_STOP 0x2000 |
#define | T1_IDLE_CON 0x0000 |
#define | T1_IDLE_MASK (~T1_IDLE_STOP) |
#define | T1_GATE_ON 0x0040 |
#define | T1_GATE_OFF 0x0000 |
#define | T1_GATE_MASK (~T1_GATE_ON) |
#define | T1_PS_1_1 0x0000 |
#define | T1_PS_1_8 0x0010 |
#define | T1_PS_1_64 0x0020 |
#define | T1_PS_1_256 0x0030 |
#define | T1_PS_MASK (~T1_PS_1_256) |
#define | T1_SYNC_EXT_ON 0x0004 |
#define | T1_SYNC_EXT_OFF 0x0000 |
#define | T1_SYNC_EXT_MASK (~T1_SYNC_EXT_ON) |
#define | T1_SOURCE_EXT 0x0002 |
#define | T1_SOURCE_INT 0x0000 |
#define | T1_SOURCE_MASK (~T1_SOURCE_EXT) |
#define | IC_IDLE_STOP 0x2000 |
#define | IC_IDLE_CON 0x0000 |
#define | IC_IDLE_MASK (~IC_IDLE_STOP) |
#define | IC_TIMER2_SRC 0x0080 |
#define | IC_TIMER3_SRC 0x0000 |
#define | IC_TIMER_SRC_MASK (~IC_TIMER2_SRC) |
#define | IC_INT_4CAPTURE 0x0060 |
#define | IC_INT_3CAPTURE 0x0040 |
#define | IC_INT_2CAPTURE 0x0020 |
#define | IC_INT_1CAPTURE 0x0000 |
#define | IC_INT_CAPTURE_MASK (~IC_INT_4CAPTURE) |
#define | IC_INTERRUPT 0x0007 |
#define | IC_EVERY_16_RISE_EDGE 0x0005 |
#define | IC_EVERY_4_RISE_EDGE 0x0004 |
#define | IC_EVERY_RISE_EDGE 0x0003 |
#define | IC_EVERY_FALL_EDGE 0x0002 |
#define | IC_EVERY_EDGE 0x0001 |
#define | IC_INPUTCAP_OFF 0x0000 |
#define | IC_CAPTURE_MODE_MASK (~IC_INTERRUPT) |
#define | OC_IDLE_CON 0x0000 |
#define | OC_IDLE_STOP 0x2000 |
#define | OC_IDLE_MASK (~OC_IDLE_STOP) |
#define | OC_TIMER2_SRC 0x0000 |
#define | OC_TIMER3_SRC 0x0008 |
#define | OC_TIMER_SRC_MASK (~OC_TIMER3_SRC) |
#define | OC_PWM_FAULT_PIN_ENABLE 0x0007 |
#define | OC_PWM_FAULT_PIN_DISABLE 0x0006 |
#define | OC_CONTINUE_PULSE 0x0005 |
#define | OC_SINGLE_PULSE 0x0004 |
#define | OC_TOGGLE_PULSE 0x0003 |
#define | OC_HIGH_LOW 0x0002 |
#define | OC_LOW_HIGH 0x0001 |
#define | OC_OFF 0x0000 |
#define | OC_PWM_MODE_MASK (~OC_PWM_FAULT_PIN_ENABLE) |
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) |
Definition in file pic24_timer.h.
#define getTimerPrescale | ( | TxCONbits | ) | getTimerPrescaleBits(TxCONbits.TCKPS) |
Given the TxCON register as a bitfield, determines the prescale based on the TCKPS bitfield. Works for PIC24H, PIC24F timers. Simply accesses the TCKPS bitfield then calls getTimerPrescaleBits with the bitfield.
TxCONbits | The TxCONbits for the timer in question |
Definition at line 20 of file pic24_timer.h.
Computes delta ticks between two Timer register captures Assumes the delta time does not exceeds the timer period
u16_start | start tick | |
u16_end | end tick | |
u16_tmrPR | Timer period register |
Definition at line 192 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
u16_start | start tick | |
u16_end | end tick | |
u16_tmrPR | Timer period register | |
u16_oflows | number of timer overflows |
Definition at line 171 of file pic24_timer.c.
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.
u8_TCKPS | TCKPS bitfield from the timer in question |
Definition at line 108 of file pic24_timer.c.
Converts milliseconds to 16-bit timer ticks.
u16_ms | Time, in milliseconds, to convert to ticks | |
u16_pre | Prescale set for this timer. Note that getTimerPrescale can easily determine this. |
Definition at line 53 of file pic24_timer.c.
Converts timer ticks to milliseconds
u32_ticks | Timer ticks | |
u16_tmrPre | Timer prescale value |
Definition at line 119 of file pic24_timer.c.
Converts timer ticks to nanoseconds
u32_ticks | Timer ticks | |
u16_tmrPre | Timer prescale value |
Definition at line 152 of file pic24_timer.c.
Converts timer ticks to microseconds
u32_ticks | Timer ticks | |
u16_tmrPre | Timer prescale value |
Definition at line 136 of file pic24_timer.c.
Converts microseconds to 16-bit timer ticks.
u16_us | Time, in microseconds, to convert to ticks | |
u16_pre | Prescale set for this timer. Note that getTimerPrescale can easily determine this. |
Definition at line 71 of file pic24_timer.c.
Converts microseconds to 32-bit timer ticks.
u32_us | Time, in microseconds, to convert to ticks | |
u16_pre | Prescale set for this timer. Note that getTimerPrescale can easily determine this. |
Definition at line 90 of file pic24_timer.c.