Sunday, September 13, 2015

Working on MD code a bit

Well,  I worked on my detector coding a bit this weekend.  Finally.

Using the Teensy is pretty fun, I will have to admit.

In less than a page of code, I had the PWM set up for the TX pulse at the frequency and duty cycle I wanted, and I then had the interrupt service routine set up to sample with the A to D, after the end of the TX pulse.

I really like the libraries available for the Teensy.  Even though it's still Arduino sketch coding, it can do what a  normal Arduino just can't.

I have the main sample pulse at 15uS past the end of the 50uS TX pulse.  I then delay 20uS past the end of the main sample pulse, and sample again for the Ground balance sample and average the two before exiting the ISR.

All in one page of code.

No setting up ISR registers, no setting up A/D, no setting up PWM, other than a few simple defines.

Screenshot of TX pulse, Main Sample, and Ground balance sample.

No comments: