Discussion:
DIO with PCI-6534
(too old to reply)
Chris Houlberg
2007-02-14 02:10:14 UTC
Permalink
I am attempting to use a PCI-6534 to continuously stream data out of a port and into another port.  I am having trouble figuring out how to control the data flow.  The DAQmx commands I am using are as follows:

 

To Configure the Output Data Task I execute the following:

DAQmxCreateTask("OutputTask", &hOutput)

DAQmxCreateDOChan(hOutput, "Dev0/Port0", "OutputPort", DAQmx_Val_ChanForAllLines)

DAQmxCfgSampClkTiming(hOutput, "/Dev0/Dig0/SampleClockTimebase", IO_RATE, DAQmx_Val_Rising, DAQmx_Val_ContSamps, OUTPUT_BUFFER_SIZE)

DAQmxExportSignal(hOutput, DAQmx_Val_SampleClock, "/Dev0/PFI6")

DAQmxCfgOutputBuffer(hOutput, OUTPUT_BUFFER_SIZE)

 

To Start the Output Data Task I execute the following:

DAQmxWriteDigitalU8(hOutput, BLOCK_SIZE, 0, 1.0, DAQmx_Val_GroupByChannel, cOutputBuffer, &lSamplesWritten, NULL)

DAQmxStartTask(hOutput)

 

To Continue the Output Data Task I repeatedly execute the following:

DAQmxGetDODataXferReqCond(hOutput, "OutputPort", &lXferCondition)

if(lXferCondition == DAQmx_Val_OnBrdMemHalfFullOrLess)

{

DAQmxWriteDigitalU8(hOutput, dwOutput, 0, 1.0, DAQmx_Val_GroupByChannel, cOutputBuffer, &lSamplesWritten, NULL)

            Put new data into cOutputBuffer for next DAQmxWriteDigitalU8()

}

 

 

To Configure the Input Data Task I execute the following:

DAQmxCreateTask("InputTask", &hInput)

DAQmxCreateDIChan(hInput, "Dev0/Port2", "InputPort", DAQmx_Val_ChanForAllLines)

DAQmxCfgSampClkTiming(hInput, "/Dev0/PFI3", IO_RATE, DAQmx_Val_Rising, DAQmx_Val_ContSamps, INPUT_BUFFER_SIZE)

 

To Start the Input Data Task I execute the following:

DAQmxStartTask(hInput)

 

To Continue the Input Data Task I repeatedly execute the following:

DAQmxGetDIDataXferReqCond(hInput, "InputPort", &lXferCondition)

if(lXferCondition == DAQmx_Val_OnBrdMemNotEmpty)

{

            DAQmxReadDigitalU8(hInput, DAQmx_Val_Auto, 1.0, DAQmx_Val_GroupByChannel, cInputBuffer, BLOCK_SIZE, &lInput, NULL)

            Transfer data from cInputBuffer and save for next DAQmxReadDigitalU8()

}

 

I am getting errors indicating the specified property in the DAQmxGetDODataXferReqCond() function and the DAQmxGetDIDataXferReqCond() are not supported.  I am at a loss on how to correct this.  Any help is much appreciated.
Raajit L
2007-02-15 01:10:26 UTC
Permalink
Hello Chris,
Correct me if I am wrong but it seems like you are trying to regenerate the data on the output port over and over again. If that is the case a better way of doing this would be to actually use the regeneration mode for this board.
What you can actually do it use the Regeneration Mode property node if you are indeed trying to regenerate. You can get/set/reset this property using:   DAQmxGetWriteRegenMode   DAQmxSetWriteRegenMode   DAQmxResetWriteRegenMode
This way you can actually keep regenerating the data again and again instead of using the functions that you are right now. Please let us know if this is actually what you want to do and if this will help you out. If not, we can come up with something else.
This is documented in the NI-DAQmx C Reference Help.
Regards,
Raajit L
Application Engineer
National InstrumentsMessage Edited by Raajit L on 02-14-2007 06:59 PM
Raajit L
2007-02-19 06:40:09 UTC
Permalink
Hello Chris,
 
The board should support that property. Do you have an error code that you could provide us?
 
These are the following values that you can use with this property.


Valid values



