06-07-2008 04:57 AM
06-07-2008 06:06 AM
06-09-2008 03:28 AM
06-09-2008 04:00 AM
06-09-2008 07:03 AM
Hello again,
Since this is something new for me, do you mean to configure the software to use "ai sample clock" as clock source or do you mean to wire the ai sample clock to (I don't know which one) an input of the board?
Thanks
06-09-2008 07:05 AM
You mean selecting (in the code where I configure the counter task) "/Dev1/ai/SampleClock/" as clock source, don't you?
Thanks
06-09-2008 09:40 AM
Yes, (if Dev1 is your 6229) then first start your digital task, and later your analog task.
@acevedo wrote:
You mean selecting (in the code where I configure the counter task) "/Dev1/ai/SampleClock/" as clock source, don't you?
06-10-2008 07:17 AM - edited 06-10-2008 07:18 AM
Hello again,
I tried it (here below the source code in C#)
****************************************************
this.sSITask = new Task("BufferedDigitalInputTask1");
this.sSITask.CIChannels.CreateLinearEncoderChannel("Dev1" +
"/ctr0", "",CIEncoderDecodingType.X2,true,0,
CIEncoderZIndexPhase.ALowBLow,1,0,CILinearEncoderUnits.Ticks);
this.sSITask.CIChannels[0].DataTransferMechanism = CIDataTransferMechanism.UsbBulk;
this.sSITask.Timing.ConfigureSampleClock("/"+"Dev1"+
"/ai" + "/SampleClock",1000,SampleClockActiveEdge.Falling,
SampleQuantityMode.ContinuousSamples,-1);
this.sSITask.Control(TaskAction.Verify);
//create a reader
this.sSIReader = new DigitalMultiChannelReader(this.sSITask.Stream);
//launch tasks
this.sSITask.Start();
****************************************************
and I got the following error message (when running this.SSITask.Start(); .)
The specified data width is not supported or cannot be
transferred on the bus. The operation could not be completed as specified.
Task Name: BufferedDigitalInputTask1
Status Code: -50005
As you see, I have configured "-1" for NumberOfSamples. Perhaps this is the cause for the error. Which settings would be right?
06-20-2008 01:04 AM
06-20-2008 08:40 AM
I only program in LabVIEW, but I *think* the problem may relate to some intermingling of terminology. Encoder tasks use the onboard counters and in NI terminology, these are NOT "Digital" tasks.
this.sSITask = new Task("BufferedDigitalInputTask1");
This line is probably ok since I expect the string is just a convenient human-readable alias to the task. But it does suggest that the encoder task is being thought of as a "Digital" task.
//create a reader
this.sSIReader = new DigitalMultiChannelReader(this.sSITask.Stream);
I kinda suspect this line. For one thing, you've only configured 1 encoder channel in your task. In fact that's all you *can* configure in one task -- you'll need 2 separate tasks for your 2 encoders. So creating a reader that expects multichannel data may be the problem. The other possibility may be that your board has only an 8-bit digital port available for digital tasks. You've asked for a multichannel digital reader that probably wants to create a buffer of 8-bit ints. However your task is for an encoder with scaling units that want to become doubles.
You probably need to create a reader that expects to handle encoder position data from a counter.
-Kevin P.