You are on page 1of 3

_____________________________________________________________________

DUBLIN INSTITUTE OF TECHNOLOGY


In Collaboration with

THE INSTITUTE OF FINANCE MANAGEMENT DAR ES SALAAM


_____________

BSc Computer Science


Year II
_____________

Assignment LAB 2 _____________

TECH 2102: MICROPROCESSOR SYSTEM

LECTURER

NAME: REG NO:

LAB 2 EXPERMENT REPORT


1. Run the program for Lab 2 and identify which bits are used to control the individual segments in each digit.

BIT NUMBER

ASSOCIATED SEGMENT

Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7

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

void DisplayInt (int16_t IntValue) { uint8_t i; // Index for LCD array

uint32_t BCDValue; enum {plus, minus} sign; if ((IntValue >= 0)&&(IntValue=<999999)) { sign = plus; } else { sign = minus; IntValue = IntValue; } }

You might also like