Question: Description: - This program uses macro functions definitions to set, clear, toggle and check a bit in position n of a given PORT. Inputs: -
Description: This program uses macro functions definitions to set, clear, toggle and check a bit in position n of a given PORT. Inputs: None Outputs: outputs on PORTB ie RB RB Instructions: Create a function macro for setting, clearing, toggling and checking a particular bit of a PORT. Eg #define setbitport bitn #define clearbitport bitn #define togglebitport bitn #define checkbitport bitn where, bitn ie bits to in a PORT Inside main call the four macro definitions above inside a continuous loop, on PORTB, to test the operation of each marco. Insert a programmable delay, with a default value of mSec, between each marco call to see if each macro operates correctly by observing the LEDs turning onoff Ensure to clear PORTB before entering the continuous loop. Use the following sequence inside a continuous loop:
Set PORTB Bit Delay Set PORTB Bit Delay Clear PORTB Bit Delay Toggle PORTB Bit Delay Toggle PORTB Bit Delay If PORTB BIT is set then set PORTB Bit else clear PORTB Bit Delay
Add comments to your code marks lost for no comments Ensure all code is properly indented ie marks lost for no indentation
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
