Teensy 3.6 DAC0 spike on startup

Status
Not open for further replies.

George1

Active member
Hi,

I am playing with the DAC on Teensy 3.6 and I notice that there is a spike in the reading after the Teensy is reprogrammed for about 1-2 seconds. I am using DAC0 to control a big DC blower and this results in a very high current draw on startup after I reprogram the micro-controller. Below is a simplified version of the code the exhibits the problem. Once the program is running inside the main loop it is all fine.

Please let me know if you have any idea of how this might be fixed.

Thanks

Code:
void setup() {
  //set DAC resolution
  analogWriteResolution(12);
  // Set DAC0 to zero
  analogWrite(A21, 0);
}

void loop() {

  //generate step function
  for (int i = 0; i < 100; i++) {

    analogWrite(A21, 20 * i);
    delay(100);

  }

  // Set DAC0 to zero 
  analogWrite(A21, 0);
  delay(10000);

}
 
Status
Not open for further replies.
Back
Top