PDA

View Full Version : PIC18F452 Compile Problem



scottl
- 11th October 2006, 01:50
I am using PICBASIC PRO 2.43 and have been trying to modify the PIC18F452.inc file to allow compile without warning. I found a post by Bruce mentioning to remove the warning add w = -230 to the .inc file. I try to add the @ _CONFIG fuses to my source file but it does not allow me to compile. Can someone submit a simple sample with how to set the fuses for a PIC18F452?

If I try to go ahead and progran the chip wth the warnings my programmer gives me the following

Configuration fuses
Actual: 00 21 0E 0F 00 01 81 00 0F C0 0F E0 0F 40
Expected: FF F9 FE FF FF FF FB FF 0F C0 0F E0 0F 40

and does not program the chip!

Please help! Scott

mister_e
- 11th October 2006, 02:18
Few things are missing in your post:

Wich message you have?
Are you using MPASM?
Wich programmer?

scottl
- 11th October 2006, 03:05
Seem to get everything to compile without warnings. I am using MPASM and the programmer I am using is the ICD-U40. I know I know!

sayzer
- 11th October 2006, 03:24
In your programmer, do you have an option of reading actual configuration fuses and re-inserting it into the hex file?


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

Bruce
- 11th October 2006, 17:19
Hi Scott,

MPASM doesn't like it when you have config fuse settings in your source code,
and in the PBP device header file.

To insert them in your source you need to comment them out in 18F452.inc.

Open 18F452.INC in your PBP directory, comment these out, save it, then add
config fuse options in your source.


LIST p = 18F452, r = dec, w = -311, w = -230, f = inhx32
INCLUDE "P18F452.INC" ; MPASM Header
;__CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H
;__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
;__CONFIG _CONFIG4L, _LVP_OFF_4L


Now you can drop them into your source;



asm
__CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
__CONFIG _CONFIG4L, _LVP_OFF_4L
endasm
I'm not familiar with the device programmer you're using, but make sure you
always erase the target before trying to program it.

scottl
- 12th October 2006, 02:11
Bruce,

The ICD-U40 is the CCS USB Programmer!

I have tried all that everyone suggested but it will not program the PIC18F452. It may be my version of PICBAsic Pro 2.43. I may rewrite the code with the CCS Compiler. I hate to start over since I have had everything working in PICBASIC Pro for the PIC16F877.

Thanks anyway,

Scott

Bruce
- 12th October 2006, 04:44
Hi Scott,

Bummer. Have you contacted CCS? I beleive they have firmware updates for
their programmers. May or may not help, but I don't think there's any reason
to port over from PBP to CCS if it's just a problem with the programmer.

I know people get tired of hearing this one, but it's also a good idea to keep
PBP & MPLAB updated as well.

If it would help, I could send you a known working .hex file for a 452 compiled
with PBP. If it doesn't go in, then at least you're 100% sure it's your device
programmer, and CCS should be able to get you sorted out on that one.

I like/use the CCS compilers, but I don't use their programmers. MeLabs U2 is
all I use now. All my other programmers are gathering dust...;o}

mister_e
- 12th October 2006, 04:50
Bruce, And i feel one of those is obsolete and no longer on the market :D

His name begin with W and you already carry those in the past.

scottl
- 12th October 2006, 20:23
Hi Bruce,

I have been looking at upgrading but timing is an issue here! I would like to test your sample .hex file just to see if it works. I will test this tonight and let you know. At least I will hopefully know were the problem is!!!

Thanks again,

Scott

Bruce
- 12th October 2006, 20:34
Hi Scott,

No problem. Shoot me an email. I'll just respond with the .hex file in .zip
format back to you.

Let me know the osc frequency, and whatever config fuse settings you
prefer.

inteco
- 21st October 2006, 10:47
Scott,

Instead of using ICD-U software, try download and use MACH X software. But you need to use the newest ICDU software, and upgrade the firmware first prior of using the the new MACHX software.

Downloading step :
1. Open MACH X
2. Browse /open the *.hex generated by PBP
3. in the MACHX click CONFIGURATION/ID, then click on any
configuration hex number located in the left side row.
Do NOT change the number just click it, as if you want to change.
4. Then click SAVE AS button, save the *.hex to a new name
(whatever.hex)
5. Then click BURN CHIP
6. Trust this would work.