LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dealing with loops

Hi all,

 

Seeking for help with the following questions

 

101.PNG

0 Kudos
Message 1 of 10
(3,149 Views)

welcome to forum

If i am not wrong this is your homework.

you have a lot of resources LabVIEW help, basic 1, basic 2 , introduction courses where you can learn all of these.

Now the best thing you did you have seen the forum very early, but try to learn all these youself and if you have any specific problem give it a try and show everyone here.

So start learning and enjoying the world of programmingSmiley Happy

0 Kudos
Message 2 of 10
(3,146 Views)

#6 is poorly worded English, doesn't even make sense.  And they should have capitalized "For Loops" so it was clear it was talking about the named structure.  When I first read it, considering the English was so bad, the word "for" blended in and it looked like they were just talking about loops.

0 Kudos
Message 3 of 10
(3,132 Views)

is it true that you you should not use a 'for loops' in data acquisition? I did not know that.

because I am having that same problem right now and I cannot write to serial port in a for loop and always get a 'NAK'

is that the reason? should I try a while loop?

I can write the individual commands to serial port, but not in a for loop. why is that? please help. thanks

 

 

0 Kudos
Message 4 of 10
(3,130 Views)

No, it is not true that you shouldn't use a For Loop for data acquisition.  Typically, you don't, but I wouldn't say you're not supposed to.

 

Two things stand out to me in your screenshot.

 

1.  You have a 20 millisecond wait.  Are you sure that is enough time between writing the command, and reading the port.

2.  You are sending a carriage return for your termination character on writing the command.  Are you sure that is correct?  Is it possible it should be a new line/linefeed character?

0 Kudos
Message 5 of 10
(3,119 Views)

For loops will iterate a fix number of times so if you want continious data aquisition you should use while loop.

 

0 Kudos
Message 6 of 10
(3,114 Views)

Hi... yes,  the individual commands work one by one when I use a case stucture and an enum,

I always get a ' > ' and the the desired result, but not in a "For Loop'.

also as you can see, I have some trouble changing the strings from serial read to number at the end too and I get 0 in numeric indicator. why?

for example if i get the string of: 25.15,45.92  from serial read buffer, I want to show it on two numeric indicators on the front panel, that one shows 25.15 and the other shows 45.92  

how do I do that?. thanks

0 Kudos
Message 7 of 10
(3,110 Views)

Yes, I want a fixed number of measurement too, like: 10 measurements.

I actually need to add network analyzer's commands in the for loop too, to take the measurement at those ten intanses. are you saying 'For Loop' is not good for 10 measurements in a sequence? 

0 Kudos
Message 8 of 10
(3,107 Views)

dont be confuse about For loop.

OK you want 10 different values use a For loop. As you said things are working when you are using case structure and enum you are getting the responce you will get this with For loop also.

instead of showing  different values in different indicator show them in an array where each element contains a single read value.

collect strings in For loop and type cast it afterwards

0 Kudos
Message 9 of 10
(3,101 Views)

@Neos wrote:

.....

collect strings in For loop and type cast it afterwards..

 


Don't use typecast, it won't work for this. Use Scan From String, which can be found on the String palette, or one of the String To Number functions.

MC

 

0 Kudos
Message 10 of 10
(3,023 Views)