View previous topic :: View next topic |
Author |
Message |
raffaele
Joined: 19 Feb 2010 Posts: 8
|
Starting PIC18 and PIC24 |
Posted: Fri Feb 19, 2010 4:54 am |
|
|
Hello to all,
I'm starting using PIC18 and PIC24 family with PCWHD 4.093.
I have few PIC like 24HJ64GP502, 18F25J11, 24HJ128GP502. I wrote a simple code for blinking a led but it's not working.
Maybe I don't configure fuses in the right way.
Here the code:
Code: | #include <24hj64gp502.h>
#fuses FRC,NOWDT
#use delay(clock=7370000)
void main()
{
set_tris_b (0xf0);
while(TRUE)
{
output_low(PIN_B3);
delay_ms(200);
output_high(PIN_B3);
delay_ms(200);
}
} |
Thank you for your help.
Raffaele |
|
|
logical
Joined: 21 Dec 2009 Posts: 57 Location: SouthPort, UK
|
|
Posted: Fri Feb 19, 2010 11:49 am |
|
|
A copy of my fuses that work with the internal oscillator, did a blink led program myself as just started on the GP502 and GP504's.
Code: | #include<24HJ128GP502.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOWRTB //Boot block not write protected
#FUSES NOBSS //No boot segment
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES FRC //Internal Fast RC Oscillator
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES OSCIO //OSC2 is general purpose output
#FUSES NOPR //Pimary oscillaotr disabled
#FUSES NOWINDIS //Watch Dog Timer in Window mode
#FUSES WPRES128 //Watch Dog Timer PreScalar 1:128
#FUSES WPOSTS16 //Watch Dog Timer PostScalar 1:32768
#FUSES PUT128 //Power On Reset Timer value 128ms
#FUSES IOL1WAY //Allows only one reconfiguration of peripheral pins
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NORSS //No secure segment RAM
#FUSES NOSSS //No secure segment
#FUSES NOWRTSS //Secure segment not write protected
#FUSES NORBS //No Boot RAM defined
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOCOE //Device will reset into operational mode
#FUSES NOJTAG //JTAG disabled
#FUSES ICSP3 //ICD uses PGC3/PGD3 pins
#FUSES NOALTI2C //I2C mapped to alternate pins
#use delay(clock=7370000)
|
|
|
|
raffaele
Joined: 19 Feb 2010 Posts: 8
|
|
Posted: Wed Feb 24, 2010 3:25 am |
|
|
Thank you, it works. I found also PIC24 Wizard is good to configure fuses. |
|
|
|