DAQmx_Val_OnBrdMemEmpty
10235
Transfer data to the device only when there is no data in the onboard memory of the device.

DAQmx_Val_OnBrdMemHalfFullOrLess
10239
Transfer data to the device any time the onboard memory is less than half full.

DAQmx_Val_OnBrdMemNotFull
10242
Transfer data to the device any time the onboard memory of the device is not full.

You can get/set/reset this property using:   DAQmxGetDODataXferReqCond   DAQmxSetDODataXferReqCond   DAQmxResetDODataXferReqCond

Here is a link to another discussion forum where they discuss how to use this property for the 6534 board.

&nbsp;<a href="http://forums.ni.com/ni/board/message?board.id=70&amp;message.id=304&amp;view=by_date_ascending&amp;page=1" target="_blank">How to use the PCI-6534 onboard memory ?</a>

Although some of the posts on that forum are in LabVIEW, similar functions are used in C and LabWindows as well. Please let us know if this still does not work out.

Best Regards,

Raajit L | Applications Engineer | National Instruments

&nbsp;

&nbsp;Message Edited by Raajit L on 02-19-2007 12:32 AM
Chris Houlberg
2007-02-20 19:10:13 UTC
Permalink
Raajit,
&nbsp;
I had read that other discussion before; however, after re-reading it I thought maybe my problem is that I just did not set up the transfer condition before getting the status.&nbsp; To test this I changed the configuration of the ports to the following leaving the rest of the code unchanged:


To Configure the Output Data Task I execute the following:

DAQmxCreateTask("OutputTask", &amp;hOutput)

DAQmxCreateDOChan(hOutput, "Dev0/Port0", "OutputPort", DAQmx_Val_ChanForAllLines)

DAQmxCfgSampClkTiming(hOutput, "/Dev0/Dig0/SampleClockTimebase", IO_RATE,&nbsp;DAQmx_Val_Rising, DAQmx_Val_ContSamps, OUTPUT_BUFFER_SIZE)

DAQmxExportSignal(hOutput, DAQmx_Val_SampleClock, "/Dev0/PFI6")

DAQmxCfgOutputBuffer(hOutput, OUTPUT_BUFFER_SIZE)DAQmxSetDOXferReqCond(hOutput, "OutputPort", DAQmx_Val_OnBrdMemHalfFullOrLess)

&nbsp;

To Configure the Input Data Task I execute the following:

DAQmxCreateTask("InputTask", &amp;hInput)

DAQmxCreateDIChan(hInput, "Dev0/Port2", "InputPort", DAQmx_Val_ChanForAllLines)

DAQmxCfgSampClkTiming(hInput, "/Dev0/PFI3", IO_RATE, DAQmx_Val_Rising,&nbsp;DAQmx_Val_ContSamps, INPUT_BUFFER_SIZE)DAQmxSetDIXferReqCond(hInput, "InputPort", DAQmx_Val_OnBrdMemNotEmpty)

&nbsp;

Now I get error messages for the DAQmxSetDOXferReqCond() and DAQmxSetDIXferReqCond() commands.&nbsp; They are they following:

For the DAQmxSetDOXferReqCond() command:

DAQmx Error: Specified property is not supported by the device or is not applicable to the task.

Property: DAQmx_DO_DataXferReqCond

Channel Name: OutputPortTask Name: OutputTaskStatus Code: -200452

&nbsp;

For the DAQmxSetDIXferReqCond() command:

DAQmx Error: Specified property is not supported by the device or is not applicable to the task.

Property: DAQmx_DI_DataXferReqCond

Channel Name: InputPortTask Name: InputTaskStatus Code: -200452

&nbsp;

Unlike the other discussion, I did set up the timing for a continuous transfer of data by using DAQmx_Val_ContSamps yet I get the same error.&nbsp;&nbsp;It seems that the DAQmx Set and Get XferReqCond commands just do not support the PCI-6534 boards.&nbsp; Either that or the above method of configuring the boards is incorrect. &nbsp;I would have thought that there would be an example somewhere that would outline how to&nbsp;continuously output and input non-repeating data using the DAQmx commands but I could find none.&nbsp;&nbsp;What am I doing wrong?

&nbsp;

