Test and Measurement Forum

Digital output with LabVIEW

Post your LabVIEW discussions here

Digital output with LabVIEW

Postby Solomon » Thu Feb 28, 2008 3:38 pm

Hi All,

I am hoping to use the ADC-11 and LabVIEW to write a simple VI that acquires/stores data and when a certain condition is met, the ADC-11's digital output is used to trigger. Does anyone know how I can write to the the ADC-11's digital output? Any example VIs you guys might have that you think may be helpful in what I am trying achieve is also most welcome

your help is much appreciated!

Solomon
Solomon
Active User
Active User
 
Posts: 8
Joined: Thu Feb 28, 2008 3:17 pm
Location: LONDON

Postby gruntman » Fri Feb 29, 2008 5:27 pm

Solomon,

To control the Digital Output you will need to call the following function:
short (UsbAdc11SetDo) (short handle, short do_value, short doNo);

do_value will control on/off. 0 means off and 1 means on. doNo is which digital output you are controling, 0 is the first output and 1 is the second.

Simply add this function to your program and you should be set. If you have any other questions feel free to ask away.

Regards,

Richard Boyd
Crag Technologies, Inc
http://www.pc-oscilloscopes.com
gruntman
Guru
Guru
 
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Postby Solomon » Sun Mar 02, 2008 9:47 pm

Hi Richard,

Do you know where I can download "UsbAdc11SetDo"?

Thanks again for your help.

regards

Solomon
Solomon
Active User
Active User
 
Posts: 8
Joined: Thu Feb 28, 2008 3:17 pm
Location: LONDON

Postby gruntman » Mon Mar 03, 2008 5:54 pm

Solomon,

To call the UsbAdc11SetDo function you simply need to have the program reference the C:\Program Files\Pico Technology\Pico Full\usbadc11.dll file and define the function. The attached example will show you how to control the two digital outputs. Simply copy the example into the place where you want the outputs enabled.

Regards,

Richard Boyd
Crag Technologies, Inc
http://www.pc-oscilloscopes.com
Attachments
USB-ADC-11_DO.vi
USB ADC-11 Digital Output Example
(16.03 KiB) Downloaded 357 times
gruntman
Guru
Guru
 
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Postby Solomon » Wed Mar 05, 2008 3:45 pm

Hi Richard,

Thanks very much for your help thus far, However I got one more question.

I only get a single pulse when I write to the digital output even though the condition that turns it on remains true. I would like to know how I can keep the output high and and whether you can keep it high for a defined period after the condition that has turned it on is no longer true.

Thanks again
Solomon
Active User
Active User
 
Posts: 8
Joined: Thu Feb 28, 2008 3:17 pm
Location: LONDON

Postby gruntman » Thu Mar 06, 2008 5:27 pm

Solomon,

I am going to assume that the condition that trues it on is actually not remaining true and causing the signal to fall. I simply wired up the open unit and close unit to the example I posted to double check that the functions are working correctly and they are. I fact if I turn the output on it would actually stay on until i either turned it off or disconnected the usb cable. If you want to keep the output high for a defined period and then turn it off you will need to simply add a wait timer into your program before the function to turn the output off. If you post your program I can attempt to look at it for you and give you some ideas as to why it isn't working but the function itself is working correctly.

Regards,

Richard Boyd
Crag Technologies, Inc
http://www.pc-oscilloscopes.com
gruntman
Guru
Guru
 
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Postby Solomon » Tue Mar 18, 2008 3:49 pm

Hi Richard,

I have attached my VI. The VI should detect when the breath waveform (a sinewave, approx freq of 0.2 Hz) is below a defined threshold. If it remains below the threshold for a given period i.e. the patient stops breathing, a trigger signal should be sent to a muscle stimulator via the ADC-11 digital output. So my problems now are:

1. I donot think I am getting a digital output when I should
2. The output should only stay high for 10 mins max after which period, it should not be able to be turned on (even if breath level is below the threshold) for the next 30 mins so as to allow the muscle to recover.

