LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

digital waveform array into boolean

Hi

 

I have changed the DAQ assistance for the temperature into the DAQmx version and also refactored the analogue to trigger. For the analogue trigger I chose PFI4 line but this is also the line used to collect the digital pulse samples and as a result data is not collected in the analogue acquistion. I have the following device pinouts of which I have wired my digital signal into pin 20 (CTRL 1 SRC):

devicepinouts.PNG

 

If I have two acquistions using the same Pin I would get a resource in use error. Under triggering option tab in the DAQ assistance I used the PFI4 as the start trigger and also as a reference trigger (using two seperate daq assistances) as a check to see if I used the correct trigger but with both I go no response from the analogue aquistion.

0 Kudos
Message 41 of 52
(3,351 Views)

Let's go back to first principles - which I should have done in the first place.  You want to take some analog and temperature measurements every time you get a digital pulse.  The proper way to do this is to use the digital pulse to trigger the analog acquisitions in hardware.  Since you have two acquisition types, you will need to use two PFI lines, both wired to the same digital line, one for analog voltage, one for temperature.  Set up one DAQ acquisition for the voltage and one for the temperature.  Both are digitally triggered in hardware.

 

If you want to trigger on both positive and negative edges, I think you will need to set up a parallel set of acquisitions identical to the first, but using a negative edge instead of a positive edge trigger, using separate analog inputs and temperature inputs and separate trigger lines.  Physically, you will be wiring the same inputs to the corresponding analog lines.

 

In your software, you will not have a digital acquisition loop (not needed).  Instead, you will have an analog loop containing the voltage and temperature measurement and your file storage loop.  If you trigger on positive and negative edges, you will have two analog loops, one for each type of trigger, but still one file storage loop.  The analog loops will ping-pong sending data to it.

 

I hope this makes sense.  Let me know if you need more info.

0 Kudos
Message 42 of 52
(3,359 Views)

Hi DFGray, I understand what you mean by ping ponging the data based on the triggered edge of the digital line and hopefully this should provide analogue data at the point of digital triggering rather than occuring during post processing as I had with the queue system.

 

I tested this out. I used two daq assistances first - each assistance was reading 2 analogue signals from the same lines and the triggering was from the single digital pulse line - the only difference was that each assistant was setup to look at either a rising edge or falling edge of the same digital line. However when I run this I get a resource error (-50103) because I am using two daqs to look at the same two analogue lines and the only difference between the daqs is the edges of the digital triggering line.

 

Have I correctly interpretated what you wrote?

 

Also I thought about the temperature measurements - these do not need to be triggered by the digital pulse since as you stated they are not going to change quickly. Even though my previous program with the queues may not be entirely correct for my application I do not think that it was a waste of time - more that I learnt a lot about LV - so thanks.Smiley Happy

0 Kudos
Message 43 of 52
(3,346 Views)

You can work around the multiple use of the same line by using two different inputs to your DAQ board, wired to the same source, assuming you have four analog inputs.

Message 44 of 52
(3,341 Views)

Hi, followed what you said; used 4 analogur lines for the two analogue inputs and used the same source but different edges to trigger on for the acquistion but still got the same resource error as shown in the vi below when using parallel loops.

 

I even wired the digital trigger to two sources so that each acquistion loop has different sources but still got the same error code. I used the daq assitance as an initial setup and chnaged them both to daqmx code but still recieved the same error. Any ideas?

 

vi.PNG

0 Kudos
Message 45 of 52
(3,319 Views)

Hi DFGray. I had a word with a NI techincian and he said that it will not be possible to ping pong data between loops on the device I have due to a an old clock system in use on the device.

 

He suggested a vi from find examples dialog in labview which allows retriggering/rearming of the digital line when using it as a counter input. This vi works by using two counter lines which in my case provide the same pulse. I get 720 pulses per rev and per pulse I get a signal as I want.

 

I also have a 1 pulse per revolution counter line and I have wired this into the vi to too. This line is used as a reference line as apposed to a full revolution counter. I have noticed that when the data is written to the file I am expecting there to be 719 pulses before the next full revolution counter pulses but this is not the case I get around 690 and this is usually random too - I believe it is to do with the speed of the vi execution. To improve speed I moved a lot of the data into queue system as you have taught me before.

 

The speed issue is clearly seen when I rotate the shaft quickly and then stop - the 720 pulse counter takes a few milliseconds to catchup its couting - is there anyway in program to speed things up - I have no other programs running and using a Xeon cpu with 4Gb RAM on winds xp 32bit? Many thanks. (I have attached both my vi and the written data file - note the one pulse per rev provides two pulses per rev instead - I think the encoder may need repairing but the other 720 pulse line is fine)  

 

vi.PNG

Download All
0 Kudos
Message 46 of 52
(3,286 Views)

Unfortunately, I am not a DAQ guru (I have not used DAQ seriously in over ten years).  However, given your symptoms, I would guess that your acquisition plus rearm time is taking longer than the time between your triggers, so you miss some.

 

You have the possibility of sending an empty set of data to the file when you loop back faster than the next available sample.  Is this intentional?

 

You may be able to save some time in building your data to put into the queue by preallocating the data structures and replacing the contents at every iteration instead of building an array of elements, but I don't think you would get much out of that.  Since most of the array sizes are constant, LabVIEW should do a good job reusing the memory.

 

Another possible way to solve the data acquisition problem is to take three lines of analog data - the two you actually want plus the pulses from the encoder shaft.  Stream it all to disk all the time or use the software trigger VIs to only stream it when you have a trigger.  Make sure you save the trigger lines, as well, since you will run into the same sorts of issues with multiple triggers in a short period of time.  The only down side to this is that the resolution of your trigger position will be equal to your acquisition rate, but you already had similar hardware issues.

 

 

0 Kudos
Message 47 of 52
(3,273 Views)

Hi there,

 

I hope I'm right in this thread. I have this problem of converting a digital waveform array (25) elements into Boolean but I am only able to use LabVIEW 8.6.1. I found nothing like the "digital waveform to Boolean" function. Is there anything comparable in LabVIEW 8.6.1.?

0 Kudos
Message 48 of 52
(3,231 Views)

That function is buried in the Digital Conversion subpalette of the Digital Waveform palette.  You will need to extract the waveform portion (Y element) of the digital waveform to use the function.

 

DWDTToBooleanArray.png

0 Kudos
Message 49 of 52
(3,221 Views)

@smercurio_fc:

 

Though unrelated, I was wondering if I could get your opinion on something (given your Knight of NI status!) I am a co-op working on generating an automated test using LabVIEW and a series of DAQ devices.  At several points during the test, I am going to need to read a PWM signal (generated by the board under test) and determine the pulse width of the signal.  I am debating between using a DI and AI (I am torn, because I am not overly familiar with LabVIEW hardware capability, being somewhat of a newbie) and was curious as to your opinion.

 

 

0 Kudos
Message 50 of 52
(2,858 Views)