Shop OBEX P1 Docs P2 Docs Learn Events
Pass word array to method — Parallax Forums

Pass word array to method

TumblerTumbler Posts: 323
edited 2014-04-21 21:55 in Propeller 1
Hi

How can i send an array of words to this method?
PRI WriteLine(data)| char  
    repeat strsize(data)                        'Iterate over the string.
    char := byte[data++]
    writeSerNoLatch(getChardata(char))        'get char data and send to shiftregisters
  Latch


Comments

  • JonnyMacJonnyMac Posts: 9,105
    edited 2014-04-21 20:47
    Use the @ operator or the string() function to pass the address of your character array. Note that by using strsize in the routine, your array must be terminated with zero.
  • TumblerTumbler Posts: 323
    edited 2014-04-21 21:17
    So this will work?(can't test at this moment)
    And what if data[2] is zero?
    PUB Main | data[8]
      data[0] := 100
      data[1] := 1024
      ...
      data[7] := 32768
    
    
      data[8]:= 0  'zero termination?
    
    
      WriteLine(data)
    
    
    
    PRI WriteLine(data)| char  repeat strsize(data)                        'Iterate over the string.
        char := byte[data++]
        writeSerNoLatch(getChardata(char))        'get char data and send to shiftregisters
      Latch
    
    
    
  • JonnyMacJonnyMac Posts: 9,105
    edited 2014-04-21 21:55
    Not even remotely close.

    Are you attempting to put numbers in a display? If so, we'll need to know more about it.

    This is the problem with program fragments that don't provide an explanation or context -- it forces those of us that would help you into being mind readers, something none of us is particularly good at. :)
Sign In or Register to comment.