Send a scaled wave to a digital output

Hi,
I have been googling for examples on the usage of a scaled /wave in DAQmx_DIO_Config and could not find any. I am using the following function to generate and visualise my wave:

Function makeawave()
Make/o/N=128 name=1
Variable i=0
For(i=0;i<128;i=i+1)
name[i]=round(Sin(2*PI/30*i)*Sin(2*PI/30*i))
ENDFOR
SetScale/I x 0,0.002,"s", name
Display name
End

...and the following function to output the wave:

Function init(word)
Wave word

fDAQmx_ResetDevice("Dev1")
DAQmx_DIO_Config/DEV="Dev1"/RPTC=1/DIR=1/wave={word}"Dev1/port0/line0"
Variable/G DIOTaskIndex = V_DAQmx_DIO_TaskNumber
print V_DAQmx_DIO_TaskNumber
fDAQmx_DIO_Finished("Dev1",DIOTaskIndex)
print fDAQmx_ErrorString()
End

I have tried to use a for loop, but the timing of the output has obviously nothing to do with the scaled wave. I don't understand how to use buffers for wave output... I am new to both Igor and NI cards, it's a steep learning curve so thanks heaps for your help!
Best wishes,

Aline
Aline-

You don't say what is going wrong. Do you get a run-time error from the DAQmx_DIO_Config operation?

If you are using an M-series device, you also need to supply a clock signal. National Instruments calls the clocked DIO capabilities of the M-series devices "correlated output". That means that the DIO lines can be clocked, but that they don't supply a dedicated clock to do it with. You must use the /CLK flag along with some source of clock pulses. Using a clock this way makes the wave scaling irrelevant. If this is your problem, I can give you some more information about it.

There is a problem in your code: the function fDAQmx_DIO_Finished() tells NIDAQ Tools MX that you are finished using the DIO lines. At that point, the task is stopped and the DIO lines are released so that they can be used by another task. In short, your code starts the DIO task and then immediately stops it.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Hi John,

I get the following error message with fDAQmx_ErrorString(): "NIDAQ Tools error for device Dev1:10020: The device name or the task handle is bad."
I am using a PCI 6713 card, am I mistaken to think it has an internal clock which physical address is "Dev1/ao/sampleclock"?
Many thanks for your help!

Aline
Aline wrote:
I get the following error message with fDAQmx_ErrorString(): "NIDAQ Tools error for device Dev1:10020: The device name or the task handle is bad."

That error is probably generated by the call to fDAQmx_DIO_Finished(). It may fail because the DAQmx_DIO_Config call is failing.
Quote:
I am using a PCI 6713 card,

Ah- I looked up the 6713 device on NI's web site. The specifications list DIO timing as "software". That means it is not capable of clocked DIO.
Quote:
am I mistaken to think it has an internal clock which physical address is "Dev1/ao/sampleclock"?

Your device does, indeed, have that clock signal. If you were using a device with "correlated" timing for DIO (such as an M-series device), then you could add /CLK="/Dev1/ao/sampleclock" to the DAQmx_DIO_Config command. But your device does not have the ability to accept any sort of clock for DIO operations; the only thing you can do with your 6713 device is to set the state of the DIO lines once. To change them, you would have to call DAQmx_DIO_Config again.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com