LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DDE in loop

Hi.
I have a program with 9 LEDs in a For Loop. After each LED is tested, it sends the data to Excel through DDE. It is working fine for the first time through the whole For Loop, but when it goes through the loop again (0-8 afor the second time), my original data in Excel gets replaced by this new data. It is because I specify what columns to insert the data into. Is there any way of updating my string input (on where to place the data) so that it changes with each for loop?
0 Kudos
Message 1 of 9
(3,672 Views)
Hi:

Inside your for loop, place a case structure and wire the iteration terminal to the question mark of your case structure. The case structure should now have 0 or 1 case. You can add more cases by right mouse clicking on the case structure and select the add case option. Now within each case number, place a string denoting what Excel cell to update with each interation.

Have fun
Robert
0 Kudos
Message 2 of 9
(3,672 Views)
Thanks for your answer - but I'm not sure if thats what I need exactly...

Ok, so I have 9 LEDs inside a For Loop (N=0-8). When N=0, it does its stuff with LED1, and sends the data to Excel...then N=1, etc etc.

Thats all fine, but the problem occurs after I've been through my first 0-8 loop...and going to repeat the whole thing again. So I don't see how the Case structure would work. I need a way of the first time N=0, for the data to go to column 1, row 1-4, but then the second time N=0, I want the data to be sent to column1, row 6-9... and so on for N=0-8 several times.

Do you see what I mean? Sorry if I'm not explaining this well....
0 Kudos
Message 3 of 9
(3,672 Views)
I think I understand what you are doing now. For now, lets assume you have a finite number of iterations. You can use a nested for-loop structure. That is, create another for-loop outside your existing for-loop. Use the outer for-loop interation counter and multiply with the inner for-loop iteration N terminal, then add inner for-loop iteration termainal Connect this result into the format into string primitive located in the string pallete.

See attached example in LV7.1

Robert
0 Kudos
Message 4 of 9
(3,672 Views)
Hi, thanks so much - that sounds like it might be the answer. Umm, my LV version is 5.0 (I know, I know - not my choice!). Is it possible for you to save the file in 5.0 for me?

Thanks so much
0 Kudos
Message 5 of 9
(3,672 Views)
I don't have LV5.0. But attached is the image of the block diagram in a MS Word format. I cannot remember if LV5.0 has the Format into string primitive.

Robert
0 Kudos
Message 6 of 9
(3,672 Views)
Hi LV Newbie,
The answer that the other user posted on the forum is what you need. I have access to a copy of Labview 5.0 and I'll try to convert his code to 5.0 for you.

Chris M
National Instruments (UK)
0 Kudos
Message 7 of 9
(3,672 Views)
Hi LV Newbie,
I couldnt find a copy of LV 5.0 but I did have a copy of 5.1 . I've converted the vi to 5.1, and it's attached. Please try it, it should load, and let me know how you get on.

Chris M
Applications Engineer
National Instruments (UK)
0 Kudos
Message 8 of 9
(3,672 Views)
Hi,

I couldn't load it in my 5.0 version, the error says 'version of VI is newer than labVIEW version'

Thanks for converting it, I think I will be ok going from the screen capture...

Thanks for your help!
0 Kudos
Message 9 of 9
(3,672 Views)