Deleted...........
Deleted...........
Last edited by towlerg; - 5th March 2015 at 04:03.
tbarania, How are you loading the program into the PIC? If you are using a bootloader the " __config1 _FOSC_HS & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _IESO_ON & _FCMEN_ON & _LVP_OFF & _WRT_OFF" statement is NOT being executed.
Dave Purola,
N8NTA
EN82fn
I have a bunch of 20MHZ low profile xtals that are happiest with _FOSC_XT an 22pF caps , had me guessing for a bit
I've tried
#config
__config1 _FOSC_HS & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _IESO_ON & _FCMEN_ON & _LVP_OFF & _WRT_OFF
#endconfig
at the top the basic program. I compile and load the hex file into MPLAB and program the chip using the PICSTART Plus. I leave the configuration bits "set in code" since I'm assuming that is what the above is supposed to take care of. Apparently it doesn't, rather the PIC reverts to the 4MHz internal oscillator. I also set the OSCCON to %01101000 which is supposed to use bits FOSC 0-2 to set the oscillator choice.
I also tried defining the config1 register to set it up to use the external crystal: DEFINE CONFIG1 $EFC2 Maybe defining is not the right approach and I need to do some sort of assembly code snippet.
I can select the 8MHz internal oscillator by setting OSCCON, so I don't know why it won't let me select an external crystal.
I wonder if #config/#endconfig is case sensitive like DEFINE? I know to say define osc 8 won't work but DEFINE OSC 8 does.
The manual shows how to do some conditional compiles but the CONFIG item is in caps.
Last edited by AvionicsMaster1; - 8th March 2015 at 02:03. Reason: clarification
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
I'm sure there are many variations and I appreciate you adding one. My point was that the config statement
doesn't look like the one in the manual. There are space at the beginning of the line __config and after each & that are not in the config statement above. I realize the config statement is ASM and therefore only the fuse is case sensitive but I thought it at least worth the effort.#config
__config1 _FOSC_HS & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _IESO_ON & _FCMEN_ON & _LVP_OFF & _WRT_OFF
#endconfig
The manual also shows #CONFIG/#ENDCONFIG in caps. Just sayin'.
for pbp3
#CONFIG
__config _CONFIG1, _HS_OSC & _WDT_ON & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOR_ON & _IESO_ON & _FCMEN_ON & _LVP_OFF & _DEBUG_OFF
__config _CONFIG2, _BOR40V & _WRT_OFF
#ENDCONFIG
for pbp 2.6
ASM
__config _CONFIG1, _HS_OSC & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOR_ON & _IESO_ON & _FCMEN_ON & _LVP_OFF & _DEBUG_OFF
__config _CONFIG2, _BOR40V & _WRT_OFF
ENDASM
I tried #CONFIG/#ENDCONFIG and #config/#endconfig and both work therefore its not case sensitive
this is just wrong for a PIC16F886
ps#config
__config1 _FOSC_HS & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _IESO_ON & _FCMEN_ON & _LVP_OFF & _WRT_OFF
#endconfig
I'm surprised it can compile
Last edited by richard; - 9th March 2015 at 01:28. Reason: ps OPPS MAKE IT HS_OSC
Bookmarks