Hello vitaly,
I am posting a new answer to your original question because it is independent of my first answer. After looking more closely at what you were actually trying to do, I realized that the answer is not as simple as I proposed before.
The ErrorEventMask is a mask that tells Visual Basic when it is possible to produce events (especially error events). This is the allowed context for events. You can set the value of the mask such that VB will allow events to be produced when you are configuring, starting, or reading data, or any combination of those.
However this does not add any new events to those that already exist on the control.
To illustrate, there are several errors that could occur during the configuration of an analog input acquisition. If the event mask is set to include the analog input configuration context, then if an error occurs, an event will be generated that notifies you of the event. If the mask does not include analog input configuration, then you would just have to check the returned value in your program to see if any errors occurred.
The answer to your question is that the ErrorEventMask is not quite the thing that you need. If you want to check for input voltages going above your limit, then there are a few ways you could do it.
One is in software: Observe your incoming data and look for flat areas at the top/bottom of your range (you can check your channel input limits programatically). This is the indicator that you have reached the limits.
Another you might be able to do in hardware, though it will be more involved: If you have analog triggering hardware, you could use the analog triggering hardware and create an outside of range trigger. When your signal goes very close to the limits of your range, then you could stop acquisition and reconfigure your input limits.
One more alternative is the same as the hardware analog triggering, except use software analog triggering.
You can find out about the analog (hardware and software) triggering methods on our website. Just search at http://www.ni.com/support for example programs and other documents about it. Additionally, there are example programs included with NI-DAQ that demonstrate analog triggering.
I hope this helps!
Regards,
John Nieri
Applications Engineer
National Instruments