Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

What is wrong?(about 2 counters in pci-660x)

Hello.
I downloaded all examples about conters(VB, VC++, LabView,..), but I could'nt solve this problem. -_-;

=============

H/W : PCI-6033E : device1
PCI-6602 : device2
O/S : Win-XP pro.
D-tools : Delphi6
Ni-DAQ710
Component Works 6.0

<>
counter0 of PCI-6033E connent to GPS signal(TTL),
But sometimes wrong values are recieved.
I wanna get exact frequency(or pulse count).
So I set additional board- pci-6602-.
Then, I downloaded all sources about counter, PCI-660x,....
(Buffered Period Measurement with Multiple Counters Using Measurement Studio 6.0,
Cascaded 48-bit Counter in ComponentWorks,
Continuous Pulse Generation with Measurement Studio for Vis
ual Basic,
DAQSTCEventCounting,
E Series Finite-Continuous Pulse and Period Measurement with Measurement Studio,
Event Counting with the Configurable Digital Filter in Visual Basic (NI-TIO),
Generate Continuous Pulse Train With a Start Trigger on Multiple Counters,
pci6601countinternal,
Simultaneously Starting Analog Input, Analog Output, and a Counter with ComponentWorks,
Single Pulse Generation with Visual Basic,
STCMeasureFrequency,etc...) But these modules did not work. Coz, I tried run original VB source.
But it didn't work so I convert it to delphi source.(using OCX). (I have not LabView module, so I wanna delphi module or example source, ^^;)

Plz somebody help me.
0 Kudos
Message 1 of 7
(7,002 Views)
Hello,

When you say that wrong values were received, what do you mean? Were you able to get the example programs working? How are your signals connected to the PCI-6033E and PCI-6602?

Also, could you provide more details on the signal(s) you are trying to measure from your GPS module?

Thanks,
Ken S.
National Instruments
0 Kudos
Message 2 of 7
(7,002 Views)
The signal from GPS is pulse count per meter.
I get speed from it.
At first, I tried that in PCI-6033E and speed is very exact under 80Km/h.
But in the case of High-deceleration, some pulse count is wrong.
(less or more value, Less values are interchanged with more vlaues).
So I added counter board(PCI-6022).
Next, I get the example programs from install directory of ComponentWorks's VB example.

<>
1. I tring "Contineus Pulse-Train Generation"
now then I wonder that settting of signals connecting and what kind of component, property(it's value), method, and so on.
2. What difference between CWCounter & CWPulse component in ComponentWorks).
3. How do I syncronize two boards-PCI-6033E & PCI-6602.


Have a nice day.
==
===========================

P.S.
I append my test program source in delphi6(using ComponentWorks6).
0 Kudos
Message 3 of 7
(7,002 Views)
Hello,

What is the highest frequency of the pulse train signal from the GPS unit? Is there one pulse per meter, or several pulses per meter? Please tell me as much as possible about this GPS signal.

One way to test this would be to first count pulses using Measurement and Automation Explorer. In this program you can open a test panel to count pulses directly from the 6033E. It would be a good first step to use this test panel to count the number of pulses during these high-deceleration cases. If the pulses are counted correctly here then we can move on to your program and see why the pulse counts are different there.

Have a great day!

Ken S.
National Instruments
0 Kudos
Message 4 of 7
(7,002 Views)
Of course, I tsted count pulses using Measurement and Automation Explorer at beginning of implementation.
Sorry, Ken S.
I read my question and I was aware it is liable to lead to misunderstanding.
So, I explain my problem again.
I have finished my system in last year.
(using PCI_6033E, GPS, ComponentWorks6, Delphi6)
But speed value is wrong often.
Oh! I missed some conditions.
My system get some other signals (8 temperatures, 1 pedal effort, 1 pedal stroke, 1 deceleration).
And sampling rate is 100Hz.
...
I don't wonder but next things.
1'st,
2'nd, Is right using method of test program code?
Using 1 CWCounter, 1 CWPulse
how use ComponentWorks components(CWCounter, CWPulse).

