Shifting bits in a word
aa200orion
Posts: 10
I am trying to·send the first 11 low order bits·of a word to a subroutine that converts a "1" or "0" into time.
Attached is my code.· The problem I am having is I can only send bits 0-7 to the subroutine.· Bits 9 & 10 are always "0".
I'm using an SX28 and SX-Basic·3.3.0
Any help would be appreciated.
Thanks,· Jimmy
CHART_CODE:
·chartcode = $211
··FOR idx = 0 TO 10
···IF chartcodebit = 1· THEN·
····OUTONE
······ ELSE·
····· ·OUTZERO
···ENDIF
···ASM
···CLC
···RR chartcode
···ENDASM
··NEXT
RETURN
·
Attached is my code.· The problem I am having is I can only send bits 0-7 to the subroutine.· Bits 9 & 10 are always "0".
I'm using an SX28 and SX-Basic·3.3.0
Any help would be appreciated.
Thanks,· Jimmy
CHART_CODE:
·chartcode = $211
··FOR idx = 0 TO 10
···IF chartcodebit = 1· THEN·
····OUTONE
······ ELSE·
····· ·OUTZERO
···ENDIF
···ASM
···CLC
···RR chartcode
···ENDASM
··NEXT
RETURN
·
Comments
Regardless, your assembly code for shifting a word will not work (but ironically, would work in straight SX/B, presuming "chartcode" is a word), e.g.
When you define a Word variable in SX/B, the compiler automatically creates THREE named symbols (variables) for each word:
wordName
wordName_LSB
wordName_MSB
Note that wordName and wordName_LSB point to the same byte, this allows for clear use when doing things like:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
create bitmap data tool: 1uffakind.com/robots/povBitMapBuilder.php
resistor ladder tool: 1uffakind.com/robots/resistorLadder.php
convert images to ascii art: 1uffakind.com/apptoys/convtoascii/
Post Edited (Zoot) : 6/28/2010 2:17:03 AM GMT