From: Nick Steinmetz on
Hi, I'm using the DAQ toolbox and trying to run a callback function for an inputOverrange event, but even when the recorded voltage appears to verifiably exceed the range of the device, no event is generated and the callback is never run. Please help!

-----------
Hardware/software details:
-----------
Matlab R2009a
DAQ toolbox 2.14
NI PCI-MIO-16E-4 with BNC-2120 breakout box

-----------
Code sample:
--------------
aiData = analoginput('nidaq', 'Dev2');
chans = [0 1];
Fs = 10000;
addchannel(aiData, chans);

set (aiData, 'TriggerType', 'Immediate');
set (aiData, 'SampleRate', Fs);
set (aiData, 'SamplesPerTrigger', Inf);

aiData.Channel(2).ChannelName = 'chanName';
aiData.chanName.InputRange = [-10 10];
aiData.chanName.SensorRange = [-10 10];
aiData.chanName.UnitsRange = [-10 10];

aiData.InputOverRangeFcn = @stop;

start(aiData);

-----------
Things I've tried:
-----------
- I have connected a 13.8V DC power supply into the channel in question. When I look at the recorded data, the voltage starts at 0 and when I turn on the power supply it clearly exits the range of the device (i.e. saturates to a value of 10V) until I turn the power source back off. I thought that this would give me the "overrange" event.
- Have tried using my own callback function as well as the one in the code sample (which is the example from the documentation). Not only does the callback not execute, but the data (logged to hard drive and loaded later), shows no events in the "events" struct other than the usual Start, Trigger, and Stop.

Please help! Thank you,

Nick
From: Sherryl Radbil on
Hi Nick,

Since your sensor range is the same as your input range the over range signal is not getting through.
That is, setting InputRange to [-10 10] means your data will never be outside that range. The device simply won’t pass 13.8V back through the NI-DAQmx drivers to MATLAB.

If your SensorRange were set to [-9 9] for example with that InputRange you should get InputOverRange events.

All the best,
Sherryl
From: Nick Steinmetz on
Perfect, that was my problem exactly. It works great now. Thank you, Sherryl!

Nick

"Sherryl Radbil" <sherryl.radbil.dontspamme(a)mathworks.com> wrote in message <i26qfp$kit$1(a)fred.mathworks.com>...
> Hi Nick,
>
> Since your sensor range is the same as your input range the over range signal is not getting through.
> That is, setting InputRange to [-10 10] means your data will never be outside that range. The device simply won&#8217;t pass 13.8V back through the NI-DAQmx drivers to MATLAB.
>
> If your SensorRange were set to [-9 9] for example with that InputRange you should get InputOverRange events.
>
> All the best,
> Sherryl