Shop OBEX P1 Docs P2 Docs Learn Events
Program efficiency — Parallax Forums

Program efficiency

cclaud2cclaud2 Posts: 21
edited 2006-04-01 03:29 in BASIC Stamp
Can someone please help me make this program more efficient so that it does not use so much EEPROM and variable space.· The LOOKUP and LOOKDOWN information does not change for each zone so I think that information only needs to be written once , but I am not sure how to make that work.· I have tried different things, but I would like to get someone else's opinion.· I have attached the program in it's most basic form.

Any help would be appreciated.· Thanks.

Comments

  • SSteveSSteve Posts: 808
    edited 2006-04-01 03:12
    How about something like this:
    rcTimeIn = rcZone1
    GOSUB Get_Temp_Set_Point
    zone1tempsp = setPoint
    
    rcTimeIn = rcZone2
    GOSUB Get_Temp_Set_Point
    zone2tempsp = setPoint
    
    rcTimeIn = rcZone3
    GOSUB Get_Temp_Set_Point
    zone3tempsp = setPoint
    
    rcTimeIn = rcZone4
    GOSUB Get_Temp_Set_Point
    zone4tempsp = setPoint
    
    ' -------------------------------------------
    
    Get_Temp_Set_Point:
        LOOKDOWN rcTimeIn, <[noparse][[/noparse] 64, 67, 70, 73, 76, 80, 83, 86, 89, 92, 95, 99,
                        102,105,108,111,115,118,121,124,127,130,134,137,
                        140,143,146,150,153,156,159,162,165,169,172,175,
                        178,181,185,188,191],offset
        LOOKUP offset,     [noparse][[/noparse] 65, 66, 67, 68, 69, 70, 70, 71, 71, 72, 73, 74,
                         74, 75, 76, 77, 77, 78, 79, 80, 80, 81, 82, 83,
                         83, 84, 85, 86, 86, 87, 88, 89, 89, 90, 91, 92,
                         92, 93, 94, 95, 95], setPoint
    RETURN
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows
  • cclaud2cclaud2 Posts: 21
    edited 2006-04-01 03:29
    Very cool.· Thanks for the help.

    Chris
Sign In or Register to comment.