https://pi-ada-tutorial.sourceforge.io/pico_ada_c09_ad_converter
Author:GPL-3.0-or-later
Version:1.9.0
Alire CI: Dependencies:No dependents.
Badge:
Chapter 9 - AD Converter
Ada rewrite of the Freenove “AD Converter” lesson for the Raspberry Pi Pico.
The sketch on GP26 (ADC0) prints three representations of the same potentiometer on one UART line:
RP.ADC.Analog_Value - the 12-bit code (0 .. 4095)RP.ADC.Microvolts - that code scaled by the HAL with a FloatPico.Analog.Input.Volts - a 32-bit ordinary fixed-point subtype
(delta 0.1 mV, 'Small => 2**(-16)), converted from the count
by multiply-first / divide-secondThe chapter is the notes I needed before that line made sense:
Volts'First and Volts'Last.Free_Running plus a 2 Hz Put_Line leaves stale samples in the
FIFO. The sketch uses One_Shot.Sketch_09_1_ADC is No_Return under the Jorvik profile. The
handler logs on Ada.Text_IO and re-raises; the embedded runtime
then halts. Fine for a sample you reset with BOOTSEL. SPARK would
want an outer loop instead.Built against rp2040_hal / the Pico BSP. Watch the UART with
CoolTerm (or any 115200 8N1 terminal).
Read the full tutorial at Chapter 9 - AD Converter: three ways to read a voltage, GNATdoc documentation, SourceForge repository