Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Each team is to create and debug a C program to meet the following specifications: 1. decade up/down counter: count up or down from 0
Each team is to create and debug a C program to meet the following specifications: 1. decade up/down counter: count up or down from 0 to 9, and repeat 2. controlled by two switches, S1 and S2 a. S1: start/stop (1-start, 0 stop) b, S2: direction (1 count down, 0 = count up) 3. switch connections on the microcontroller a. S1: I/O port pin PA1 connected to DIO0 on the EEBoard 4. Changing S2 while counting is enabled (S1-1) should change the count direction 5. Display the count value by writing to port pins PC[3:0]. In the laboratory, these 6. Count period is to be approximately 0.5 s b. S2: /O port pin PA2 connected to DIO1 on the EEBoard on the next count change. lines will be connected to four virtual LEDs. Prior to lab, design the C program with a main program, and two separate "functions" as follows. The main program is to initialize port directions and variables, and then execute in an endless loop, calling the delay function, setting the direction variable based on position of switch S2, and calling the counting function if counting is enabled by switch Si * 12 ~ ELEC 3040/3050 Lab Manual Lab 2 Revised 8/20/14 A delay function is to implement a half-second time delay ("do nothing" for about half a second). If time permits, try to get the delay function to be accurate within 10% of the nominal value (0.5 seconds +/-10%), or better A counting function is to increment or decrement the count, according to the setting of a direction variable passed as a parameter from main, and display the new value on the LEDs. The count value is to be a static global variable. *
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started