Hello Steve,
Your code has basically the right idea. I started with the histogram data and wrote a new vi around it that processes it correctly. Also, I had to chop off a bunch of points at the ends because the source wasn't covering the whole ADC range nicely. If you think about what a triangle wave goes through when it reverses direction then you understand why there are nonlinearities there. You typically want the triangle wave to clip just above the input limits of the DAQ board.
Run the VI and you can see, the DNL actually looks okay with correct processing, typically less than .4 LSBs of error, which is decent. Those same spikes are still buried in there, but it's okay to get an extra 100 hits in a particular bin if the average number of hits
is 1000 (that corresponds to a DNL of only +0.1). I've also computed the INL, and here I can clearly see the effects of a very poor triangle wave source. The INL line should be flat, but instead there's the classic s-shape that all circuits eventually succumb to when they get near their limits.
I hope this helps!
Matthew C
Applications Engineer
National Instruments