Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Matlab and daq?

I was given a daq. I hvae daqmx 9.2.2 installed. I would like to use matlab to do the following. 

 

If detect digital signal iniput from port 0 line 0 (Sensor)

      wait 100ms

      send digital signal output to port 0 line 1 (LED)

      wait 100ms

      send the inverse siganl to port 0 line 1 (turn off LED)

 

Thanks 

0 Kudos
Message 1 of 7
(7,890 Views)

You should try contacting MathWorks directly as this will use their Data Acquisition Toolbox:

 

http://www.mathworks.com/products/daq/

http://www.mathworks.com/support/search_results.html?q=product:%22Data+Acquisition+Toolbox%22

 

Good luck!

Craig H. | CLA CTA CLED | Applications Engineer | NI Employee 2012-2023
0 Kudos
Message 2 of 7
(7,862 Views)

Mathworks team is rather non responsive to my questions. So i'll stick with this forum XD. 

Anyways. 

 

I just want to know how to detect digital signals from port 0 line 1

and send digital signals fro port 0 line 2.

 

I am expecting something like this..

if digitalsignal.port[0] = true

    sendsignal(digital;signal.port[1])

 

something along the lines

0 Kudos
Message 3 of 7
(7,823 Views)

Well, this is how you can do it in LabVIEW!

 

Read DI, write to dO.png

 

You can download a trial version of LabVIEW here: https://lumen.ni.com/nicif/us/evallv/content.xhtml

You can download the DAQ drivers here: http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/catnav:du/q/daqmx/

 

Good luck 🙂

Craig H. | CLA CTA CLED | Applications Engineer | NI Employee 2012-2023
0 Kudos
Message 4 of 7
(7,816 Views)

I do not want to use labview to do it. I want to use matlab(not simulink but matlab) to do it. Any ideas? anyone?

 

I just need that one line of code which is send/detect digital I/O

0 Kudos
Message 5 of 7
(7,808 Views)

Originally, you were asking for LabVIEW code and you were given a couple of different solutions for your simple problem. You've apparently decided that LabVIEW is too complicated a language to learn. Now, you are asking about Matlab programming on an NI board. As you have been told, you need to go to Matlab and ask about programming in their language.

0 Kudos
Message 6 of 7
(7,796 Views)

^ Errr. that is not true. I figured out how to do it using labview, btu then my boss suddenly said "I have decided that it would be best to code this in Matlab, since it is the most widely used language among scientists. I hope that switching at this point won't be too much of a hindrance for you." so now I need to do it in matlab )=. 

0 Kudos
Message 7 of 7
(7,789 Views)