Ok I found the problem... Sorry for the hassle, but this chip has a few traps man!
The problem was with the CONFIG statements, I was using Steve's example:
<b>
ASM
CONFIG FOSC=HS ; Use HS oscillator (20MHZ here)
CONFIG BOR=ON ; Brown out reset ON
CONFIG BORV=2 ; Brown out detect voltage=4.5 Volt
CONFIG PWRT=ON ; Power-up timer ON
CONFIG WDT=ON ; Watch dog timer ON
<i>....... etc.......</i>
ENDASM
</b>
This would compile ok on its own.
But as soon as I started to add code (eg CMCON = 7) and the likes I got heaps of Compile errors. (Yes I did delete the _config lines in the 18F4550.inc file!!)
Anyway I fixed the problem by not using the above asm example but rather this instead. (I found this example in one of Mel's threads not sure where now)
<b>
<i>' PRESET FUSES</i>
_CONFIG_FOSC_HS ; Use HS oscillator (20MHZ here)
_CONFIG_BOR_ON ; Brown out reset ON
_CONFIG_BORV_2 ; Brown out detect voltage=4.5 Volt
_CONFIG_PWRT_ON ; Power-up timer ON
_CONFIG_WDT_ON ; Watch dog timer ON
_CONFIG_STVREN_ON ; Stack over/underflow ON
_CONFIG_LVP_OFF ; Low Voltage programming OFF
_CONFIG_DEBUG_OFF ; Background debugger OFF
_CONFIG_VREGEN_OFF ; USB voltage regulator disabled
...... etc ......
</b>
Hope this info helps others when dealing with the dreaded 18F series. hahaha
Squib




Bookmarks