Author Topic: Honestly, what am I missing?  (Read 934 times)

0 Members and 1 Guest are viewing this topic.

Offline jsmokerTopic starter

  • Full Member
  • ***
  • Posts: 118
  • Helpful? 2
Honestly, what am I missing?
« 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.

Code: [Select]
#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();
}

« Last Edit: March 09, 2009, 09:42:14 AM by jsmoker »

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: Honestly, what am I missing?
« Reply #1 on: March 09, 2009, 10:16:25 AM »
do you need TRISD setting to output?

Offline jsmokerTopic starter

  • Full Member
  • ***
  • Posts: 118
  • Helpful? 2
Re: Honestly, what am I missing?
« Reply #2 on: March 09, 2009, 10:24:34 AM »
Yep! That was it.  For some reason I thought they defaulted to 0.

 Thanks!
« Last Edit: March 09, 2009, 10:25:53 AM by jsmoker »

 


Get Your Ad Here