Can not read the ADC at Attiny84

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Xbeejunior
Posts: 8
Joined: Tue Dec 10, 2013 9:32 am
Has thanked: 1 time
Contact:

Can not read the ADC at Attiny84

Postby Xbeejunior » Sat Sep 07, 2019 3:49 pm

Hi Team,
I'm trying to read a voltage on the ADC port of Attiny84, I've already tried all possible settings, but to no avail, I get only the "0" on LCD!
It works in the simulation......I think I get the ADC simply not switched !?

With an Attiny85 has it ever worked, at a certain voltage, I turned on a port, only to read on an LCD has too few ports.

I'm grateful for every tip!

Greetings
Ralf

User avatar
Benj
Matrix Staff
Posts: 14157
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4330 times
Been thanked: 4080 times
Contact:

Re: Can not read the ADC at Attiny84

Postby Benj » Wed Sep 11, 2019 10:20 am

Hello Ralf,

Just looking into this for you and the ADC code looks ok.

One thing I spotted is that there is a digital input disable register mentioned in the datasheet. It doesn't say it is required to be set for ADC conversion but it's work a go.

Code: Select all

DIDR0 = 0x3F;  //Disable Digital Inputs


Code: Select all

DIDR0 = 0x00;  //Enable Digital Inputs


Let us know if this helps and if so I will add the code to the ADC component.

Xbeejunior
Posts: 8
Joined: Tue Dec 10, 2013 9:32 am
Has thanked: 1 time
Contact:

Re: Can not read the ADC at Attiny84

Postby Xbeejunior » Thu Sep 12, 2019 12:08 pm

Hello Benj,
thanks for your support :)

As I have inserted it in the attached test program, it does not work either! I only get a short "3" displayed when I declare GetByte in the component, I do that with GetInt I get the short "15" displayed!

I try to evaluate the voltage on an ADXL335 module, the measured voltage of an axis in the basic position is at 1.8V ......

I'm looking forward to more ideas and I'm curious what stupid mistakes I currently make :D

Thanks again
Attachments
ADC and LCD Test Attiny84.fcfx
(19.69 KiB) Downloaded 6 times