LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to import labVIEW codes to different editor (KitEditor in EA eDIPTFT70-A)

Solved!
Go to solution

@JÞB wrote:

@Borjomy wrote:

 The meaning of the conversion is that the sum of the byte array will exceed the number 255, which is the maximum number for the byte. Therefore, the bit depth of the representation must be increased, at least up to U16. An array of constants in this case is used only to indicate the type to which the input data is converted. Therefore, its contents can be any.


Why? You immediately mask the most significant 24 bits anyhow! 

Just let the rollover happen in the sum array elements and cast to string.  (Unless you charge on a per-primitive basis, of course.  Then its dandy!)


The number of bytes in the package is no more than 255. Therefore, U16 is sufficient. Even if all the bytes in the message are equal to 255, the maximum amount will be 0xFE01, which fits into the Word. But the example uses U32. For reliability 🙂

Labview 4.0, 5.0, 6.1, 8.6, 2009, 2011, 2012, 2014
If you do not know something, ask me.
0 Kudos
Message 21 of 23
(116 Views)

@Borjomy wrote:

@JÞB wrote:

@Borjomy wrote:

 The meaning of the conversion is that the sum of the byte array will exceed the number 255, which is the maximum number for the byte. Therefore, the bit depth of the representation must be increased, at least up to U16. An array of constants in this case is used only to indicate the type to which the input data is converted. Therefore, its contents can be any.


Why? You immediately mask the most significant 24 bits anyhow! 

Just let the rollover happen in the sum array elements and cast to string.  (Unless you charge on a per-primitive basis, of course.  Then its dandy!)


The number of bytes in the package is no more than 255. Therefore, U16 is sufficient. Even if all the bytes in the message are equal to 255, the maximum amount will be 0xFE01, which fits into the Word. But the example uses U32. For reliability 🙂


You missed the point.  So, Lets "Do the math" In Hex if you please,

 Word U16 (00FF*00FF) mod 0100 = 0001  Or 
DWord U32 (000000FF*000000FF) mod 00000100 = 00000001

As Byte it is FF*FF=01  

Simpler No?


"Should be" isn't "Is" -Jay
0 Kudos
Message 22 of 23
(106 Views)

@JÞB wrote:

@Borjomy wrote:

@JÞB wrote:

@Borjomy wrote:

 The meaning of the conversion is that the sum of the byte array will exceed the number 255, which is the maximum number for the byte. Therefore, the bit depth of the representation must be increased, at least up to U16. An array of constants in this case is used only to indicate the type to which the input data is converted. Therefore, its contents can be any.


Why? You immediately mask the most significant 24 bits anyhow! 

Just let the rollover happen in the sum array elements and cast to string.  (Unless you charge on a per-primitive basis, of course.  Then its dandy!)


The number of bytes in the package is no more than 255. Therefore, U16 is sufficient. Even if all the bytes in the message are equal to 255, the maximum amount will be 0xFE01, which fits into the Word. But the example uses U32. For reliability 🙂


You missed the point.  So, Lets "Do the math" In Hex if you please,

 Word U16 (00FF*00FF) mod 0100 = 0001  Or 
DWord U32 (000000FF*000000FF) mod 00000100 = 00000001

As Byte it is FF*FF=01  

Simpler No?

U8sum.png

 

You can do without type conversions

Labview 4.0, 5.0, 6.1, 8.6, 2009, 2011, 2012, 2014
If you do not know something, ask me.
Message 23 of 23
(97 Views)