A20 LRADC - Where are the pins? To much input voltage! How much to destroy it?

Started by NewBieGermany, February 10, 2015, 07:28:53 PM

Previous topic - Next topic

jmyreen

Well, some people may find an increment and a shift less complex than a floating point multiply. Especially if you don't want a floating point result.  :)

JohnS

Quote from: dave-at-axon on February 13, 2015, 06:17:42 PM
I often wonder why some folks use complex formula to get the result.

A simple data * 0.003125 would get the same result.

:)
Magic numbers are usually bad, however they're written.

The compiler will sort it all out, so best write it clearly.

John

dave-at-axon

True, the compiler can sort it out. I was just making comment about the complex one shown as a sample  :P

In my own defence :) and as you said John, I usually create a #define for the calculation and let the compiler sort out the final value.


NewBieGermany

Thanks a lot for all the comments!  :)

Well, I use two resistors to do a voltage devider so the voltage level is ok.

I figured out that LRADC1 is on PIN 39 of GPIO1 and LRADC0 is connected to several buttons not used with a the debian system (if android is used). I used the LRADC1.

With the register base adress LRADC and the offsets of the LRADC_CTRL and LRADC_DATA1 I could configure them using:

void *memcpy(void* addressDest, const void* addressSource, size_t n)

Unfortunately I can't make any sense on the data read on LRADC_DATA1.
Maybe someone has an idea what to check? Do I have to export the the port?

The resolution of the sensor is ok for me.

Thanks to all!