Quality RTOS & Embedded Software

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




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) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists