Quality RTOS & Embedded Software

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




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) 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