LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to do finite read?

Hi,
I am using the following code to read from device. It reads the specified data. But the clock still toggles until I stop it with "DIG_Out_Prt (ANALOGBOARD, PORTA, 0x00);". This puts my device in other mode. So, I want to toggle the clock only specified number of times. How can I do that?
Thanks a lot,
Kiran.



DIG_Grp_Config(DIOBOARD, 2, 1, 2, 0);
DIG_Out_Prt (ANALOGBOARD, PORTA, 0x00);
status = DIG_Grp_Mode (DIOBOARD, 2, 3, 0, 0, 0, freq);
status = Align_DMA_Buffer(DIOBOARD, 12, buf, numbytes, numbytes, &ulAlignIndex);
// Ready to acquire, waiting for trigger
status=DIG_Block_In(DIOBOARD, 2, buf, numbytes);
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Start Burst Trigger Here
//!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
DIG_Out_Prt (ANALOGBOARD, PORTA, 0x0F);
;
count = 0;
maxcount=100*numbytes;
while ((ulRemaining != 0) && (status == 0) && (count++ {
status = DIG_Block_Check(DIOBOARD, 2, &ulRemaining);
if ((count>(maxcount/10)) && (ulRemaining==numbytes))
count=maxcount;
}
if (count>=maxcount)
{
MessagePopup ("Time Out Error!!!", "Ready Busy Signal may have a problem");
DIG_Block_Clear (DIOBOARD, 2);
DIG_Grp_Config(DIOBOARD, 2, 0, 0, 0);
DIG_Out_Prt (ANALOGBOARD, PORTA, 0x00);
return FAIL;
}
DIG_Grp_Config(DIOBOARD, 2, 0, 0, 0);
DIG_Out_Prt (ANALOGBOARD, PORTA, 0x00);
0 Kudos
Message 1 of 4
(2,676 Views)
Kiran,

What type of operation are you wanting to perform? Do you want to perform finite pattern generation output or input with a start trigger? If so, I would suggest to look at example programs for a reference. The example entitled 'DOsingleBufExtTrig653x' performs output and 'DIsingleBufExtTrig653x' performs input. You can find the examples in the ...\Program Files\National Instruments\MeasurementStudio\CVI\samples\daq\do or di directories.

I hope this helps.

Regards,

Todd D
NI Applications Engineer
0 Kudos
Message 2 of 4
(2,676 Views)
Todd,
Thanks for your reply.

I am trying to do an input operation. As soon as the required number of bytes are input, I want the clock to stop toggling without waiting for the trigger.

My \program files\national instruments\ folder does not contain "MeasurementStudio\CVI\samples" folder. Will you be kind enough to point other source for the above sample or email me that sample.

Thanks a million for you support,
Kiran.
0 Kudos
Message 3 of 4
(2,676 Views)
Sorry about that. You should have the directory ...\Program Files\National Instruments\NI-DAQ\Examples\VisualC\Di and Do where you will find the same examples.

If you are just wanting to acquire a set number of digital samples, then I would suggest not to configure a trigger and just use the digital input single pattern generation 653x example.

Regards,

Todd D.
0 Kudos
Message 4 of 4
(2,676 Views)