A more program space efficient way of doing ta whole heap of IFs????


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: A more program space efficient way of doing ta whole heap of IFs????

    Quote Originally Posted by Darrel Taylor View Post
    OK, so let's go with Steve's idea and put it in EEPROM.

    88 words.
    Code:
    supply_in  VAR BYTE
    max_duty   VAR BYTE
    ItemNo     VAR BYTE
    Temp       VAR BYTE
    '
    supply_Max  DATA 252,250,248,245,240,237,234,231,229,226,223,220,218,215,212,210,207,204,201,199,196,193,187,0
    Set_duty    DATA 154,155,156,157,159,160,161,163,165,167,169,172,175,179,181,182,184,188,191,195,214,238,251,255
    '
    FOR ItemNo = 0 TO (Set_duty - supply_Max)
        READ (supply_max + ItemNo), Temp
        IF supply_in > Temp THEN
            READ  (Set_duty + ItemNo), Temp
            max_duty = Temp
            EXIT
        ENDIF
    NEXT ItemNo
    I haven't tested it, but it looks right.
    Check my work.
    I originally shyed away from using suggestion, on account the initial idea provided rescued me back sufficient space, but alas, things have just got too tight, so I've just tried this latter suggestion...it worked first time & has rescued me back a good bit of space (room to breathe again!)

    I'll admit I don't totally understand what's going one (other than we're storing stuff in EEPROM, then cleverly marrying it up), I'll addess my inner "huh?" demons & work this out soon, but for now I'm just chuffed the enigma works...as a bonus it's far easier for me to mate the values (the formatting on here clouds it, but it's as clear as day in reality)

    Many thanks.
    Last edited by HankMcSpank; - 19th June 2011 at 11:51.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts