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

PWM CONFIGURATION

Posted by Nobody/Anonymous on January 21, 2007
HI!!

Can you help us please with the following problem:

We made a PWM configuration (PIC18f452) to drive two motors using the CCP1CON and CCP2CON registers. It is the program code:

void Configuracion_PWM(void)
{
PR2=0xFF;

CCP1CONbits.DC1B1=DUTY_PWM1bits.BIT1;
CCP1CONbits.DC1B0=DUTY_PWM1bits.BIT0;
CCPR1L=DUTY_PWM1>>2; // Config. duty cicle (MSB) PWM1

CCP2CONbits.DC2B1=DUTY_PWM2bits.BIT1;
CCP2CONbits.DC2B0=DUTY_PWM2bits.BIT0;
CCPR2L=DUTY_PWM2>>2; // Config. duty cicle (MSB) PWM2

TRISCbits.TRISC2=0;
TRISCbits.TRISC1=0;

TRISBbits.TRISB4=0;
TRISBbits.TRISB5=0;

T2CONbits.TMR2ON=1;

T2CONbits.T2CKPS1=1;
T2CONbits.T2CKPS0=1;


CCP1CONbits.CCP1M3=1;
CCP1CONbits.CCP1M2=1;
CCP1CONbits.CCP1M1=0;
CCP1CONbits.CCP1M0=0;

CCP2CONbits.CCP2M3=1;
CCP2CONbits.CCP2M2=1;
CCP2CONbits.CCP2M1=0;
CCP2CONbits.CCP2M0=0;
}

This program works very well, but we have to put it into the FREERTOS, so the problem is that both of them are using the same register CCPCON1.

Thanks so much for your help. We┬┤ll waiting your best answer.

Best Regards,

Moneditas

RE: PWM CONFIGURATION

Posted by Nobody/Anonymous on January 22, 2007
You can generate the tick interrupt from any peripheral that can generated a fix period interrupt. I'm not familiar with the PIC, but other processors I have used have been able to generate the tick from the watchdog timer. Look at the function prvSetupTimerInterrupt() in port.c for the PIC18 port. This is where the timer interrupt is configured. You can change it as required.


[ 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