[Flashforth-devel] A-D
Brought to you by:
oh2aun
|
From: GRAHAM B. <gw...@bi...> - 2015-03-19 03:55:24
|
Mikael - sorry to bother you with this one, but I really do need help
from a higher source.
Attached is simple code designed to do an A-D on channel zero. Only two
registers need to be set (ADMUX,ADCSRA)with one (ADCSRB) left at default.
I have 2.65 volts on AD0 with AREF at 5.01 measured with a voltmeter.
Before initialising A-D system $78 @ returns 0.
Set ADEN to 1. With no interrupt ADIF bit always set, resetting it to
zero and it immediately resets to 1. $78 @ returns 1023. Settting ADSC
bit appears to do nothing.
Setting interrupt and continuous interrupts occur. Again 1023 returned
in the two data registers.
Setting the BG voltage ref as input still returns 1023.
Can change voltage selection using REFS1, REFS0 as per the documentation
and it measures correctly at AREF with a voltmeter.
Same result with two different MEGA boards - so not a faulty board.
Have had great success so far with this Forth - keypad,lcd, GPS, battery
backed clock, SDHC/ micro SDHC all functioning so I am rather surprised
that someting as simple as an A-D conversion failing.
Many thanks - Graham
--
Graham Boyd
Managing Director
Geosolutions Pty. Ltd.
16 Centre Way
Belair, 5052
South Australia
Ph. 61 (0)407 563944
61 (0)8 82786752
www.geosol.com.au
|