Re: [Flashforth-devel] A-D
Brought to you by:
oh2aun
From: GRAHAM B. <gw...@bi...> - 2015-03-19 06:23:42
|
David - many thanks - I had not picked up on the prescaler - the a-d's are now working. I have read pages 275 to 295 repeatedly but did not realise the need to set the prescaler. It is there very clearly when you know what to look for. Hard to get good help these days!!!!!!!!!!!!!!!!!! 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 On 3/19/2015 2:43 PM, David Schweizer wrote: > I'm a rank beginner with both Forth and Atmel processors, but I hacked > and thrashed my way through to produce the four attached files that do > work (on an Arduino R3 with FlashForth). > > There's no good reason the code is spread over four files... > > --dls > > > On Wed, Mar 18, 2015 at 8:55 PM, GRAHAM BOYD <gw...@bi... > <mailto:gw...@bi...>> wrote: > > 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 <http://www.geosol.com.au> > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel > Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your > hub for all > things parallel software development, from weekly thought > leadership blogs to > news, videos, case studies, tutorials and more. Take a look and > join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > <mailto:Fla...@li...> > https://lists.sourceforge.net/lists/listinfo/flashforth-devel > > |