Getting desperate,

&nbsp;

Chris
Chris Houlberg
2007-02-28 21:40:17 UTC
Permalink
I tried the suggestion you sent via e-mail&nbsp;and it doesn't work.

&nbsp;

I am still having problems with my e-mail so I will also repeat my results on the forum.

&nbsp;

What I did was eliminate the commands referring to the transfer condition, the DAQmxSetDODataXferReqCond() and DAQmxGetDODataXferReqCond() commands, and write the data out with without polling for status.&nbsp; After the data was be output for a few seconds I got the following error:

&nbsp;

Error: Write Digital Data

DAQmx Error: Some or all of the samples to write could not be written to the buffer yet.&nbsp; More space will free up as samples currently in the buffer are generated.

&nbsp;

To wait for more space to become available, use a longer write timeout.&nbsp; To make the space available sooner, increase the sample rate.

Property: DAQmx_Write_RelativeTo

Corresponding Value: DAQmx_Val_CurrWritePos

&nbsp;

Property: DAQmx_Write_Offset

Corresponding Value:

&nbsp;

Task Name: OutputTask

&nbsp;

Status Code: -20092

&nbsp;

This is what I expected.&nbsp; I cannot do what the error comments suggest.&nbsp; Waiting longer will subject to output to a possible pause in output which will corrupt the process at the other end.&nbsp; I also cannot change the data rate as the processor at the other end only accepts one data rate.

&nbsp;

I need to poll some status word or flag so I know when I can write the next block of data.&nbsp; My only other solution is to try and write the data out and test for the above error.&nbsp; If I get the above error retain the block of data and try again until it is accepted.&nbsp; I am concerned that this will cause some problem in the PCI-6534 that will cause some interruption in the output.&nbsp; I need a status word or flag to test to get around all these problems.

&nbsp;

Surely someone has used this board to do continuous output before.&nbsp; Surely NI has designed it to do continuous output and someone must have tested it.&nbsp; How was this done?

&nbsp;

Please respond to this e-mail on the forum.&nbsp; I am not sure when my regular access to e-mail will be up again.

&nbsp;

