Forgot how to do this


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153

    Default Forgot how to do this

    I have forgotten how to get multiple bytes using the I.0{x} to increment
    its been a while and my notes are not as clear as I thought, or my mind is a little foggy and my notes are great.

    POSISTION VAR BYTE(3) or posistion.0{I}
    I VAR BYTE


    FOR I = 1 TO 3
    SERIN2 PORTA.1,84,[POSISTION.0{I}] 'NEED TO GET POSISTION INFO
    SEROUT2 PORTA.0,84,[POSISTION.0{I}] 'SEND BACK TO ECHO TO CONTROLLER
    NEXT

    Larry

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: Forgot how to do this

    Hi Larry,
    To access the individual bytes in an array you do:
    Code:
    Position VAR BYTE [3]
    For i = 0 to 2
       SERIN PORTA.1, 84, [POSITION[i]]
       SEROUT PORTA.0, 84, [POSITION[i]]  
    Next
    Note that the array is zero-indexed, first byte is Position[0], last byte is Position[2].

    The Position.0[i] thing you have in your notes is used when you want to access the individual bits in something not specifically declared as an array an of bits. For example Position.0[8] will access the least significant bit Position[1].

    Hope that makes sense.
    /Henrik.

  3. #3
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default Re: Forgot how to do this

    Thanks Henrik ?
    this look like what I want, and yes my notes say bits but I skipped over that word (of course).

    Thank you
    Larry

Members who have read this thread : 1

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