View Full Version : AnalogRead extension procedures and THE MISSING MANUAL!?

01-28-2013, 10:12 PM
The Arduino documentation only tells me about analogRead(pinNumber).

In various forum entries here I've seen mention of:

Use of these *seems* obvious, but WHERE IS DOCUMENTATION ON THESE CALLS?

Min/Max resolution? Conversion time implications?

Hopefully, the answer to "where is documentation...." will have lots of stuff beyond analog and answer lots of my questions (digitalReadFast?) which I am gonna shut up regarding now and wait awhile for answers... In other words, I'd really love to RTFM, as soon as I find it! :)

01-28-2013, 11:04 PM
Yes, there needs to be good, accurate and easy to understand documentaton liberally embelished with abundant useful examples.

Meanwhile, consult Chapter 31 Analog-to-Digital Converter (ADC) of the K20 sub family reference manual (http://cache.freescale.com/files/32bit/doc/ref_manual/K20P48M50SF0RM.pdf).

01-28-2013, 11:05 PM
re min-max resolution:

Output modes: differential 16-bit, 13-bit, 11-bit and 9-bit modes, or single-ended 16-bit, 12-bit, 10-bit and 8-bit modes

01-29-2013, 11:19 PM
Thanks. I have looked over the reference, does answer my question and lots more. As to where is the manual, haha!

01-30-2013, 05:44 PM
I've wished for a WIKI where we could all contribute to a manual as we discover things.

How about it, Paul?

01-30-2013, 06:32 PM
"We all" != "Paul"! Poor Paul!

I had the very brief thought yesterday, hey, if I poured over this part of the manual *I* could write some documentation! Then reality hit me. Perhaps in an alternate universe where the phrase "spare time" existed. :)

But Paul, just a LIST of all the known functions, even without descriptions, would be immensely helpful! The names alone may be descriptive enuf, and in any case, given a list of the functions in an given area, I can then go find the code. EG:

THE MISSING MANUAL (and still missing most of its details!):

Additional Analog functions:

Additional Digital I/O functions:

Etc, etc.

I've only been around a couple of days, the above is all I learned about so far because it was where I needed to fix to make my new code compile. I bet there is a huge list of functions I don't know about!

The above are relatively self-evident, and I can search the forum and go look at the code and the full manual to figure out more, like what referenceReference modes other than DEFAULT exist. But just having the above list is a zillion times more helpful than no list! [IMHO]

Perhaps we should start a thread named "What functions [built-in but not in the regular Arduino.cc reference] do you know about?" and collect them. Names only, one-line description optional. If we really want to get ambitions, what about a list of libraries (a) that work on general Arduinos and/or (b) that have been converted or tested on Teensy-3.

Ambition project. I'm good at suggesting projects. That's the easy part. Its the DOING or the finding someone to do that is the hard part!

I'm a newbie here so I don't know if the above is a valuable suggestion or a stupid one or one that's already been done or whatever. FWIW, there it is.

Steven Swift (aka ImmortalSpirit).

01-30-2013, 06:41 PM
I agree with this desire to have some additional documentation (or just names) of the 'hidden' functions. In addtion, as I try to go beyond the bounds of a compatible Arduino environment, I want to change the MCU setup -- timers, clocks etc. I find that I have to constantly check all the other code to reassure myself that if I change (say) the FTM0, I won't disable other functions (e.g. tone()) that I might use.

What I do is grep through the Teensy code (C:\Program Files\arduino-1.0.2\hardware\teensy\cores\teensy3) looking for definitions and implementations of these functions to see where they may interact. I also find that the Freescale manuals (while severly lacking in examples, and some things such as the Inetrrupts NVIC are delegated to ARM's manuals) do document most regsters and at least give hints that help extend the capability.

01-30-2013, 07:02 PM
Technical writing is hard. I do quite a bit for my day job. When using products where documentation is, shall we say, sparse, I usually open a google doc and write whatever I learn. If I don't then two weeks later when I am in the same situation again I can't remember what I did to solve it the first time. There may be lots of us who do that. I hope so...

So if there was a way to post all that to a place where we can all use it, it would be some help. And I am willing to contribute.

I think Teensy (now using ++2, plan to start with 3 soon) is a great product and Paul's support is super. The business model for products like this is tough: free tools and the hardware is inexpensive, so where's the profit? Documentation takes time to do well, so it's easy to see how in much of the Arduino world it gets not enough attention.


01-30-2013, 07:14 PM
That document doesn't include the exact MK20DX128VLH5 part used on the Teensy 3 but I did not read enough to learn the differences. Here is one document which does cover MK20DX128VLH5 http://cache.freescale.com/files/32bit/doc/data_sheet/K20P64M50SF0.pdf

Here is the main product page: http://www.freescale.com/webapp/sps/site/taxonomy.jsp?code=K20_USB_MCU&tid=mKOvp (note freescale.com doesn't seem to display properly in Chrome!)

Here is the correct reference manual: http://cache.freescale.com/files/32bit/doc/ref_manual/K20P64M50SF0RM.pdf?fpsp=1&WT_TYPE=Reference%20Manuals&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=pdf&WT_ASSET=Documentation which is Document Number: K20P64M50SF0RM