LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to output a calculated signal using DAQmx

Dear all

 

I have as a part of my code a portion that inputs two signals from two sensors and then calculate the difference between them after that i want to output the difference between the two signals. How can I do it using the DAQmx?

 

also I would like to know how can I speed up my code excution?

 

In the attachments you can find my code

 

 

Thanks 

0 Kudos
Message 1 of 12
(2,869 Views)

There is no way to create a calculated channel, but if all you are looking for is the difference AND you are using sensors with high-level single-ended voltage inputs, you might be able to fake it by configuring a channel as a differential input and tieing one channel to the + input and the other channel to the - input.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 12
(2,853 Views)

Hello FaisalF,

 

Unless I am misunderstanding, the other option would be to subtract the values you read from your sensors in software and then output that subtracted voltage. This will not be ideal if you are trying to run control loops, however, because control decisions will be software timed on the Windows side.

 

Does the above fit with what you are trying to do? I was not sure if my interpretation or Mike's fit with what you wanted.

 

Can you clarify what you mean by "speed up my code execution"? Are you seeing slow performance? If so, where, and how have you benchmarked this? I do not see anything in your code that stands out as someting that would slow it down - though you are only reading or writing a finite number of samples once; I was not sure if this was intended (versus sampling continuously)?

Rahul B.
0 Kudos
Message 3 of 12
(2,811 Views)

Hello National Burritos

 

Yes what you have said is exactly right. I have two laser sensors that gives and output that ranges from 1 to 5 volts. I want to input these two sensors outputs' into the lab view and then calculate the differnece between the (voltages) and then output the calculated difference. In other words I need to feed the difference of the two sensors into a valve that will open or close depending on the value of the two sensors.

 

The other thing I am using a PCIe-6123 card that have an internal clock. and in my code timing settings I am using the onboard clock. The software excution time should not depend on the PC and/or the windows timing. Am I right?

 

Finally, I am a beginner in LabVIEW and I would like to speed up my my code processing in general so I would like to know any tips or hints that could increase the speed of excution of the code.

 

p.s. I used the attached VI to know the time that my code use to excute one loop. What I have done is separating my code into two halfes and measure the excution time for one loop.

 

 

Looking forward to hear from you

Many Thanks

0 Kudos
Message 4 of 12
(2,778 Views)

Hello Mike

 

I didnt understand what do you mean by "sensors with high-level single-ended voltage inputs"

 

I am using two fiber optic laser sensors that detects the position of a moving object. So these two sensors are exactly the same but are opposite to each other. They measure measure the position of an oscilating object between them. so when ever the object moves towards a direction one of the sensors will give higher voltage gradually and the other one will decrease in voltage. and then when the object moves again to the opposite direction vice versa will happen.

 

So basically I have to have the deffirence betwwen the two sensors' voltages and the feed that difference to a valve that open and close depending on this difference.

 

 

I hope my explination is clear. Looking forward to hear from you

 

Many thanks

0 Kudos
Message 5 of 12
(2,775 Views)

What i meant was what it sounds like you have. The idea I offered wouldn't work with low-level signal like accelerometers or thermocouples, or signals that themselves required differential input - at least not without signal conditioning in place. 

 

It sounds like the sensors you have (which are identical?) would be ideal for this technique.

 

 Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 12
(2,771 Views)

Aha perfect

 

So what should I do exactly to output their differnce? and how can I do it?

 

Thanks sir

0 Kudos
Message 7 of 12
(2,769 Views)

Take the voltage signal from one sensor and connect it to the positive side of a differential input and the voltage from the other sensor and connect it to the negative side of the same differential input. To test the setup, use the "test panels" in MAX to observe what you are getting.

 

Mike


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 12
(2,761 Views)

Aha

 

And how do I output the deffirence between the two signals?

 

Thanks for your patience and fast response

0 Kudos
Message 9 of 12
(2,757 Views)

The output from the differential channel is the difference.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 10 of 12
(2,751 Views)