Lab 1 Introduction to Assembly Programming Language
Lab 1 Introduction to Assembly Programming Language
1. Introduction
In this lab, students will learn how to program the PIC16F877A microcontroller using
assembly language. Through simple tasks such as controlling LEDs, integrating input
signals, and simulating the famous "Knight Rider" LED sequence, you will gain practical
experience with basic microcontroller I/O operations. The tasks are designed to develop
both your understanding and technical skills progressively.
2. Objectives
3. Apparatus
• Connect an LED to any one of the output pins of the microcontroller (e.g. PORTB0).
• Simulate in Proteus: Load the hex file and check if the LED turns on.
Objective: Control the LED based on external inputs such as a push button or toggle
switch.
• Modify the code to turn on the LED only when the button is pressed.
o Use BTFSS (Bit Test File, Skip if Set) instruction to detect button press.
• Simulate in Proteus: Verify the LED turns on when the button is pressed.
Objective: Create a sequential LED pattern using bit-rotating techniques and enhance
control with an input toggle switch.
• Write code to create a Knight Rider effect (LEDs light up one after another in a pattern).
o Use RLF (Rotate Left) or RRF (Rotate Right) instructions to create the
sequence.
• Simulate in Proteus: Ensure the LEDs light up in sequence, creating the Knight Rider
effect.
• Modify the code so the Knight Rider sequence starts only when a toggle switch is
turned ON.
o Use conditional checks with BTFSS or BTFSC instructions.
• Simulate in Proteus: Check that the sequence only starts when the switch is ON.
5. Post-Lab Questions
6. Conclusion
This lab introduces the fundamental principles of controlling hardware using assembly
programming for the PIC16F877A. You will learn about basic output control, input sensing,
and sequence generation using LEDs, which are common tasks in embedded systems
development.