News:

;) This forum is the property of Proton software developers

Main Menu

PIC18F25K22 Serout problem.

Started by JackB, Jan 12, 2025, 05:13 PM

Previous topic - Next topic

JackB

Hi,

with this command at 9600 Baud: 

SerOut PORTA.0,84, [" Test    : ",13,10]

I received on the terminal at 2400 baud.

when I set the  LVP = On then nothing is show on the terminal

any idea for a fix what I can setup on my side.

thank you

' Serial test

Device = 18F25K22 
Declare Xtal = 64

Config_Start
  FOSC = INTIO67     ; Internal oscillator block
  PLLCFG = On        ; Oscillator multiplied by 4
  MCLRE = INTMCLR    ; RE3 input pin enabled; MCLR disabled
  PRICLKEN = On      ; Primary clock enabled 
  FCMEN = OFF        ; Fail-Safe Clock Monitor disabled
  BOREN = SBORDIS    ; Brown-out Reset enabled in hardware only (SBOREN is disabled)
  WDTEN = Off        ; WDT is always enabled. SWDTEN bit has no effect
  LVP = Off          ; Single-Supply ICSP disabled 
Config_End

TRISA = %00001000              ' 0:Out 1:In
TRISB = %00100000
TRISC = %00000000

High PORTA.0                   
                         
ANSELA = 0
ANSELB= 0
ANSELC= 0
OSCCON = $70                 

MAIN:                                  ' Main Routine

While PORTE.3 = 1: Wend                ' Button Press
DelayMS 100                            ' Bounce delay
While PORTE.3 = 0: Wend                ' Button release
DelayMS 100                            ' Bounce delay

SerOut PORTA.0,84, [" Test    : ",13,10]

GoTo MAIN



RGV250

Hi,
I think it is not as straight forward as that for the internal osc at 64mhz. this would be why the BAUD is different.
Have a look at post 2 here.  https://protoncompiler.com/index.php/topic,310.msg1912/topicseen.html#msg1912

Bob

JackB

#2
code work fine with PBP3 and serout2
and Picaxe before erasing to use with Positron, PBP3
also a PIC18F14K22 serout command work fine at 64Mhz and Positron

CPR

        OSCCON = 0b01110000           '// HFINTOSC (16 MHz), SCS=00 Primary clock (determined by FOSC<3:0>)
        OSCTUNE.6 = 1                 '// enable 4xPLL NOTE: This gives us 64Mhz

JackB

Hello CPR

you're a life saver.

I had the osccon = $70, but omit the osctune = $40 since the config had this line PLLCFG = On

Many thanks for your help have a great day.






CPR

Quote from: JackB on Jan 12, 2025, 08:55 PMHello CPR

you're a life saver.

I had the osccon = $70, but omit the osctune = $40 since the config had this line PLLCFG = On

Many thanks for your help have a great day.







My pleasure. Glad to be of help. I had exactly the same issue bother me for quite a while.  :)

JackB

I have to add me too, remember this while ago to include the osctune.

Great help..