with CWCounter1 do
begin
AuxLineFilter := cwfiterNone;
AuxLineMode := cwauxlineRisingEdge;
AuxLineSignal := 0;
AuxLineSource := cwauxlineNIDAQChoose;
BufferMode := cwctrContinuous;
BufferSize := 10;
CountDirection := cwctrNIDAQChooseDirMode;
Counter := 1;
Device := 2;
EncoderType := cwctrQuadEncoderX1;
ExceptionOnError := True;
GateFilter := cwfilterNone;
GateMode := cwctrRisingEdgeGate;
GateSignal := 32;
GateSource := cwctrCtrGateGS;
GateWidth := 1;
InitialCount := 0;
MeasurementType := cwctrPulsePeriodRisingEdge;
NMeasurements := 10;
OutFilter := cwfilterNone;
PrescaleFactor := 1;
SourceEdge := cwauxlineNIDAQChooseSE;
SourceFilter := cwfilterNone;
StartTrigger := cwauxlineNIDAQChooseTrigger;
SynchronousCounting := False;
TimebaseSignal := -1;
TimebaseSource := cwctrSourceNTB;
UseBuffering := True;
UseDefaultBufferSize := True;
ZIndexActive := True;
ZIndexReloadPhase := cwctrAHighBHigh;
ZIndexValue := 0;
end;

with CWPulse do
begin
ActualDutyCycle := 0;
ActualFrequency := 0;
ActualPeriod := 0;
ActualPhase1 := 0;
ActualPhase2 := 0;
ActualTimebaseSignal := 0;
Count := 0;
Counter := 0;
Device := 2;
DutyCycle := 0.5;
ExceptionOnError := True;
Frequency := 0.001;
Frequency2 := 1;
GateFilter := cwfiterNone;
GateMode := cwpulseUngated;
GateSignal := 0;
GateSource := cwauxlineNIDAQChooseGS;
InternalClockMode := cwpulsePeriod;
OutFilter := cwfiterNone;
Period := 0.1;
Period2 := 1;
Phase1 := 1;
Phase1Inc := 0;
Phase2 := 1;
Polarity := cwpulseHighPulse;
PulseDelay := 0.5;
PulseType := cwpulseContinuous;
PulseWidth := 0.5;
SourceEdge := cwpulseRisingSE;
SourceFilter := cwfilterNone;
StartTrigger := cwauxlineNIDAQChooseTrigger;
TimebaseSignal := 0;
TimebaseSource := cwpulseFrequencyTB;
end;


Have a nicde day.

chaan.
0 Kudos
Message 5 of 7
(7,002 Views)
Hello chaan,

I�m still not completely clear on exactly what your question is. So I�ve got some specific questions for you:

1. Which board are you using for this application (6033E or 6602)? Or are you using both of these boards at the same time? If both boards are being used which signals are read by each board?

2. Please describe as much as possible about the signal you are trying to read with this board. What is the frequency of the pulses on this signal? Does the frequency vary? Is there one pulse per meter or many pulses per meter from the GPS unit?

3. You said that in the case of high deceleration the pulse count is wrong. In what way is it wrong? Are there more pulses counted than expected or less pulses c
ounted?

Also, unfortunately, Delphi is not officially supported by ComponentWorks. However, I can help you with which methods and properties to use for your application. Also if you want to count pulses using a ComponentWorks object, you should use the CWCounter object.

Thanks,
Ken S.
National Instruments
0 Kudos
Message 6 of 7
(7,002 Views)
Hello.
I reply to your question.

1. Which board are you using for this application (6033E or 6602)? Or are you using both of these boards at the same time? If both boards are being used which signals are read by each board?

- Existing system using 6033E, but I couldnt right(?) value from it, so I testing 6602 now. In the end, I wanna using both at the same time.

2. Please describe as much as possible about the signal you are trying to read with this board. What is the frequency of the pulses on this signal? Does the frequency vary? Is there one pulse per meter or many pulses per meter from the GPS unit?

- a. Acquisition Sampling Rate : 100Hz
- b. Acquisition Interval : 100ms
- c. GPS pulse count : 500pulses/m


3. You said that in the case of high deceleration the pulse count is wrong. In what way is it wrong? Are there more pulses counted than expected or less pulses counted?

