Digitals I/O pins problem

Thread Starter

absdoso

Joined Mar 26, 2025
13
Hello everyone,
I’m facing quite a headache. As you can see in the schematic below, my design includes a PIC24FJ64GA104 controlling the input/output pins. Everything seemed fine until I discovered that there is no signal coming out from pins RA4, RB4, and RA3.
I have reviewed the configuration of these pins in detail, but no matter how I test the code, I still cannot activate them. I’m quite sure the issue is not from the hardware side, since other output pins are configured exactly the same way as RA4 and they work normally, generating output signals.

So I’d like to ask for help from the experts here — could you please give me some guidance?

Here's the code i used for testing:

C-like:
void init_config(void) {


    /* Disable Watchdog */

        RCONbits.SWDTEN = 0;


     /* Disable Secondary Oscillator RA3, RA4, RB4 */

        OSCCONbits.SOSCEN = 0;


    /*  analog to digital */

        AD1CON1bits.ADON = 0; // disable ADC

        AD1PCFG = 0xFFFF;         // ANx = digital


    /* Config I/O */

       _TRISA3 = 1; // RA3 = INPUT_4

       _TRISA4 = 0; // RA4 = OUTPUT_13

       _TRISB4 = 0;   // RB4 = OUTPUT_1


    /* Clear output*/

       LATA = 0;

       LATB = 0;


    /* Open-drain off */

       ODCA = 0;

       ODCB = 0;

}


int main(void) {

    init_config();   

    while(1) {

      

        //DEFAULT OUTPUT

        LATBbits.LATB4 = 1;             //OUTPUT1 12V SUPLY FAN0 ON

        LATAbits.LATA4 = 1;            //OUTPUT13 12V SUPPLY SPLITTERS       

        wait_3s();

        LATBbits.LATB4 = 0;             //OUTPUT1 12V SUPLY FAN0 ON

        LATAbits.LATA4 = 0;            //OUTPUT13 12V SUPPLY SPLITTERS   

        wait_3s();

        

    }

    return 0;

}
 

Attachments

Last edited by a moderator:

Scott Moore

Joined Oct 1, 2019
12
Are you using the internal oscillator? Since those pins are multiplexed with the use of an external oscillator, check your configuration bit settings to be sure that the internal oscillator is selected. I don't believe that setting OSCCONbits.SOSCEN = 0 is sufficient to do this. [You can set the configuration bits in MPLAB X IDE. I think it's view memory -> configuration bits. Make your changes and copy the settings into your main code and rebuild.]
 
Top