Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC24FJ64GA004 not working...plz help

Status
Not open for further replies.

be_jouster

Junior Member level 1
Joined
Jun 27, 2006
Messages
19
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,283
Activity points
1,419
pic24fj64ga004

Hi all,


#include "p24FJ64GA004.h"
#include "remapable_peripheral.h"


_CONFIG1(JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & BKBUG_OFF & ICS_PGx1 & FWDTEN_OFF & WINDIS_OFF & FWPSA_PR32 & WDTPS_PS1)
_CONFIG2(IESO_OFF & FNOSC_PRI & FCKSM_CSDCMD & OSCIOFNC_OFF & IOL1WAY_OFF & I2C1SEL_PRI & POSCMOD_XT)


#define InlineAsm __asm__ volatile


#define UnlockRegister() {InlineAsm(" mov #OSCCON, w1 \n\
mov #0x46, w2 \n\
mov #0x57, w3 \n\
mov.b w2, [w1] \n\
mov.b w3, [w1] \n\
bclr OSCCON, #6 ");}

#define LockRegister() {InlineAsm(" mov #OSCCON, w1 \n\
mov #0x46, w2 \n\
mov #0x57, w3 \n\
mov.b w2, [w1] \n\
mov.b w3, [w1] \n\
bset OSCCON, #6 ");}

void ConfigureRPpin (void);

void ConfigureRPpin (void){

UnlockRegister();
//Input
RPINR0bits.INT1R = RP0;
RPINR1bits.INT2R = RP1;
RPINR3bits.T2CKR = RP2;
RPINR3bits.T3CKR = RP3;
RPINR4bits.T4CKR = RP4;
RPINR4bits.T5CKR = RP5;
RPINR7bits.IC1R = RP6;
RPINR7bits.IC2R = RP7;
RPINR8bits.IC3R = RP8;
RPINR8bits.IC4R = RP9;
RPINR9bits.IC5R = RP10;
RPINR11bits.OCFAR = RP11;
RPINR11bits.OCFBR = RP12;
RPINR18bits.U1RXR = RP13;
RPINR18bits.U1CTSR = RP14;
RPINR19bits.U2RXR = RP15;
RPINR19bits.U2CTSR = RP16;
RPINR20bits.SDI1R = RP17;
RPINR20bits.SCK1R = RP18;
RPINR21bits.SS1R = RP19;
RPINR22bits.SDI2R = RP20;
RPINR22bits.SCK2R = RP21;
RPINR23bits.SS2R = RP22;

//Output
RPOR0bits.RP0R = NULL;
RPOR0bits.RP1R = NULL;
RPOR1bits.RP2R = NULL;
RPOR1bits.RP3R = NULL;
RPOR2bits.RP4R = NULL;
RPOR2bits.RP5R = NULL;
RPOR3bits.RP6R = NULL;
RPOR3bits.RP7R = NULL;
RPOR4bits.RP8R = NULL;
RPOR4bits.RP9R = NULL;
RPOR5bits.RP10R = NULL;
RPOR5bits.RP11R = NULL;
RPOR6bits.RP12R = NULL;
RPOR6bits.RP13R = NULL;
RPOR7bits.RP14R = NULL;
RPOR7bits.RP15R = NULL;
RPOR8bits.RP16R = NULL;
RPOR8bits.RP17R = NULL;
RPOR9bits.RP18R = NULL;
RPOR9bits.RP19R = NULL;
RPOR10bits.RP20R = NULL;
RPOR10bits.RP21R = NULL;
RPOR11bits.RP22R = NULL;
RPOR11bits.RP23R = NULL;
RPOR12bits.RP24R = NULL;
RPOR12bits.RP25R = NULL;
LockRegister();
}

int main(void){
ConfigureRPpin();
AD1PCFG = 0xFFFF;
TRISB = 0x0000;
ODCB = 0x0000;
TRISC = 0x0000;
ODCC = 0x0000;
while (1){
PORTB = 0xFFFF;
PORTC = 0xFFFF;
PORTB = 0x0000;
PORTC = 0x0000;
}
}




Here is my program. It just blink the LED on portB and portC. 4mhz crystal osc is used. After I flash the PIC and click at Release from Reset button, nothing happen. But when i changed my icd2 into debug mode, program back the PIC and click at play button, then it working.

Plz advise.
 

Re: pic24fj64ga004

Hi,
Please provide me the link to download p24FJ64GA004.h

Thanks
 

#include "p24FJ64GA004.h"

you can complete your project a lot faster if you were to stop what you are doing now, and pick up the compiler manual and read it and attempt to understand it before you try to program the chip again.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top