Thank you for your help, I am still desparate for a solution.
Chris Houlberg
2007-03-01 18:10:14 UTC
Permalink
Raajit,
I have two corrections to make to my last post.&nbsp; These are typo errors due to interruptions while I was typing my reply and also due to using another computer and its old keyboard.
The first correction to my last reply is the program was run to write the&nbsp;data out without polling for status.&nbsp; This follows your suggestion which unfortunately did not work.
The second correction is the error code was not -20092, it was -200292.&nbsp; The keyboard was sticky and I did not proof read what I typed.
Still looking forward to a solution,
Chris
Chris Houlberg
2007-03-05 22:10:16 UTC
Permalink
Hi Raajit,
&nbsp;
The error is occurring because the data is being written too fast for the buffer to take.&nbsp; I have data available all the time to write out to the buffer.&nbsp; If I write it out before the buffer has room to accept it I will obviously overrun the buffer.&nbsp; As the error states: "Some or all of the samples to write could not be written to the buffer yet.&nbsp; More space will free up as samples currently in the buffer are generated."&nbsp; indicating the data was available to write to the buffer and I overwrote the buffer.&nbsp; It also indicates that as time passes more space in the buffer will be available for data.&nbsp; That is why I need a status flag to test so I know when the buffer has room for the data I want to write.
&nbsp;
As for using burst handshaking, as I stated before, I need to output the data continuously.&nbsp; No interruptions, pauses or missing bits of data can be tolerated.&nbsp; This should be a simple matter of setting up the PCI-6534 for continuous data out and testing a flag for space available in the buffer to maintain continuous data out.
&nbsp;
I am beginning to come to the conclusion that this board is incapable of outputting data continuously.&nbsp; Either that or the commands I used to set up the output task, channel and timing are incorrect (see above 1st post and following attempted fixes)&nbsp;or the DAQmx commands just do not support continuous data out .&nbsp; There must be a simple method I am overlooking and someone at National Instruments should be capable of showing me the error of my ways.&nbsp; I am just about to scrub this approach, return the PCI-6534 boards and SCB-68 breakout boxes to National Instruments and go with another manufacturer's product (or build my own).&nbsp; We in our division buy National Instruments' products all the time.&nbsp; This is the first time National Instruments has not been able to support us.
&nbsp;
Have you used the DAQmx commands before to output digital data?&nbsp; Who else at National Instruments might know something about this problem?&nbsp; Who designed the PCI-6534?&nbsp; I would like to talk to them.&nbsp; Who wrote the DAQmx commands that this board should be able to interpret?&nbsp; Is there any DAQmx command that will allow the testing of a status flag relating to the amount of space available in the buffer that works with the PCI-6534?
&nbsp;
I do appreciate the time you have put in on this Raajit; however, I still need answers that work.
&nbsp;
Thank you,
&nbsp;
Chris
&nbsp;
Chris Houlberg
2007-03-06 18:40:11 UTC
Permalink
Here is some additional information to support my conclusion that the PCI-6534 is not keeping up with the rate at which I am sending data to it.
I increased the clock rate (IO_RATE in the above expressions) from 500KHz to 10MHz and was able to output a 200 MByte file without getting any DAQmx errors.&nbsp; So I conclude that at 500KHz the error I am getting is indicating that I am overruning the PCI-6534 buffer.&nbsp; I need a flag to test.
In actual operation, I intend on outputting files between 6 GBytes and 27 GBytes in size.&nbsp; The output rate must be constant, without interruptions,&nbsp;without gaps, without drop bits and without&nbsp;overruns.
I need a flag to test for space available in the buffer (such as HalfFullOrLess).&nbsp; I cannot rely on a specific output rate that matches a specific computer capability to maintain the output without DAQmx overrun errors.&nbsp;&nbsp;This application and the PCI-6534 will be hosted on many different computers which do not all operate at the same speed and which do not all have the same configuration and software running.
Still looking for a solution.
Thanks,
Chris
mandar
2007-04-12 12:10:10 UTC
Permalink
Hi,
i'm using DAQmax&nbsp; to genrate finite pulses&nbsp; (no.of pulses-controllable),but am unable to control pulses it gives continously pulses
i have used one case structure once applied true it gives me limited
pulses (depend on no of samples)since it's mechanical action is latch
when pressed if i increased no.of pulses more than 130 it gives me
limited pulses please mechanical action since&nbsp; tell&nbsp; me solution on
this application


