Society of Robots - Robot Forum
Software => Software => Topic started by: jsmoker on March 09, 2009, 09:41:04 AM
-
I've done tons of projects with the dsPIC30F3012 and now suddenly I can't get a simple LED to light up. I have a 5V power supply source with a .33uF cap on the source. The dsPIC is set to use it's own oscillator. Here's the code. Maybe it's just a brain fart. I should be able to do this in my sleep.
#include "p30fxxxx.h"
_FOSC(CSW_FSCM_OFF & FRC_PLL8); //Internal Clock routed through the PLL8
_FWDT(WDT_OFF); //Turn off the Watch-Dog Timer.
_FGS(CODE_PROT_OFF);
_FBORPOR(PBOR_OFF & MCLR_DIS & PWRT_OFF); //MCLR must be disabled to reprogram while using internal oscillator
void mdelay(unsigned int dcycle);
int main(void)
{
_LATD0 = 0;
int j = 0;
for(j = 0; j < 10; j++)
mdelay(3000);
while(1)
{
_LATD0 = 1;
}
return 0;
}
void mdelay(unsigned int dcycle)
{
int i;
for(i = 0; i < dcycle; i++)
Nop();
}
-
do you need TRISD setting to output?
-
Yep! That was it. For some reason I thought they defaulted to 0.
Thanks!