PIC18F24J50 oscillator setting do not work

For general Flowcode discussion that does not belong in the other sections.
Post Reply
SpeedPIC32
Posts: 278
http://meble-kuchenne.info.pl
Joined: Thu Dec 10, 2020 2:35 pm
Location: Germany
Has thanked: 37 times
Been thanked: 17 times

PIC18F24J50 oscillator setting do not work

Post by SpeedPIC32 »

Hi,
I need help
I want to run it with the 8Mhz internal and USB
no matter what I set, it flashes every 2 seconds
I'm curious what I'm doing wrong :roll: :roll:

thank you and have a nice weekend
Attachments
PIC18F24J50.fcfx
(8.44 KiB) Downloaded 748 times

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: PIC18F24J50 oscillator setting do not work

Post by p.erasmus »

Hi,

I do not have such a device to test however these settings should run your PIC at 48MHz for USB FS with the Internal OSC

PIC18F24J50.rar
(2.5 KiB) Downloaded 696 times
Regards Peter - QME Electronics

chipfryer27
Valued Contributor
Posts: 1684
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 374 times
Been thanked: 583 times

Re: PIC18F24J50 oscillator setting do not work

Post by chipfryer27 »

Hi SpeedPIC32

In your settings you have the chip set to look for an external clock on Port A7 (ECPLL), perhaps set that to INTOSC, and you will probably need a C-code block at the beginning containing OSCCON=0x70;

I don't have that chip to try out myself.

Hope this helps.

Regards

Edit

Haha
I've just pretty much said what Qmesar did <s>

SpeedPIC32
Posts: 278
Joined: Thu Dec 10, 2020 2:35 pm
Location: Germany
Has thanked: 37 times
Been thanked: 17 times

Re: PIC18F24J50 oscillator setting do not work

Post by SpeedPIC32 »

first of all thank you chipfryer27
unfortunately the chip does not want to run at 48 MHz yet.
it runs at 8 MHz???
do you have another idea?
does it have to do with saving power?

Regards

SpeedPIC32
Posts: 278
Joined: Thu Dec 10, 2020 2:35 pm
Location: Germany
Has thanked: 37 times
Been thanked: 17 times

[color=#FF0000] Re: PIC18F24J50 oscillator setting do not work[/color]

Post by SpeedPIC32 »

The problem seems to be bigger. :twisted:
I set OSCTUNE = 0xc0 with the same settings and additionally.
FC9 does not respond to this.
With the software mikroBasic Pro for PIC I got the PIC to run at 48Mhz.
I also have there too
OSCCON = 0x70 and OSCTUNE = 0xc0 set.

configuration register
CONFIG1L : $3FF8 : 0x008E
CONFIG1H : $3FF9 : 0x00F7
CONFIG2L : $3FFA : 0x0012
CONFIG2H : $3FFB : 0x00FF
CONFIG3L : $3FFC : 0x00F7
CONFIG3H : $3FFD : 0x00F9
CONFIG4L : $3FFE : 0x00CF
CONFIG4H : $3FFF : 0x00F1

program pic18f24j50

' Declarations section

' Main program
dim uart_rd as byte

main:

OSCCON = 0x70
OSCTUNE = 0xc0

trisc.2=0
portc.2=0
UART1_Init(9600) ' Initialize UART module at 9600 bps
Delay_ms(100) ' Wait for UART module to stabilize

UART1_Write_Text("Ready")
UART1_Write(10) ' Line Feed
UART1_Write(13) ' Carriage Return

while (TRUE) ' Endless loop
if (UART1_Data_Ready() <> 0) then ' If data is received,
uart_rd = UART1_Read() ' read the received data,
UART1_Write(uart_rd) ' and send data via UART
end if
portc.2=1
delay_ms(1000)
portc.2=0
delay_ms(1000)
wend
end.

chipfryer27
Valued Contributor
Posts: 1684
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 374 times
Been thanked: 583 times

Re: PIC18F24J50 oscillator setting do not work

Post by chipfryer27 »

Hi

I'll have a look and hopefully will get back to you over the weekend. Unfortunately I don't have that chip to try things with myself so (if) anything I do come back with would be based on datasheet info. It does sound like a setting isn't quite right though.

Did Qmesar's code not run at all?

Regards

SpeedPIC32
Posts: 278
Joined: Thu Dec 10, 2020 2:35 pm
Location: Germany
Has thanked: 37 times
Been thanked: 17 times

Re: PIC18F24J50 oscillator setting do not work

Post by SpeedPIC32 »

The program was executed but only at 8 MHz
With the same setting, the same program runs under MicroBasik at 48Mhz.
I did everything the same way.
I also tested the built-in compiler and the latest XC8 compiler. without success. it seems that the PLL is not switched on

best regards

SpeedPIC32
Posts: 278
Joined: Thu Dec 10, 2020 2:35 pm
Location: Germany
Has thanked: 37 times
Been thanked: 17 times

Re: PIC18F24J50 oscillator setting do not work

Post by SpeedPIC32 »

here is my program

Thank you for your help
Attachments
PIC18F24J50.fcfx
(7.57 KiB) Downloaded 645 times

SpeedPIC32
Posts: 278
Joined: Thu Dec 10, 2020 2:35 pm
Location: Germany
Has thanked: 37 times
Been thanked: 17 times

Re: PIC18F24J50 oscillator setting do not work

Post by SpeedPIC32 »

hi chipfryer27
After restarting the computer, the chip runs at 48Mhz

It was due to the OSCCON register and also the OSCTUNE register

Thank you for your help

Post Reply