array problem


Closed Thread
Results 1 to 12 of 12

Thread: array problem

Hybrid View

  1. #1
    ro37bis's Avatar
    ro37bis Guest

    Angry array problem

    hello guys,
    I need to make some like this:
    ---------------
    array var word [5]
    C var byte

    for c = 0 to 5
    if array[C].highbyte = 0 then ' <- Compiler message: This style array syntax not supported
    gosub Compute
    endif
    next c

    end

    Compute:
    'Do something
    return
    ----------------------
    but the compiler do not support my array style.
    Some idea to solve it?
    tnk in advance.
    Roberto from Italy

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Most things are already somewhere here on the forum... you just need to SEARCH for them...

    http://www.picbasic.co.uk/forum/showthread.php?t=544

  3. #3
    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

  4. #4
    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 12:13.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  5. #5
    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 14:13.
    Steve

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

  6. #6
    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

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. Simple Array Demo
    By Archangel in forum Code Examples
    Replies: 5
    Last Post: - 15th February 2010, 04: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, 20:48
  4. Array problem (18F2550)
    By Ronald123 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th January 2008, 18:47
  5. Problem with bit array
    By Dick M in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th May 2005, 17: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