View previous topic :: View next topic |
Author |
Message |
sindyme
Joined: 05 Aug 2009 Posts: 37
|
How can I set internal oscillator for PIC24F16KA101 |
Posted: Sun Mar 14, 2010 11:57 pm |
|
|
Hello everybody
I want to set internal oscillator for "PIC24F16KA101"
I'm try these set at wizard but still can't work
#FUSES FRC //Internal Fast RC Oscillator
#FUSES FRC_PLL //Internal Fast RC oscillator with PLL
#FUSES LPRC //Internal low power RC Oscillator
Code: |
#include <24F16KA101.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 NOIESO //Internal External Switch Over mode enabled
#FUSES NOPR //Pimary oscillaotr disabled
#FUSES NOOSCIO //OSC2 is general purpose output
#FUSES POSCFREQ_H
#FUSES SOSC_HIGH
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES WPOSTS16 //Watch Dog Timer PostScalar 1:32768
#FUSES WPRES128 //Watch Dog Timer PreScalar 1:128
#FUSES WINDIS //Watch Dog Timer in non-Window mode
#FUSES NOBROWNOUT //No brownout reset
#FUSES PUT //Power Up Timer
#FUSES BORV_LOW
#FUSES MCLR //Master Clear pin enabled
#FUSES ICSP1 //ICD uses PGC1/PGD1 pins
#FUSES NODEBUG //No Debug mode for ICD
#FUSES DSWDT2147483648
#FUSES DSWDTCK_LPRC
#FUSES RTCCK_SOSC
#FUSES DSBOR
#FUSES DSWDT
#use delay(clock=8000000)
|
|
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Mar 15, 2010 12:24 am |
|
|
#fuses FRC is working with PIC24F24KA101 and (at least) recent compiler versions (V4.104, V4.105).
How do you determine, that it doesn't work? What's your compiler version? |
|
|
sindyme
Joined: 05 Aug 2009 Posts: 37
|
|
Posted: Mon Mar 15, 2010 12:38 am |
|
|
FvM wrote: | #fuses FRC is working with PIC24F24KA101 and (at least) recent compiler versions (V4.104, V4.105).
How do you determine, that it doesn't work? What's your compiler version? |
My CCS version is 4.105 of PCDIDE.
There is my code for internal oscillator test.
Code: |
void main()
{
setup_spi( FALSE );
setup_wdt(WDT_OFF);
setup_timer1(TMR_DISABLED);
enable_interrupts(INT_RDA);
enable_interrupts(INT_RDA2);
for(;;)
{
delay_ms(500);
fprintf(comb,"MLis-Ln64 Start Initial\r\n");
fprintf(coma,"Please wait....\r\n");
}
}
|
.h file
Code: |
#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 NOIESO //Internal External Switch Over mode enabled
#FUSES NOPR //Pimary oscillaotr disabled
#FUSES NOOSCIO //OSC2 is general purpose output
#FUSES POSCFREQ_H
#FUSES SOSC_HIGH
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES WPOSTS16 //Watch Dog Timer PostScalar 1:32768
#FUSES WPRES128 //Watch Dog Timer PreScalar 1:128
#FUSES WINDIS //Watch Dog Timer in non-Window mode
#FUSES NOBROWNOUT //No brownout reset
#FUSES PUT //Power Up Timer
#FUSES BORV_LOW
#FUSES MCLR //Master Clear pin enabled
#FUSES ICSP1 //ICD uses PGC1/PGD1 pins
#FUSES NODEBUG //No Debug mode for ICD
#FUSES DSWDT2147483648
#FUSES DSWDTCK_LPRC
#FUSES RTCCK_SOSC
#FUSES DSBOR
#FUSES DSWDT
#use delay(clock=8000000)
#use rs232(UART1,baud=9600,parity=N,bits=8,stream=coma) //Pin_11,Pin_6
#use rs232(UART2,baud=9600,parity=N,bits=8,stream=comb) //Pin_4,Pin_5
|
|
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Mar 15, 2010 3:49 am |
|
|
I don't see a problem with the fuses settings, also no other problem in your code (as far as you posted it). I'm using
nearly identical fuses in my application. I don't know, if you have ISRs for your enabled RxD interrupts. Otherwise, there
would be a problem. |
|
|
sindyme
Joined: 05 Aug 2009 Posts: 37
|
|
Posted: Mon Mar 15, 2010 8:41 pm |
|
|
FvM wrote: | I don't see a problem with the fuses settings, also no other problem in your code (as far as you posted it). I'm using
nearly identical fuses in my application. I don't know, if you have ISRs for your enabled RxD interrupts. Otherwise, there
would be a problem. |
Ok, I solve this question.
Because I have ISRs for enabled RxD interrupts.
Now my "PIC" work when I remove RxD interrupts.
Thank your suggestion, Fvm. |
|
|
|