View Full Version : 18F25K20 osc setting problem
Gevo
- 3rd June 2015, 13:05
Hi every one,
On a older application with the 18F25K20 I need some more I/O. So, I remove the crystal to get RA6 and RA7 available.
Now I want to switch to the internal osc and try this working with @_CONFIG_CONFIG1H_FOSC_INTIO67 but nothing happend.
OSCCON = % 01110000 ' set to 8MHz
OSCTUNE = % 00000000 ' set PLL off
For control I connect a LED to a I/O. When I put the crystal back, the LED is flashing...
The software is written in Pro 2.60C and MPASM is using.
In MicroCode Studio Plus the Device set to PIC18F25K20 and the compiler give no errors.
mackrackit
- 3rd June 2015, 13:22
Your OSCCON setting is for 16 MHz
Change INTIO67
to
INTOSCIO
Gevo
- 3rd June 2015, 13:49
Hi Dave,
You right about the OSCCON. I set this to %01100000 for 8MHz. speed.
I try to change INTOSCIO but no LED flashing...
mackrackit
- 3rd June 2015, 13:56
Post your code and configs.
Gevo
- 3rd June 2015, 14:29
Hi Dave,
This my program.
asm
@_CONFIG_CONFIG1H_FOSC_INTIO67
endasm
OSCCON = %01100000 ' OSC Control register to 8MHz
OSCTUNE = %00000000 ' 16 MHz PLL Off bit 6=0, 64MHz PLL On bit 6=1
DEFINE OSC 8 ' Inform PBP for 8 MHz
' Hardware initialization
ANSEL = 0 ' all I/O to digital
ANSELH = 0 '
Led var PORTA.0
' ----- [ Program Code ] ------------------------------------------------------
Main:
High LED ' LED On
pause 200
low LED ' And off....
pause 300
goto Main
mackrackit
- 3rd June 2015, 15:49
I read something wrong the first time.
Try
@ __CONFIG _CONFIG1H, _FOSC_INTIO67_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
@ __CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
@ __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
@ __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
CM1CON0 = 0
CM2CON0 = 0
Along with your other settings. But I do not have this chip to test...
Gevo
- 3rd June 2015, 16:47
Thanks Dave,
A lott of errors. like:
(,) illegal character
(_CONFIG1H) illegal opcode
(_CONFIG2H) illegal opcode
(_CONFIG3H) illegal opcode
(_CONFIG4L) illegal opcode
The 18F25K20 is the same as on the Amicus18 boards. I read about some problem with MPASM for this PIC.
towlerg
- 3rd June 2015, 17:02
@Gevo What version of the compiler are you using?
George
towlerg
- 3rd June 2015, 17:11
@Gevo What version of the compiler are you using?
George
Gevo
- 3rd June 2015, 17:15
Hi George,
PBP 2.60C
MicroCode Studio 3.0.0.5
MPASM ? I have MPLAB IDE v8.84
Gevo
- 3rd June 2015, 18:48
I have update MPLAB IDE to v8.92
So, MPASM is now v5.51
I think this is the last version of MPLAB IDE
Dave
- 3rd June 2015, 20:17
Gevo, This compiles just fine for me.
#CONFIG
__CONFIG _CONFIG1H, _FOSC_INTIO67_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
#ENDCONFIG
In fact I use MPLAB 8.73a
I am how ever using PBPX 3.0.7.4
Gevo
- 3rd June 2015, 20:49
Hi Dave,
Thanks for your input. This give errors for PBP Pro...
error (122) Illegal opcode (_CONFIG1H)
error (122) Illegal opcode (_CONFIG2H)
error (122) Illegal opcode (_CONFIG3H)
error (122) Illegal opcode (_CONFIG4L)
If have plans to upgrade to PBP3 :-)
towlerg
- 3rd June 2015, 22:18
I think the #CONFIG syntax was introduced with v3.
George
Scampy
- 4th June 2015, 01:36
The the following.
Browse to where you have your PBP2.60 folder installation. Scroll down until you find the 18F25K20.INC file and open it in notepad. It should look something like this
;************************************************* ***************
;* 18F25K20.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2008 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 09/15/08 *
;* Version : 2.60 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F25K20, r = dec, w = -311, w = -230, f = inhx32
INCLUDE "P18F25K20.INC" ; MPASM Header
__CONFIG _CONFIG1H, _FOSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 32
Under the section "Include P18F25k20.inc" you'll see all the config settings... comment out all four lines thus:
;************************************************* ***************
;* 18F25K20.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2008 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 09/15/08 *
;* Version : 2.60 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F25K20, r = dec, w = -311, w = -230, f = inhx32
INCLUDE "P18F25K20.INC" ; MPASM Header
;__CONFIG _CONFIG1H, _FOSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
;__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
;__CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
;__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 32
Now include the settings in your main PBP code
ASM
@ __CONFIG _CONFIG1H, _FOSC_INTIO67_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
@ __CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
@ __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
@ __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
ENDASM
This should compile correctly in PBP 2.60
Scampy
- 4th June 2015, 01:39
I think the #CONFIG syntax was introduced with v3.
George
That's correct...
Gevo, This compiles just fine for me.
#CONFIG
__CONFIG _CONFIG1H, _FOSC_INTIO67_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
#ENDCONFIG
Dave, the OP is using 2.60. It doesn't support the #CONFIG /#ENDCONFIG satements
Gevo
- 4th June 2015, 16:06
Hello Scampy, thanks for the workout.
I have comment out the four line's in the .INC file (PBP folder)
I have add the line's to PBP main code and get errors after compiling. (PBP v2.60C)
4 time this error > [warning 207] .... Found label after column 1. (@)
4 time this error > [error 121] illegal label (@)
I don't understand why PBP give this error, the instructions/settings are equal as in de .INC file what you advice me to comment out.
If change some __ like this;
ASM
@_CONFIG _CONFIG1H, _FOSC_INTIO67_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
@_CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
@_CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
@_CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
ENDASM
Now I get 4 other errors:
Error [122] illegal opcode (_CONFIG1H)
Error [122] illegal opcode (_CONFIG2H)
Error [122] illegal opcode (_CONFIG3H)
Error [122] illegal opcode (_CONFIG4L)
Pfff, all this to get RA6 and RA7 as I/O...
Scampy
- 4th June 2015, 17:11
Hello Scampy, thanks for the workout.
I have comment out the four line's in the .INC file (PBP folder)
I have add the line's to PBP main code and get errors after compiling. (PBP v2.60C)
4 time this error > [warning 207] .... Found label after column 1. (@)
4 time this error > [error 121] illegal label (@)
I don't understand why PBP give this error, the instructions/settings are equal as in de .INC file what you advice me to comment out.
The following compiles fine using PBP 2.60c and MPASM 5.06 (old but that's not what's causing your problem.
'************************************************* ***************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2015 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 04/06/2015 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
ASM
__CONFIG _CONFIG1H, _FOSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
ENDASM
Notice that there are no @'s in the config settings, and that I have the config settings indented. If you have the underscore (_) at the start of column 1 you get those errors.
Cut and paste those settings at the start of your code, make sure you have the 18F25K20 selected in microcode studio and hit the compile button
Gevo
- 6th June 2015, 08:14
Hi Scampy,
I cut and paste the settings at the start of the code, change _FOSC_HS_1H to _FOSC_INTIO67_1H to get RA6 and RA7 as I/O en compile without error's.
The LED is flashing now and the PIC RUNs without the crystal.
Thank you very much for your advice to solve this !
Scampy
- 7th June 2015, 00:53
You're welcome,
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.