Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How I can Activate and Deactivated a relay in DAQmx using C# ?

I'm trying make a simple task using the DAQmx board verion 6520. I want enable a relay and disable from the .net interface. using the code below I can activate a relay but I dont know how I can disable.

 

Any Ideias ?

 

 digitalWriteTask = new Task();

sLine = string.Format("{0}/{1}/{2}", sNameDevice, "port1", "line1");

digitalWriteTask.DOChannels.CreateChannel( sLine, "TimeOutWhite", ChannelLineGrouping.OneChannelForEachLine );

writer = new DigitalSingleChannelWriter(digitalWriteTask.Stream);

writer.WriteSingleSampleSingleLine(true, true);

led1.Value = true;

 

Regards,

 

Alexandre A.

0 Kudos
Message 1 of 5
(4,397 Views)
Have you simply tried setting the logic state to false?
0 Kudos
Message 2 of 5
(4,385 Views)

yes,

 

I made a code using a timer control to disable the relay with false without sucess.

 

digitalWriteTask = new Task();

digitalWriteTask.Control(TaskAction.Start);sLine =

string.Format("{0}/{1}/{2}", sNameDevice, "port1", "line2");

digitalWriteTask.DOChannels.CreateChannel(

sLine,

"TimeOutWhite", ChannelLineGrouping.OneChannelForEachLine

);

writer = new DigitalSingleChannelWriter(digitalWriteTask.Stream);writer.WriteSingleSampleSingleLine(

true, false);

  

0 Kudos
Message 3 of 5
(4,379 Views)
I can't help with the .net code but you should be able to go into MAX and set the digital output high and low there and see if the relay operates. If it works there, then someone who understands .net will at least know there is nothing wrong with the hardware.
0 Kudos
Message 4 of 5
(4,375 Views)

The hardware works fine. I able to disable and enable relays using Measument & Automation Application without problem. My problem is try make this work using .net API. When I run my code to enable no problem but when I trying disable the relay the process run without errors but nothing happen in the board.

 

 

0 Kudos
Message 5 of 5
(4,359 Views)