Sorry, I have a problem. I hope someone knows what I'm doing wrong.
I compiled the example STCsinglePeriodMeasure.C , it works. When
I see the message "Apply your digital pulse train to the GATE of the
counter now", I do it and the counting goes fine. The
counting starts when I apply the pulse so it doesn't matter in which
moment I apply the pluse after I saw the message on screen, so I assume
the structure do-while in the example does 2 things:
------------
do {
iStatus = GPCTR_Watch(iDevice, ulGpctrNum, ND_ARMED,
&ulArmed);
iRetVal = NIDAQYield(iYieldON);
} while ((ulArmed == ND_YES) && (iStatus == 0));
------------
First: The first pulse starts the counter.
Second: The next pulse stops the counter.
If I'm wrong please tell me.
I'm trying to set the first pulse at the same time with a signal that
is emmited from a port in the card (with DIG_Out_Line), (iLine3 = 3),
to do this , I'm trying it in the next code with the first while. To
get the second pulse and finish counting I wait for an external signal
that is entered by other port (DIG_In_Line), this is the second while.
I have everything well connected to the needed pins. With
"DIG_Out_Line(iDevice, iPort, iLine3, iStateOFF)" I generate the first
pulse from low to high and is sensed
with the pin GPCTR0_SOURCE, setting iLine3 to istateON makes the pulse
to go from high to low. To get the second pulse i wait for a high
signal with "DIG_In_Line(iDevice, iPort, iLine4, &iState)", this
signal also is connected to GPCTR0_SOURCE with the help of an OR gate
(7432).
(Code attached)
I'm not sure if I'm making myself clear, sorry. I can post my
entire code, it has just some more lines, and I can explain how I have
connected my pins.
Any help would be appreciated, Thanks.