Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Finite Pulse Generation for 6608 Counter using Visual C++

I am trying to generate a finite number of pulses using the counters aboard the 6608 System Timer. I was wondering if anyone knew how to do this.

Basically, what I want to do is generate a set of 4 pulses that are synchronized with another pulse, as pictured below.

________------------------______________

________--__--__--__--______________

Can this be done??? Ultimately, I am trying to generate the following set of pulses, as pictured below. I can generate all of the pulse trains except for pulse train #2.

(1)
________------------------______________

(2)
________--__--__--__--______________

(3)
________--__________________________

(4)

____________--______________________

(5)
________________--__________________
(6)
____________________--______________

I have included my code as reference. Any help in this matter would be greatly appreciated.
0 Kudos
Message 1 of 8
(4,703 Views)
Rodney

Here is an example program that will generate a square wave with the 6608 board. You can modify it so the wave has the properties you need it to have.

If you want pulses #1 and #2 to start at the same time, you can have them both start off the same trigger.

One of the examples below shows you how to start a square wave with a trigger, the other one is started by software.

I hope this helps.

Brian
Download All
0 Kudos
Message 2 of 8
(4,703 Views)
The code you sent me was not for a finite set of pulses. The example you sent me was for an infinite set of pulses. I want "Finite Pulse Generation for 6608 Counter using Visual C"
0 Kudos
Message 3 of 8
(4,703 Views)
Rodney

Sorry about that. Here is an idea on how to get it to work. Use the program I sent you, though add a GPCTR_Change_Parameter function to set the Gate of the counter, that is generating #2, to the output of the counter that is generating pulse #1. (Basically interanally wire, #1 output to #2 gate)

This way, when there is a high signal on the gate,(pulse #1) it will generate pulses, though when the signal goes low, it will stop.

Brian
0 Kudos
Message 4 of 8
(4,703 Views)
I just tried routing the output of counter 1 to the gate of counter 2 Brian, and it doesn't work. The second counter doesn't even provide a pulse. I've attached my code to this comment/reply.
0 Kudos
Message 5 of 8
(4,703 Views)
Oops...

...Brian I do get a pulse train on the second counter, it's just not toggling off when the first counter goes off.
0 Kudos
Message 6 of 8
(4,703 Views)
Instead of using PFI36 and wiring it externally, you can do it internally by using ND_OTHER_GPCTR_OUTPUT. (Since you are using counters 0 and 1, the other counter is going to be 0 for 1 and 1 for 0.) (i.e. 0 and 1 are together, 2 and 3 are together and so on)

Instead of :
iStatus = GPCTR_Change_Parameter(iDevice, ulGpctrNum1, ND_GATE, ND_PFI_36);

try

iStatus = GPCTR_Change_Parameter(iDevice, ulGpctrNum1, ND_GATE, ND_OTHER_GPCTR_OUTPUT);

Let me know if this solves the problem.

Brian
0 Kudos
Message 7 of 8
(4,703 Views)
Yup, that did the trick. I now have the capability to generate finite pulses!

Thanx Brian 😃
0 Kudos
Message 8 of 8
(4,703 Views)