Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

DIG_Block_Check does not return 0

Hello!
I use the PCI-6534 and Visual C++ 6.0.
I send a pattern of Data into the memory of the NI-card and use the onboardloop to send it cyclical.
But sometimes I want to do changes in the pattern and update the data. So I call DIG_Block_Clear and send the updated pattern with DIG_Block_Out to the card again. The problem is, that the pattern should be updated only when the old pattern is sended out by the card completely. So before I update the old pattern I use DIG_Block_Check to guarantee that the old pattern is sended completely before I call DIG-Block_clear. Like this:
while ((ulRemaining != 0) && (iStatus == 0))
{
iStatus = DIG_Block_Check(iDevice,iInGroup,&ulRemaining);
iRetVal = NIDAQYield(iYieldON);
}
iRetVal = NIDAQEr
rorHandler(iStatus, "DIG_Block_Check", iIgnoreWarning);

iStatus = DIG_Block_Clear(iDevice, iGroup);
iStatus = DIG_Block_Out(iDevice, iGroup, piBuffer, ulCount);
iRetVal = NIDAQErrorHandler(iStatus, "DIG_Block_Out", iIgnoreWarning);

But DIG_Block_Check does never return 0 so the program stays in the while-loop forever.
I don't know, where the error is. I hope someone can help me. Thank you.
0 Kudos
Message 1 of 6
(3,543 Views)
What does the call to DIG_Block_Check() currently return? If it's not 0 then it must be a positive or negative number which corresponds to an error/warning code. I will be better able to help if I knew this error/warning code.

Regards,
Justin Britten
0 Kudos
Message 2 of 6
(3,543 Views)
Hello!
DIG_Block_Check returns the number of items remaining to be transferred after a DIG_Block_In or DIG_Block_Out call. In my case I want to transfer a pattern of 26 items with the onboardloop of the card, which works. When I want to update the pattern I have to be sure that the current pattern was send out completely. For this I want to use DIG_Block_Check.
If it returns 0 the pattern is send out completely. In my case it returns numbers from 25 to 1 but never 0. If I update the pattern at 25 or 1, my datastream is incorrect because it contains an uncompleted pattern.

Thank you for your interest,
Andreas Tauchert
0 Kudos
Message 3 of 6
(3,543 Views)
Andreas,

I apologize about the miscommunication earlier. It seems that you were referring to the function parameter "remaining" when saying the return value and I was thinking the actual return value of the function which is "status".

The issue you are seeing is most likely that the NI 6534 always performs DMA transfers in 32-bit intervals. Therefore, if the data is not transfered in groups of 4 bytes there will be "stranded" data. This different behavior (compared to the NI 6533) is due to the addition of onboard memory to support high speed transfers.

I recommended that you either make the sample count a multiple of 4 bytes, or change the condition of the while loop to break when DIG_Block_Check returns 1 instead of 0.

Rega
rds,
Justin
0 Kudos
Message 4 of 6
(3,543 Views)
Hello Justin,

You don't have to apologize, my question was a little bit unprecise. I meant the function parameter "remaining" when I said return value.
I will try your advice. Thank you for your help.

Regards,
Andreas
0 Kudos
Message 5 of 6
(3,543 Views)
Andreas,

I just wanted to check on the status of your issue. Did you get a chance to try the advice? Please let me know if it worked out for you.

Regards,
Justin
0 Kudos
Message 6 of 6
(3,543 Views)