Getting 'ina' value in PASM
Philldapill
Posts: 1,283
I am new to PASM and I'm trying to write a very simple driver for an ADC. Right now, I need to be able to see if a pin is high/low, and shift that value into a variable.
How is this done?
How is this done?
Comments
You can also use the value of INA directly :
test INA, my_pin WC
rcl result, #1
or
rcr result, #1
rcl or rcr depends on the word order you have - for MSB first you need rcl, for LSB first you need rcr and if the result is smaller than 32 bit, you have to shift for 32-number_of_bits.
By the way ... as long as you don't write back (which test does not do) the order of the INA and my_pin is not relevant. The difference is, if you do it like I showed, you can use immediate value if your pin is one of the first nine pins.
test INA, #000100000 WC
This saves one long of memory (only for the case you get short with memory ;o)
Post Edited (MagIO2) : 4/17/2009 9:34:26 AM GMT
http://forums.parallax.com/showthread.php?p=800398
·
BTW)
If your data is comming in as inverted logic, you can rotate the "true" logic into "DataIn" this way...
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 4/17/2009 3:03:28 PM GMT