LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

analog and digital signal generation

Hello,
 
I would just like some help with my code. The purpose of my interface is to generate an analog  output triangular signal that runs my system; it then measures the analog response of the system to the triangular voltage that I have just supplied and displays this on screen. However, at the same time, it is providing a digital signal that controls a multiplexer. At the moment, my code doesn't seem to work, but when I remove the multplexer from my system and delete the digital signal generation, it works. So could someone please let me know how to include both analog and digital signal generation in my interface? At the moment, I have created 2 tasks - one for the analog generation and measurement and one for the digital generation. Is it possible to have one task for both analog and digital signals?
I have attached my code to show what I've done so far. Any help would be appreciated.
 
Thanks
0 Kudos
Message 1 of 5
(2,884 Views)
What exactly do you mean by 'doesn't work'? Are there errors generated, output wrong, or what?
 
You actually have three tasks - analog out, analog in, and digital out. I don't understand the purpose of the while loop. It only runs once and can be eliminated. You can also move the digital create channel, create task, and clear task outside the loop for better performance. The Is DAQmx Task Done? doesn't do anything and you can remove that as well.
 
You should also clean up your wiring. You've got wires hidden by the main while loop and that makes it harder to read your program.
0 Kudos
Message 2 of 5
(2,875 Views)

Hi,

Thank you for your useful suggestions. I have cleared up the block diagram as you had suggested. I don't get any error messages but the problem is that the output from the system is not correct. What I'm doing is that I am generating a traingular voltage signal from Labview, which is the input to my system. I've set the system up so that the output should be the same triangular voltage. The digital signal generator controls a multiplexer, which changes the feedback resistance, which in turn modifies the amplitude of the output signal from my amplifier. At the moment, I am not gettnig the same signal that I put into the system. I am just getting a very noisy signal that varies between 5.72 and 5.75V. I've attached a neater version of my program.

thanks alot for the help

0 Kudos
Message 3 of 5
(2,860 Views)

You went a little too far. the while loop I was talking about was the one around the digital write. You've now taken the digital write completely out of the loop and closing it. You can't do anything with the digital when the analog in is running. You've also closed the analog write while the analog in is running. The attached is more like what I was talking about.

Even with the diagram cleaned up, it sounds like you still have a problem. I don't know the details of your hardware setup but I would start by looking at the analog signal you are generating and verifying that it is correct to your hardware. It would help if you had a scope to troubleshoot. If the signal is correct to the hardware, then trace it through to the connection to the DAQ's analog input. If it's correct there and you still don't see the signal, then you may have wired up the DAQ incorrectly. You haven't specified the connection type (differential, RSE, etc) and I believe it will default to differential.

Message 4 of 5
(2,842 Views)

Hello,

I'd just like to let you know that I tried the interface that you modified for me and it worked! Smiley Happy

Thanks alot for all your help. I really appreciate it. Its really helped me to design my system

0 Kudos
Message 5 of 5
(2,826 Views)