Reading analog inputs on Teensy 4.0

Driessens_nl

New member
I try to read a external voltage applied to the teensy on input A0 to A3.
This voltage (0 to 3v) is applied to the Teensy with a 18kOhm series resistor. Now i've noticed that when the input voltage drops below approx 1,8 volt the teensy impedance drops also. Resulting that the voltage of 1,8volt in front of the series resistor will show approx 1,5v on the analog input pin.
What could cause this ? and how to solve.
The analog input pins are in default state and only used with analogread function.
 
C:
void setup() {
  int i;

  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(57600);
  Serial2.begin(1000000,SERIAL_8N1);
  MyTimer.begin(MilliSec,1000);
  while( syscnt < 1000) ;
  Serial.println("Profsync started V1.0");
  Serial.println("Performing zero calibration");
  i = 0;
  Pmax = 0;
  while( i < 1000) {
    delay(1);
    Pmax = Pmax + analogRead(A0)+analogRead(A1)+analogRead(A2)+analogRead(A3);
    i++;
  }
  Pmax = Pmax / 4000;
  Pmin = 100;
  Serial.print("Pmax is: ");
  Serial.println(Pmax);
  Serial.print("Pmin is: ");
  Serial.println(Pmin);
  // while (!Serial) ;

}
This a part of the code. In the rest there is only a analogRead on the analog pins.
I have to look in to INPUT_DISABLE and how this is used.
 
Back
Top