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.
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
Thanks for this. I'm using pbp3 so I copied and pasted and it compiled. The program still doesn't seem to time correctly tho, which I describe below.
-- How did you know this was the correct configuration? I've read many threads, tried many different suggestions including some that use @ DEVICE. I've looked in the manual and went by its examples. The manual comes close but it has a couple spaces before the CONFIG, which it shows in caps and yours is lowercase. This is what I get when I type it in:
#CONFIG
__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
#endconfig
Note that CONFIG is uppercase and endconfig is lowercase, tho when I cut and pasted the code they were both uppercase. Go figure.
How did you know your code would work? Trial and error? Is there a book you can recommend? I spent hours and hours getting nowhere.
----------------------------------
To test the timing I toggle a bit and look at it with a scope. This is the code:
portb.7 = 0
PAUSEUS 100
portb.7 = 1
PAUSEUS 100
portb.7 = 0
pauseus 100
portb.7 = 1
PAUSEUS 100
portb.7 = 0
pauseus 100
portb.7 = 1
pauseus 100
portb.7 = 0
I have OSCCON set to select the external crystal and define the oscillator as 20:
OSCCON = %01111110 'runs at 20 MHz set in configuration bits
define OSC 20
(again the word define is lowercase in pbp but copies and pastes as uppercase, tho I show it ias it appears on pbp)
I expect
portb.7 to toggle at 100usec high, 100usec low. Instead it is 250usec hi/lo. It's as if the pic is running at 8MHz but doing the timing calculations at 20MHz.
What am I missing?
don't trust copy and paste for case sensitive defines(again the word define is lowercase in pbp but copies and pastes as uppercase, tho I show it ias it appears on pbp)
Micro Code Studio is changing what you see, whereas what you copy paste is what you have. To fix this, open MCS and click the tab marked view, then click Editor Options,in Options click the tab Highlighter Options, at the bottom you will see Reserved Word Formatting, click the checkbox marked "DEFAULT" and click OK to close the box.
Last edited by Archangel; - 9th March 2015 at 16:07.
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.
Bookmarks