Jump to content
mkwahler

Boostc : #pragma Config For Pic18F44J50

Recommended Posts

Greetings:

 

I need assistance with configuring the PIC18F44J50 with the BoostC compiler.

 

The provided header "PIC18F44J50.h" contains several "#pragma config"

directives, from which I chose the desired ones and copied to my source.

Everything compiles OK, except for the "#pragma FOSC" line.

 

I get an error: "invalid setting 'FOSC'". I tried all the possible values provided

in the header, but get the same error.

 

I double-checked that I have the correct target set in the SourceBoost IDE

"Settings/Target".

 

My exact code follows.

 

--- begin code ---

#include <system.h>

 

#pragma config WDTEN = OFF // Watchdog Timer

#pragma config PLLDIV = 1 // PLL Prescaler

#pragma config STVREN = ON // Stack Overflow/Underflow Reset

#pragma config XINST = OFF // Extended Instruction Set

#pragma config CPUDIV = OSC1 // CPU System Clock Postscaler

#pragma config CP0 = OFF // Code Protect

#pragma config OSC = INTOSC // Oscillator

#pragma config T1DIG = OFF // T1OSCEN Enforcement

#pragma config LPT1OSC = OFF // Low-Power Timer1 Oscillator

#pragma config FCMEN = OFF // Fail-Safe Clock Monitor

#pragma config IESO = OFF // Internal External Oscillator Switch Over Mode

#pragma config WDTPS = 1 // Watchdog Postscaler

#pragma config DSWDTOSC = INTOSCREF // DSWDT Clock Select

#pragma config RTCOSC = INTOSCREF // RTCC Clock Select

#pragma config DSBOREN = OFF // Deep Sleep BOR

#pragma config DSWDTEN = OFF // Deep Sleep Watchdog Timer

#pragma config DSWDTPS = 2 // Deep Sleep Watchdog Postscaler

#pragma config IOL1WAY = OFF // IOLOCK One-Way Set Enable bit

#pragma config MSSP7B_EN = MSK7 // MSSP address masking

#pragma config WPFP = PAGE_0 // Write/Erase Protect Page Start/End Location

#pragma config WPEND = PAGE_0 // Write/Erase Protect Region Select bit (valid when WPDIS = 0)

#pragma config WPCFG = OFF // Write/Erase Protect Configuration Region

#pragma config WPDIS = OFF // Write Protect Disable bit

#pragma config FOSC = INTIO67 // Oscillator Selection bits

 

int main(void)

{

return 0;

}

--- end code ---

 

Can anyone help?

 

Thanks,

-Mike

Share this post


Link to post
Share on other sites

mkwahler,

...

#pragma config FOSC = INTIO67 // Oscillator Selection bits

...

Can anyone help?

All the device configuration options can be found in the devices target descriptor file (.tdf file). This file can be found in the installation folder, inside the config folder.

 

Please take a look in there.

 

Regards

Dave

Share this post


Link to post
Share on other sites

Hi Mike,

 

The problem lies in the PIC18F44J50.tdf file.

 

Find the line

TargetConfig OSC

and change it to

TargetConfig FOSC

 

You may have to use:

#pragma config FOSC = INTOSC // Oscillator Selection bits

as the .h and .tdf don't match up.

 

