Like you did have to be fine.
WordOut=(MSByte*256)+LSByte
Like you did have to be fine.
WordOut=(MSByte*256)+LSByte
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Well not saying its is the best way by any means, but this seems to work:
Thanks for the help guys, for now this will cover my needsCode:Dim i AsInteger Dim t AsUShort Dim datain AsByte Dim data(20) AsByte Dim sign AsString t = (data(0) * 256) + data(1) If t > 32767 Then t = (Not t) + 1 sign = "-" Else : sign = " " EndIf gxhb.Text = sign & t.ToString
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Seems like it should be much easier.![]()
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
yeah but where would be the fun![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Well I guess it would be a little better if that snippet was a sub routine, or function, or module, or object. See, I don't even know what it should be.
To me a sub-routine. I want to call it with values in data1 and data2. it should return with a string in wordout.
But that is just a little above my pay grade right now.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Once you feel you're ready, have a look at this
http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx
Then you could use something like
txtResult.txt = ConvertWordToSignedString (WordVariable)
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hot Dog!! Thanks again, I feel proud
new function:
And how to get there:Code:PublicFunction CreateSWord(ByVal data1 AsByte, ByVal data2 AsByte) AsString Dim t AsUShort Dim sign AsString t = (data1 * 256) + data2 If t > 32767 Then t = (Not t) + 1 sign = "-" Else sign = " " EndIf Return (sign & t.ToString) EndFunction
Code:gxhb.Text = CreateSWord(data(0), data(1)) gyhb.Text = CreateSWord(data(2), data(3)) gzhb.Text = CreateSWord(data(4), data(5)) axhb.Text = CreateSWord(data(6), data(7)) ayhb.Text = CreateSWord(data(8), data(9)) azhb.Text = CreateSWord(data(10), data(11)) cxhb.Text = CreateSWord(data(12), data(13)) cyhb.Text = CreateSWord(data(14), data(15)) czhb.Text = CreateSWord(data(16), data(17))
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Bookmarks