Binary operators in SX/B
I have read the help file but would like to know if I am correct.
I have a LTC 1298 and it returns two different·variables of bytes the upper 4 and the lower 8.
What the question I have is I want to combine these into a word then convert theis number to a decimal number.
When you add say Variable1 and Variable2 like this I should get this?
Word = 11110000 + 00001111
Word·= 11111111
Or
Word = 00010000 + 00010000
Word = 00100000
Is this Correct?
Then how do I make this bianry # into a decimal #·so I can display it in hyperterminal?
Thanks and hope this makes sense...
·
I have a LTC 1298 and it returns two different·variables of bytes the upper 4 and the lower 8.
What the question I have is I want to combine these into a word then convert theis number to a decimal number.
When you add say Variable1 and Variable2 like this I should get this?
Word = 11110000 + 00001111
Word·= 11111111
Or
Word = 00010000 + 00010000
Word = 00100000
Is this Correct?
Then how do I make this bianry # into a decimal #·so I can display it in hyperterminal?
Thanks and hope this makes sense...
·
Comments
I found an old LTC1298 program on my PC; I've updated and attached it -- but didn't take time to test yet (please let me know if you find a problem).
Post Edited (JonnyMac) : 6/25/2007 5:35:38 PM GMT
Question about the code if you dont mind are these because you are passing data between subroutines? Does it work if you dont use them?
'
' Subroutine / Function Declarations
'
DELAY_MS SUB 1, 2
TX_BYTE SUB 1
TX_STR SUB 2
TX_HEX2 SUB 1
RD_1298 FUNC 2, 1
I dont have my code here with me right now but I will upload it tonight I did not Use any Delcarations and SX/B compiler compiled with no errors. I have two subroutines one for Channel 1 and the other is for Channel 2.
But I do know that if I try to use more than two subroutines that it will not let it compile maybe this is what you are talking about?
And if it helps I am using the Gosub in my main loop. I just read in the help file it is not needed anymore.
You can see that I have just one Function for reading the ADC and you pass the channel to it; what I've done (versus your program) is conserved code space. It may not matter for this program, but as you projects get more sophisticated code space conversation will become important.
Post Edited (JonnyMac) : 6/26/2007 12:28:50 AM GMT