How are arrays used?


Results 1 to 6 of 6

Threaded View

  1. #2
    Join Date
    May 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Wink Thats a pretty general question.

    Quote Originally Posted by NO2K View Post
    I am clueless as to how one uses arrays. My idea is to program a pic to do the Bingo game. Does anyone have any ideas on this?

    Alright thats a general question but I'll try and answer.

    first off choose a length of array and type of data.

    nameofarray VAR unitsize[numberofunits]

    lets say you want row one to be 12 bytes wide.

    rowone var byte[12]

    Now okay thats all fine and dandy right? Now you want to populate it.

    There are two ways you can go one segment at a time like this.

    rowone[0] = "b"

    Or you can populate an array serially.

    serin pin,baud,[ STR rowone\1]

    this would wait until one byte is recieved and put it in the first position in the array. Lets say you wanted to put it in the second position.


    serin pin,baud,[ STR rowone(1)\1]

    This would take one byte serially, and transfer it into the second unit of the array.

    ill give one more example this time using more then one byte.

    serin pin,baud,[ STR rowone(6)\6]

    Now this will take the first six bytes it recieves, and will put it in the array starting at the 7th byte, basically byte one will go in rowone[5], byte two rowone[6], all the way up to rowone[11]

    Hopefully that helps.
    Last edited by gandora; - 29th May 2007 at 07:04. Reason: bad explanation.

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. Beginner trying to use arrays
    By captain in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 3rd November 2007, 07:20
  3. How to use Arrays Using Pic Basic Pro(need help)
    By MrSafe in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 17th July 2007, 21:56
  4. SerOut and Arrays
    By shawn in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th July 2005, 17:32
  5. storing arrays and reading arrays
    By Yue in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 5th March 2004, 22:03

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