05-13-2009 11:45 AM
Hi folks.
I have a train pulse that I created using ctr0 from my usb-6289 board.
I can use internal routing to use it as a clock source in the timming of another task.
Every time I try ti add it as a clock source (timming) to two tasks, I get an error from LabVIEW saying that the specified route is already in use.
My question is: Is there a way to use the train pulse as a clock (timming) source to more than one task?
I have found an example in the forum, and have attached so everybody can see what I mean by "internal routing".
Cheers, and thanks for any input.
05-14-2009 07:01 AM
Hi Rsilva,
Good afternoon and I hope your well today.
Thanks for the post.
Using Measurement and Automation Explorer (MAX) and a simulated USB 6289 your VI posted works. There is a direct route between the counter outputs and the digital input sample clock - for the USB 6289.
The only aspect of this application I can think of that would cause this error is that buffered Digital input tasks can only be performed on Port 0. I had to change the type of DAQmx read - but that generates a different error to the one you have mentioned.
Are you running any other VIs that could be using the Device? or any MAX test panels?
Hope this helps,
05-14-2009 08:41 PM
Hi Hillman.
Sorry for the late reply.
I am going to try to explain it very clearly so please bare with me
I am trying to code 3 outputs:
1) In digital line 0: a boolean value that goes to "0" when data is going to be written, and goes to "1" when data finishes;
2) In digital line 1: a pulse train, that needs to be outputed in this particular line, and also that acts as a clock (sync timming) for the other two lines;
3) In digital line 2: output digital waveform data, in sync with the pulse train;
I started by coding output 2) using my USB-6289 (it has 2 onboard counters) counter 0 and using it in "continuous mode" and not "finite sample" (the pulse can go
on forever, it's not important).
I got this running with no problem. Next I started the output 3), meaning the digital waveform, and synchronizing it to the pulse train, using the pulse train as a timming source.
I use PFI12 line as source because it is the output line of counter 0, according to the datasheet and MAX , for my USB-6289 board.
The problem started here: when I try to code the boolean value (very simple stuff similar to the digital generation example shipped with LabVIEW), I
need a timming source to sync this output to the others. However when I try to use counter 0 output as a timming source, LabVIEW gives me
an error message, basically saying that the resource is already in use....
So I tried to code a train pulse using counter 1 and use this one as timming source for the boolean value but yet again the same error....
I should point out that I am a Chemical Engineer with very little experience in LabVIEW and boards, etc....
I appreciate your input in this, Hillman, and I apologyze for the enormous post...
Cheers, and hope to ear from you cause I am stuck in this part
05-15-2009 03:58 AM - edited 05-15-2009 04:03 AM
Rsilva,
I think I understand your problem. If you are attempting to do items 2 and 3 in separate tasks you will receive resource reservation errors. Digital port 0 on your M-Series device can do timed generation. However, for the entire port there is only one timing source, and only one data FIFO. These two resources are shared for all lines on the port (the resource conflict you are getting is based on digital resources, not the counter resource). Now there is good news if I read your post correctly, because you would like both digital lines to output based off of the same timing source. To do this, add both lines to the same task (this can be as simple as using Dev1/port0/line1:2 for your channel string). In addition, when you call DAQmx Write, you'll have to write the data for both lines together.
**** Edit **** I saw you attached a VI with your first post... Looking at it, I'm not sure I understand what you need to do, so if my advice is off base, I apologize.
Hope this helps,
Dan
05-15-2009 04:59 AM - edited 05-15-2009 05:04 AM
Rsilva,
In taking a second look at this, it appears as though you are attempting to generate a SPI-like set of signals. Is that correct?
Line 0 goes low, and is followed by some clock and data pulses... When these are finished, line 0 goes high again?
As I'd mentioned in my previous post, you'll need to use 1 task for all of this, since digital port 0 can have only one clock source. The timing of the digital pattern generated will be controlled by the timing source, combined with the data you write. To do this, you'd create one digital task, containing lines 0,1, and 2. All three of these lines would be timed by your counter (ie... their data would be written at the same time). Timing from line to line is then governed by the data that you write . Using your three lines as reference, I will demonstrate the following:
1) Generate a 'chip select' signal on line 0
2) Output digital pattern 01101010 on line 1
3) Generate an rising edge active clock, for data generated on line 1
Data to write:
Line 0:1110000000000000000000000000000000000000000000000000000000000000000000000000000000000111
Line 1:0000000000000001111111111111111111100000000001111111111000000000011111111100000000000000
Line 2:0000000011111000001111100000111110000011111000001111100000111110000011111000001111100000
Let's say for instance that I used my counter to generate a 1 kHz pulse to use as my digital output's sample clock. In this case, line 0 goes low for 83 ms (I wrote 0 to it 83 consecutive times). My clock on line 2 has a period of 10 ms (write 5 zeros followed by 5 ones). By manipulating the data that you write, you control the timing of various edges on various lines with respect to each other. Your timing resolution will be determined by the rate of the signal you generate on the counter to use as a sample clock (in my example, 1 ms).
That was long winded, and not as clear as I had hoped it'd be, but hopefully this will provide some insight into what you're trying to do. If I'm still misreading your question, please let me know.
Dan
05-15-2009 05:14 AM - edited 05-15-2009 05:15 AM
Hi Mcdan.
That is precisely what I am trying to achieve!! An SPI-like coding!
Although in my case line 0 is going to "dictate" when the waveform generator (the equipment my board is going to comunicate with)
starts to read line 2 (digital data), and as you correctly said, the frequency is set by the clock output in line 1.
Although I'm starting to understand LabVIEW coding in a more in depth way, there are still some details
that elude me, simply because I have not tried, case in point, the triggers.....
I suppose you couldn't provide me with a link to an example or tutorial about it?
Thank you very much for your help.
Cheers.
05-15-2009 10:12 AM
Hey,
For this:
I use PFI12 line as source because it is the output line of counter 0, according to the datasheet and MAX , for my USB-6289 board.
The problem started here: when I try to code the boolean value (very simple stuff similar to the digital generation example shipped with LabVIEW), I
need a timming source to sync this output to the others. However when I try to use counter 0 output as a timming source, LabVIEW gives me
an error message, basically saying that the resource is already in use....
Are you setting PFI12 as your clock source? If so, try to use counter0 internal output instead. If you right click on the Clock source control and select I/O Name Filtering... you'll get a dialog box. Check the "Include Advanced terminals" and hit ok. When you go through the list of terminals in that control now you should see something along the lines of "/Dev1/Ctr0InternalOutput" where dev1 will be your device name. Another way to go about it is to start with the "Correlated Dig Write With Counter.vi" shipping example.
For SPI like communication, you might use this as a starting point, though some of the code is probably overkill for what you're trying to do:
cheers,
Andrew S
03-27-2010 06:24 PM
Hi,
I am trying to implement one wire digital communication using USB 6289. Right now, I am using external clock for my sample clock source . I need sample clock of 10Mhz. Is there any way I can use Freqoutput counter for my sample clock. When I try to use FREQ_output I get an error.
I know there are three counter output in USB 6289. Counter 0, counter 1 and Freq_output. I can not use counter 0 and 1 because it can not generate more than 1Mhz clock.
Please let me know.
Thanks
03-29-2010 03:52 AM
Hi,
Please, next time create a new post for a new question, it permits to find questions and answers with the post title for other users having the same issue.
For your problem, why don't you use directly the DO Sample clock? This one can go up to 10MHz (p.8 of specifications).
Then, what is the error appearing? It could help us to analyze what is the limitation in your application.
Regards,
Olivier L. | Certified LabVIEW Developer
03-29-2010 11:07 AM
Actually, the 6289 is required to obtain the DO (or DI) Sample clock from another source (there is no built-in DO Sample Clock like there is on X Series boards). From page 8 of the specifications:
Having said that, you should be able to use any of the counters to clock the DO task (either ctr0, ctr1, or Freq Out). I'm not sure what gave the impression that ctr0 and ctr1 cannot generate pulses faster than 1 MHz, you could use the 80 MHz timebase to generate a 20 MHz square wave if desired (this would be too fast for the 10 MHz DO limit). You can certainly generate a 10 MHz clock with either of the counters.
What error do you receive when trying to use Freq Out? This should work without any issues, could you post your code and the specific error message that you are receiving? The available frequencies for Freq Out are {10 MHz, 100 kHz} / {1:16}.
Best Regards,