Quality RTOS & Embedded Software

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


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 ]    [ Privacy ]    [ Sitemap ]    [ ]


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner