Using the ARMSim + Embest plugin produce a program that behaves in the following
ID: 657436 • Letter: U
Question
Using the ARMSim + Embest plugin produce a program that behaves in the following manner:
The Keypad is assumed to be numbered like so:
0 1 2 3
4 5 6 7
8 9 A B
C D E F
The 8 segment display should display the value of the last key pressed, starting out blank.
The LCD should display a single integer, starting out at 255.
Pressing an even-numbered value should add the amount to the value displayed.
Pressing an odd-numbered value should subtract the amount from the value displayed.
Pressing either of the black buttons should cause a reset. The 8-segment display should be blanked and the LCD should display the starting value.
You can assume that the user will never press more than one key or button at a time.
Meeting the above requirements is a bare minimum for the assignment. In order to get full credit, your program should:
have appropriate comments
check for errors
have a readable output
Please submit a single file called "project3.s" to the assignment.
Explanation / Answer
int main(void)
{
int i;
volatile unsigned char * ModeRegister1;
volatile unsigned char * OutputRegister1;
volatile unsigned char * ModeRegister2;
volatile unsigned char * OutputRegister2;
ModeRegister1 = 0xB7A05008;
OutputRegister1 = 0xB7A05000;
ModeRegister2 = 0xB7A03008;
OutputRegister2 = 0xB7A03000;
*ModeRegister1 =0x00FF;
*ModeRegister2 =0x00FF;
while (1)
{
*OutputRegister1 = 0x003F; // Display 0
*OutputRegister2 = 0x0000; // Display 0
for (i=0; i<1000000; i++); //Delay
*OutputRegister1 = 0x0006; // Display 1
*OutputRegister2 = 0x0000; // Display 1
for (i=0; i<1000000; i++); //Delay
*OutputRegister1 = 0x001B; // Display 2
*OutputRegister2 = 0x0008; // Display 2
for (i=0; i<1000000; i++); //Delay
*OutputRegister1 = 0x000F; // Display 3
*OutputRegister2 = 0x0008; // Display 3
for (i=0; i<1000000; i++); //Delay
*OutputRegister1 = 0x0026; // Display 4
*OutputRegister2 = 0x0008; // Display 4
for (i=0; i<1000000; i++); //Delay
*OutputRegister1 = 0x002D; // Display 5
*OutputRegister2 = 0x0008; // Display 5
for (i=0; i<1000000; i++); //Delay
*OutputRegister1 = 0x003D; // Display 6
*OutputRegister2 = 0x0008; // Display 6
for (i=0; i<1000000; i++); //Delay
*OutputRegister1 = 0x0007; // Display 7
*OutputRegister2 = 0x0000; // Display 7
for (i=0; i<1000000; i++); //Delay
*OutputRegister1 = 0x003F; // Display 8
*OutputRegister2 = 0x0008; // Display 8
for (i=0; i<1000000; i++); //Delay
*OutputRegister1 = 0x0027; // Display 9
*OutputRegister2 = 0x0008; // Display 9
for (i=0; i<1000000; i++); //Delay
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.