From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

error using PXI 5412 arbitrary waveform generator using matlab

Software: Matlab 2013a

Hardware: PXI 5412 arbitrary waveform generator

Chasis - PXIe 1082

 

As I am new to using AWGs with matlab I have been trying to use the example code from the Mathworks website to generate a sine wave using the AWGs. 

 

 

driverInfo = instrhwinfo ('ivi');
disp(driverInfo.Modules')

% it gives me 'niFgen' in the list

makemid('niFgen')

% No error

resourceID = 'DAQ::PXI1Slot6';

% I also tried using the resourceID as just 'PXI1Slot6' but still gives the same error
ictObj = icdevice('niFgen',resourceID)
% No error here
connect(ictObj)

% No error at this stage

Waveform = 1; %The number 1 is the enumerated value for Sine Waveform
ChannelName = '0';
Frequency = 10E+6;
Amplitude = 2.0;
DCOffset = 0;
StartPhase = 0.0;

invoke(ictObj.Configurationfunctionsstandardfunctionoutput,'configurestandardwaveform',ChannelName, Waveform, Amplitude, DCOffset, Frequency, StartPhase);

 

At this point it gives me the following error:

 

"Error using icgroup/invoke (line 93)

The instrument returned an error while executing the function.

The operation cannot be completed in the current output mode"

 

 

Thanks in advance.

0 Kudos
Message 1 of 6
(4,388 Views)

Hello,

 

How to solve this issue is going to depend on whether it is a hardware problem, a driver problem, or a coding problem. In order to figure out if it's a driver problem it would be best to perform an NI I/O Trace. You can find instructions for that in this KnowledgeBase. If you have questions about coding in MATLAB®  it would be best to seek support from The Mathworks Inc.. 

 

MATLAB® is a registered trademark of The MathWorks, Inc. 

Miles G.
National Instruments
Staff Applications Engineering Specialist
0 Kudos
Message 2 of 6
(4,369 Views)

Hi Miles,

 

Thanks for your reply.

 

I have tried the NI MAX and I am able to generate a sine wave and observe it on an oscilloscope and have also downloaded an example Labview program and run it and generate waveforms using the AWG. So it does not seem to be a hardware issue or probably a driver issue.

 

As for the programming issue I am not sure if I am using the correct fields in the Matlab API.

 

What should be the Channel Name - Should it just be a numeric value or should it be a string? 

 

It would be great if someone on the forum who has used matlab to interface with an NI AWG could throw some light on this. Or even point me to an example program which has worked with actual hardware and not in simulation mode.

 

Thanks!

0 Kudos
Message 3 of 6
(4,360 Views)

Hello,

 

Yeah that does make it seem like it's not a hardware problem. It's possible that there are some users here that can help you with your coding or setup, but you may have a better chance on the MATLAB® forums. 

 

MATLAB® is a registered trademark of The MathWorks, Inc. 

Miles G.
National Instruments
Staff Applications Engineering Specialist
0 Kudos
Message 4 of 6
(4,349 Views)

Thanks again Miles.

 

Is there a forum/group on the NI forums which specializes in Matlab interfacing with NI products? I couldn't find any but it would be great if someone could point me to it.

 

 

 

 

0 Kudos
Message 5 of 6
(4,339 Views)

Hello again,

 

I don't know of a forum like that on ni.com. Generally the forums on this site refer to NI product lines. If you need help with a third party's software you may want to try their site and see what community forums they have available. 

Miles G.
National Instruments
Staff Applications Engineering Specialist
0 Kudos
Message 6 of 6
(4,323 Views)