English
Language : 

LPC1000 Datasheet, PDF (66/153 Pages) List of Unclassifed Manufacturers – Learn embedded programming with NXP’s LPC1000 family of Cortex-M0/M3 microcontrollers!
LPCXpresso Experiment Kit - User’s Guide
Page 66
7.9.3 Lab 8c: Control 7-segment Display, cont.
In this experiment you shall present the value on ADC input #0 on one digit in the display. When
turning the trimming potentiometer a value between 0 and 1023 will be read (10 bit resolution). This
value shall be converted to a number between 0 and 9. One obvious conversion is (ADC value / 1024)
* 10. In theory this conversion is correct but since we are working with integer values the term (ADC
value / 1024) will always be 0. By rewriting it as (ADC value * 10) / 1024 the precision will be kept.
Assuming that the calculations are done on 16-bit variables, the calculation of (ADC value * 10) is still
within 16-bits of precision so no overflow will occur.
The translation (ADC value * 10) / 1024 works perfect for presenting the value 0-9. Consider however
how a function to present the value 0-10 would have looked like. Figure 37 present the proposed
conversion function (in black) and a function that would work well for the range 0-10 (in red).
Output value
9
(ADC value * 10) / 1024
1
0
0
Figure 37 – Conversion Function
((ADC value + offset) * 10 /
1024), where
offset = 0.5*1024/10
1023 ADC input value
value
It would be a good program structure to place the conversion function in a separate subroutine.
7.9.4 Lab 8d: Control Dual Digit 7-segment Display
In this experiment you will create a time multiplexed control of the two digits. On the schematic there
are two PNP-transistors to control the anodes of the two digits. A microcontroller output cannot supply
enough current to directly drive the anodes. Therefore the PNP transistors are needed. Pulling the
respective GPIO-pins connected to the base (via series resistors) low will open the transistors and
hence supply current to the anodes.
In this experiment we ignore the shift register control of the segments. Instead we continue using the
direct GPIO control of each segment from the previous experiments. In the following experiment the
shift register will be used.
Copyright 2013 © Embedded Artists AB