View previous topic :: View next topic |
Author |
Message |
tugrulex84
Joined: 10 Nov 2008 Posts: 9
|
help me(s.o.s) 24fj64GA006 code.. |
Posted: Fri Nov 21, 2008 3:04 am |
|
|
Hi,
I am trying to use 24fj64GA06 but I have an error. I don't know the reason maybe about header file. Is there anyone to help me with this
at output: it is saying "Unknown device type --Try PCD"
Thank you.
Code: | #include <24FJ64GA006.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES EC_PLL16 #FUSES PR #FUSES NOCKSFSM #FUSES NODEBUG //No Debug mode for ICD
#FUSES NOSYNC //No sync between I/O and clock
#FUSES INT4MHZ //Internal 4 mhz Osc
#FUSES BROWNOUT //Reset when brownout detected
#FUSES BORV47 #FUSES LPOL_HIGH //Low-Side Transistors Polarity is Active-High (PWM 0,2,4 and 6)
#FUSES HPOL_HIGH //High-Side Transistors Polarity is Active-High (PWM 1,3,5 and 7)
#FUSES NOPWMPIN //PWM outputs drive active state upon Reset
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES INT250KHZ //Internal 250 khz Osc
#FUSES INT125KHZ //Internal 125 khz Osc
#FUSES RESERVED //Used to set the reserved FUSE bits
Reserved
#FUSES RC_IO //Resistor/Capacitor Osc
#use delay(clock=4000000)
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_oscillator(False);
// TODO: USER CODE!!
while(1)
{
output_high(PIN_D0);
delay_ms(250);
output_low(PIN_D0);
delay_ms(250);
}
} |
|
|
|
Ttelmah Guest
|
|
Posted: Fri Nov 21, 2008 3:17 am |
|
|
The error message is (oddly for CCS), telling you _exactly_ what the problem is.
With CCS, there are four different compilers. PCB (handles the '12' chips), PCM (handles the 16 chips), PCH (handles the 18 chips), and PCD, which handles the DSP chips. You buy a mix of these according to what chips you want. So the 'PCW' package, gives you PCB, and PCM, with the windows front end. PCWH, gives you PCB, PCM, and PCH, while PCWHD, gives all the parts.
Yor compiler is saying that the chip number is one that needs PCD. Unless you have bought the PCD compiler, you can't use this chip.
Best |
|
|
tugrulex84
Joined: 10 Nov 2008 Posts: 9
|
|
Posted: Fri Nov 21, 2008 3:26 am |
|
|
Thank you so much, I will try with PCWHD. |
|
|
tugrulex84
Joined: 10 Nov 2008 Posts: 9
|
|
Posted: Fri Nov 21, 2008 8:27 am |
|
|
Hi, I used PCWHD but I had errors again. When I hide some fuses I got rid of the errors but then code doesn't work in the pic24. I want to see that pic24 working Can you help me with this ?
Thank you.
Code: | #include <24FJ64GA006.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
//#FUSES NOVREGEN //USB voltage regulator disabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
//#FUSES INT500KHZ //Internal 500 khz Osc
//#FUSES INT125KHZ //Internal 125 khz Osc
//#FUSES WDT_1024 #FUSES WDT_2048
#use delay(clock=4000000)
void main(void)
{
setup_adc_ports(NO_ANALOGS);
//setup_adc(ADC_OFF);
//setup_psp(PSP_DISABLED);
setup_spi(FALSE);
//setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
//setup_timer_1(T1_DISABLED);
//setup_timer_2(T2_DISABLED,0,1);
//setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_oscillator(False);
// TODO: USER CODE!!
while(1)
{
output_high(PIN_B0);
delay_ms(250);
output_low(PIN_B0);
delay_ms(250);
}
} |
|
|
|
Ttelmah Guest
|
|
Posted: Fri Nov 21, 2008 9:40 am |
|
|
I don't know what options are supported on this chip, so you will have to look for yourself. The fuse list in the ICD, or the top of the processor include file would be a good start. However there are some obvious things that won't work. For example, you can't have two different oscillator frequencies, both selected, or two different watchdog divisors....
Best Wishes |
|
|
tugrulex84
Joined: 10 Nov 2008 Posts: 9
|
|
Posted: Mon Nov 24, 2008 7:16 am |
|
|
Still I couldn't find the problem that there is no error in that code but doesn't work in my proteus simulation. Please can s.o help me??
Code: | #include <24FJ64GA006.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
//#FUSES NOVREGEN //USB voltage regulator disabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
//#FUSES INT500KHZ //Internal 500 khz Osc
//#FUSES INT125KHZ //Internal 125 khz Osc
//#FUSES WDT_1024 #FUSES WDT_2048
#use delay(clock=4000000)
void main(void)
{
setup_adc_ports(NO_ANALOGS);
//setup_adc(ADC_OFF);
//setup_psp(PSP_DISABLED);
setup_spi(FALSE);
//setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
//setup_timer_1(T1_DISABLED);
//setup_timer_2(T2_DISABLED,0,1);
//setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_oscillator(False);
// TODO: USER CODE!!
while(1)
{
output_high(PIN_B0);
delay_ms(250);
output_low(PIN_B0);
delay_ms(250);
}
} |
|
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
|
Ttelmah Guest
|
|
Posted: Mon Nov 24, 2008 9:58 am |
|
|
Obvious comment. No clock oscillator at all selected.
Best Wishes |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Nov 24, 2008 11:23 am |
|
|
Quote: | Obvious comment. No clock oscillator at all selected. | Yes, but CCS C selects internal oscillator by default, also 1 MHz frequency. With a real chip, it's supposed to work. With Proteus - I don't care. |
|
|
tugrulex84
Joined: 10 Nov 2008 Posts: 9
|
|
Posted: Fri Nov 28, 2008 8:30 am |
|
|
i think this program must work in real but how can see it working before i buy a pic24f.is there any simulation program for this pic24F series. ?? |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Nov 29, 2008 6:30 am |
|
|
MPLAB simulator basically can simulate PIC24F correctly. |
|
|
tugrulex84
Joined: 10 Nov 2008 Posts: 9
|
|
Posted: Fri Dec 19, 2008 7:40 am |
|
|
FvM wrote: | MPLAB simulator basically can simulate PIC24F correctly. |
Hi my friend, I only know to use proteus for simulation. But it doesn't work as I said. I want to know that program works or not?? If you have chance, can you try or simulate this and after please tell me that program is correct and works in a real chip or not.
Thank you so much.. |
|
|
|