Shop OBEX P1 Docs P2 Docs Learn Events
Help with WRLONG in PASM — Parallax Forums

Help with WRLONG in PASM

yamaha1yamaha1 Posts: 6
edited 2011-04-17 15:03 in Propeller 1
Hi all, new to the forum but have been learning the Propeller for a year or so now.

I am having an issue that I can't seem to figure out.....

It's a simple process that measures the input state of a pin at set intervals, stores the state of the pin in a long in the cog, then when all 32 bits are read, writes to the hub.

reading the pin, seems to be working correctly as does storing the data in the cog. However, when I write it to the HUB, I only get the lower 16 bits indicated in both VeiwPort terminal and Prop Serial Terminal.....

Any suggestions?

In the manual it states:
WRLONG
Instruction: Write a long to main memory.
WRLONG Value, 〈#〉 Address
•
Value (d-field) is the register containing the 32-bit value to write to main memory.
•
Address (s-field) is a register or a 9-bit literal whose value is the main memory address to write to.

....I'm having trouble wrapping my head around why I'm only get 16 of the bits.

Thanks!
1024 x 819 - 64K

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2011-04-17 14:05
    debug.bin(@long[info], 32)

    replace that by

    debug.bin( info, 32 )
  • yamaha1yamaha1 Posts: 6
    edited 2011-04-17 14:11
    yep, that did it.....

    so the issue wasn't with the WRLONG, but with my pointer to the VAR for Serial Terminal.

    Thanks MagIO2!!
  • MagIO2MagIO2 Posts: 2,243
    edited 2011-04-17 14:16
    Yep .. The function expects a value but you gave it an address.

    debug.bin( long[ @info ], 32 ) would have worked as well, but it's not necessary, as info is accessible directly here.


    Oh ... AND ... Welcome to the forum!
  • yamaha1yamaha1 Posts: 6
    edited 2011-04-17 15:03
    The light is dim but it's starting to come on!! :smile:

    Because the variable is called out at the beginning of the object, the "Long[ @info]" is not required since the variable is directly accessible within the object and any methods that are called within the object.

    But, this format "Long [@info]", would be required if I were to call my "start" method from a different object while passing the VAR address....

    something like:
    object 1
    VAR
       long  info
    
    OBJ
       display : "display"
    
    
    Pub Go
    
       display.start(@info)
       repeat
    
    object 2:
    Pub Start(info)
    
      Cognew(@Entry, long[@info])
    

    Cool! Thanks for all your help and the warm Welcome!!
Sign In or Register to comment.