Go Down

Topic: About pins ... (Read 18050 times) previous topic - next topic

Jiggy-Ninja

Do not throw your Arduino out just yet.

Remove all wires from your Mega and upload this sketch. This connects the ADC to two internal signals (GND and the 1.1V bandgap reference) and reads them. It should print out 0 and 161 (give or take a few) to the Serial monitor. If you still get 512-ish with this sketch, your chip is broken. If you get the expected values, your ADC is fine and the external circuit is most likely faulty.
Code: [Select]
#include "wiring_private.h"

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
 
  ADMUX = 0x40 + B011111;
  sbi(ADCSRA, ADSC);

  while(bit_is_set(ADCSRA, ADSC));

  Serial.println(ADC);

  ADMUX = 0x40 + B011110;
  sbi(ADCSRA, ADSC);

  while(bit_is_set(ADCSRA, ADSC));

  Serial.println(ADC);
}

void loop() {
  // put your main code here, to run repeatedly:
 
}

EasyGoing1

It should print out 0 and 161 (give or take a few) to the Serial monitor.
Nope, it gives me 0 and 512

:-(

If you get the expected values, your ADC is fine and the external circuit is most likely faulty.
Well, since I wasn't actually using a circuit to do my tests (I had a scope plugged directly into the port), I had little hope that I would get a good reading with your sketch.

I suppose there is no way to simply repair this board?  Perhaps replacing the main chip would be cheaper than purchasing a new board?

Thank you for your help.

Mike Sims
Mike Sims

Jiggy-Ninja

#17
Feb 01, 2017, 07:25 pm Last Edit: Feb 01, 2017, 07:26 pm by Jiggy-Ninja
Nope, it gives me 0 and 512
Well that's unfortunate.

Quote
:-(
Well, since I wasn't actually using a circuit to do my tests (I had a scope plugged directly into the port), I had little hope that I would get a good reading with your sketch.

I suppose there is no way to simply repair this board?  Perhaps replacing the main chip would be cheaper than purchasing a new board?

Thank you for your help.

Mike Sims
Do you have a second Arduino that you can use to flash the new chip with the bootloader? If you do, and you think you can handle replacing a 100 pin TQFP, then by all means go for it. :)

Go Up