LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Samples question

 

looking at the picture attachment. here is my question

this is in a producer loop for continuous sampling , i want this to do: if x (samples local variable) is less than or equal to 32768 (no. of samples) then continuous sample at 32768

just asking as theres a boolean output to this and wondering?

Thanks in advance

0 Kudos
Message 1 of 7
(4,046 Views)

I'm having a hard time with the English here.  You may find it easier to post in your native language.  There are other language boards on the forums.  That being said you'll need a case structure to take the boolean output and do something if it is true, or do something else if the boolean is false.

0 Kudos
Message 2 of 7
(4,032 Views)

this is my native language lol.

so i want to do a continuous sample, for no. of samples there is 4k,8k,16k,32k,64k.....etc
when i do a continuous sample, i want it so that it when no. of samples chosen is below 32,768 . ie the 4,8 & 16k number of samples, then it will automatically continuously sample at 32,768 

if that helps?

0 Kudos
Message 3 of 7
(4,025 Views)

So sorry about the language thing.

 

Like I said you can use the case structure.  Wire the boolean output to the selector, and then if it is than 32768 have it return a constant of 32768, otherwise pass out the value.

0 Kudos
Message 4 of 7
(4,018 Views)

 

 

You need to be really careful here because of race conditions.You are reading from a local variable of a control and in parallel you are writing to a value property of the same control. The outcome will strongly depend on the order of operations, but there is no way to predict what happens first. The result of this code cannot be predicted.

 

If this is a control operated by the user, you can set the data entry limits so values lower than a defined limit cannot be entered. No code needed! You can also disable&grey out certain enum values.

 

Otherwise you could just use min&max function to force a lower limit (assuming the enum values are sorted).

 

 

 

 

0 Kudos
Message 5 of 7
(3,989 Views)

hi altenbach

so i have 2 controls for 'sample' & 'continuous sample', then i have no. of samples, 4k,8k,16k,32k etc....

i want to keep 4,8 & 16k no.of samples for the 'sample' control, but in the continuous when 4,8 & 16k are chosen it will automatically put out 32k samples, if that makes sense?

hence i cannot do the disabling of enums and greying them out, as both 'sample' & 'continuous sample' share the same control 'no.of samples'


0 Kudos
Message 6 of 7
(3,945 Views)

So then you just put a case structure around the code Altenbach gave you so that the comparison is only done when in continuous mode.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(3,923 Views)