Conditional Compilation
Hi all,
We are converting some BS2 code over to BS2p. Looking at some code from Jon Williams psot on this and at some code I have here, I find I am a bit confused-
This is the code I want to add to Jon Williams work.....
here:
But looking at how the various case staements are set up, I have no idea how to add my code .. Can someone please enlighten a n00b coder [noparse]:D[/noparse]
Alohas, and Thanks!
We are converting some BS2 code over to BS2p. Looking at some code from Jon Williams psot on this and at some code I have here, I find I am a bit confused-
This is the code I want to add to Jon Williams work.....
' Set scale factor for PULSIN #SELECT $STAMP #CASE BS2, BS2E Scale CON $200 ' 2.0 us per unit #CASE BS2SX Scale CON $0CC ' 0.8 us per unit #CASE BS2P Scale CON $0C0 ' 0.75 us per unit #CASE BS2PE Scale CON $1E1 ' 1.88 us per unit #ENDSELECT
here:
#SELECT $STAMP #CASE BS2, BS2E, BS2PE T1200 CON 813 T2400 CON 396 T4800 CON 188 T9600 CON 84 T19K2 CON 32 TMidi CON 12 T38K4 CON 6 N2400 CON $418D N9600 CON $4054 #CASE BS2SX, BS2P T1200 CON 2063 T2400 CON 1021 T4800 CON 500 T9600 CON 240 T19K2 CON 110 TMidi CON 60 T38K4 CON 45 N2400 CON $43FD N9600 CON $40F1 #CASE BS2PX T1200 CON 3313 T2400 CON 1646 T4800 CON 813 T9600 CON 396 T19K2 CON 188 TMidi CON 108 T38K4 CON 84 #ENDSELECT
But looking at how the various case staements are set up, I have no idea how to add my code .. Can someone please enlighten a n00b coder [noparse]:D[/noparse]
Alohas, and Thanks!
Comments
You can't really "add it to" Jon's conditional coding, since you seem to have different criteria than he does. Additionally, I feel it would be better documented if it was left to stand alone - unincorporated so to speak.
If you were of the belief that there could only be one set of conditionals, that is not the case at all. You can have as many #Select variable / #Case / #Endcase sets as you may require.
Thus, just stuff it in either before or after Jon's conditional coding, and off you go!
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
·· THe appropriate Scale constants from your source file can simply be added by themselves to the appropriate areas in the destination code.· For example:
Scale·······CON·····$200····················'·2.0·us·per·unit
Can be added to the the section:
#CASE·BS2,·BS2E,·BS2PE
····T1200·······CON·····813
····T2400·······CON·····396
····T4800·······CON·····188
····T9600·······CON·····84
····T19K2·······CON·····32
····TMidi·······CON·····12
····T38K4·······CON·····6
····N2400·······CON·····$418D
····N9600·······CON·····$4054
··· Scale·······CON·····$200····················'·2.0·us·per·unit
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
And in particular, thanks Bruce, for this:
Thats excellent, and I will just do it that way, as I would like to include all of the data for the different stamps - we will also be experimenting with some BS2sx's and possibly a BS2e that someone is donating to our college.
hehe ..... even though Jon is not around, I still hear him saying ,over and over , "Read the datasheets!, use conditional compilation!! Google is your friend!!" ...
Post Edited (Robert@HCC) : 7/24/2006 5:37:21 AM GMT