My application needs 8-bit AnalogIn data. But the existing lib has 16-bit conversion and no 8-bit conversion(I guess). Can anyone help me on this issue?
#include "mbed.h"
AnalogIn x(p20);
int main() {
uint8_t byte = x.read_u16() >> 8; // take most significant 8-bits of sample
}
Thanks,
Simon
Hi Nitin,
Does the following give you what you need?
<<code>>
#include "mbed.h"
AnalogIn x(p20);
int main() {
uint8_t byte = x.read_u16() >> 8; // take most significant 8-bits of sample
}
<</code>>
Thanks,
Simon
Ya ultimately I have to try your suggestion. But is there a way to get 8-bit ADC without consuming extra CPU clocks? I am trying to build a oscillscope using mbed and a color lcd. So I cant consume more CPU clocks and do plotting of waveform at the earliest! What might be the maximum ADC speed? 200kHz?
Even at maximum ADC speed you don't have to worry about comsuming some extra CPU clocks.
Important Information for this Arm website
This site uses cookies to store information on your computer.
By continuing to use our site, you consent to our cookies.
If you are not happy with the use of these cookies, please review our
Cookie Policy
to learn how they can be disabled.
By disabling cookies, some features of the site will not work.
Access Warning
You do not have the correct permissions to perform this operation.
Hello everyone,
My application needs 8-bit AnalogIn data. But the existing lib has 16-bit conversion and no 8-bit conversion(I guess). Can anyone help me on this issue?
Thanks
Nitin