View previous topic :: View next topic |
Author |
Message |
danielz85
Joined: 22 Sep 2012 Posts: 37
|
dspic basic program doesn't work |
Posted: Sun Jan 20, 2013 1:24 pm |
|
|
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: 19537
|
|
Posted: Sun Jan 20, 2013 1:42 pm |
|
|
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
|
|
Posted: Sun Jan 20, 2013 2:07 pm |
|
|
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: 19537
|
|
Posted: Sun Jan 20, 2013 2:40 pm |
|
|
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
|
|
Posted: Mon Jan 21, 2013 7:25 am |
|
|
Issue solved:
needed to set MCLR to Vdd... |
|
|
|