05-22-2009 11:17 AM
Hello everyone,
I am a LabView novice and I am trying to create a program that generates, acquires, and graphs a waveform. The program will use DAQmx blocks corresponding to the compact DAQ AI and AO modules.
I decided to use a state machine after running into some data type difficulties using producer/consumer loops and some physical channel difficulties when using a simple series structure.
My problem is that I cannot wire the case selector to either the AO or AI voltage blocks in separate cases. This doesn't allow me to actually create my wfm generation and aquisition cases so my program is broken.
I keep getting the error: "you are trying to connect two terminals with different data types. the type of the source is an unsigned word and the type of the sink is a user defined refnum tag". My AO and AI type is a voltage that I selected from the drop down menu. I do not know how to change these DAQmx data types to something other than "user defined refnum tags". This is the same error that I got when I tried to connect my producer/consumer queues.
I am pretty sure that there is a simple solution to this and I would really appreciate some help :).
05-22-2009 11:36 AM
05-22-2009 12:14 PM
Dennis,
Here's a little overview about what I'm trying to do:
I originally wrote a program that read a sine wave from SignalExpress with the AI module. I didn't have any trouble with this. My supervisor asked me to rewrite it so that the AI was reading and graphing directly from an AO signal generated within the same program. I tried to simply wire them in series and I kept getting errors regarding the use of multiple physical channels.
I decided to run a parrallel loop structure instead so they could generate and acquire simultaneously. Yesterday I tried to create the Producer/Consumer loop and I hit the connecting different data types, "user defined refnum tag" error. Today I decided to try a state machine, and I ran into the same error.
I used the simple state machine template for the structure. Following the initialize default state, I tried to create a state called "Generate Wfm" which shows up in red. I tried to connect the data types by wiring from the "beginning state" typedef block, through the shift register, to the case selector and finally to AO voltage "task in" terminal. I never specified a data type for the typedef block so I think the unsigned word is showing up because I can make it a boolean, enum, etc.
To clarify, when I said "AO function" I meant the "DAQmx Create virtual channel, AO voltage" block.
There is, of course, the possibility that I am doing this completely wrong....this is my first week using LabView.
Thanks so much for the help and let me know if you need more clarification.
05-22-2009 12:20 PM
What I wanted was an actual VI or at least an image. Connecting the state to the task in makes absolutely no sense and yes, it is completely wrong. You probably don't need to connect anything into the task input of the DAQmx Create Channel.
Attaching a VI is pretty simple. You just click the 'Add Attachements'. Attaching an image has just become easier. Click the 'Upload or Insert an image' button.
05-22-2009 12:28 PM
Here's my tentative VI.
I'm sure there are plenty of mistakes so I apologize in advance haha
Thanks!
05-22-2009 12:29 PM
05-22-2009 12:44 PM
Here's the VI as an image to make things a little easier.
Thanks!
05-22-2009 12:48 PM
You are also mishandling the tasks. You have a single shift register for a task but you actually have two separate tasks - an analog write and an analog read. You would need two shift registers - one for each. You also do not need the Index Array function in the Generate Waveform state. the output of the Waveform buffer Generation is not an array.
I'm also unsure what you are actually trying to do. From each of your states, you go to the stop state and that will stop the while loop. You would then have to change the front panel control Next State and rerun the VI. DO NOT use the run continuous button. You should have an idle state where you can choose what to do next.
05-22-2009 01:57 PM
Thanks everyone!
I'm sort of figuring it all out now. I got the enumerated constant down in my new program and I am currently learning about why all of my case names disappeared haha...
Once I started over from scratch, everything became a little easier to understand. The template was good but starting fresh with all of your tips has helped.
Conceptually, the data flow makes sense but LabVIEW seems to be a bit more demanding than a lot of other programs I've used.
Good luck