concatenate a 4 byte into 1 float value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chand arora
    New Member
    • Apr 2010
    • 1

    concatenate a 4 byte into 1 float value

    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.OutBuff erCount = 0
    MSComm1.InBuffe rCount = 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
Working...