Hello everyone,
I have just published Chapter 9 of the Pi Ada Tutorial:
AD Converter – three ways to read a voltage
This is the Freenove potentiometer lesson in Ada. One sketch on GP26
prints the raw 12-bit code, the HAL’s integer microvolts, and a
fixed-point Volts type from Pico.Analog.Input on the same UART
line.
Highlights:
- AGND / ADC_VREF — filtered analogue pair, not a second isolated
supply. ADC3 (VSYS/3) and ADC4 (the on-chip temperature sensor) never
appear on the header. - The RP2040 ADC has dead zones at both rails. On my board the floor
sits around 19 counts (~15 mV) and the ceiling around 4081. You will
not see0or4095. Pico.Analog.Input.Voltsis a 32-bit ordinary fixed-point subtype
(delta0.1 mV,'Small => 2**(-16)). Conversion is multiply first,
then divide — noFloat.Free_Runningplus a 2 HzPut_Lineleft stale samples in the FIFO.
The sketch usesOne_Shot.No_Returnunder Jorvik: the handler logs and re-raises, the
embedded runtime halts. Fine for a sample you reset with BOOTSEL.
SPARK would want an outer loop instead.
Full write-up:
Alire crate: pico_ada_c09_ad_converter (soon)
Source: https://sourceforge.net/p/pi-ada-tutorial/code/ci/master/tree/
As always, feedback and questions are very welcome.
Cheers,
Martin