chipKIT® Development Platform

Inspired by Arduino™

Sensitive Logic Levels? ChipKit32 Max32

Created Sun, 09 Sep 2012 23:34:17 +0000 by giannisa


giannisa

Sun, 09 Sep 2012 23:34:17 +0000

Hello,

I just recently started using the ChipKit32 Max32 after some experience with the Arduino Uno. I am running into an issue where my input pins are detecting logic level "HIGHs" when its left floating. Using a Modified Blink Code:

void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);
  pinMode(8, INPUT);  
}

void loop() {
  if(digitalRead(8) == HIGH) // if pin 8 is HIGH @ 3.3V, oscillate at 1 second
  {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
  }
  else // Oscillate at a quarter second
  {
  digitalWrite(13, HIGH);   // set the LED on
  delay(250);              // wait for a quarter second
  digitalWrite(13, LOW);    // set the LED off
  delay(250);              // wait for a quarter second
  }
}

If left floating, LED oscillates at a 1 second rate; I have to jump Pin 8 to ground just to force the logic level "LOW" in order to get my quarter second oscillations.

Any suggestions/hints would be appreciated,

-Gianni


majenko

Sun, 09 Sep 2012 23:50:46 +0000

Simple: don't let the input float.

A floating input is a bad input and should never be allowed to happen.

Add a pull-down (say 10K) resistor between the input and ground to stop it floating.

Anyway, to answer your actual question, at 3.3v the high threshold is 2.64 volts. That's 0.8*Vdd as detailed in the data sheet.