Digital output with LabVIEW

 
Post new topic   Reply to topic    Pico Technology Forum Index -> LabVIEW
Author Message
Solomon
Active User
Active User


Joined: 28 Feb 2008
Posts: 8
Location: LONDON

PostPosted: Thu Feb 28, 2008 3:38 pm    Post subject: Digital output with LabVIEW Reply with quote

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
Back to top
gruntman
Guru
Guru


Joined: 28 Sep 2006
Posts: 96
Location: Garden City, KS USA

PostPosted: Fri Feb 29, 2008 5:27 pm    Post subject: Reply with quote

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
Back to top
Solomon
Active User
Active User


Joined: 28 Feb 2008
Posts: 8
Location: LONDON

PostPosted: Sun Mar 02, 2008 9:47 pm    Post subject: Reply with quote

Hi Richard,

Do you know where I can download "UsbAdc11SetDo"?

Thanks again for your help.

regards

Solomon
Back to top
gruntman
Guru
Guru


Joined: 28 Sep 2006
Posts: 96
Location: Garden City, KS USA

PostPosted: Mon Mar 03, 2008 5:54 pm    Post subject: Reply with quote

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



USB-ADC-11_DO.vi
 Description:
USB ADC-11 Digital Output Example

Download
 Filename:  USB-ADC-11_DO.vi
 Filesize:  16.03 KB
 Downloaded:  74 Time(s)

Back to top
Solomon
Active User
Active User


Joined: 28 Feb 2008
Posts: 8
Location: LONDON

PostPosted: Wed Mar 05, 2008 3:45 pm    Post subject: Reply with quote

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
Back to top
gruntman
Guru
Guru


Joined: 28 Sep 2006
Posts: 96
Location: Garden City, KS USA

PostPosted: Thu Mar 06, 2008 5:27 pm    Post subject: Reply with quote

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
Back to top
Solomon
Active User
Active User


Joined: 28 Feb 2008
Posts: 8
Location: LONDON

PostPosted: Tue Mar 18, 2008 3:49 pm    Post subject: Reply with quote

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



ApneaDetector.vi
 Description:

Download
 Filename:  ApneaDetector.vi
 Filesize:  21.63 KB
 Downloaded:  64 Time(s)

Back to top
Solomon
Active User
Active User


Joined: 28 Feb 2008
Posts: 8
Location: LONDON

PostPosted: Tue Mar 18, 2008 4:31 pm    Post subject: Sorry..Wrong file attached on previous post Reply with quote

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



Breath.vi
 Description:

Download
 Filename:  Breath.vi
 Filesize:  395.93 KB
 Downloaded:  65 Time(s)

Back to top
gruntman
Guru
Guru


Joined: 28 Sep 2006
Posts: 96
Location: Garden City, KS USA

PostPosted: Wed Mar 19, 2008 5:14 pm    Post subject: Reply with quote

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
Back to top
Solomon
Active User
Active User


Joined: 28 Feb 2008
Posts: 8
Location: LONDON

PostPosted: Tue Mar 25, 2008 10:55 am    Post subject: Reply with quote

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
Back to top
gruntman
Guru
Guru


Joined: 28 Sep 2006
Posts: 96
Location: Garden City, KS USA

PostPosted: Tue Mar 25, 2008 3:19 pm    Post subject: Reply with quote

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



usbadc_11_block_example.vi
 Description:
USB ADC-11 Labview File

Download
 Filename:  usbadc_11_block_example.vi
 Filesize:  25.79 KB
 Downloaded:  66 Time(s)

Back to top
Solomon
Active User
Active User


Joined: 28 Feb 2008
Posts: 8
Location: LONDON

PostPosted: Wed Apr 02, 2008 2:33 pm    Post subject: Reply with quote

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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Pico Technology Forum Index -> LabVIEW
All times are GMT
Page 1 of 1

 


Pico Technology topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group