Material: . Atmel Studio 7 Analog Discovery Kit ATmega328P Xplained Mini Board (
ID: 3607017 • Letter: M
Question
Material: . Atmel Studio 7 Analog Discovery Kit ATmega328P Xplained Mini Board (or replacement 328P development board) 7-segment Display Breakout Board e · Phase 2 Add the push button to your code for Phase 1. This means incorporating pin change interrupts to detect a press of the button. Every time the button is pressed, increment the value in NUM 2 DISP by one. Remember that the pin change interrupt will fire twice for the press and release of the button, so only increment once per press and release. At the completion of phase two you will have the timer interrupts performing TDM, and the push button triggering an ISR.Explanation / Answer
int
main (int argc, char **argv)
{
while (1){
int childPid;
char * cmdLine;
printPrompt();
cmdLine= readCommandLine(); //or GNU readline("");
cmd = parseCommand(cmdLine);
record command in history list (GNU readline history ?)
if ( isBuiltInCommand(cmd)){
executeBuiltInCommand(cmd);
} else {
childPid = fork();
if (childPid == 0){
executeCommand(cmd); //calls execvp
} else {
if (isBackgroundJob(cmd)){
record in list of background jobs
} else {
waitpid (childPid);
}
}
}
}
For your requirement the above code is solution.