CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

dspic basic program doesn't work

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
danielz85



Joined: 22 Sep 2012
Posts: 37

View user's profile Send private message

dspic basic program doesn't work
PostPosted: Sun Jan 20, 2013 1:24 pm     Reply with quote

hi,
I've recently purchased a dspic33FJ06GS202.
http://ww1.microchip.com/downloads/en/DeviceDoc/70318F.pdf
I've written the following code just as sanity check, but for some reason it just doesn't work.
Pickit2 programs and reads the program well and the voltages also seem to be fine. I thought maybe the clock doesn't work because I don't put any fuses, but I doubt that this is the reason.
Code:

#include <33FJ06GS202.h>
     
void main()
{
   SETUP_ADC_PORTS(NO_ANALOGS);
   set_tris_b(0x0);
   OUTPUT_b(0xFF);
   set_tris_a(0x0);
   OUTPUT_a(0xFF);
   while (1){

}

Any ideas or suggestions we be extremely welcome,
thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19359

View user's profile Send private message

PostPosted: Sun Jan 20, 2013 1:42 pm     Reply with quote

You have the answer already:

"I thought maybe the clock doesn't work because I don't put any fuses".

Best Wishes
danielz85



Joined: 22 Sep 2012
Posts: 37

View user's profile Send private message

PostPosted: Sun Jan 20, 2013 2:07 pm     Reply with quote

thanks for the answer Ttelmah,

I've tried the following and still no luck.
Am I configuring the device wrong?
Code:

#include <33FJ06GS202.h>
#fuses FRC
#use delay(clock=7.37M)

void main(void){
   SETUP_ADC_PORTS(NO_ANALOGS);
   setup_oscillator(OSC_INTERNAL | OSC_RC);
   set_tris_a(0x0);
   output_a(0xFF);
   set_tris_b(0x0);
   output_a(0xFF);
   while(1){
   
   }
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19359

View user's profile Send private message

PostPosted: Sun Jan 20, 2013 2:40 pm     Reply with quote

The problem is that quite a few of the fuses default to values that can/will cause problems on these later PIC's. Copy a basic setup from an example, and see if it starts.

Best Wishes
danielz85



Joined: 22 Sep 2012
Posts: 37

View user's profile Send private message

PostPosted: Mon Jan 21, 2013 7:25 am     Reply with quote

Issue solved:

needed to set MCLR to Vdd...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group