LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview beginner

Solved!
Go to solution

MikeS81 wrote:

Hi tbob,

if the number is unsigned and the end is smaller than the start, then the subtraction results in a big number.

 

Mike

Message Edited by MikeS81 on 03-31-2010 09:30 PM

 

You are correct in that point.  However, there is a coersion dot that appears at the N terminal.  Evidently if the difference between start and end is small it gets changed by the coersion dot to a negative number (I32) and the loop doesn't execute.  However, if the starting number is much larger than the ending number (start=4294967290, end=5), the difference is actually a positive number after conversion to a signed integer.  Then the loop will execute and you will get an unintended result.  So a test should be made to ensure that the starting number is less than the ending number to have a completely robust VI.

 

 

 

- tbob

Inventor of the WORM Global
Message 11 of 17
(1,169 Views)

Hi tbob,

you are correct. If it is a U32 (the result from two U32 normally resulting in a negatice number) and i connect it to a for loop (LV 2009) then the loop do not execute. Is it expected behaviour? Where is the difference between a "normal" U32 (value=5) number and the result of the operation 5-12=4294967289? I would expect that the loop iterats 4294967289 times.

 

Mike

0 Kudos
Message 12 of 17
(1,164 Views)

I will use a U8 vs I8 to show the difference.  With a U8 (unsigned), the range of numbers are from 0 to 255.  For I8 (signed), the MSB is the sign bit and is not part of the number, so the range is from -128 to 127.  So lets make start and end numbers U8.  A start number of 129 with an end number of 1, subtract end minus start and you get -128.  But the output is unsinged, so you get 128 instead.  But the N in the loop terminal only accepts signed integers, so it sees -128 and does not execute.

 

Now lets say the start is 130 and the end is 1.  The subtraction gives -129, which is beyond the limits of the I8 (-128 to 127), so the number gets converted to 127.  The loop executes 127 times.

 

Apply the same principle for U16-I16 and U32-I32, only the range is much larger.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 13 of 17
(1,151 Views)
The simpler the better.ramp.png
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 14 of 17
(1,143 Views)
Solution
Accepted by bagarman
Good day.
I need a few more ideas from you.
I try to create an ultrasound image at the moment, that is, to my problem:
I take ultrasound echoes from a sensor a_mode (2D wobbler principle) and try to make create a B-mode image, now the problem, I turn the sensor from -45 ° to +45 °, and therefore I get a polar image.
Now I want to convert this information into Cartesian coordinates and represent 2D image
I hope that someone here has ideas.
would post some cool programs.
with friendly greetings
0 Kudos
Message 15 of 17
(1,103 Views)

Wierd and not acceptable No:1 - You have posted something totally different and is it not better to start a new thread?.

 Wierd and not acceptable No:2 - Why is the above post marked as the solution?

Wierd and not acceptable No:3 - Why are posting the same message under un related threads????? :smileymad:

Message Edited by muks on 04-02-2010 11:40 AM
Message 16 of 17
(1,098 Views)
Message 17 of 17
(1,088 Views)