Problem converting Chips and Timing

Thread Starter

PGP_Protector

Joined Sep 24, 2010
2
Ok, I'm not getting the configuration on the Timers right, maybe someone can help me.
Using MPLAB IDE v8.56 / MPLAB C30 C Compiler (pic30-gcc.exe) v3.24


On the p24Fj128GA010 on a Explorer 16 Board I'm using this code to set up a PWM Output and it gives me an output with a frequency of about 1.25KHz (measured on a scope)

Rich (BB code):
#include <p24FJ128GA010.h>  
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & FWDTEN_OFF & ICS_PGx2)  
_CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI)  
void _ISRFAST _T3Interrupt( void){_T3IF = 0;}  
int main()  
{  
T3CON = 0x8010;	 // This is about 1.25KHz with the Debugger board running at 8MHz  
PR3 = 400-1; 
_T3IF = 0; 
_T3IE = 1; 
OC1R = OC1RS = 200; 
OC1CON = 0x000E; 
while(1); 
}
But with this Code (same code I thought) on a p24FJ256GB210, I'm not getting any output.
Rich (BB code):
#include <p24FJ256GB210.h>  
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & FWDTEN_OFF & ICS_PGx2)  
_CONFIG2( FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_XT & FNOSC_PRI)  
void _ISRFAST _T3Interrupt( void){_T3IF = 0;}  
int main()  
{  
__builtin_write_OSCCONL (OSCCON & 0xbf);
RPOR5bits.RP11R = 18;		// 18=OC1		RP11
__builtin_write_OSCCONL (OSCCON | 0x40);
T3CON = 0x8010;	 // This is about 1.25KHz with the Debugger board running at 8MHz  
PR3 = 400-1; 
_T3IF = 0; 
_T3IE = 1; 
OC1R =OC1RS=200; 
OC1CON1 = 0x000E; 
while(1); 
}
 

Potato Pudding

Joined Jun 11, 2010
688
You would have to check the data sheets because between two Microchip PICs you normally can't drop in code code without correcting ports and addressing.

For your example, I think the data area for the 256k might start where the data for the 128k chip ended.

But like I said - you need to check all the ports and addresses carefully against the data sheets, then check the data sheets errata and then contact microchip support to have them confirm that what you got from the data sheets and errata was accurate.

After you have done all of that - if it still isn't working - that is when you start to worry about a PIC program port.
 
Top