Shop OBEX P1 Docs P2 Docs Learn Events
PASM Reset — Parallax Forums

PASM Reset

I have been using
clkset  (255)
to reset the Prop from PASM. I have found that this is not always reliable. I am unsure if possibly the clock frequency is not reset once the prop is reset or if there is other magic causing me grief. (Such as my other hardware needs a reset)

Thoughts?

Comments

  • Why are you setting all the clock field bits?. Just write $80 otherwise you are trying to enable other settings.
  • I couldn't determine from the Prop Manual what the bitwise operation was against the current settings. I figured if I was resetting, it wouldn't matter. Obviously it does. :) I will try 128. Thanks!
  • ElectrodudeElectrodude Posts: 1,657
    edited 2016-11-25 18:42
    Also, you don't need the parentheses. It's an assembly instruction, not a Spin function. Also, it's probably more clear if you use a hex or binary constant, since it's a bitfield and not a decimal number.
    clkset $80
    

    EDIT: This is wrong. You can't specify an immediate value in an instruction's destination field. See PhiPi's post below.
  • I don't recall why I used the parens. IIRC, it was in an example I found out on the net.

    I received a PM that clkset uses indirect addressing, therefore it is looking at the values in the register address you are pointing at.

    I don't know if the parens allow you to pass a literal value. Could be some compiler trickery.

    Either way, I will fiddle with it and determine if a literal value can be passed and if not, I will fix my code.

    Thanks guys!

    --Terry
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2016-11-24 23:19
    You can't write an immediate value to the clock register, since the argument is the D field of the instruction, not the S field. So you will have to define a register that holds your desired value, viz:
            clkset  rst
            ...
    rst     long    $80
    

    This behavior is defined in the Propeller Manual: "Mode (d-field) is the register containing the 8-bit pattern to write to the CLK register."

    -Phil
  • Someone PMed me this gem.
    hubop $, #128
    

    Works like a charm and does not require an extra register. Sweet!

    --Terry
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2016-11-25 01:54
    That's pretty clever! Kuroneko, maybe?

    -Phil
  • Sounds like a trick a black cat would come up with :) neat
    Ah ..... so much talent that has faded from the forum, and who could forget deSilva and many others?
  • Twas the black cat indeed :) Phil, Peter, et al, I do miss the good old days on these forums. Glad you guys are still around.
  • ke4pjw wrote: »
    Someone PMed me this gem.
    hubop $, #128
    

    Works like a charm and does not require an extra register. Sweet!

    --Terry

    That is clever. If anyone tries using this to clkset other values, note that the bottom 3 bits of the #128 must be zero, since they're what specifies that it's a clkset and not some other hubop.
Sign In or Register to comment.