Thanks for all answered my question.
But I am still confused How to convert a 3 byte value as 24 bits which is in array.
I am able to display this value by lcd command keep all 3 byte in array side by side without any mathematics.
with some experiment I have found out that any length of signed variable minimum positive value and minimum negative value lies in the mid value of this integer for handling integer and long in bascom it very easy, because bascom compiler understand the integer and long, but case become differs in case of 12 bit datatype it dosn't fit nor into integer or long as negative number. to understand myself and making my question more clear I have made a short program of bascom and the result image I am posting.
Dim Num As Integer
Dim Counting As Byte
Num = &HFFFF
Print ""
Print " Incrementing the integer "
Print ""
For Counting = 1 To 5
Print " Hex Value " ; Hex(num) ; " " ; ; Num
Incr Num
Waitms 10
Next
Print ""
Print ""
Print " decrementing the integer "
Print ""
For Counting = 1 To 10
Print " Hex Value " ; Hex(num) ; " " ; ; Num
Decr Num
Waitms 10
Next
End
Robert7x example was looking to me as simple solution by overlay asjavascript:emoticon(':)')
dim value as long
dim r_data(4) overlay at value
butjavascript:emoticon(':?')
I believe that signed 24 bit data type can not deal as integer and long in bascom. as Paulvk says,
" Hex will not work if its TWO's compliment and negative with odd numbers of bits that are not full bytes which I have with 12 & 14 bits."
as my program shows and proofed.
we require some different mechanism for handling singed value waiting in byte arrays.
my reading is still in byte array need some help to come out and do some needful. (':lol:')
↧