array problem


Closed Thread
Results 1 to 12 of 12

Thread: array problem

Hybrid View

  1. #1
    ro37bis's Avatar
    ro37bis Guest


    Did you find this post helpful? Yes | No

    Thumbs up RE: Array problem

    Hi Melanie,
    usefull!!
    Tnk you very much!!!!!!!
    Roberto

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Like this ?


    Code:
    array var word [5]
    C var byte
    Temp Var word
    
    
    for c = 0 to 5
       
       Temp = array[C]
       if temp.highbyte = 0 then gosub Compute
    
    next c
    Last edited by sayzer; - 14th September 2006 at 13:13.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Or maybe
    Code:
    array var word [5]
    C var byte
    
        for c = 0 to 5
            if (array[C]>>8) = 0 then gosub Compute
            next
        end
    
    Compute:
        'Do something
        return
    another method...
    Code:
    array var word [5]
    C var byte
    
        for c = 0 to 5
            if array[C]<=$00FF then gosub Compute
            next
        end
    
    Compute:
        'Do something
        return
    Last edited by mister_e; - 14th September 2006 at 15:13.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Roberto, Sayzer and Steve

    Me thinks you will avoid much trouble if the array has 6 elements, or the FOR...NEXT counts from 0 to 4.

    Steve B

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    LMAO! ssshhhhhhut!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    I know that Steve sleeps only a few hrs from late morning to later morning.

    Just like I do.


    Don't know about Roberto's.

    --------------------
    Last edited by sayzer; - 15th September 2006 at 15:17.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  7. #7
    ro37bis's Avatar
    ro37bis Guest


    Did you find this post helpful? Yes | No

    Smile thk you for the support

    Hi guys,
    thank you for the support.

    I tested all of your suggestion.
    the Sayzer solution require 34 bytes,
    the 1st Mister_e solution require 83 bytes,
    the 2nd solution require 66 bytes.
    the Melanie idea for solution:
    ---------------
    array var word [5]
    C var byte

    for c = 1 to 9 step 2
    if array.lowbyte(c) = 0 then gosub Compute
    next
    end

    Compute:
    'Do something
    return
    ------------------
    require 35 bytes.

    The winner is:......... Sayzer.

    bye
    Roberto

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 08:55
  2. Simple Array Demo
    By Archangel in forum Code Examples
    Replies: 5
    Last Post: - 15th February 2010, 05:46
  3. Problem with ASM IRQ using FSR0 on PIC18F252
    By mytekcontrols in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 11th March 2008, 21:48
  4. Array problem (18F2550)
    By Ronald123 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th January 2008, 19:47
  5. Problem with bit array
    By Dick M in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th May 2005, 18:03

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