- Sorry, explanation was too simple.
I think my system's problem is taht missing pulses at window timming.
You see, GPS pulse count is different when high speed or low speed.
When I debugged this problem(using pulse generator, simple event count, each 100ms window time interval), one time is more pulses, one time is less pulses. like this.
<>
pulse0 pulse1 speed0 speed1
205 205 2859 2859 100.41 100.41 : more
95 95 1306 1306 98.98 98.98 : less
100 100 1387 1387 99.86 99.86
105 105 1458 1458 99.98 99.98
100 100 1389 1389 100.01 100.01
100 100 1388 1388 99.94 99.94
100 100 1389 1389 100.01 100.01
100 100 1388 1388 99.94 99.94
100 100 1388 1388 99.94 99.94
100 100 1395 1395 100.44 100.44
100 100 1382 1382 99.50 99.50
100 100 1388 1388 99.94 99.94
100 100 1389 1389 100.01 100.01
99 99 1389 1389 101.02 101.02
100 100 1387 1387 99.86 99.86

So, I added counter board(6602) for solve this problem.

<>
Device => PCI-6602
counter0.Source => pulse generator(GPS)
counter0.Gate(PFI38, pin3) => counter1.Out(PFI32, pin9)

<>
GOAL : I wanna using two components.
(CWCounter, for get GPS pulse. CWPulse for Pulse Train Generation)

========================================================================================
with CWCounter1 do
begin
BufferMode := cwctrContinuous;
BufferSize := 10;
CountDirection := cwctrUpDirMode;
Counter := 0;
Device := 2; // current PCI-6602's Device No.
GateFilter := cwfilterNone;
GateMode := cwctrRisingEdgeGate;
GateSignal := 32;
GateSource := cwctrCtrGateGS;
GateWidth := 1;
InitialCount := 0;
MeasurementType := cwctrPulsePeriodRisingEdge;
NMeasurements := 10;
OutFilter := cwfilterNone;
PrescaleFactor := 1;
SourceEdge := cwctrRisingSE;
SourceFilter := cwfilterNone;
StartTrigger := cwctrNIDAQChooseTrigger;
SynchronousCounting := False;
TimebaseSignal := -1;
TimebaseSource := cwctrSourceNTB;
UseBuffering := True;
UseDefaultBufferSize := True;
end;

with CWPulse do
begin
ActualDutyCycle := 0;
ActualFrequency := 0;
ActualPeriod := 0;
ActualPhase1 := 0;
ActualPhase2 := 0;
ActualTimebaseSignal := 0;
Count := 0;
Counter := 1;
Device := 2;
DutyCycle := 0.5;
ExceptionOnError := True;
Frequency := 100;
Frequency2 := 1;
GateFilter := cwfiterNone;
GateMode := cwpulseUngated;
GateSignal := 0;
GateSource := cwpulseNIDAQChooseGS;
InternalClockMode := cwpulsePeriod;
OutFilter := cwfiterNone;
Period := 0.1;
Period2 := 1;
Phase1 := 1;
Phase1Inc := 0;
Phase2 := 1;
Polarity := cwpulseHighPulse;
PulseDelay := 0.5;
PulseType := cwpulseContinuous;
PulseWidth := 0.5;
SourceEdge := cwpulseRisingSE;
SourceFilter := cwfilterNone;
StartTrigger := cwctrNIDAQChooseTrigger;
TimebaseSignal := 0;
TimebaseSource := cwpulseFrequencyTB;
end;


procedure TForm1.CWCounter1AcquiredData(Sender: TObject;
var Measurement: OleVariant; Overflow: WordBool);
var
nCnt: double;
i, j: integer;
begin
memo1.lines.Clear;
for i := varArrayLowBound(Measurement, 1) to varArrayHighBound(Measurement, 1) do
begin
nCnt := Measurement[i];

memo1.lines.add(format('%f', [nCnt]));
end;
end;

========================================================================================
Reuslt : I can't GPS Pulse Count but '2,000,000' is displayed.

2000000
2000000
2000000
2000000
2000000
2000000
2000000
2000000
2000000
2000000


What is wrong? Is wrong as I missed property of these objects?
0 Kudos
Message 7 of 7
(7,002 Views)