Beginner programmer, simple goal. Help please!

Thread Starter


Joined Dec 4, 2010
I'm programming a PIC24f using MPLAB with the C30 C compiler. My first goal is to light up some LEDs before I move on to anything more advanced. I'm a day or two into learning about MCUs, and I have some code written, but I think I may be missing a lot at the beginning (housekeeping/setup stuff) that is keeping my MCU from starting the program. Anyway, here's my code. I'd really appreciate any advice on how to "set up" an MCU before giving it specific instructions like enabling/disabling ports as input/output.

Rich (BB code):
//include header file
#include <p24f04ka200.h>

//configuration --I got the following by looking at options for config in the
//header file above

//main function
int main()

    TRISB = 0x0000;
    LATB = 0x0000; //Not sure if I need this
    PORTB = 0x0000;    
    ODCB = 0x0000; //Not sure if I need this
return 1;
I just want all of the portB pins on my MCU to be at VIH...
be gentle! (thanks)
Last edited by a moderator: