LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating loop

Hi 

I have to acquire some data from device pulse oxymeter module ChipOx. If anyone had experience with it, i would appreciate it. I attached the block diagram, how it should start. Its connect through the serial port and i have to read always 1 byte and find out if its a start flag wich is (0xa8). The device send me data in 4 packets the first is the start flag, so i have to start always with it.

 

 

0 Kudos
Message 1 of 6
(3,075 Views)

Learning to program using LabVIEW involves getting familiar with LabVIEW's use of loops, structures, Case Statements, etc.  Instead of using flowchart symbols, I recommend you develop your ideas using LabVIEW code, perhaps with Text Labels where you don't know how to do something.

 

Have you had any training in LabVIEW?  Do you know where to find the functions to open and read from the Serial port?  Do you know how to test if a byte is equal to the Start Flag?  If so, develop some code to do these things, and then attach your code (the VI itself) when asking for help.  If not, there are many tutorials on LabVIEW fundamentals available on the Web, some of them listed in the upper right corner of this Forum page.

 

Bob Schor

0 Kudos
Message 2 of 6
(3,067 Views)

I am a begginer in Labview. For me its a little bit hard to completely understand how the loops work. I started to program that, but im not sure if its a good way to do that according to the block diagram. So I will be glad, if you can help me.

0 Kudos
Message 3 of 6
(3,046 Views)

I know, there are some things missing according to VISA to finish it completely, but i am only interested in the inside of the loop

0 Kudos
Message 4 of 6
(3,041 Views)

Hi

Assuming that I have understood what you intend to program: Here's a hint.

I agree with Bob_Schor, you should work through some tutorials. This will help you a lot!

Greetings

0 Kudos
Message 5 of 6
(2,991 Views)

OK, you've initialized VISA, and now have a loop that reads a single byte at a time until you tell it to stop.  When do you want it to stop?  Might that be when you get a byte whose value it 0xA8?  How do you stop a While loop?

 

Some further comments.  VISA returns its data as a string, but I think you are looking for a Byte value.  Do you know how to change the (one-byte) String to a Byte?  Or, alternatively, how to change a byte (0xA8) into a string?  Doing either will let you compare Byte to Byte or String to String to get a Boolean "They're the Same" signal that you can use to stop your While loop.

 

LabVIEW (you may have noticed) includes language constructs that handle Time, which is its own data type in LabVIEW.  Many times you don't want loops running "as fast as they can" (because you can have multiple loops "cooperating" rather than "competing" with each other.  For this reason, you'll often find "Wait" functions in While loops.  This particular While loop of your, however, does not need a Wait function -- do you know why?  {Hint -- there's already a "self-clocking" function inside the While loop that limits its speed to "something reasonable").

 

Once your While loop exits, you should be in what some Computer Scientists call the "Post-Condition" of (a) having your VISA system opened, and (b) having your "Start" byte read.  Now add additional code to do other things that you want to do.

 

Another suggestion as you continue -- you are off to a good "Style" start in having straight wires running left-to-right.  As you get your loops finished, resize them to make them more compact so you can fit more of your Block Diagram on the screen.  Strive for having no Block Diagram take more than a single screen to view.  This is almost always possible, particularly if you use sub-VIs (another hint, probably for the Next Lesson).

 

Bob Schor

 

 

0 Kudos
Message 6 of 6
(2,956 Views)