Hi, i want your opinion about this code for PIC24FJ32GB002...I want to use internal FRC for bus clock at 8MHz and obtain a PWM output at 150KHz...this is my first pic code and i can't test it (i haven't any evalboard)...what do you think? This is my code #include <P24FJ32GB002.h> #define DEBUG _CONFIG2(IESO_OFF & FNOSC_FRC & POSCMOD_NONE) _CONFIG1(JTAGEN_OFF & ICS_PGx2 & FWDTEN_OFF) int main (void) { CLKDIV=0x00; //clock divisor 0 => 8MHz #ifdef DEBUG REFOCONbits.ROEN=1; //to see clock on REFO pin #endif //---150KHz PWM--- OC1CON2bits.SYNCSEL=0b00000; //free running OC1RS=25; OC1R=25/2; //50% duty cycle OC1CON1bits.OCTSEL=0b111; //system clock OC1CON1bits.OCM=0b110; __builtin_write_OSCCONL(OSCCON & 0xBF); RPOR1bits.RP3R=18; __builtin_write_OSCCONL(OSCCON | 0x40); while(1); return 0; } I've tried to test my firmware with mplab with logic analyzer, but notihing comes out from REFO pin, so i need your opinion...what do you think? Thanks

Help with this PIC code
Started by ●January 3, 2011
Reply by ●January 3, 20112011-01-03
Em 3/1/2011 16:08, eryer escreveu:> Hi, > i want your opinion about this code for PIC24FJ32GB002...I want to use > internal FRC for bus clock at 8MHz and obtain a PWM output at > 150KHz...this is my first pic code and i can't test it (i haven't any > evalboard)...what do you think? This is my code[snipped] Get a look at http://eng-serve.com/pic/pic_timer.html HTH -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/
Reply by ●January 4, 20112011-01-04
On 3 Gen, 20:16, Cesar Rabak <csra...@bol.com.br> wrote:> Em 3/1/2011 16:08, eryer escreveu: > > > Hi, > > i want your opinion about this code for PIC24FJ32GB002...I want to use > > internal FRC for bus clock at 8MHz and obtain a PWM output at > > 150KHz...this is my first pic code and i can't test it (i haven't any > > evalboard)...what do you think? This is my code > > [snipped] > > Get a look athttp://eng-serve.com/pic/pic_timer.html > > HTH > > -- > Cesar Rabak > GNU/Linux User 52247. > Get counted:http://counter.li.org/Thanks for answer, but PIC16F is very different from 24F: so link isn't useful...
