Question: 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

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

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 Databases Questions!