Professional Documents
Culture Documents
LECTURER
BIT NUMBER
ASSOCIATED SEGMENT
a b c d e f g dp
2. Complete Table 2 below so that it contain the set of patterns of 1's and 0's required to display any digit on the display. Digit 0 1 2 3 4 5 6 7 8 9 Bit pattern (binary) 0111 1110 0000 0110
0110 1101 0111 1001 0011 0011 0101 1011 0101 1111 0111 0000 0111 1111 0111 1011
Bit pattern (Hex) 0x7E 0x06 0x6D 0x79 0x33 0x5B 0x5F 0x70 0x7F 0x7B
3. Using Table 2 create a lookup table in your program that maps values in the range 0 to 9 to their associated display bit patterns
void displaybitPattern(int Position, char Pattern) { LCDMEM[Position] = Pattern; }
4. Write a displayDigit function with the following C-prototype that can be used to display a digit at any location on the screen. void displayDigit(int Position, int Digit) where Position ranges from 0 to 6 and Digit ranges from 0 to 9
void displayDigit(int Position, int Digit) { static const charDIGITS[]={0x7E,0x06,0x6D,0x79,0x33,0x5B,0x5F,0x70,0x7F,0x7B}; LCDMEM[Position]=DIGITS[Digit]; } 5. Write a displayDecimal function that can be used to display any decimal numer in the range 0 to 999999. Test your function by calling it repeatedly with an ever increasing value.
#define LCDDIGITS 6 // Number of digits in display
uint32_t BCDValue; enum {plus, minus} sign; if ((IntValue >= 0)&&(IntValue=<999999)) { sign = plus; } else { sign = minus; IntValue = IntValue; } }