Is this glitch free?
Chad George
Posts: 138
I'm sure doing it this way is wrong because there is a short time between instructions where the output is invalid.
Does anyone know if the following code updates pins simultaneously or will there still be a small glitch in the output?
tmp := (tc & $3F) << 1 outa &= (tmp | %11111111_11111111_11111111_10000001) outa |= tmp
Does anyone know if the following code updates pins simultaneously or will there still be a small glitch in the output?
outa[noparse][[/noparse]6..1] := tc
Comments
I think it does. If it doesn't you could try something like this
I don't know if you can read the value of outa ... do one or more operations with it then assign it back and be safe from unintended consequences.
Thats why I'm a little concerned about doing it this way in SPIN...if it was assembly then I'd know exactly what was going to happen.
I kinda figure the array index notation was designed for this scenario, but I wanted to make sure before relying on it. I am pretty certain it will not affect the status of other pins, but I don't know if it updates all pins in a single atomic action.
So there there is no problem with atomicity in reading/modifying/writing outa. It's yours no one else can get in between. Just don't go setting bits that are not yours.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."
- Bjarne Stroustrup