Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting ND_INITIAL_COUNT in GPCTR_Change_Parameter doesn't take

Applies to PXI-6070E and PXI-6115 hardware.
Unsigned long Initial_Count = 2 when applied to

Function_Status = GPCTR_Change_Parameter (1, ND_COUNTER_0, ND_INITIAL_COUNT, Initial_Count);

Then,

Function_Status = GPCTR_Watch (1, ND_COUNTER_0, ND_COUNT, Set_Count);

where unsigned long Set_Count doesn't return 2.
0 Kudos
Message 1 of 9
(3,028 Views)
Is Set_Count a pointer to unsigned long? Set_Count should be passed by reference. You might have to prepare or arm the counter before the initial count actually gets changed.
0 Kudos
Message 2 of 9
(3,028 Views)
you must reset the counter before Change_par
In the armed status change_par does nothing
0 Kudos
Message 3 of 9
(3,028 Views)
You're correct (pointer) and it is passed by ref (forgot & when submitted). But, prepare then watch doesn't work and arm starts the counter.
0 Kudos
Message 4 of 9
(3,028 Views)
Reset was done, so that's not it. Just use the examples in NI-DAQ Help and you'll see that it doesn't work. Just insert GPCTR_Watch where ever you wish to verify.
0 Kudos
Message 5 of 9
(3,028 Views)
In the armed status changepar does nothing
believe it or not
0 Kudos
Message 6 of 9
(3,028 Views)
Thanks for the reply, but it's just as I thought:

It cannot be done.

I've tried it on a PXI-6070E, PXI-6115, and NI-4472.

I thought NI monitored this forum? Please prove me wrong.
0 Kudos
Message 7 of 9
(3,028 Views)
In my programm it works like this with 6031e and 6024e and 6030e, Delphi + 7.1 or 7.2 Traditional
both counters:
Status := GPCTR_Watch(Device, ulGpctrNum, ND_COUNT,p_Count0);
Status := GPCTR_Watch(Device, ulGpctrNum1, ND_COUNT,p_Count1);

// sx:= inttostr(ulcount0)+#13#10+inttostr(ulcount1);
ulCount0 :=0;
ulcount1:=0;
Status := GPCTR_Control(Device, ulGpctrNum1, ND_RESET);
Status := GPCTR_Set_Application(Device, ulGpctrNum1,ND_SIMPLE_EVENT_CNT);
Status := GPCTR_Change_Parameter(Device, ulGpctrNum1, ND_SOURCE,ctr_s);
Status := GPCTR_Change_Parameter(Device, ulGpctrNum1,ND_INITIAL_COUNT,ulCount1);

Status := GPCTR_Control(Device, ulGpctrNum, ND_RESET
);
Status := GPCTR_Set_Application(Device, ulGpctrNum,ND_SIMPLE_EVENT_CNT);
Status := GPCTR_Change_Parameter(Device, ulGpctrNum, ND_SOURCE,ctr_s);
Status := GPCTR_Change_Parameter(Device, ulGpctrNum,ND_INITIAL_COUNT,ulCount1);

// Start
Status := GPCTR_Control(Device, ulGpctrNum1, ND_PROGRAM);
Status := GPCTR_Control(Device, ulGpctrNum, ND_PROGRAM);
0 Kudos
Message 8 of 9
(3,028 Views)
Thanks for the reply. I too have been successful with event counters (counter as input device). It's when I try to program a counter as an output device that I cannot get the initial count to set correctly. Have you? (TIA)
0 Kudos
Message 9 of 9
(3,028 Views)