Hi all, I'm trying to use the DAC on a Teensy 3.1 to generate a pulse train at a desired frequency, amplitude and pule duration to control a laser driver that modulates based on an applied analogue voltage (technically this requires 0-5V, but I'll deal with that later). In the attached code, the user inputs these parameters over a serial line, and then types 'GO' to initiate the sequence. Pulses are then output, terminated by a brief ramp down at the end of each. This works well, except for the amplitude of the pulse, which given a user selected value between 0~1 should scale the 12bit DAC between 0~4095, and be output as 0~3.3V on A14. The proportional scaling works using the method, but the DAC won't output more than ~0.25V. I've tried various options to change Vref, and don't think it's a (int) casting or 'map' issue as printing amp_ (the 0~4095 scaled integer amplitude) value to the serial comes up correct. Am I missing something? How can I get a full 0~3.3V output on the DAC? The Teensy is powered over USB.
Many thanks for any insight/advice!
Cheers,
Aleks
Many thanks for any insight/advice!
Cheers,
Aleks