It works!!!
Just love these moments. Especially when they are two hours before my
holiday starts.
What?
Change detection in Java, with a PCI6527 card. All they way up into my
application
Our lessons learned:
- The change detection interval starts at 20us, if you don't use a filter.
We need about 200us, so that's well within limits. Too bad figure 4-2 in
the 6527 user manual suggests an accuracy of at least 100ns.
- There is no room to add custom hardware components in a SCB100, on data
lines 25 to 50. This means that if you want to monitor more than 12 signals,
each using custom hardware (for example, a zener to configure the voltage
level at which a change detection is to be sent), the SCB100 accessoiry will
give you a challenge you'd rather not havet.
- In the call to DIG_Change_Message_Config, the callbackAddr is an u32.
This requires an (ugly) cast from a void* to a u32. It's ugly, but it
works correctly.
- When change detection is running while you close the application, if
you get a callback somewhere during this exit, Windows NT 4.0 gives you
a nice blue screen. Solution: stop change detection before you exit your
application.
- The interface with java works perfectly, using JNI on top of NI-Daq.
The callback-side writes its data into a buffer, wakes up a thread from
the java environment and returns from the callback method.
The thread from the java environment makes a JNI callback, which results
in an event sent to registered listeners.
The buffer flows over if we generate callbacks continuously at a rate of
faster than once every 5ms. This does not occur in our situation (only
if we start playing with a function generator, but that's not the regular
kind
of usage).
Conclusions:
- An expensive 6533 card or other card with an onboard processor is not
always neccessary. Change detection works even for relatively short
pulses (for safety, say 100us).
- Java on top of Ni-Daq works great! You're definitely not restricted to
LabView or C. Just keep ignoring NI people trying to convince you to
use Labview, because C is an ugly language, and you will end up with
a great program.
- (one week later) never expect the proxy to work if you're about to take
a
holiday...