View previous topic :: View next topic |
Author |
Message |
farouk_baya
Joined: 18 Jun 2010 Posts: 27
|
problem with 18f26j50 |
Posted: Sun Aug 07, 2011 7:18 am |
|
|
Hello, it is the first time that I use 18f26j50. I used before 18f4550, it
wasn't so complicated.
Code: |
#include "18f26j50.h"
#fuses HSPLL,NOWDT,NOCPUDIV,PLL5
#use delay(clock=48M)
void main()
{
SETUP_ADC(ADC_OFF);
SETUP_ADC_PORTS(NO_ANALOGS);
output_b(0x00);
set_tris_b(0x00);
while(1)
{
output_b(0x00);
delay_ms(1000);
output_b(0b00111111);
delay_ms(1000);
}
} |
I have problems to make choice for the fuses because I don't know enough about them.
In the data sheet I took a look in the oscillator diagram they mentioned. As I understand: I have to fix the PLLDIV, CPDIV, the use of external or internal oscillator.
I have to fix this problem.
Thanks for everybody.
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Aug 07, 2011 12:42 pm |
|
|
What's your CCS compiler version ?
What is the frequency of your external crystal ? |
|
|
farouk_baya
Joined: 18 Jun 2010 Posts: 27
|
|
Posted: Sun Aug 07, 2011 5:12 pm |
|
|
hello,
20 MHz external crystal
ccs c 4.110 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Aug 07, 2011 9:08 pm |
|
|
I think this setup will work with your version:
Code: |
#include <18F26J50.h>
#fuses HSPLL, NOWDT, PLL5
#use delay(clock=48M)
//============================
void main()
{
setup_oscillator(OSC_PLL_ON);
while(1);
} |
|
|
|
farouk_baya
Joined: 18 Jun 2010 Posts: 27
|
|
Posted: Mon Aug 08, 2011 4:28 am |
|
|
Thanks for you help.
It works very fine. |
|
|
|