Regards
Mandar
Matt A
2007-05-04 15:10:19 UTC
Permalink
Hello Mandar,I apologize if I was unclear before. What aspect of the external clock are you having problems with, specifically? Are you wondering about the physical connections or the programming? It sounds like you are somewhat new to programming NI-DAQmx in LabVIEW, so I would recommend a couple introductory tutorials. First, you can find a document called "Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications" <a href="http://zone.ni.com/devzone/cda/tut/p/id/2835#toc4" target="_blank">here</a>. You can also find the Complete Data Acquisition Tutorial <a href="http://zone.ni.com/devzone/cda/tut/p/id/3116" target="_blank">here</a>. In addition to these tutorials, the PCI-6534 documentation is a valuable resource for using this device. You can find the NI 6533/6534 Devices for NI-DAQmx Help <a href="http://digital.ni.com/manuals.nsf/websearch/30B2C2113F47800A862570AD00811A3F" target="_blank">here</a>. Included in this documentation is a section entitled "External Sample Clock Source" which states: "Use an external Sample clock when you want to time data transfers
using an external signal on the PFI&nbsp;&lt;2..3&gt; or PFI&nbsp;&lt;6..7&gt; pin of the
I/O&nbsp;connector. You can configure the active edge of the external Sample clock
signal using DAQmx. The low time
and high time of the Sample clock signal must each be &gt;20&nbsp;ns. The minimum
duration for a period of the Sample clock signal is 50&nbsp;ns."This section goes on to describe the use of an external sample clock and provides timing diagrams and other information. If you want more details regarding the connections you may want to examine the section entitled "Signal Descriptions" which lists the Pins, Signal Names, Signal Types and Signal Descriptions for the NI 6533/6534.
Chris Houlberg
2007-03-08 23:40:14 UTC
Permalink
Thanks Raajit.&nbsp; Everything works now.&nbsp; That was the information I was looking for in my first post.
For those who are as ignorant as me, I am posting the sequence of DAQmx commands I now use to stream data out of and in to the PCI-6534.&nbsp; They are as follows:
To Configure the Output Data Task I execute the following:DAQmxCreateTask("OutputTask", &amp;hOutput)DAQmxCreateDOChan(hOutput, "Dev0/Port0", "OutputPort", DAQmx_Val_ChanForAllLines)DAQmxCfgSampClkTiming(hOutput, "/Dev0/Dig0/SampleClockTimebase", IP_RATE, DAQmx_Val_Rising, DAQmx_Val_ContSamps, OUTPUT_BUFFER_SIZE)DAQmxExportSignal(hOutput, DAQmx_Val_SampleClock, "/Dev0/PFI6")DAQmxCfgOutputBuffer(hOutput, OUTPUT_BUFFER_SIZE)
To Start the Output Data Task I execute the following:Read block of data from file into cOutputBuffer for 1st DAQmxWriteDigitalU8()&nbsp;&nbsp;&nbsp;&nbsp; // Amount read = dwOutputAmountDAQmxWriteDigitalU8(hOutput, dwOutputAmount, 0, 1.0, DAQmx_Val_GroupByChannel, cOutputBuffer, &amp;lSamplesWritten, NULL)DAQmxStartTask(hOutput)Read new data from file into cOutputBuffer for 2nd DAQmxWriteDigitalU8()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Amount read = dwOutputAmount
To Continue the Output Data Task I repeatedly execute the following:DAQmxGetWriteSpaceAvail(hOutput, &amp;lSpaceAvailable)if(lSpaceAvailable &gt;= dwOutputAmount){ &nbsp;&nbsp;&nbsp;&nbsp; DAQmxWriteDigitalU8(hOutput, dwOutputAmount, 0, 1.0, DAQmx_Val_GroupByChannel, cOutputBuffer, &amp;lSamplesWritten, NULL)&nbsp;&nbsp;&nbsp;&nbsp; Read new data from file into cOutputBuffer for next DAQmxWriteDigitalU8()&nbsp;&nbsp;&nbsp;&nbsp; // Amount read = dwOutputAmount}
&nbsp;
To Configure the Input Data Task I execute the following:DAQmxCreateTask("InputTask", &amp;hInput)DAQmxCreateDIChan(hInput, "Dev0/Port2", "InputPort", DAQmx_Val_ChanForAllLines)DAQmxCfgSampClkTiming(hInput, "/Dev0/PFI3", IO_RATE, DAQmx_Val_Rising, DAQmx_Val_ContSamps, INPUT_BUFFER_SIZE)
To Start the Input Data Task I execute the following:DAQmxStartTask(hInput)
To Continue the Input Data Task I repeatedly execute the following:DAQmxReadDigitalU8(hInput, DAQmx_Val_Auto, 1.0, DAQmx_Val_GroupByChannel, cInputBuffer, BLOCK_SIZE, &amp;lInput, NULL)Transfer data from cInputBuffer and save to file for next DAQmxReadDigitalU8()&nbsp;&nbsp;&nbsp;&nbsp; // Amount transferred&nbsp;= lInput
It is all very simple if you know the commands.
Thanks again for your help,
Chris
jcarbonell
2007-03-13 21:10:11 UTC
Permalink
Hi Chris,On the output data task, you should set the DAQmxSetWriteRegenMode to DAQmx_Val_DoNotAllowRegenJeffChris Houlberg wrote:
Thanks Raajit.&nbsp; Everything works now.&nbsp; That was the information I was looking for in my first post.
For those who are as ignorant as me, I am posting the sequence of DAQmx commands I now use to stream data out of and in to the PCI-6534.&nbsp; They are as follows:
To Configure the Output Data Task I execute the following:DAQmxCreateTask("OutputTask", &amp;hOutput)DAQmxCreateDOChan(hOutput, "Dev0/Port0", "OutputPort", DAQmx_Val_ChanForAllLines)DAQmxCfgSampClkTiming(hOutput, "/Dev0/Dig0/SampleClockTimebase", IP_RATE, DAQmx_Val_Rising, DAQmx_Val_ContSamps, OUTPUT_BUFFER_SIZE)DAQmxExportSignal(hOutput, DAQmx_Val_SampleClock, "/Dev0/PFI6")DAQmxCfgOutputBuffer(hOutput, OUTPUT_BUFFER_SIZE)
To Start the Output Data Task I execute the following:Read block of data from file into cOutputBuffer for 1st DAQmxWriteDigitalU8()&nbsp;&nbsp;&nbsp;&nbsp; // Amount read = dwOutputAmountDAQmxWriteDigitalU8(hOutput, dwOutputAmount, 0, 1.0, DAQmx_Val_GroupByChannel, cOutputBuffer, &amp;lSamplesWritten, NULL)DAQmxStartTask(hOutput)Read new data from file into cOutputBuffer for 2nd DAQmxWriteDigitalU8()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Amount read = dwOutputAmount
To Continue the Output Data Task I repeatedly execute the following:DAQmxGetWriteSpaceAvail(hOutput, &amp;lSpaceAvailable)if(lSpaceAvailable &gt;= dwOutputAmount){ &nbsp;&nbsp;&nbsp;&nbsp; DAQmxWriteDigitalU8(hOutput, dwOutputAmount, 0, 1.0, DAQmx_Val_GroupByChannel, cOutputBuffer, &amp;lSamplesWritten, NULL)&nbsp;&nbsp;&nbsp;&nbsp; Read new data from file into cOutputBuffer for next DAQmxWriteDigitalU8()&nbsp;&nbsp;&nbsp;&nbsp; // Amount read = dwOutputAmount}
&nbsp;
To Configure the Input Data Task I execute the following:DAQmxCreateTask("InputTask", &amp;hInput)DAQmxCreateDIChan(hInput, "Dev0/Port2", "InputPort", DAQmx_Val_ChanForAllLines)DAQmxCfgSampClkTiming(hInput, "/Dev0/PFI3", IO_RATE, DAQmx_Val_Rising, DAQmx_Val_ContSamps, INPUT_BUFFER_SIZE)
To Start the Input Data Task I execute the following:DAQmxStartTask(hInput)
To Continue the Input Data Task I repeatedly execute the following:DAQmxReadDigitalU8(hInput, DAQmx_Val_Auto, 1.0, DAQmx_Val_GroupByChannel, cInputBuffer, BLOCK_SIZE, &amp;lInput, NULL)Transfer data from cInputBuffer and save to file for next DAQmxReadDigitalU8()&nbsp;&nbsp;&nbsp;&nbsp; // Amount transferred&nbsp;= lInput
It is all very simple if you know the commands.
Thanks again for your help,
Chris
Chris Houlberg
2007-03-14 20:40:12 UTC
Permalink
Hi Jeff,
I included that command in the output configuration.&nbsp; That allowed me to clean up&nbsp;the code I used to stop the task.
Thanks for the information,
Chris
stilly32
2007-04-09 21:40:11 UTC
Permalink
Hi,
&nbsp;
You can change your Hex integer into a boolean array by using the Number to Boolean Array.vi. If you want an array of 1's and 0's, you're going to have to go old school and convert it&nbsp;by dividing the number by 2, and putting the remainder in an array. You could also take the boolean array, and&nbsp;for each index value if it's true, insert a 1, if false, insert a 0.
Something like&nbsp;this:
&nbsp;
<img src="Loading Image...">
Hope this helps,
Andrew S
&nbsp;
Message Edited by stilly32 on 04-09-2007 04:36 PMMessage Edited by stilly32 on 04-09-2007 04:36 PM


to bit array.JPG:
http://forums.ni.com/attachments/ni/70/6677/1/to bit array.JPG
stilly32
2007-04-13 14:40:14 UTC
Permalink
Mandar,
&nbsp;
I'm not sure that I understand how you are trying to do this - are you using SW timing to toggle values to generate a pulse train, or outputting a waveform? The best way to do this would be to generate the pulse train in SW as a digital waveform, and generate it using the "Write Dig Chan-Int Clk-Dig Start" example. You can remove the digital start if needed.
&nbsp;
Hope this helps,
Andrew S
Continue reading on narkive:
Loading...