Shop OBEX P1 Docs P2 Docs Learn Events
Conditional Compilation — Parallax Forums

Conditional Compilation

UnsoundcodeUnsoundcode Posts: 1,532
edited 2008-03-25 15:54 in BASIC Stamp
Hi, I want a time out value for a SERIN instruction that·is value dependant on the the baudrate.

I want it to be·independent of which kind of Stamp I use.

I can write code for this but want it to be part of·a compiler directive I can use for different programs and different Stamps where when I choose a baudrate the timeout is automatically chosen.

Can anyone tell me what might be the best way to tackle this.

thanks

Jeff T.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-24 19:10
    Look in the Basic Stamp Manual starting at page 70 and page 412. This will show you how to do what you want.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-03-25 15:54
    Thanks for the pointer Mike, rather an elementary question I know but something I have tended to ignore until now. I ended up using the following which works well for my purpose.

    #DEFINE baud_value=16390· 'alter value to suit

    #SELECT baud_value
    #CASE 16390
    time_out CON 20
    baud CON 16390
    #CASE 16468
    time_out CON 30
    baud CON 16468
    #CASE 16572
    time_out CON 40
    baud CON 16572
    #ENDSELECT

    Jeff T.
Sign In or Register to comment.