Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

VB Code to route the NI660x Internal Timebase to a PFI Line

There is a Labview vi example that routes the internal timebase of the NI660x counter to one of the PFI lines. How is this done in VB?

I'm having difficulties using the "CWDAQTools1.RouteIOSignal" command to route "cwrsnBoardClock" or "cwrssBoardClock". What is the proper syntax to route the 6602's timebase to a PFI line for use as an 80 MHz pulse train output?

Also, in VB, I'm having difficulties configuring the "CWPulseInternalClockModes" command. What is the proper syntax to generate a 40 MHz pulse train, i.e. half of the 6602's maximum timebase of 80 MHz?
0 Kudos
Message 1 of 4
(3,481 Views)
Greetings,

The key to routing the internal timebase to a PFI line is to configure a counter operation (for example, simple event counting) and choose the source of the selected counter to be the internal timebase:

CWCounter1.TimebaseSource = cwctrFrequencyTB
CWCounter1.TimebaseSignal = 80000000

You then need to route the source of the counter to the PFI line:

CWDAQTools1.RouteIOSignal 1, cwrsnPFI0, cwrssGPCTR0Source

Finally, you need to start the counter operation and not stop it until you no longer want to route the internal timebase to the PFI line.

To generate a 40 MHz pulse train, you will need to use the "pulsed" output mode instead of the "toggled" output mode. With the "toggled" output mode, you will only be able to achieve 1/4 of the
timebase (20 MHz for an 80 MHz timebase).

Good luck with your application.

Spencer S.
0 Kudos
Message 2 of 4
(3,481 Views)
Thanks for the good reply, however, when I tried it I get an error message box as follows--

Run-Time error ‘10341’:
The RTSI or PFI signal/line cannot be connected as specified.

The debugger highlights the "CWDAQTools1.RouteIOSignal 1, cwrsnPFI0, cwrssGPCTR0Source" line as the error source. Unfortunately, this result is consistent with my many other attempts at routing counter source or board clock signals to a PFI line for connecting to an external device.

Regarding 40 MHz pulse generation, perhaps I should have phrased my question better...
How do you command the board for "pulsed" mode vice "toggled" mode?
or...
Which of the "CWPulse1.InternalClockMode" datatypes configures the board for "pulsed" mode
vice "toggled" mode (CwpulseDelayWidth, CwpulseFrequency, CwpulsePeriod, CwpulseTimebase)?
0 Kudos
Message 3 of 4
(3,481 Views)
Sorry, my mistake. I forgot about the fact that the route can only be made to the default source line for the counter. For example, if you are using counter 0, you must route the source to PFI39. All other lines will generate the error you mentioned. With regards to your second issue, I have some bad news. The CWPulse ActiveX control does not support the pulsed output mode. Thus, you are restricted to a maximum frequency of 20 MHz. Below I have included a link to a KnowledgeBase that discusses the different pulse train output modes. So, if you want to achieve a 40 MHz pulse train, you will need to use NI-DAQ function calls. Specifically, you will need to call GPCTR_Change_Parameter with a paramID of ND_OUTPUT_MODE and a paramValue of ND
_PULSE. Unfortunately, using the CWDAQ ActiveX controls and NI-DAQ function calls in the same program is not supported.

What Is the Maximum Output Frequency I Can Obtain with the PCI-6601 or the PCI-6602?

I hope this helps.

Spencer S.
0 Kudos
Message 4 of 4
(3,480 Views)