Question: LED _ Functions Description: - This program uses functions to call the first three exercises ( EX 1 _ 1 ; EX _ 2 ;

LED_Functions
Description:- This program uses functions to call the first three exercises (EX1_1; EX_2; EX_3) and passes an argument called "repeat" to control how many times each pattern repeats.
Inputs:- None
Outputs:-8 outputs on PORTB (i.e. RB7\(\rightarrow \) RB0)
Instructions:-
1. Create a programmable delay as a macro:-
E.g.\#define DELAY 100
2. Create a max count parameter as a macro:-
E.g.\#define MAX_COUNT 16
3. Create three functions (below main()) with the function headers below and use the code inside exercises EX1_1...; EX_2...; EX_3... respectively for each of the functions. The macros defined above are used as decribed in exercises EX1_1...; EX_2...; EX_3...
void blink_leds(unsigned char repeat);
void bin_count_leds(unsigned char repeat);
void strobe_left_leds(unsigned char repeat):
repeat refers to the number of times the sequence repeats
Note:- You will need to add functionality to each function to allow the sequence to repeat the requested number of times when called from main(0.
4. Create three local variables within main 0 that allows each of the first three exercises to repeat the requested number of times:-
Example:-
unsigned char num_blink_leds \(=5\);
unsigned char num_binary_leds \(=2\);
unsigned char num_strobe_leds =3;
5. After calling the three functions inside main with the requested number of repeats, the sequence repeats continuosly (i.e. EX1_1...; EX_2...; EX_3... ; EX1_1;.....)
6. Add comments to your code (marks lost for no comments).
7. Ensure all code is properly indented (i.e. marks lost for no indentation).
Project Name:-\(\cdot \)-_ LED_Blink
Description:- This program turns on/off LEDs connected to PORTB as shown below. There should be a programmable delay (in mSec ) between both LED patternsturning on/off.
Inputs:- None
Outputs:-8 outputs on PORTB (i.e. RB7\(\rightarrow \) RB0)
In the program, create a programmable delay as a macro:E.g.\#define DELAY 100
Choose your preferred method of creating a delay.
Updating the delay macro constant. (i.e.100 to 500) will update the delay in mSec .
Toggle the bits from one state to the other (i.e. using either \(\sim \) or \(\wedge \) operators)
Add comments to your code (marks lost for no comments).
Ensure all code is properly indented (i.e. marks lost for no indentation).
). Ensure that the project builds in MPLABx wihout any errors.
Project Nar
LED_Strobe_Left
Description:- This program turns all LEDs connected to PORTB in the sequence shown below (i.e.\(\mathrm{RB}0\rightarrow \mathrm{RB}1\rightarrow \mathrm{RB}2\rightarrow \ldots \mathrm{RB}7\)). The sequence continually repeats and there should be a programmable delay (in mSec ) between each LED turning on.
Inputs:- None
Outputs:-8 outputs on PORTB (i.e. RB7\(\rightarrow \) RBO)
Instructions:-
1. Create a programmable delay as a macro:-
2. Use the left shift operator (i.e \(\)) to manipulate the bit pattern to turn on the LEDs.
3. Add comments to your code (marks lost for no comments).
4. Ensure all code is properly indented (i.e. marks lost for no indentation).
LED _ Functions Description: - This program uses

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!