Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 6008 digital i/o and counter sequence problem

Hello
I write a code using USB 6008 to acquire both "digital write port" and "counter signal"
but they are running at the same time when I execute the code.
 
Does anyone can teach me how to execute"digital write port" first then run "counter signal" latter?
 
Thank you for your time
 
0 Kudos
Message 1 of 15
(4,940 Views)
Hello,
 
How much later do you want to start the counter task?  The simplest way would be to insert a sequence structure with the digital task start in one frame, followed by the counter task start in the frame after.  You will have to include a digital write in the first frame if you want to write a value before the counter task starts.  Take a look at the attached VI.
 
Does this help?  Please let me know if you have any further questions.
 
Regards,
Sean C.
0 Kudos
Message 2 of 15
(4,918 Views)
I would also recommending upgrading to NI-DAQmx 7.5.  The USB-6008 is now supported in DAQmx, which gives much more functionality.
 
 
0 Kudos
Message 3 of 15
(4,916 Views)
Hello Sean,
Thanks for your help!
I modify your code a little bit. I put digital i/o selector in the first frame, wait 1 sec in the second frame then start to calculate frecquency by counter in the third frame. My intention is to make sure each frame and step work independently and sequentially.
However, I found that digital i/o selector in the first frame is not working properly. why? 
Can you tell me where I wrong?
  
Thanks again
 
Regards,
Sean C.
0 Kudos
Message 4 of 15
(4,908 Views)

Hello,

I don't know exactly how you have your tasks configured, so I modified your code to create tasks dynamically.  I can run this code without any errors.

How is your digital output task not working in the first frame?  Are you getting any errors?  Can you run the attached code?
 
Regards,
Sean C.
0 Kudos
Message 5 of 15
(4,886 Views)

Hello Sean,

I can run your code without error here, Your code is about the same as mine but still get no response from USB-6008 digital write port.

What I want to point out is:

1 :freq+select_a.vi and code2:freq+select_a_Mod.vi

           Digital U8 1Chan 1Samp is in the while loop and USB6008 dio can actually controlled by the selector during code running

2:freq+select_a_Mod.vi Digital U8 1Chan 1Samp is NOT in while loop and  USB6008 dio state is not change and no error occurred.      

This is code problem or DAQ problem? Do you have USB6008 to try this?

0 Kudos
Message 6 of 15
(4,873 Views)

Hello,

I just ran freq+select_m1.vi with a USB-6008 with no problems.  I was able to see the digital line change states as soon as I ran the program. I could then change the state again by rerunning the VI.

How are you monitoring the state of your digital line?

Regards,
Sean C.

0 Kudos
Message 7 of 15
(4,857 Views)

Hi Sean

I see the stste of digital line is no change at all during program running even I got no error

If you could change state of digital output any time and "many times" during program is running.

It could be my hadrware problem. Then I should call local engineer fot it.

 

Thanks

 Regards,

Benson

0 Kudos
Message 8 of 15
(4,840 Views)

Hi Benson,

I actually ran freq+select_a_Mod.vi and was able to change the state of the DIO line.  Keep in mind that the DIO Write VI is only called once in this VI, so you will only be able to set the digital level once per run.

Are you able to set the digital level of a DIO line with this VI?  How are you monitoring the state of your lines?  With an LED?  A multimeter?

Regards,
Sean C.

0 Kudos
Message 9 of 15
(4,826 Views)

Hi Sean,

In your reply "freq+select_once_per_run.vi" DIO state can only be changed at once. Second call will not be taken. This is the same result as I run here (by multimeter). My another vi freq+select_m1.vi can change DIO state anytime I want during vi running. But the problem is higher frequency (>100KHz) I measure less accuracy result I read.

It it possible to explain this?  I can only guess because I put two functions in the same loop. That will share the hardware resource? If this is true, how do I modify this if I still need to control the state of DIO anytime during vi running? Thanks

Regards,

Benson

0 Kudos
Message 10 of 15
(4,811 Views)