Newbe: Nested For..Next loops problem


Results 1 to 7 of 7

Threaded View

  1. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Newbe: Nested For..Next loops problem

    Hi, Biggazzzz

    3 sensors ???

    could also be written


    Code:
    mainloop:
     
    For index = 1 to 3                                          ; read 10 values for 3 sensors
     
        FOR index2 = 1 to 10                                    ; Take 10 reading
     
            IF temp_val[index2] < temp_val_lo[index] then       ; is readlng lower than lowest
                temp_val_lo[index] = temp_val[index2]           ; update lowest
     
            ELSE IF temp_val[index2] > temp_val_hi[index] then  ; is reading higher than highest
                temp_val_hi[index] = temp_val[index2]           ; update highest
     
            ENDIF
     
            temp1[index] = temp1[index] + temp_val[index2]  ; add reading to running total   
     
        NEXT index2                                             ; update next reading
     
    NEXT index                                                  ; update next sensor
     
    GOTO mainloop
    as you add temp1[index] to total whatever the value ...

    Alain
    Last edited by Acetronics2; - 12th February 2011 at 14:18.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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