Dave will correct this in the next release :(

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites

Dave and Reynard:

 

Thanks for your reply. In the tdf file, I did find the line

TargetConfig OSC

 

But then I noticed there's a "#pragma config OSC" line in the .h file.

So if I change the tdf from OSC to FOSC, the I suppose the "#pragma

config OSC" line will fail.

 

Perhaps the OSC line is already sufficient, and FOSC is superfluous?

Or are these supposed to be two different config items, or what?

 

----

 

Aside from this, is there anyone with experience with PIC18F44J50 who would

be willing to share some example code? All my previous experience has been

with PIC16 devices, and I'm new new PIC18. I'm have a bit of trouble trying to

configure pins for digital I/O. Does anyone have a simple example of driving

an LED or two with this device?

 

Thanks, and everyone have a safe and Happy New Year.

 

-Mike

Share this post


Link to post
Share on other sites

Reynard,

The problem lies in the PIC18F44J50.tdf file.

...

Dave will correct this in the next release :(

We just follow the names for the configuration control as used by MPASM, rather than start creating our own names. For the PIC18F46J50 MPASM uses OSC for oscillator configuration. Take a look in MPLAB PIC18 config help.

So we won't be correcting this as we want to be consistent with MPASM.

 

Regards

Dave

Share this post


Link to post
Share on other sites

Hi Dave,

 

Given the user cannot compile your product without error using the supplied .h and .tdf files, the problem lies with Souceboost.

 

The PIC18F44J50 is part of the PIC18F46J50 family but Sourceboost have decided to use differing names for OSC and FOSC also select names INTOSCO and INTIO67.

 

The info for the 44J50 part is incorrect with the Microchip data book for CONFIG2L (p421).

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites

Dave:

 

Since I still can't seem to get BoostC to create a simple working program, I decided to make

sure nothing else was wrong (e.g. my hardware), so I created a simple assembly language

program (using MPLAB/MPASM) to flash some LEDs. It worked fine.

 

Then I went back and compared the configuration directives from the MPASM .INC file with

those from the BoostC .h file. Everything matched, except that the BoostC .h file had an

extra: "FOSC". So I just eliminiated it from my C code.

 

However, I still cannot create a working C program with BoostC.

I also downloaded the Microchip MPLAB C18 compiler, and built the

same LED test program. It worked fine.

 

Following, I've pasted for each tool I tried (BoostC, MPLAB/MPASM,

and MPLAB/C18): the source code, the build log, and PICkit screen

data after importing the hex file. I hope this is not too much text

for a forum post.

 

MPLAB/MPASM and MPLAB/C18 code both work,

BoostC code does not work.

 

Note that for both C compilers, the config directives I used

are identical.

 

====== begin BOOSTC data =============

** Source file:

#include <system.h>

#include <stdlib.h>

 

#pragma CLOCK_FREQ 4000000

#pragma config WDTEN = OFF // Watchdog Timer

#pragma config PLLDIV = 1 // PLL Prescaler

#pragma config STVREN = ON // Stack Overflow/Underflow Reset

#pragma config XINST = OFF // Extended Instruction Set

#pragma config CPUDIV = OSC1 // CPU System Clock Postscaler

#pragma config CP0 = OFF // Code Protect

#pragma config OSC = INTOSC // Oscillator

#pragma config T1DIG = OFF // T1OSCEN Enforcement

#pragma config LPT1OSC = OFF // Low-Power Timer1 Oscillator

#pragma config FCMEN = OFF // Fail-Safe Clock Monitor

#pragma config IESO = OFF // Internal External Oscillator Switch Over Mode

#pragma config WDTPS = 1 // Watchdog Postscaler

#pragma config DSWDTOSC = INTOSCREF // DSWDT Clock Select

#pragma config RTCOSC = INTOSCREF // RTCC Clock Select

#pragma config DSBOREN = OFF // Deep Sleep BOR

#pragma config DSWDTEN = OFF // Deep Sleep Watchdog Timer

#pragma config DSWDTPS = 2 // Deep Sleep Watchdog Postscaler

#pragma config IOL1WAY = OFF // IOLOCK One-Way Set Enable bit

#pragma config MSSP7B_EN = MSK7 // MSSP address masking

#pragma config WPFP = PAGE_0 // Write/Erase Protect Page Start/End Location

#pragma config WPEND = PAGE_0 // Write/Erase Protect Region Select bit (valid when WPDIS = 0)

#pragma config WPCFG = OFF // Write/Erase Protect Configuration Region

#pragma config WPDIS = OFF // Write Protect Disable bit

 

int main(void)

{

ancon1 = 0xFF;

ancon0 = 0xFF;

 

latb = 0;

latc = 0;

 

trisb.0 = 0;

trisb.1 = 0;

trisb.2 = 0;

trisc.0 = 0;

 

latb.0 = 1;

latb.1 = 1;

latb.2 = 1;

latc.0 = 1;

 

while(1)

{

latb.0 = 1;

delay_ms(250);

latb.0 = 0;

delay_ms(250);

 

latb.1 = 1;

delay_ms(250);

latb.1 = 0;

delay_ms(250);

 

latb.2 = 1;

delay_ms(250);

latb.0 = 0;

delay_ms(250);

 

latc.0 = 1;

delay_ms(250);

latc.0 = 0;

delay_ms(250);

}

 

return 0;

}

** Build log:

 

Building...

"C:\Program Files (x86)\SourceBoost\boostc_pic18.exe" control.c -t PIC18F44J50 -idx 2 -W2 -obj

Debug -d _DEBUG

control.c(45:2): warning: expression is always true

BoostC Optimizing C Compiler Version 7.04 (for PIC18 architecture)

http://www.sourceboost.com

Copyright© 2004-2011 Pavel Baranov

Copyright© 2004-2011 David Hobday

Licensed to Mike Wahler under Single user Pro License for 1 node(s)

Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited

 

control.c

success

"C:\Program Files (x86)\SourceBoost\boostlink_pic.exe" -idx 2 /ld "C:\Program Files

(x86)\SourceBoost\lib\large" libc.pic18.lib Debug\control.obj /t PIC18F44J50 /d "Debug" /p Control

BoostLink Optimizing Linker Version 7.04

http://www.sourceboost.com

Copyright© 2004-2011 Pavel Baranov

Copyright© 2004-2011 David Hobday

 

Building CASM file

Memory Usage Report

===================

RAM available:3776 bytes, used:3 bytes (0.1%), free:3773 bytes (99.9%),

Heap size:3773 bytes, Heap max single alloc:127 bytes

ROM available:16376 bytes, used:36 bytes (0.3%), free:16340 bytes (99.7%)

 

success

Done

 

** PICkit screen, bottom of memory:

 

0000 EF46 F000 FFFF FFFF 5203 0000 E101 0012

0010 0EF9 0FFF A4D8 D7FD 0000 2E03 D7F9 0012

0020 010F 6949 6948 6A8A 6A8B 9093 9293 9493

0030 9094 808A 828A 848A 808B 808A 0EFA 6E03

0040 EC04 F000 908A 0EFA 6E03 EC04 F000 828A

0050 0EFA 6E03 EC04 F000 928A 0EFA 6E03 EC04

0060 F000 848A 0EFA 6E03 EC04 F000 908A 0EFA

0070 6E03 EC04 F000 808B 0EFA 6E03 EC04 F000

0080 908B 0EFA 6E03 EC04 F000 D7D7 EF10 F000

0090 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

00A0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

 

 

** PICkit screen, top of memory:

 

3FC0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

3FD0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

3FE0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

3FF0 FFFF FFFF FFFF FFFF F72E F010 F801 F180

====== end BOOSTC data =============

 

====== begin MPLAB MPASM data =============

 

** Source file:

 

#include <P18F44J50.INC>

 

CONFIG WDTEN = OFF

CONFIG PLLDIV = 1

CONFIG STVREN = OFF

CONFIG XINST = OFF

CONFIG CPUDIV = OSC1

CONFIG CP0 = OFF

CONFIG OSC = INTOSC

CONFIG T1DIG = OFF

CONFIG LPT1OSC = OFF

CONFIG FCMEN = OFF

CONFIG IESO = OFF

CONFIG WDTPS = 1

CONFIG DSWDTOSC = INTOSCREF

CONFIG RTCOSC = INTOSCREF

CONFIG DSBOREN = OFF

CONFIG DSWDTEN = OFF

CONFIG DSWDTPS = 2

CONFIG IOL1WAY = OFF

CONFIG MSSP7B_EN = MSK7

CONFIG WPFP = PAGE_0

CONFIG WPEND = PAGE_0

CONFIG WPCFG = OFF

CONFIG WPDIS = OFF

 

UDATA

delFF res 1

del res 1

 

CODE 0

goto start

MAIN CODE

 

start

movlw 0xFF

movwf ANCON0 ; all i/o is digial

movwf ANCON1 ; all i/o is digial

 

clrf LATB

clrf LATC

 

clrf TRISA

clrf TRISB

clrf TRISC

clrf TRISD

clrf TRISE

 

; --------------------------

top

; LED1

bsf LATB, 0

call delay

bcf LATB, 0

call delay

 

; LED2

bsf LATB, 1

call delay

bcf LATB, 1

call delay

 

; LED3

bsf LATB, 2

call delay

bcf LATB, 2

call delay

 

; LED4

bsf LATC, 0

call delay

bcf LATC, 0

call delay

 

goto top

 

; --------------------------

delayFF

movlw 0xFF

movwf delFF

nop

decfsz delFF, f

goto $-2

return

 

; --------------------------

delay

movlw 0xFF

movwf del

dec

decfsz del, f

goto ff

return

ff

call delayFF

goto dec

; --------------------------

 

END

** Build log:

 

----------------------------------------------------------------------

Debug build of project `C:\MWCS\MotoCam\PIC18_ASM\PIC18_LED_test.mcp' started.

Language tool versions: MPASMWIN.exe v5.37, mplink.exe v4.37, mplib.exe v4.37

Preprocessor symbol `__DEBUG' is defined.

Mon Jan 02 12:49:11 2012

----------------------------------------------------------------------

Make: The target "C:\MWCS\MotoCam\PIC18_ASM\PIC18_LED_test.o" is out of date.

Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p18F44J50 "C:\Users\Mike

\Desktop\PIC18_ASM\PIC18_LED_test.asm" /l"PIC18_LED_test.lst" /e"PIC18_LED_test.err"

/o"PIC18_LED_test.o" /d__DEBUG=1

Make: The target "C:\MWCS\MotoCam\PIC18_ASM\PIC18_LED_test.cof" is out of date.

Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\mplink.exe" "..\..\..\Program Files

(x86)\Microchip\MPASM Suite\LKR\18f44j50_g.lkr" "PIC18_LED_test.o" /u_DEBUG /z__MPLAB_BUILD=1

/z__MPLAB_DEBUG=1 /o"PIC18_LED_test.cof" /M"PIC18_LED_test.map" /W

MPLINK 4.37, Linker

Copyright © 1998-2010 Microchip Technology Inc.

Errors : 0

MP2HEX 4.37, COFF to HEX File Converter

Copyright © 1998-2010 Microchip Technology Inc.

Errors : 0

Loaded C:\MWCS\MotoCam\PIC18_ASM\PIC18_LED_test.cof.

----------------------------------------------------------------------

Debug build of project `C:\MWCS\MotoCam\PIC18_ASM\PIC18_LED_test.mcp' succeeded.

Language tool versions: MPASMWIN.exe v5.37, mplink.exe v4.37, mplib.exe v4.37

Preprocessor symbol `__DEBUG' is defined.

Mon Jan 02 12:49:13 2012

----------------------------------------------------------------------

BUILD SUCCEEDED

 

 

** PICkit screen, bottom of memory:

 

0000 EF03 F000 0000 0EFF 6F48 6F49 6A8A 6A8B

0010 6A92 6A93 6A94 6A95 6A96 808A EC2E F000

0020 908A EC2E F000 828A EC2E F000 928A EC2E

0030 F000 848A EC2E F000 948A EC2E F000 808B

0040 EC2E F000 908B EC2E F000 EF0D F000 0EFF

0050 6F60 0000 2F60 EF2A F000 0012 0EFF 6F61

0060 2F61 EF34 F000 0012 EC27 F000 EF30 F000

0070 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

0080 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

0090 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

00A0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

 

 

** PICkit screen, top of memory:

 

3FC0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

3FD0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

3FE0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

3FF0 FFFF FFFF FFFF FFFF F78E F010 F801 F180

====== end MPLAB MPASM data =============

 

====== begin MPLAB C18 data =============

 

** Source file:

 

#include <P18F44J50.h>

#include <delays.h>

#pragma config WDTEN = OFF // Watchdog Timer

#pragma config PLLDIV = 1 // PLL Prescaler

#pragma config STVREN = ON // Stack Overflow/Underflow Reset

#pragma config XINST = OFF // Extended Instruction Set

#pragma config CPUDIV = OSC1 // CPU System Clock Postscaler

#pragma config CP0 = OFF // Code Protect

#pragma config OSC = INTOSC // Oscillator

#pragma config T1DIG = OFF // T1OSCEN Enforcement

#pragma config LPT1OSC = OFF // Low-Power Timer1 Oscillator

#pragma config FCMEN = OFF // Fail-Safe Clock Monitor

#pragma config IESO = OFF // Internal External Oscillator Switch Over Mode

#pragma config WDTPS = 1 // Watchdog Postscaler

#pragma config DSWDTOSC = INTOSCREF // DSWDT Clock Select

#pragma config RTCOSC = INTOSCREF // RTCC Clock Select

#pragma config DSBOREN = OFF // Deep Sleep BOR

#pragma config DSWDTEN = OFF // Deep Sleep Watchdog Timer

#pragma config DSWDTPS = 2 // Deep Sleep Watchdog Postscaler

#pragma config IOL1WAY = OFF // IOLOCK One-Way Set Enable bit

#pragma config MSSP7B_EN = MSK7 // MSSP address masking

#pragma config WPFP = PAGE_0 // Write/Erase Protect Page Start/End Location

#pragma config WPEND = PAGE_0 // Write/Erase Protect Region Select bit (valid when WPDIS =0)

#pragma config WPCFG = OFF // Write/Erase Protect Configuration Region

#pragma config WPDIS = OFF // Write Protect Disable bit

 

int main(void)

{

ANCON0 = 0xFF;

ANCON1 = 0xFF;

 

LATB = 0;

LATC = 0;

 

TRISA = 0;

TRISB = 0;

TRISC = 0;

TRISD = 0;

TRISE = 0;

 

while(1)

{

LATBbits.LATB0 = 1;

Delay1KTCYx(0);

LATBbits.LATB0 = 0;

Delay1KTCYx(0);

 

LATBbits.LATB1 = 1;

Delay1KTCYx(0);

LATBbits.LATB1 = 0;

Delay1KTCYx(0);

 

LATBbits.LATB2 = 1;

Delay1KTCYx(0);

LATBbits.LATB2 = 0;

Delay1KTCYx(0);

 

LATCbits.LATC0 = 1;

Delay1KTCYx(0);

LATCbits.LATC0 = 0;

Delay1KTCYx(0);

}

 

return 0;

}

 

 

** Build log:

 

----------------------------------------------------------------------

Debug build of project `C:\Users\Mike\Desktop\PIC18_MPLAB_C18\C18_LED_test.mcp' started.

Language tool versions: mpasmwin.exe v5.42, mplink.exe v4.40, mcc18.exe v3.40, mplib.exe v4.40

Preprocessor symbol `__DEBUG' is defined.

Mon Jan 02 12:25:29 2012

----------------------------------------------------------------------

Make: The target "C:\Users\Mike\Desktop\PIC18_MPLAB_C18\PIC18_LED_test.o" is out of date.

Executing: "C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\mcc18.exe" -p=18F44J50

"PIC18_LED_test.c" -fo="PIC18_LED_test.o" -D__DEBUG -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-

C:\Users\Mike\Desktop\PIC18_MPLAB_C18\PIC18_LED_test.c:28:Warning [2103] default startup code

expects main function declared as 'void main (void)'

Make: The target "C:\Users\Mike\Desktop\PIC18_MPLAB_C18\C18_LED_test.cof" is out of date.

Executing: "C:\Program Files (x86)\Microchip\mplabc18\v3.40\bin\mplink.exe" /p18F44J50

"PIC18_LED_test.o" /u_CRUNTIME /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"C18_LED_test.cof"

/M"C18_LED_test.map" /W

MPLINK 4.40, Linker

Device Database Version 1.3

Copyright © 1998-2011 Microchip Technology Inc.

Errors : 0

MP2HEX 4.40, COFF to HEX File Converter

Copyright © 1998-2011 Microchip Technology Inc.

Errors : 0

Loaded C:\Users\Mike\Desktop\PIC18_MPLAB_C18\C18_LED_test.cof.

----------------------------------------------------------------------

Debug build of project `C:\Users\Mike\Desktop\PIC18_MPLAB_C18\C18_LED_test.mcp' succeeded.

Language tool versions: mpasmwin.exe v5.42, mplink.exe v4.40, mcc18.exe v3.40, mplib.exe v4.40

Preprocessor symbol `__DEBUG' is defined.

Mon Jan 02 12:25:30 2012

----------------------------------------------------------------------

BUILD SUCCEEDED

 

 

** PICkit screen, bottom of memory:

 

0000 EFAA F000 0012 0000 0E06 6EF6 0E00 6EF7

0010 0E00 6EF8 0100 0009 50F5 6F65 0009 50F5

0020 6F66 E103 6765 D001 D03D 0009 50F5 6F60

0030 0009 50F5 6F61 0009 50F5 6F62 0009 0009

0040 50F5 6EE9 0009 50F5 6EEA 0009 0009 0009

0050 50F5 6F63 0009 50F5 6F64 0009 0009 CFF6

0060 F067 CFF7 F068 CFF8 F069 C060 FFF6 C061

0070 FFF7 C062 FFF8 0100 5363 E102 5364 E007

0080 0009 50F5 6EEE 0763 E2F8 0764 D7F9 C067

0090 FFF6 C068 FFF7 C069 FFF8 0100 0765 0E00

00A0 5B66 D7BF 0012 010F 6948 6949 6A8A 6A8B

00B0 6A92 6A93 6A94 6A95 6A96 808A 6AE6 EC8A

00C0 F000 52E5 908A 6AE6 EC8A F000 52E5 828A

00D0 6AE6 EC8A F000 52E5 928A 6AE6 EC8A F000

00E0 52E5 848A 6AE6 EC8A F000 52E5 948A 6AE6

00F0 EC8A F000 52E5 808B 6AE6 EC8A F000 52E5

0100 908B 6AE6 EC8A F000 52E5 D7D7 6AF3 6AF4

0110 D000 0012 0EFF 50E3 6E02 0E48 D001 0E4C

0120 6EE7 2EE7 D7FE 6AE7 2EE7 D7FE 2E02 D7F7

0130 0000 0012 0EC0 6EF3 EE00 F000 0E0E D801

0140 0012 60EA D002 6AEE D7FC 50F3 60E9 0012

0150 6AEE D7FC EE1D F000 EE2D F000 6AF8 9C01

0160 EC04 F000 ECB8 F000 EC53 F000 D7FB 0012

0170 0012 FFFF FFFF FFFF FFFF FFFF FFFF FFFF

0180 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

0190 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

01A0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

 

 

** PICkit screen, top of memory:

 

3FC0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

3FD0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

3FE0 FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF

3FF0 FFFF FFFF FFFF FFFF F7AE F010 F801 F180

 

====== end MPLAB C18 data =============

 

=============== END OF TEST DATA =================================

 

Perhaps someone can tell me what's going on?

I've been using BoostC for quite a while for programming the PIC16F690,

and I really like the compiler. I hope I'll be able to continue to use

it now that I've moved to a PIC18 device.

 

-Mike

Share this post


Link to post
Share on other sites

Mike,

The issue is probably in the device configuration data.

 

When using BoostC you got:

3FF0 FFFF FFFF FFFF FFFF F72E F010 F801 F180

 

When using MPASM you got:

3FF0 FFFF FFFF FFFF FFFF F78E F010 F801 F180

 

When using C18 you got:

3FF0 FFFF FFFF FFFF FFFF F7AE F010 F801 F180

 

You need to check what the differences in the configurations words mean.

It could be that Microchip uses some defaults when an option is not specified, and hence when identical settings are used the Microchip versions work.

 

Regards

Dave

Share this post


Link to post
Share on other sites

In the SourceBoost config words you may have the DEBUG bit turned on.

 

In the header file 18F44J50.h, the oscillator bits are defined twice, Once as OSC and once as FOSC.

 

Ignore FOSC definitions at the bottom of the file, better still delete them and use only the OSC definitions.

 

CHeers

 

Reynard

Share this post


Link to post
Share on other sites

[ SOLVED !! ]

 

Bingo! You've identified the trouble. I should have noticed those differing config

bytes on the PICkit screen (I'll just attribute my inattention to my frustration. :-))

 

I flipped the bit in PICkit, and the program worked.

 

But I think there's still something that needs to be done in BoostC

regarding the DEBUG config bit.

 

The MPLAB/C18 compiler accepts and correctly implements a "#pragma config DEBUG"

directive (but interestingly does not document it). I found it in the MPASM .INC

file which is what C18 uses for config stuff.

 

BoostC rejects "pragma config DEBUG" as an error.

 

I'm able to work around this with

#pragma DATA 0x3FF8, 0x8E

 

My test program works correctly.

 

So now I'm back in business with BoostC. :) :) :)

 

 

(Reynard: I had already previously determined that the 'FOSC' definition was superfluous,

and omiited it.)

 

Thanks for all your help, guys.

 

-Mike.

Share this post


Link to post
Share on other sites

Reynard,

Given the user cannot compile your product without error using the supplied .h and .tdf files, the problem lies with Souceboost.

If this is the case, then its not good.

 

The PIC18F44J50 is part of the PIC18F46J50 family but Sourceboost have decided to use differing names for OSC and FOSC also select names INTOSCO and INTIO67.

 

The info for the 44J50 part is incorrect with the Microchip data book for CONFIG2L (p421).

I'm not seeing exactly where we are getting it wrong.

Our config naming is meant to be following the Microchip format.

Attached is a screen shot of the config help, showing the PIC18F46J50, I can't find FOSC for this device?

 

Regards

Dave

post-469-0-21715200-1325626776_thumb.png

Share this post


Link to post
Share on other sites

Hi Dave,

 

The .h file for the 18F44J50 has both OSC and FOSC progmas declared. Mike unfortunately chose the wrong one.

 

There is also no pragma for DEBUG so can't turn it off without playing tricks as Mike had to do.

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites

Hi Guys

 

 

Don't forget that, as stated by Microchip documentation, the "DEBUG" bit in the configuration word should allways be turned OFF.

This bit is directly manipulated by the debugging tools like PicKit that override it when necessary..

 

 

Best regards

 

Jorge

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...