Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

TimerTick on PIC18 port

Posted by Marcel van Lieshout on November 26, 2004
Studying the PIC18-port I came across the following line in port.c:

OpenTimer1( T1_16BIT_RW & T1_SOURCE_INT & T1_PS_1_1 & T1_CCP1_T3_CCP2 );

Reading "MPLAB_C18_Libraries_51297c.pdf" on www.microchip.com to figure out what this function does, confuses me. The argument "T1_CCP1_T3_CCP2" is not defined for OpenTimer1, it's only defined for OpenTimer3. Can someone enlighten me on this?

Marcel

RE: TimerTick on PIC18 port

Posted by Nobody/Anonymous on November 26, 2004
The C18 header file does not define T1_CCP1_T3_CCP2 for all devices. Maybe the library documentatin does not take this into account.

#if defined(__18F6520) || defined(__18F6620) || defined(__18F6720) || \
defined(__18F8520) || defined(__18F8620) || defined(__18F8720) || \
defined(__18F6620) || defined(__18F6621) || \
defined(__18F8620) || defined(__18F8621)

#define T34_SOURCE_CCP 0b11111111
#define T12_CCP12_T34_CCP3450b11110111
#define T12_CCP1_T34_CCP23450b10111111
#define T12_SOURCE_CCP 0b10110111

#else

#define T3_SOURCE_CCP 0b11111111
#define T1_CCP1_T3_CCP2 0b10111111
#define T1_SOURCE_CCP 0b10110111

#endif

RE: TimerTick on PIC18 port

Posted by Nobody/Anonymous on November 26, 2004
My library ref manual (dated 2003) has the CCP section missing for timer 1.

The code example is given as:

OpenTimer1( TIMER_INT_ON &
T1_8BIT_RW &
T1_SOURCE_EXT &
T1_PS_1_1 &
T1_OSC1EN_OFF &
T1_SYNC_EXT_OFF &
T1_SOURCE_CCP );

But it does not define the T1_SOURCE_CCP options for timer 1.

Compare this to timer 3 where the code snippet is almost the same (T1->T3) but just above it there is a section "Use With CCP:" that defines values for T3_SOURCE_CCP.

Looks to me just like an omission from the
manual.

RE: TimerTick on PIC18 port

Posted by Marcel van Lieshout on November 27, 2004
The weird thing then is that the datasheet (eg. 18F452) also defines it only for timer3...

RE: TimerTick on PIC18 port

Posted by Richard on November 27, 2004
Hi Marcel,

This does look odd looking back. I got the constant value from the header file - and presuming that the timer is working correctly and that the header file is not incorrect - it seems ok.

I need to investigate futher and see exactly what the timer function library call does and compare this to the datasheet.

Regards.

RE: TimerTick on PIC18 port

Posted by Marcel van Lieshout on November 27, 2004
Well, I assume it works. So, your call should be correct. I was just wondering, nothing more. It's of course ok If you like to investigate this, but my quriosity (?) is already satisfied :-)


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS