Hello Ian, Ian Jefferson writes:
> Question: > > I found this: > http://amforth.sourceforge.net/TG/recipes/Arduino-Analog.html > > Is this current? I could not find the code referenced in the article. > > I did find in ewlib (Erich?) adc.fs and the adc.frt in the butterfly app > but both of those have a wait adc which I would think contradicts the > instructions in the recipe to sleep 50ms. The wait for bit ADSC to clear is straight from the datasheet: A single conversion is started by writing a logical one to the ADC Start Conversion bit, ADSC. This bit stays high as long as the conversion is in progress and will be cleared by hardware when the conversion is completed. ... Alternately ADC can issue an interrupt upon completion of a conversion. The 50 ms thing is maybe to keep things simple and may be sufficient in a lot of applications. I also briefly looked at adc.fs. Nothing did strike me as possibly broken in recent versions of AmForth, except for adding "decimal" at the front of the file, just in case. However, the code can be considered as "hard coded stuff". For example: Instead of writing : +adc ( -- ) \ result left adusted [ 1 5 lshift \ ADLAR ] literal ADMUX c! ... ; I would probably today write something like : +adc ( -- ) \ result left adjusted ADMUX_ADLAR ADMUX c! ... ; where $20 constant ADMUX_ADLAR had to be taken from trunk/avr8/devices/atmega32/atmega32.frt or similar. And even this is far away from "general" or "elegant". But for learning Forth with microcontrollers imho it is perfectly ok to spell out register settings like above. Cheers, Erich ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel