LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why a multiplication of 2 uint16 is limited to 11264 ?

Solved!
Go to solution

Hi,

 

 

I am trying to read a binary file and the number of bytes to be read is 320x240x2 (153600). But I must read them as uint16 which should limit it to 65535.

 

 

I have tried to do 320*240 as uint16 and the result is 11264. Do you understand why?

 

 

How can I do to read this file without being limited and use a byte stream type of uint16 when i read it?

 

 

Thanks!

0 Kudos
Message 1 of 4
(1,407 Views)

What does the number of bytes to read have to do with the representation of the data in the file? The answer is nothing so you don't have a problem.Smiley Very Happy

 

I really don't understand what you mean by 'result is 11264'.

Message Edited by Dennis Knutson on 06-19-2009 08:40 AM
0 Kudos
Message 2 of 4
(1,404 Views)
Solution
Accepted by topic author christophe69000

320*240 = 76800 = 65536 +11264

 

Count the bytes in I32, which is what most LabVIEW indexes use.   Interpret the values of the data as U16 if that is appropriate for your application.  The Read from Binary File function has a datatype input to simplify the conversions.  If the data is in the form of arrays, read the detailed help carefully for information about size of the arrays.

 

Lynn 

0 Kudos
Message 3 of 4
(1,398 Views)

 

I understand now why 11264... i didn't notice it at all. If i don't read the file as uint16 (with the Read from binary File function), all my values change and are wrong.

 


 

Count the bytes in I32, which is what most LabVIEW indexes use.   Interpret the values of the data as U16 if that is appropriate for your application.  


 

This works perfectly!

Thank you Lynn!

 

0 Kudos
Message 4 of 4
(1,388 Views)