Answered step by step
Verified Expert Solution
Question
1 Approved Answer
TOPIC: 8. PIC MICRO CONTROLLER 8.1 READING A SWITCH WITH PORT A AND DRIVING LEDs ON PORT B OBJECTIVE: Reading a switch that are connected
TOPIC: 8. PIC MICRO CONTROLLER 8.1 READING A SWITCH WITH PORT A AND DRIVING LEDs ON PORT B OBJECTIVE: Reading a switch that are connected to port A and display the input value on LEDs using the same port A of the microcontroller. REFERENCE: Notes on the PIC micro controller COMPONENTS: None EQUIPMENT: Development board INSTRUCTIONS: 1. Use the two switches that are connected to port A, inputs RA2 and RA4. 2. Use the two LEDs that are connected to port A, output lines RAO and RAI. 3. Write a program where the two switches at RA2 and RA4 are read and then displayed on the LEDs connected to RAO and RAI. The switch at RA2 must be displayed at the LED at port RAO and the switch at RA4 must be displayed at the LED at port RAI. 4. When you finished writing the code using the editor, make sure that the program is saved on your stiffy with the name: PORTI.ASM 5. Show your circuit design for the practical on the given page. QUESTIONS: (a) Which registers did you have to initialize for the input and output ports? (b) Explain what happens when the switch condition changes from a 0 to a 1. (c) Were any flags set in the operation of the program? What flags were affected? (d) Show the flow diagram for the program. (e) Show your program listing with comments. (f) Calculate the current through the LED with a series resistor of 100 ohm. TOPIC: 8. PIC MICRO CONTROLLER 8.1 READING A SWITCH WITH PORT A AND DRIVING LEDs ON PORT B OBJECTIVE: Reading a switch that are connected to port A and display the input value on LEDs using the same port A of the microcontroller. REFERENCE: Notes on the PIC micro controller COMPONENTS: None EQUIPMENT: Development board INSTRUCTIONS: 1. Use the two switches that are connected to port A, inputs RA2 and RA4. 2. Use the two LEDs that are connected to port A, output lines RAO and RAI. 3. Write a program where the two switches at RA2 and RA4 are read and then displayed on the LEDs connected to RAO and RAI. The switch at RA2 must be displayed at the LED at port RAO and the switch at RA4 must be displayed at the LED at port RAI. 4. When you finished writing the code using the editor, make sure that the program is saved on your stiffy with the name: PORTI.ASM 5. Show your circuit design for the practical on the given page. QUESTIONS: (a) Which registers did you have to initialize for the input and output ports? (b) Explain what happens when the switch condition changes from a 0 to a 1. (c) Were any flags set in the operation of the program? What flags were affected? (d) Show the flow diagram for the program. (e) Show your program listing with comments. (f) Calculate the current through the LED with a series resistor of 100 ohm
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