How do I write clocked digital data using the Data Acquisition Toolbox?
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MathWorks Support Team
il 13 Mar 2025
Risposto: MathWorks Support Team
il 14 Mar 2025
I am using an NI DAQ 9174. If I follow the instructions to generate pulse data on a counter channel for R2023b, I can send a PWN signal to the DAQ that oscillates between 'on' and 'off':
This signal oscillates as follows: 0101010101, and so on.
How do send square wave with different peaks (i.e., a digital signal), such as 000101001111, to my DAQ?
Risposta accettata
MathWorks Support Team
il 14 Mar 2025
You can do this using a digital channel and a clock. To create the digital channel, use the following code:
d = daq('ni');
d.addoutput(<DEVICE ID>, <CHANNEL ID>, "Digital");
d.Rate = // Desired data rate here.
Then, you need to add a clock, the specifics of which which will depend on your goal. The easiest way to accomplish this is to add any analog input/output, which will automatically assign a clock for you. Please know that if you manually assign a clock the clock frequency will need to match the above rate.
d.addinput(<DEVICE ID>, <CHANNEL ID>, "Voltage");
Lastly, 'preload' your desired data and start the DAQ:
preload(d,[0 0 0 1 0 1 0 0 1 1 1 1]');
start(d);
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Analog Input and Output in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!