Change the world

Control Software

Download: Examples - Analog.zip

The following example programs are available to demonstrate the basic principles of using the A/D converters:

ex1_analog_leds.c

Example that measures an analog voltage on PA1 (ADC1_IN1) and displays the result on 8 LEDs.

* 8 LEDs connected to PC7 - PC0
* a potentiometer (POT) connected to PA1 (ADC1_IN1 - Analog1 Channel 1)

 

ex2_analog_LM6029ACW.c

Example that measures an analog voltage on PA1 (ADC1_IN1) and displays the result on the LM6029ACW graphics LCD as a 12-bit value (0-4095), as a voltage (0-3.3V), and as a graphics slider.

* a potentiometer (POT) connected to PA1 (ADC1_IN1 - Analog1 Channel 1)
* The LM6029ACW is connected as described in ex1_LM6029ACW_HelloWorld.c

 

ex3_analog_smooth_LM6029ACW.c

The same as ex2_analog_LM6029ACWc, but reads 16 samples, sums them and then calculates the average result and displays this "smoothed" out value.  In the previous example the analog value would jump around a bit due to noise.

* a potentiometer (POT) connected to PA1 (ADC1_IN1 - Analog1 Channel 1)
* The LM6029ACW is connected as described in ex1_LM6029ACW_HelloWorld.c 

 

ex4_analog_2channels_LM6029ACW.c

Example that measures 2 analog voltages on the same ADC module (ADC) and 2 different channels, PA1 (ADC_IN1) and PA2 (ADC_IN2). DMA requests are required to efectively do
simultaneous conversions of multiple channels.

* potentiometers (POTs) connected to:
- PA1 (ADC_IN1 - Analog1 Channel 1)
- PA2 (ADC_IN2 - Analog1 Channel 2) 
* The LM6029ACW is connected as described in ex1_LM6029ACW_HelloWorld.c

 

ex5_analog_6channels_LM6029ACW.c

Example that measures 6 analog voltages, all 6 on ADC1.  DMA requests are required to efectively do simultaneous conversions of multiple channels.

* potentiometers (POTs) connected to:
- PA1 (ADC1_IN1 - Analog1 Channel 1)
- PA2 (ADC1_IN2 - Analog1 Channel 2)
- PA3 (ADC1_IN3 - Analog1 Channel 3)
- PA4 (ADC1_IN4 - Analog1 Channel 4)
- PA5 (ADC1_IN5 - Analog1 Channel 5)
- PA6 (ADC1_IN6 - Analog1 Channel 6)
* The LM6029ACW is connected as described in ex1_LM6029ACW_HelloWorld.c