$29
This circuit connects a variable voltage to an ADC port on the ARM M0 MCU (Micro Controller Unit). Your software running on the ARM M0 MCU will read the digital value and display the percent and raw value of the voltage, VA.
The interface consists of some analog circuitry, wiring the circuit to the Nuvoton board, and running corresponding software on the ARM M0 MCU.
Figure 1: Input to an A/D converter
Voltage is measured at the output of the Potentiometer (VA). VCC and GND can be obtained from ports on the Nuvoton Nu-LB-NUC140 development board (Nuvoton).
A. Background:
A potentiometer can set a variable that is processed and used by the microprocessor. Typical applications include having the potentiometer represent a volume or level of ambient light, although a potentiometer can set just about any reference signal.
There are two basic styles of potentiometers: audio and linear. Audio potentiometers vary logarithmically as the sense of hearing is logarithmic. Recall, the definition of decibels is: ratio dB = 10 log10(ratio). This lab uses a linear single turn potentiometer.
The potentiometer in Figure 1 is part of an external circuit that provides an input signal to the Nuvoton. The NUC140VE3CN has an eight channel A/D converter connected to Port A on the Nu-LB-NUC140 development board.
B. ADC on the NUC140VE3CN:
The ADC on the M0 chip is a 12-bit A/D converter with an analog input voltage range of 0 to
Vref. For the Nuvoton board Vref is set at 3.3V. There are up to 8 single-end analog input channels and 4 pairs of differential analog input channels for compare functions. The maximum
conversion rate is 600 KHz and the maximum operating frequency is 16MHz. There are three operation modes: single mode, single-cycle mode, and continuous scan mode. The A/D
conversion can be triggered externally or by software. Conversion results are held in dedicated data registers for each channel with valid and overrun indicators. The ADC on the M0 chip is equipped with a digital compare function that can be used to monitor conversion results. Channel 7 on the NUC140VE3CN has 3 possible input sources, an external analog voltage (what we are doing in this lab), the internal bandgap voltage and the output of the temperature sensor on the Nuvoton board. The ADC also has a self-calibration function to minimize the conversion error.
Figure 2: Pin locations for Lab 2
In this lab you will create a program to use the A/D converter to sample and derive a digital value from the A/D port. Your first program should use the single mode operation and the second program use the continuous scan mode operation. In your report discuss the difference in performance, if any. Also compare the results if you include the self-calibration function vs. no calibration.
Note: Each student must conduct the labs by themselves. You are not allowed to copy codes/content or to pair-up with other students to complete the labs. Each student must demonstrate individual tasks (after completion) to the professor and teaching assistant to get the full marks for the demo.
The items on this list will NOT be repeated in the lab write-up but they are necessary for all labs.
NOTE: All the lab reports should be typed and turned in as a hard copy on time (check the syllabus for the due date), and a soft copy should be forwarded to the Teaching Assistant: Srikanth Ramadurgam on the due date and time.
Table 1: Voltage and Percentage of Full
Scale
Figure 3: Table 1
5. Pre-Lab Questions for Lab 2:
Name:___________________________
10 points total. Be sure to include units, as appropriate, with your answers.