Hi All
Do anyone have a clue how to set a PWM using C18 compiler. I had a good look in C18 user guide. it doesnt help in a graet deal. I am sure some one would help me with a sample code.
regards,
nathan
Plz see my code below.......it compiles with no error..cant see any output.
**********************************************************
#include <p18f4520.h>
#include <timers.h> //header file for Timers
#include <pwm.h> //header file for PWM
void main (void)
{
TRISC = 0b10000000; //All bits output except 7 (mode switch),
PORTC = 0;
OpenTimer2 (TIMER_INT_OFF & T2_PS_1_1 & T2_POST_1_1);
OpenPWM1 (0xFF); //Enable PWM1 and set period
OpenPWM2 (0xFF); //Enable PWM2 and set period
}
**********************************************************
Do anyone have a clue how to set a PWM using C18 compiler. I had a good look in C18 user guide. it doesnt help in a graet deal. I am sure some one would help me with a sample code.
regards,
nathan
Plz see my code below.......it compiles with no error..cant see any output.
**********************************************************
#include <p18f4520.h>
#include <timers.h> //header file for Timers
#include <pwm.h> //header file for PWM
void main (void)
{
TRISC = 0b10000000; //All bits output except 7 (mode switch),
PORTC = 0;
OpenTimer2 (TIMER_INT_OFF & T2_PS_1_1 & T2_POST_1_1);
OpenPWM1 (0xFF); //Enable PWM1 and set period
OpenPWM2 (0xFF); //Enable PWM2 and set period
}
**********************************************************