Pin won't turn off properly
David Cary email (remove spam text)
How bizarre. Thanks for reducing this down to a simple test case.
So you're running at 20 ns / instruction, right ?
I think that rules out interrupt problems ...
Have you looked at the actual wave form with a (analog) o'scope, rather
than a logic analyzer ?
I suspect you are hitting the read-modify-write gotcha
. Adding a single NOP isn't reliable -- the more capacitance connected to
the pin, the more NOPs would be needed.
(PICs have this gotcha -- do SX chips also have this problem ?)
Because of that gotcha, I *only* use the movwf instruction to write to
output pins. Typically I allocate a mirror RAM byte corresponding to each
port, something like this:
setb mirror_port, s_ack
setb mirror_port, way
clrb mirror_port, s_ack
clrb mirror_port, way
I'm much happier with code that works vs. clever code that only takes 1/3
the number of instructions that doesn't work.
If this "read-modify-write gotcha" is the true explanation, I would expect
this to cause s_ack to prematurely turned off at the *same* time as the
software turned on the other pin ... odd.
Please tell us if you ever discover the real problem -- perhaps it will
help the next person to slam into this gotcha.
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
In reply to: <005901c2d66b$5dbe6a00$3cada7cb@joe>
See also: www.piclist.com/techref/ubicom/devices.htm?key=sx
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the