I'm new to DAQ with NI hardware (in my case the NI PCIe-6321 board) and so I tried some simple tasks. However, I fail with writing a "1"/high on a digital output port line. Neither my own C# code (see below) nor NI's MAX work and I can't measure anything but 0 Volts when I connect my multimeter with P0.0 (the pin I want to set to high) and D GND. I tried to disable "Tristate" (I have no clue what it does but I'm sure I don't need that functionality) but it didnt help.
What am I doing wrong? I guess
writer.WriteSingleSampleSingleLine(true, true);
is permanent? Why can't I measure 3.3/5 Volts?
// Reset the device var dev1 = DaqSystem.Local.LoadDevice("Dev1"); dev1.Reset(); // Create a task var digitalOutTask = new NationalInstruments.DAQmx.Task(); var digitalOutChannel = digitalOutTask.DOChannels.CreateChannel( "Dev1/Port0/line0", "", ChannelLineGrouping.OneChannelForAllLines); digitalOutTask.Control(TaskAction.Verify);
// Write var writer = new DigitalSingleChannelWriter(digitalOutTask.Stream); writer.WriteSingleSampleSingleLine(true, false); digitalOutChannel.Tristate = false; writer.WriteSingleSampleSingleLine(true, true);