Problem 3. (10 pts) (7-segment display): Write an ARM program as follows. A comm
ID: 3746777 • Letter: P
Question
Problem 3. (10 pts) (7-segment display): Write an ARM program as follows. A commonly used output device in digital systems is a seven-segment display, depicted below. The device consists of seven independent segments which can be illuminated by applying electrical signals to them. Assume that cach segment is illuminated when a logic value HIGH is applied to it. The figure shows the bit patterns needed to display numbers 0 to F. Write a program that displays the number represented by a byte value stored in memory location DIGIT at address 0x800. Assume that the display has an IO interface consisting of an cight-bi data register, SEVEN, where the segments a to g are connected to bits SEVEN 6 0. Let the bit SEVEN7 be equal to 0 Also, assume that the address of register SEVEN is 0x4030 TABLEI Truth Table for the Hexadecimal Display Individual segments Display 300 n each RBO RDS RD4 RD3 RD2 RDI RDO common cathodeExplanation / Answer
#include<LPC21XX.H> // header file for lpc2148
void delay(); // delay function
unsigned int i,j,k; // globle variable
unsigned int ar[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90 }; // array data
int main()
{
PINSEL0=0X00000000; // select port0 as gpio mode
IO0DIR =0X000000FF; // make starting 8 pin as output and other as input of port0
while(1)
{
for(i=0;i<10;i++)
{
IO0SET =ar[i];
delay();
IO0CLR =ar[i];
}
}
return 0;
}
void delay()
{
for(j=0;j<1000;j++)
for(k=0;k<400;k++);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.