LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I could not produce an output and input at the same time using DT9837

Hi,

 

First and foremost, hi all. This is my first time posting at NI forums and I am using LabVIEW 8.6.

 

I have a problem here, what I am trying to do here is I try to process the input, by measuring the counts and converting it into 'mm'. 

And after that, I want to rescale that value within the range of 10 because my device, DT9837 can only support +-10V. For the counts measurement, I use a printer carriage, since it has the quadrature encoder, and I connect it to my data translation device, DT9837, and as it moves back and forth, manually (by hand), the counts will increase and decrease.

 

After calculating the voltage, I want to output it so I can see the signal on oscilloscope, but somehow I could not get it to work.

What I want is as I move the carriage, I want to get the measurements (in mm and counts, and I succeeded in this) but somehow I could not produce output at the same time.

 

Really appreciate any helps. Thank you in advance! 🙂

0 Kudos
Message 1 of 7
(2,839 Views)

Hi Hidz7,

 

Thanks for posting to the forums!

 

I wanted to ask you a few questions regarding your application and exactly what is going on.

 

How are you connecting your DT9837 device to your computer/laptop? Through a simple USB connection?

 

I have had a look at your code and can see you have set up an Analogue Input Task as well as an Analogue Output Task.

 

You are taking in the voltage from the printer carriage, then using a quadrature encoder, you get a 'Count' value. You are then converting this to a value in mm. Have I correctly understood?

 

You mention that once you have taken in the voltage, you wish to output it? Do you mean output the same voltage to an oscilloscope or a different voltage?

 

When I looked at your code, I could see you were using a 'Simulate Signal' express VI that was writing a different type of signal to the AO task. Is this what you trying to do? 

 

In order to write the voltage input to the output, you need to pass the data directly into the OLWrite.vi subVI.

 

I was not able to run your example with simulated hardware as there were certain .vi files missing. Would you be able to attach the following for me:

 

- OLCreateTask.vi

- OLWrite.vi

- OLRead.vi

- OLTiming.vi

- OLCloseTask.vi

 

If you could provide this information and the .vi files, I would appreciate it. 

 

Kind Regards,

 

 

 

Dom C
0 Kudos
Message 2 of 7
(2,808 Views)

Hi,

Thank you Clad19 for the reply.

I have attached the VIs that you requested.

 

Yes I have connected DT9837 device to the computer using a simple USB connection.

 

Yes, I took the voltage from printer carriage, then using a quadrature encoder, I got the 'Count' value which I converted into mm.

 

No it is not the same voltage. Let's say if I move the carriage myself, I will get a 'Count' value, and also 'mm' value. What I am trying to do is I want to create output voltage proportional to the count/mm value as it increments or decrements.

 

Regarding the simulate signal express VI, I could be wrong by using that VI, because what I am trying to do is to get output voltage to the oscilloscope which is proportional to the 'count/mm' value.

 

I would be really happy if you could help me or highlight what I have done wrongly, because actually I want to get the proportional output value as I moves the carriage and I think my VI failed to do that. 😞

And if it helps. I have created another VI also for this purpose, but it does not seem to be working either.

 

Looking forward for your help. Thank you in advance! 🙂

Download All
0 Kudos
Message 3 of 7
(2,799 Views)

Hi Hidz7,

 

Thank you for your reply with further information, that has cleared up my queries.

 

I can clearly see what you are trying to do in your application.

 

The 'Simulate Signal' Express VI is good for generating a simulated signal and then using this for further processing or in a different function.

 

I can see how you have used it and you are not doing anything wrong. You wish to add your 'Voltage' result and use this to amend a waveform signal so that it is proportional to the Count/mm. 

 

I would use a Sine Wave rather than a Square Wave as a side note.

 

If you were just interested in the actual 'Voltage' value, you could simply use a 'DAQ Assistant Express VI'. Here you could write the voltage value to an AO channel on the oscillscope.

 

I ask this because the way you have written your application lends itself to parallel execution of both tasks. The first while loop takes care of the AI acquisition and processing and the second deals with the AO task. 

 

I've noticed why you cannot run both at the same time. You pass out the Count value from the first while loop to the second while loop.

 

Through the principles of data flow this means that the second while loop will only execute once it receives all of its inputs. Therefore only when you press the first 'Stop' button. 

 

The way around this is to either use 'Local Variables' or a queue architecture such as a 'Producer Consumer' architecture.

 

I am currently working on modifying the example to implement this.

 

Kind Regards,

Dom C
0 Kudos
Message 4 of 7
(2,781 Views)

Hi Hidz7,

 

As mentioned in my previous post I was working on implemented a Producer/Consumer Architecture for your application so that you can run your AI and AO at the same time.

 

It is attached to this post. Give it a go and let me know if you have any other questions.

 

Here are other examples using this architecture:

 

Using Producer/Consumer Architecture for DAQmx Read and Write to File

 

Producer-Consumer Architecture

 

DAQmx Base Continuous Analog Input with Producer Consumer Architecture

 

Kind Regards,

Dom C
0 Kudos
Message 5 of 7
(2,774 Views)

Hi Clad19,

 

Thank you for your help.


What I will do is I will read the examples that you gave to me, and try to run it to see whether it will work.

 

I really appreciate your help and also thank you very much for willing to spend your time to help me.

 

I will post the result of the modification later and tell you whether it works or not.

 

Thank you again! 🙂

0 Kudos
Message 6 of 7
(2,766 Views)

Hi Clad19.

 

I am so sorry for bothering you. Regarding the VI, can you save it to previous version (LabVIEW 8.6), because in my university lab I only have this version of LabVIEW. 

Hope you can help me. 😞

Thanks in advance! 🙂

0 Kudos
Message 7 of 7
(2,747 Views)