473,386 Members | 1,763 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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.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
0 1531

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

Similar topics

9
by: franzkowiak | last post by:
Hello, I've read some bytes from a file and just now I can't interpret 4 bytes in this dates like a real value. An extract from my program def l32(c): return ord(c) + (ord(c)<<8) +...
235
by: napi | last post by:
I think you would agree with me that a C compiler that directly produces Java Byte Code to be run on any JVM is something that is missing to software programmers so far. With such a tool one could...
2
by: Abby | last post by:
Hi all, I need advice on how to concatenate bits value. I have 2 bytes of Hex value: Byte1 = 0x33 --> 00110011 Byte2 = 0x90 --> 10010000 I want 10 bits value which compose of 2 bits(7th...
4
by: Marius Cabas | last post by:
I have a Byte array and I want to concatenate it to another Byte array. How can I do this? Thanks.
8
by: Kenny ODell | last post by:
I do not know how to convert from a byte array to a float, and back again. I read data from a serial port into a byte (entire command structure which I parse). I am able to sift the data and...
3
by: Aykut | last post by:
Hi I have to convert byte value to float in C#.Float is in IEEE 754 format. byte value is= 70 23 22 195 in a byte array. and its float value is = -150.0909 what is the algoritm for this...
2
by: Parag Ambernath Keni | last post by:
Hi, I am using the Diab compiler for the MPC 555 controller. I wanted to know the internal bit representation of float value. Also if I type cast of float value to byte the way the final value...
2
jeffbroodwar
by: jeffbroodwar | last post by:
Hi, I want to concatenate 0x with a variable (dont know what type) to pass it in a byte array. the code below shows the original code : ORIGINAL CODE : ioData = new byte; ...
9
by: ssubbarayan | last post by:
Hi all, I am trying a program to convert floating point values to a byte array and printing the same to the screen.The idea behind this is we already have an existing function which can do byte...
5
by: Zamdrist | last post by:
I have a need to make a group of records 'unique' by concatenating a foreign key value to another field, the two are float and varchar type. Now, I'll have to cast the float column, but then I end...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.