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.
I just want all of the portB pins on my MCU to be at VIH...
be gentle! (thanks)
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
_FGS(GCP_OFF & GWRP_OFF)
_FOSCSEL(FNOSC_FRC)
_FOSC(POSCFREQ_LS)
_FWDT(FWDTEN_OFF)
_FPOR(MCLRE_ON)
_FDS(DSWDTEN_OFF)
//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;
}
be gentle! (thanks)
Last edited by a moderator: