LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I raed and write into an array simultaniously?

Solved!
Go to solution

And as I already told you, you do not need the for loop. The other indicator you have seems silly.

 

No For Loop.PNG

0 Kudos
Message 11 of 23
(1,432 Views)

Hi Dennis,

 

I think the for loop is needed as a histogram of the amplitudes is counted here. Your example just scales the amplitude values instead...

 

Btw. It's kind of silly to use a histogram array capable to hold 100 bins and only use the first 60 bins...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 23
(1,423 Views)
Oops. Looked like just the scaled value was being placed into the array. Missed the value being wired to both.
Message Edited by Dennis Knutson on 12-16-2009 06:04 AM
Message Edited by Dennis Knutson on 12-16-2009 06:08 AM
0 Kudos
Message 13 of 23
(1,420 Views)

Hi Dennis,

 

yes, it's one more point to complain about the original VI: using DBLs to index the array...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 23
(1,408 Views)

At denis...

 

The VI is for simulating a multichannel analyzer (MCA) in labview. It finds out peaks in a waveform which is being received continuously by interfacing Tektroniks oscilloscope and Signal express. After a peak is found out it is arranged in channels as per it's height. channel count is incremented by 1 when a pulse of the height, designated to it is dected. suppose we have 100 channels and maximum possible height of a pulse is 4 volts. Then we will make our program such that 4 volt pulse will sit in 100th channel, 2 volt will sit in 50th channel and so on. At last we drwa channel vs counts graph. Code inside the for loop does so(arranges pulses in channel).

 

I have done this project successfully with offline data (you can see the vi attached). when I am trying to do it online (continuously acquring and processing data) problem is coming. I have to continously acquire data from tektronics oscilloscope in signal express and process it. Tektronics sends data in a block of 2500 samples. Peak detector pallet is able to find 7 peaks in this much data points. When next set of 2500 data points come , peak detector instead of accumulating the peaks its overwriting the older values.

 

Can you help and suggest me how to go about the same project, if I want to make it work online.   

Vipin
0 Kudos
Message 15 of 23
(1,391 Views)
STOP USING LOCAL VARIABLES!!!!
0 Kudos
Message 16 of 23
(1,382 Views)

Hi number,

 

have you read any of our messages?

Have you ever considered to follow our suggestions?

Why should we invest (our precious spare) time to give advice that isn't followed?

 

Again: Stop using locals this way and first integrate our proposed solution. Then try debugging with highlighting execution. Then spot the problems and ask for specific help. IN THAT ORDER!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 23
(1,370 Views)

OK, if you want to retain the contents of the shift register between calls of this subVI, you need to use a globally initialized feedback node instead. Also such integer histograms are most easily done using the "in place element" structure.

 

As others have said, your code is full of race conditions because there is no way to tell in which order the three disconnected code fragments execute.

 

  • It does not make sense to increment the array size by one and wire it to N of the for loop. The loop should execute exactly once per element, thus it would be correct to use the unaltered array size. Of course autoindexing takes care of that automatically, so there is no need to even get the size or wire N.
  • Please don't to the "array to cluster-unbudle-dance" to get the first element of an array. All you need is "index array".
  • Indicators and controls should not be inside non-interactive loops. The constant updates will slow down your code.
  • I have no idea why you use the absolute value. Are all values negative? If they are negative and positive, taking the absolute value would probably distort the reusult.

 

 

Message Edited by altenbach on 12-16-2009 11:59 AM
0 Kudos
Message 18 of 23
(1,351 Views)

@ GenerdW

 

Please dont get angry. I am a beginner in Labview. All I am doing is to learn from you experienced people.  I had already implemented your suggestions on a different VI (The VI I attached just before is for offline data processing) thats why I marked the thread as SOLVED. your suggestions  worked out well if I use a create signal step in signal express. But when I am using Tektroniks oscilloscope its not updating the MCA array (same problem). You can see the VI which I implemented your suggestions on, in attachment. 

 

altenbach

 

Thanx a lot for your valuable tips and suggestions sir. I hope these things come with experience only. I will try implementing them and will let you know of the outcome. 

 

 

 

Vipin
0 Kudos
Message 19 of 23
(1,326 Views)

sorry again..

I should have termed that VI as "VI for GerdW" not VI for "Dennis" Smiley Surprised

Vipin
0 Kudos
Message 20 of 23
(1,323 Views)