Help with this PIC code

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

Reply to
eryer
Loading thread data ...

Em 3/1/2011 16:08, eryer escreveu:

[snipped]

Get a look at

formatting link

HTH

--
Cesar Rabak
GNU/Linux User 52247.
 Click to see the full signature
Reply to
Cesar Rabak

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.