Shop OBEX P1 Docs P2 Docs Learn Events
Arrays in ASM — Parallax Forums

Arrays in ASM

tom90tom90 Posts: 55
edited 2009-04-14 18:07 in Propeller 1
Hey All,

I would like to take 150 data points from my A/D as fast as I can, then output them. How can I write these values from the A/D into an array in ASM and then send it to a cog running spin to read and output the array? I have already used the PAR function to time sync all of my cogs.

Thanks
Tom

Comments

  • JonnyMacJonnyMac Posts: 9,194
    edited 2009-04-14 15:28
    Seems like the array would actually be defined in SPIN and the address of it passed to the assembly cog that's populating it.
  • tom90tom90 Posts: 55
    edited 2009-04-14 16:01
    JonnyMac,

    If I create an array in spin, how do I write to each individual location in ASM?

    -Tom
  • Brian FairchildBrian Fairchild Posts: 549
    edited 2009-04-14 16:15
    You know the base address of the array because you pass it to PASM when you start the COG so all you need to do is add an offset to that for each element and then use that in your WRBYTE/WRWORD/WRLONG which copies the data back to the Hub memory.

    Hub Address = Base Address of Array + (Array Element Number * Size of Array Elements)
  • JonnyMacJonnyMac Posts: 9,194
    edited 2009-04-14 16:31
    As Brian points out you can use WRLONG with the address of your array. The attached demo saves the address of element 0 of your array and loads that at the beginning of a loop that populates the array.
  • tom90tom90 Posts: 55
    edited 2009-04-14 18:07
    Thanks JonnyMac I will be sure to give this a try in my code.

    -Tom
Sign In or Register to comment.