Regrading the first issue, I would be grateful if could help me rule out the VI not working. Regarding the second issue, any help/tips on how to implement this would be much appreciated

As you probably already gathered, I have limited experience in Labview, so you help is very much appreciated!

Thanks again

Solomon
Attachments
ApneaDetector.vi
(21.63 KiB) Downloaded 295 times
Solomon
Active User
Active User
 
Posts: 8
Joined: Thu Feb 28, 2008 3:17 pm
Location: LONDON

Sorry..Wrong file attached on previous post

Postby Solomon » Tue Mar 18, 2008 4:31 pm

Hi Richard,

I have attached my VI (the right one this time). The VI should detect when the breath waveform (a sinewave, approx freq of 0.2 Hz) is below a defined threshold. If it remains below the threshold for a given period i.e. the patient stops breathing, a trigger signal should be sent to a muscle stimulator via the ADC-11 digital output. So my problems now are:

1. I donot think I am getting a digital output when I should
2. The output should only stay high for 10 mins max after which period, it should not be able to be turned on (even if breath level is below the threshold) for the next 30 mins so as to allow the muscle to recover.

Regarding the first issue, I would be grateful if could help me rule out the VI not working. Regarding the second issue, any help/tips on how to implement this would be much appreciated

As you probably already gathered, I have limited experience in Labview, so you help is very much appreciated!

Thanks again

Solomon
Attachments
Breath.vi
(395.93 KiB) Downloaded 291 times
Solomon
Active User
Active User
 
Posts: 8
Joined: Thu Feb 28, 2008 3:17 pm
Location: LONDON

Postby gruntman » Wed Mar 19, 2008 5:14 pm

Solomon,

I took a real quick look at the vi that you posted and noticed one thing. You do not have the input handle wired into your first UsbAdc11SetDo function. This should be wired to the handle that your open unit call returns. Without this you will not have any DO set...

Regards,

Richard Boyd
Crag Technologies, Inc
http://www.pc-oscilloscopes.com
gruntman
Guru
Guru
 
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Postby Solomon » Tue Mar 25, 2008 10:55 am

Hi Richard,

The function I am using to read from the ADC-11 doesnot have a an output node for handle hence I donot know what to wire to the handle input on the UsbAdc11SetDo function. Could you please tell me how I do this.

Thanks again.

Solomon
Solomon
Active User
Active User
 
Posts: 8
Joined: Thu Feb 28, 2008 3:17 pm
Location: LONDON

Postby gruntman » Tue Mar 25, 2008 3:19 pm

Solomon,

Instead of using the LabView single method that was designed around the parallel version of the ADC-11 you need to call the updated USB ADC-11 calls to use the UsbAdc11SetDo. This is because the handle that is wired to this call comes from the USB handle that the open unit call returns. I have attached the example from which you will need to look at and modify for your application. You will want add the UsbAdc11SetDo functions after the stop function and before the close unit function. Also if you want to return values continuously you will want to put your for loop between all the open unit and close unit calls otherwise this will only run one time...

Regards,

Richard Boyd
Crag Technologies, Inc
http://www.pc-oscilloscopes.com
Attachments
usbadc_11_block_example.vi
USB ADC-11 Labview File
(25.79 KiB) Downloaded 279 times
gruntman
Guru
Guru
 
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Postby Solomon » Wed Apr 02, 2008 2:33 pm

Hi Richard,

I have set the adc11_run's function method node to "2" and put my while loop between the open unit and close unit calls but I still cannot get the VI you uploaded to continously stream data. Would you by any chance have a VI that uses this function to continously acquires data and also uses the UsbAdc11SetDo function that I can look at?

Once again, your help is very appreciated

Solomon
Solomon
Active User
Active User
 
Posts: 8
Joined: Thu Feb 28, 2008 3:17 pm
Location: LONDON


Return to LabVIEW

Who is online

Users browsing this forum: No registered users and 0 guests