Page 1 of 1

Analg read

Posted: Tue Dec 20, 2022 2:35 pm
by Amrat
I set potentiometer connect to A0 with GETBYTE and decision IF Getbyte>128 LED TurnON

When simulate its is OK but when to compile to target, LED always turn on ???

Someone please explain

Thanks
Amrat

Re: Analg read

Posted: Tue Dec 20, 2022 3:08 pm
by medelec35
Hi
An issue like that is when the potentiometer VRef voltage properties is set to vref+ instead VDD and Vref+ pin is left floating.
If that is not the case can you post your project file that has extension .fcfx

Re: Analg read

Posted: Wed Dec 21, 2022 1:29 am
by Amrat
Hi Martin,

Thanks for your reply. About set parameter Vref I confused as no explanation on Wiki. Will you please send sample base on my fcfx file ? then I will understand.
Thanks in advance
Attached is simple file I do test.

Thanks again
Amrat

Re: Analg read

Posted: Wed Dec 21, 2022 8:18 am
by medelec35
Hello.
I have modified your project by changing Vref option from the default AREF to AVCC.
Changing Vref option.png
Changing Vref option.png (78.27 KiB) Viewed 1816 times
Additionally, I have increased the conversion speed to Fosc/128 for extra stability.

I have also added a note on wiki for each potentiometer.

Re: Analg read

Posted: Sun Dec 25, 2022 11:19 am
by Amrat
Hi Martin,

Again need some advice.

How to program to read Analog Voltage of Microphone ? as in component libraries have no mic !!

Thanks in Advance
Best rgds
Amrat

Re: Analg read

Posted: Sun Dec 25, 2022 8:08 pm
by chipfryer27
Hi

It depends on your application.

There is a component to measure strength of background sound levels, but if you are looking to record your voice or such like then things get a little more complicated and component speeds are critical to success.

Generally speaking you would need to take a reading (sample) at twice the highest frequency you wish to capture. As an example, analogue telephones have a bandwidth of 4KHz (being 300 - 3400Hz + gaps) therefore we would need to sample at 8KHz to stand a reasonable chance of recording / transmitting recognisable speech.

Whilst that works out at a sample every 125uS you have to take the time taken to actually sample and store / do something with the sample into consideration too.

Regards