Conditional Compile Directives & Multiple program slots
Kurt
Posts: 7
Hi:
I'm hoping the answer is yes
Can I·define a conditional compile variable in my Slot 0 code that works during compile throughout the other Slots? In other words, I have this code in JEM5 Init.bpe (Slot 0):
It seems that I need to put this is each succesive slot as well in order to have this symbol evaluated in the "Announce.bpe" program.· I'm hoping that I can define all variables in one place i.e "JEM5 Init.bpe".
BTW - Here's some of the "later" code that is effected by the conditional:
Thanks,
Kurt
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
kk
I'm hoping the answer is yes
Can I·define a conditional compile variable in my Slot 0 code that works during compile throughout the other Slots? In other words, I have this code in JEM5 Init.bpe (Slot 0):
'{$STAMP BS2pe,MainLoop.bpe,Announce.bpe,ISDDATA.BPE,GPS.bpe,DTMF.bpe} '{$PBASIC 2.5} ' 20050308 -kk Setup for Loading all boards (enter JEM5 S/N in the "BoadNumber" constant ' Code rev 2.1.0 '+++++++++++++++++++++++++ ' Compile Directives '+++++++++++++++++++++++++ #DEFINE BoardNumber = 10
It seems that I need to put this is each succesive slot as well in order to have this symbol evaluated in the "Announce.bpe" program.· I'm hoping that I can define all variables in one place i.e "JEM5 Init.bpe".
BTW - Here's some of the "later" code that is effected by the conditional:
InitTemp: DEBUG "Init Temperature", CR ConvTemp: #SELECT BoardNumber #CASE 10 OWOUT OneWire, 1, [noparse][[/noparse]MatchROM,$28,$20,$C2,$76,$00,$00,$00,$A8, ConvertTemp] ' Send Calculate Temperature command #CASE 09 OWOUT OneWire, 1, [noparse][[/noparse]MatchROM,$28,$92,$D2,$76,$00,$00,$00,$BD, ConvertTemp] ' Send Calculate Temperature command #CASE 08 OWOUT OneWire, 1, [noparse][[/noparse]MatchROM,$28,$9B,$19,$76,$00,$00,$00,$79, ConvertTemp] ' Send Calculate Temperature command #CASE 07 OWOUT OneWire, 1, [noparse][[/noparse]MatchROM,$28,$27,$CE,$76,$00,$00,$00,$0C, ConvertTemp] ' Send Calculate Temperature command #CASE 06 OWOUT OneWire, 1, [noparse][[/noparse]MatchROM,$28,$F3,$B7,$76,$00,$00,$00,$8A, ConvertTemp] ' Send Calculate Temperature command #CASE 05 OWOUT OneWire, 1, [noparse][[/noparse]MatchROM,$28,$B1,$B5,$76,$00,$00,$00,$12, ConvertTemp] ' Send Calculate Temperature command #CASE 04 OWOUT OneWire, 1, [noparse][[/noparse]MatchROM,$28,$01,$D6,$76,$00,$00,$00,$4A, ConvertTemp] ' Send Calculate Temperature command #CASE 03 OWOUT OneWire, 1, [noparse][[/noparse]MatchROM,$28,$0F,$C1,$76,$00,$00,$00,$74, ConvertTemp] ' Send Calculate Temperature command #CASE 02 OWOUT OneWire, 1, [noparse][[/noparse]MatchROM,$28,$CB,$D4,$76,$00,$00,$00,$99, ConvertTemp] ' Send Calculate Temperature command #CASE 01 OWOUT OneWire, 1, [noparse][[/noparse]MatchROM,, ConvertTemp] ' Send Calculate Temperature command #ENDSELECT
Thanks,
Kurt
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
kk
Comments
Note: Be very careful with getting thedefinitions right because the compiler assigns variable names to locations according to certain rules:
1. Largest first.
2. Variables of same size is taken in order.
I do understand the issues with preserving standard variables. Infact, I just use the scratchpad and move data inbetween slots that way.
Any more input on Compile Time Variables?
Anyone?
Kurt
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
kk
Here's an idea that may save you some trouble: You can use READ accross program slots in the BS2p by setting the target slot with STORE. You could put the board number at address 0 of slot 0, then the table of addresses following that. You'd have to send the OW serial number in a loop, but it might simplify things -- especially if the number of boards grows.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
So - Can I actually execute a loop in the middle of a OW command?· Could you give me an example based on my code above? (Pick any data location).
I like your idea and, I already have one slot setup as a data slot supporting the data table for an ISD voice chip. I have lots of room there, and I could easily add the address strings for the OW parts, (I have both an AtoD and a temp sensor on each board).
Thanks for your ideas and and assistance!
Kurt
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
kk
· STORE 0
· READ 0, modNum
· eeAddr = modNum * 8 + 1
· OWOUT OwPin, 1, [noparse][[/noparse]MatchRom]
· FOR idx = 0 TO 7
··· READ eeAddr + idx, owByte
··· OWOUT OwPin, 0, [noparse][[/noparse]owByte]
· NEXT
· OWOUT OwPin, 0, [noparse][[/noparse]ConvertTemp]
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
Kurt
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
kk