08-15-2011 03:22 AM - edited 08-15-2011 03:26 AM
@uranus999 wrote:
Dear Alex,
I have tried out your program, replacing the Random Number with DAQ. But it just doesn't seem correct, as the analog output cannot be connected to the DBL. I am attaching the program which I have wrote at the moment (after the replacement). My other question is, I still won't be able to control the output voltage value of 5V, right.
I am really sorry about all the questions.
Hey uranus999,
I'm sorry, my explanation wasn't too clear. What I've given you is a format for how your solution can be attempted; if you play around with the VI you'll see that on a button press, it'll start indicating a constantly changing random number for five seconds, then stop. This displays the functionality which you requested; being able to do something for five seconds on a button press. My idea was instead of the random number and indicator, you could instead place your DAQ assistant which outputs a particular value.
So, say you only wanted to output a 5V for five seconds and a 0V until the button is pressed again, you could place a DAQ assistant in the 5s long while loop programmed to output this voltage, and in the false case of the button press you could place a DAQ assistant with a 0V output. This isn't the most elegant solution though, but it will work.
Here's another solution you can try implementing, however it's worth trying to understand the flaws that exist with it and how to find ways of improving it:
In this example, an infinite loop is used to control the operation of the program. Using an Elapsed Time express VI, configured to a 5s count, the user presses a button to initiliase the counter by resetting it. By using the Time Elapsed? boolean out, by implementing a NOT on this function, you can derive whether to drive a high or low on the boolean indicator. I used a false constant on the Auto Reset function of the timer in order to prevent it from rolling over and restarting the count, which disallows the control interaction. All you could do to drive a digital line of a DAQ Assistant by using a build array function to put it in the appropriate digital control format.
Problems with this implementation:
In these two posts I've made, I've used quite different methods to produce what is relatively the same function. There are many ways you can attempt this, some more efficient than others (The methods I've submitted to you aren't too efficient, but they serve as a good introductory coding since you're new to LabVIEW). It might be worth looking at some of the lower level VIs used for DAQ, to delegate this timing task down to the hardware level. There are a lot of possibilities regarding implementation of this code, so just have fun with them!
Anyway, here is the code which will output a 5V signal to a digital line on a button press. You'll need to reconfigure the DAQ assistant for your hardware.
I'd like to see how you get on!
08-15-2011 06:18 AM
Dear Alex,
Thank you for your reply.
At the current moment, Labview still looks difficult to me, but I am slowly understanding it. Anyway, I have a few questions, actually and I hope that you don't mind answering them.
i) So, in the current program, it can only give an output of 5V signal, right. So, if I want to change the output voltage, for example, to 6V, I cannot use the digital output line, is it?
ii) My other question is, why is analog output not chosen? Is it because it cannot generate a constant output voltage compared to the digital output?
iii) And if I want the DAQ to generate another output voltage but at different time than the first output voltage, does that mean I have to create another Elasped Time function for it?
I am sorry for all the questions again but I really do appreciate your advice on this matter.
Thank you so much.
Regards,
uranus999
08-15-2011 06:30 AM - edited 08-15-2011 06:37 AM
@uranus999 wrote:
Dear Alex,
Thank you for your reply.
At the current moment, Labview still looks difficult to me, but I am slowly understanding it. Anyway, I have a few questions, actually and I hope that you don't mind answering them.
i) So, in the current program, it can only give an output of 5V signal, right. So, if I want to change the output voltage, for example, to 6V, I cannot use the digital output line, is it?
ii) My other question is, why is analog output not chosen? Is it because it cannot generate a constant output voltage compared to the digital output?
iii) And if I want the DAQ to generate another output voltage but at different time than the first output voltage, does that mean I have to create another Elasped Time function for it?
I am sorry for all the questions again but I really do appreciate your advice on this matter.
Thank you so much.
Regards,
uranus999
Hey again uranus999,
Really, don't worry about it! Ask as many questions as you like.
I know what it's like starting with LabVIEW, especially when you're used to text based programming; things can really seem difficult to begin with because you do have to think about your programming in a different way than usual, at least that's how I found it. But once you get used to it you'll find yourself using the same design patterns again and again, so as long as you're constantly practicing and trying out new things you'll find things get easier and even more interesting as you go along. Your ability in LabVIEW will come with experience, so just try to play around as much as you can! If you go to LabVIEW > Help > Find Examples... you'll view a ton of example code that you can download and play around with. It's a really great starting point for learning how LabVIEW programming works and just why LabVIEW is applicable across so many different industries, and it's even great to refer to when you're an experienced programmer (There are some quite advanced coding examples there), I find myself using it every day!
So remember, the forums are here for a reason; ask as many questions as you want, we're all learning!
08-15-2011 06:57 AM
Dear Alex,
Thank you for your reply again. I really really do appreciate it.
So, my understanding is correct. In order to generate other voltage apart from 5V, I have to use the analog output function, right.
I will give it a try again and hope it will works. I will write to you again on how it goes.
The thing is, I have also tried looking at some forum discussions as well, and some of the people seems to face similar problem as mine. However, when I want to try the examples out, it seems like it is only compatible with higher versions of the Labview program.
I hope to be able to use Labview well soon. I know its a very useful program, only problem is I don't understand it yet.
Regards,
uranus999
08-15-2011 06:57 AM
Dear Alex,
Thank you for your reply again. I really really do appreciate it.
So, my understanding is correct. In order to generate other voltage apart from 5V, I have to use the analog output function, right.
I will give it a try again and hope it will works. I will write to you again on how it goes.
The thing is, I have also tried looking at some forum discussions as well, and some of the people seems to face similar problem as mine. However, when I want to try the examples out, it seems like it is only compatible with higher versions of the Labview program.
I hope to be able to use Labview well soon. I know its a very useful program, only problem is I don't understand it yet.
Regards,
uranus999
08-15-2011 07:45 AM
Sorry for the delay. The two VIs posted earlier were not the ones I meant to post. Sorry again, not sure what happened.
08-16-2011 01:06 AM
Dear Moreese,
Thank you for your kind reply.
As I mentioned in my previous reply, I am still wondering where will the voltage generated goes? I plan to use my DAQ to generate the output voltage but I still don't really understand how it is possible. Do you mean that if I add a DAQ as a control, the voltage of maybe 6V can be generated?
I am really sorry for the questions, which might seems easy for most of you but confusing to me.
Regards,
uranus999
08-16-2011 02:54 AM
Dear Alex,
I have tried changing the DAQ from digital output to analog output with the addition of a controller of the offset. I am wondering how I can control the output voltage to be generated for only 10 seconds. I have attached the current program which I have modify to this mail.
With the current program (which I have changed from your previous reference), the time elaspe function do not seem to be playing any role anymore. I am not sure whether my understanding is correct.
Sorry for all the questions again. I do appreciate this forum a lot as it really helps me a lot to have the discussion session.
Thank you.
Regards,
uranus999
08-16-2011 02:55 AM
Dear Alex,
I am sorry. I have forgotten to attach the program file in the previous mail.
Thank you again.
Regards,
uranus999
08-16-2011 07:48 AM
Yes, you should be able to generate using the DAQ device. I only use the Simulated Signal express VI for lack of such a device.