By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,467 Members | 994 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,467 IT Pros & Developers. It's quick & easy.

concatenate a 4 byte into 1 float value

P: 1
i want to concatenate 4 byte value into 1 float value. i will receive data thorugh the microcontroller in the form of byte.Now i want to concatenate this recived 4 byte value into 1 float value.how it is done . some one help me for doing this.That's the code:--
Reply soon ......


CODE
.................................................. ......................................
Public Function GetByt(byt As Integer) As single
Dim CropL As Single
Dim x As Integer
Dim crop(3) As Byte
Dim Buff As Integer
Dim buf As Variant
Dim Str As String

MSComm1.OutBufferCount = 0
MSComm1.InBufferCount = 0
MSComm1.Output = "S"
Delay 1
buf = MSComm1.Input
MSComm1.Output = "R"
Buff = Asc(buf)
Print ("sera is" & buf)
crop(0) = Buff
Delay 2
buf = MSComm1.Input
MSComm1.Output = "R"
Buff = Asc(buf)
Print ("Serial is " & Buff)
crop(1) = Buff
Delay 2
buf = MSComm1.Input
MSComm1.Output = "R"
Buff = Asc(buf)
Print ("Serial is " & buf)
crop(2) = Buff
Delay 2
buf = MSComm1.Input
MSComm1.Output = "R"
Buff = Asc(buf)
Print ("Serial is " & buf)
crop(3) = Buff
CropL = ByteArrToSingle(crop())
GetByt = CropL
MSComm1.Output = "D"
End Function
.................................................. ............................



thanks advanced.

arora
Apr 22 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.