9 bit optical encoder input to SX28 or how to read the ports
I need help on this one...............
Am learning to program the SX chips·so I'm not sure of how to read 9 input pins at once. I've got a rotary optical encoder giving me 9 bits in parallel that represent 0 to 360 Degrees of rotation. I need to use 9 pins to read the encoder as it doesn't have a serial output.
Does anyone know the instruction that would read 9 pins at one time and store the state (1 or 0, high or low status) of each pin? I'm looking to·develop a binary number 9 digits long like 101010101 to use in the code I'm writing. I would then convert this binary number to degrees rotation·as a·decimal number.
Let me say thanks in advance to anyonethat can help me with this one.
Am learning to program the SX chips·so I'm not sure of how to read 9 input pins at once. I've got a rotary optical encoder giving me 9 bits in parallel that represent 0 to 360 Degrees of rotation. I need to use 9 pins to read the encoder as it doesn't have a serial output.
Does anyone know the instruction that would read 9 pins at one time and store the state (1 or 0, high or low status) of each pin? I'm looking to·develop a binary number 9 digits long like 101010101 to use in the code I'm writing. I would then convert this binary number to degrees rotation·as a·decimal number.
Let me say thanks in advance to anyonethat can help me with this one.
Comments
·
These things were designed/marketed to be Virtual Periferals - use them like that - use them as their own extenders.
encoder VAR WORD
encoder = RBC AND 511
Note that RBC is a virtual 16 bit I/O port. It is actually read as two seperate reads, so you have to make sure the value from the encoder doesn't change between the reads.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
·