hello,
I interface a microcontroller with PC using VB6. as i transfer string from the microcontrller it is desplayed on the VB form. but when i send a float byte array from the microcontller it is showing mismatch error. i am sending a four bytes of float value from the microcontroller to com port. now i am not able to convert that 4 bytes of float value to single or double data in vb.
please suggest what to do..Code:Public Function GetByt(Byt As Integer) As Single Dim CropL As Single 'Dim i As Integer Dim crop() As Byte Dim buf As Byte Dim Str As String MSComm1.OutBufferCount = 0 MSComm1.InBufferCount = 0 MSComm1.Output = "S" Do While MSComm1.InBufferCount < Byt DoEvents MSComm1.Output = "R" ' ack to controller that byte is received, send next Loop crop() = MSComm1.Input CropL = crop() GetByt = CSng(CropL) MSComm1.Output = "D" 'ACk to controller that all bytes are received, End Function
Best Regards.


Reply With Quote



Bookmarks