Question about ARRAYWRITE


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156

    Default Question about ARRAYWRITE

    I have a project in which I'm gathering data from several sources, and need to pass it to another processor when polled. I anticipate the need to save/buffer these messages until I'm polled by the host and ARRAYWRITE looks like a perfect answer. I just started reading the posts about this command today, and am a little confused. I guess you can have multiple ARRAYWRITEs going at the same time because you are allowed to give them different names. Where is this data stored? RAM? EEPROM? How many ARRAYWRITEs can you have going simultaneously? How do you know the limitations of the space available? (I'm using an 18F6722for this project).

    Thanks,
    Len

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


    Did you find this post helpful? Yes | No

    Default

    Hi,
    You can have as many ARRAYWRITE in your program as the program memory of your device allows but as with any other command only one is executing at the time.

    The data is stored in the specified and previously declared array, ie in RAM.
    Code:
    myFirstArray VAR BYTE[30]
    mySecondArray VAR BYTE[30]
    ARRAYWRITE myFirstArray, ["This is a test with Arraywrite"]
    ARRAYWRITE mySecondArray, ["This is also a test", 10, 13]
    Now the first "location" of myFirstArray contains "T", the second "location" contains "h" and so on. Again, remember that they execute sequentially - first myFirstArray is loaded THEN mySecondArray is loaded.

    If your trying to load the array with data coming in over the USART or something like that I don't think ARRAWRITE is the way to do it. Sure, you can specify where in the array to start writing but since you still have to keep a "pointer" of "where you are" in the array you might as well fill the array "manually".

    If you have several "streams" of data coming in simultanously from several devices you'll have to use a PIC with several USARTs. There's no way of capturing several "serial inputs" simultanoulsy with the SERIN/SERIN2/DEBUGIN commands.

    /Henrik.

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default You can do it with one USART

    With one USART and DT interrupt and using a RS485 ring, you can connect several devices at a pretty high speed. Look the data sheet for 75176 (there are several others, but I use this one) for more detail.

    Al.
    All progress began with an idea

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


    Did you find this post helpful? Yes | No

    Default

    Hi Al,
    Yes, that's possible, as long as you have control over the transmitting devices or if you don't care if you miss some data by cycling thru the devices listening to one device at a time. If they are self contained units sending data on their own, at will, then it's going to be tricky. If I've missed your point please enlighten me :-)

    Now, the OP doesn't say how the transmitting devices works and/or if he has "control" over how they works. Hopefully a multidrop network can be implemented in which case one USART would be enough.

    /Henrik.

  5. #5
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Yes, that's possible, as long as you have control over the transmitting devices
    Yes, Henrik the control is necessary, devices must tx only on request, without it the OP will not achieve much.

    Al.
    All progress began with an idea

  6. #6
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Talking

    Thanks for the info! This particular application is a polled system, and my local PIC needs to process data and format the output into a predefined 'message'. Then when I am polled, I need to forward the data on to the host. I think ARRAYWRITE is the way to go. I was thinking about using an eeprom, but this is definately faster. I am not sure of the time between the polls yet though, and am concerned my data will back up, so need some message buffer space. Thanks very much for your help.

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