How many ways to sample an input with PASM?
StephenMoore
Posts: 188
I am kind of a beginner here. Just how many different ways are there to sample an input pin using PASM?
Here is one attempt I've used:
This works but I would like to know what the best way is (I know that I can not test ina directly for some reason).
There must be a quite a number of shorter version I would think.
SM
Here is one attempt I've used:
mov temp, ina test temp, pir_mask wz if_nz andn outa, pong_mask pong_mask long 1 << PONG_LED pir_mask long 1 << PIR temp res 1
This works but I would like to know what the best way is (I know that I can not test ina directly for some reason).
There must be a quite a number of shorter version I would think.
SM
Comments
And is shorter too, thanks.
Any idea on what to do with this comment from pg 297 of the manual:
"Keep in mind that in Propeller Assembly, unlike in Spin, all 32 bits of INA are accessed at once unless the MUXx instructions are used."
Haven't a clue. Maybe it's in reference to the fact that you can't do value := ina[4] in PASM (as such). That said, SPIN would have to access all 32 bits as well and then pick a specific bit. The MUXx reference comletely escapes me.
This seems overdone for some reason:
What is it supposed to do? ATM it only ever samples ina once (you better use jump labels instead of relative offsets, #$-3 is one short). Also, outa starts with 0 so the andn doesn't do a lot. So what are you after? Something like this: