Set/clear of OUTput pins
Is there any Propeller instruction in assembly which will simultaneously affect output pins? I have several outputs which should only have one active at a time.
AND allows one to clear, OR to set. Is there any instruction that can force set and clear states to out pins? There doesn't seem to be any such instruction. Sure would be nice to have such.![yeah.gif](http://forums.parallax.com/images/smilies/yeah.gif)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
AND allows one to clear, OR to set. Is there any instruction that can force set and clear states to out pins? There doesn't seem to be any such instruction. Sure would be nice to have such.
![yeah.gif](http://forums.parallax.com/images/smilies/yeah.gif)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Thanks, Mike. The above does it, though at the 'expense' of 3 instruction times; at 80 MHz system clock is an extra 150 nsec delay. Hopefully this delay can be tolerated.
Paul, unfortunately, according to the Prop manual, MUXC, MUXNC, MUXZ, MUXNZ doesn't clear bits to '0'. I need to affect the individual bits to either HI or LO simultaneously.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
Post Edited (Harley) : 7/25/2007 5:31:22 PM GMT
If this is running in its own cog and there are no other output pins involved, you can dispense with the ANDN since each cog has its own DIRA register and you can just enable only those bits you want to be outputs. Also, the OUTA bits not involved with this will be zero. Similarly, if DESIRED is computed every time, you can do:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
What I was hoping for was a 'set/clear' operation rather than a 'set' or 'clear' on several output lines.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
There is no danger to influence anything not enabled by the local DIRA register.
Also, be carefull with read-modify-write cycles on I/O registers at dest-position.
Looks like the 'two XORs' does the desired result. Dang tricky, those XORs.
Appreciate the solution. I'd seen something like this before but didn't understand what the point was. After doing a few examples on the combinations involved in this application, it is quite clear.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
I'm missing something here with no masking happening.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
I'm not splitting hairs. I'm talking about a functional difference. A MOV instruction changes all 32 bits of the destination to a new 32 bit value. The MOV may be part of a larger program and the new 32 bit value may be an amalgam of several sources. The XOR modifies an existing value, changing only some of the bits. Any bits corresponding to zero bits in the source are left unchanged in the destination. Now the instruction cycle does go through a source and destination fetch, modification, and destination store, so the whole contents of the destination does get set to the result of the instruction execution. From the standpoint of the programmer and the actual instruction, known, anticipated bits of the destination are not changed. In the case of OUTA, there will be no glitches on any output pins where zero bits exist in the source field.