Python and NI

cancel
Showing results for 
Search instead for 
Did you mean: 

Sine wave output

Hi,

Newbie to Python for NI.

I want to generate a continuous sine wave with frequency=60 Hz and amplitude = 4V .

I want to use Python NIDAQMX for this(have NI 9269 module ,if that matters)

What is the best way to do this?

0 Kudos
Message 1 of 5
(3,725 Views)

Hello

 

I can recommend the documentation of the nifgen module. I do not use it myself, but the example explains your use case.

https://nimi-python.readthedocs.io/en/master/nifgen.html#usage

 

Please also have a look at the documentation of the nidaqmx module.

https://nidaqmx-python.readthedocs.io/en/latest/index.html#usage

 

Hope it helps...

 

Christian

Drivetek AG

0 Kudos
Message 2 of 5
(3,708 Views)

Thanks Drivetekag,

I tried Nifgen but somehow it does not recognize my module NI 9269. Does NIFGEN support NI9269? I want to use  cDAQ2Mod2  device and port 2 . I hope I am using right syntax.Tried too many different syntaxes but failed.

Regards

0 Kudos
Message 3 of 5
(3,694 Views)

Here is what I tried

 

import nifgen
import time
with nifgen.Session("cDAQ2Mod2") as session:
session.output_mode = nifgen.OutputMode.FUNC
session.configure_standard_waveform(waveform=nifgen.Waveform.SINE, amplitude=1.0, frequency=10000000, dc_offset=0.0, start_phase=0.0)
with session.initiate():
time.sleep(5)

 

and here is the error

nifgen.errors.DriverError: -1074134944: IVI: (Hex 0xBFFA0060) Insufficient location information or resource not present in the system.

 

Also tried this as third line of program instead. Did not help

with nifgen.Session("cDAQ2Mod2::1") as session:

0 Kudos
Message 4 of 5
(3,615 Views)

I wanted to use nifgen module to generator a square wave via python, then I've met the same error as you.

0 Kudos
Message 5 of 5
(3,156 Views)