7 years, 4 months ago.

How do you direct read write to register map

I would like to put a device into continuous conversion mode for the ADC in order to speed it up. Someone suggested directly changing the register that controls this function. I have found the address and bit that control this function. However I do not know the syntax of how to read or write directly to the register map. Can someone provide the code line that would allow to either read or write a register address.

1 Answer

7 years, 4 months ago.

ADC0->SC3 |= ADC_SC3_ADCO_MASK;       // Enable continuous conversion

Here are all of them: http://mbed.org/users/mbed_official/code/mbed-src/file/ae4891ca7084/targets/cmsis/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/MKL46Z4.h

Btw, I remembered you used the KL46, but without that it is a bit of a cryptic question ;)

Accepted Answer

Thank you so much. What I really should have been asking for is the link for the mbed code that controls this stuff. I was actually trying to do this through the datasheet and looking up register addresses. Clearly not the right approach. I am very new to mbed (3 days) so bound to be some dumb issues that I cannot get around. With this code link I should do much better.

posted by Near Margalit 07 Mar 2014

What might also help is: http://mbed.org/users/mbed_official/code/mbed-src/file/ae4891ca7084/targets/hal/TARGET_Freescale/TARGET_KLXX. That is the device specific source for of the mbed lib for the KLxx devices. (A few like SPI are in the target specific folders).

posted by Erik - 07 Mar 2014