Hi Steve,
I also need to add UCON and UCFG for a PIC 18F4550. Adding the variables in the file mentionned above corrects the undefined error at compile time, but how do those variables get linked with the proper registers?
Robert
![]()
Hi Steve,
I also need to add UCON and UCFG for a PIC 18F4550. Adding the variables in the file mentionned above corrects the undefined error at compile time, but how do those variables get linked with the proper registers?
Robert
![]()
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Ruben,
Unless I am mistaken, the USB module is disabled by default. That's why I need to turn it on for USB processing. If you need to use pins C4-5 as IO, you should not have any problems doing so.
Or did I read the datasheet backwards?
Robert
![]()
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
I think I found a clue from Steve about where the variable would get linked to the actual register:
http://www.picbasic.co.uk/forum/show...75&postcount=5
Now I have to find the right file to edit and the right address.
Robert
![]()
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Interesting, it's in the USB Descriptor and USB18 files.
I think it is mainly dependant on whether or not the USB Voltage Regulator is enabled (which I forgot to enable).
Robert
![]()
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
I'm going nuts!!!
Actually it's this 18F4550 that everyone seems to be raving about that is driving me nuts! Or is the 18FXXX series in general.
Ok I'm getting there.
1. Downloaded MPASM.
2. Setup Microcode studio to use MPASM
3. Figured out how to set the CONFIG fuses... Phewww!
But now a new problem. (Next in the chain you could say)
Setting the ADCON0:2 to registers causes compile errors and warnings
Setting the CMON register causes compile errors and warnings
I've even tried cut and pasting the ASM code from the data sheet, but to no avail.
Any help appreciated. Maybe we should setup an 18F forum???
Squib
This is all I have along with the Port definitions, variables and constants:
DEFINE OSC 48 ' 20MHz crystal with HSPLL enabled = 48MHz
DEFINE I2C_SLOW 1 ' Access I2C device above 8MHz
DEFINE I2C_HOLD 1 ' Permit I2C device to hold clock line low
CLEAR
Maybe just trying with the default values?
Here's my CONFIG file for 48MHz USB processing, I commented in all values so that I can easily change things around. The base of this setup came from Bruce's post.
Robert
![]()
Last edited by Demon; - 11th July 2006 at 14:11.
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Sounds bad to me, sounds like you have a corrupted INC file OR there's something bad in the PBP-Plugin installation or in the project building process.Originally Posted by Squibcakes
can you post all your files generated in MPLAB (MCW and all other in a zip) and or a COPY/PASTE of the error you got.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
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