"

Assembly Language Programming – II

In this module, students will further explore assembly language programming, focusing on the PIC16F18875 microcontroller. This module builds on foundational knowledge and introduces more advanced programming techniques and practical applications. By the end of this module, students will have a thorough understanding of the PIC16F18875 instruction set and the ability to implement complex assembly programs.

Part 1: Introduction to PIC16F18875 Instruction Set

The first part of the instruction set will cover the basic categories of instructions used in the PIC16F18875 microcontroller. Students will learn about:

  • Data Transfer Instructions: Instructions that move data between registers, memory, and I/O ports.
  • Arithmetic Instructions: Instructions that perform arithmetic operations like addition, subtraction, increment, and decrement.
  • Logical Instructions: Instructions that perform bitwise logical operations such as AND, OR, XOR, and complement.
  • Control Instructions: Instructions that manage program flow, including jumps, calls, returns, and resets.
  • Special Instructions: Instructions for specific microcontroller operations, such as sleep, watchdog timer reset, and no operation.

Part 2: Detailed PIC16F18875 Instruction Set and Programming Techniques

The second part of the instruction set will delve deeper into the advanced instructions and their applications. Students will explore:

  • Advanced Data Manipulation: Instructions for more complex data handling and manipulation.
  • Conditional and Unconditional Branching: Detailed use of branching instructions for creating loops and conditional execution.
  • Interrupt Handling: Instructions and techniques for managing interrupts and implementing interrupt service routines.
  • Timing and Delay Instructions: Instructions used for creating precise timing delays, which are essential for various applications.

Part 3: Advanced Instructions and Practical Applications for PIC16F18875 Assembly Programming

In this part, students will learn about the advanced instructions and their practical applications. Topics will include:

  • Rotate and Shift Instructions: Used for bit manipulation, essential in applications such as cryptography and data compression.
  • Bit-Oriented Instructions: Precise control over individual bits in registers, crucial for tasks like setting flags, toggling LEDs, or reading sensor states.
  • Literal and Control Instructions: Immediate data manipulation and controlling the flow of the program.
  • Practical Applications: Implementing delays, reading and writing to I/O ports, using interrupts, and implementing finite state machines.

Part 4: Instruction Set for 16F18875 Specific to Lab Assignments and Video Lectures

This part will focus on the specific instructions and techniques required for the lab assignments and video lectures. Students will learn how to apply the instruction set to real-world scenarios, including:

  • Lab #6: Rotating LED to RIGHT with Consistency: Writing an assembly program to rotate an LED to the right consistently.
  • Lab #7: Rotate LED on Each Button Press: Writing an assembly program to rotate an LED each time a button is pressed.

Lab #6: Rotating LED to RIGHT with Consistency

In this lab assignment, students will write an assembly program to rotate an LED to the right consistently. The lab will cover:

  • Configuring I/O Ports: Setting up the microcontroller ports for LED control.
  • Using Rotate Instructions: Implementing rotate instructions to shift the LED pattern to the right.
  • Creating Delay Routines: Adding delay loops to control the speed of the LED rotation.

Objectives:

  • Understand how to configure I/O ports for LED control.
  • Learn to use rotate instructions for bit manipulation.
  • Gain practical experience in writing and debugging assembly programs with delays.

Lab #7: Rotate LED on Each Button Press

In this lab assignment, students will extend their knowledge by writing an assembly program to rotate an LED each time a button is pressed. The lab will cover:

  • Configuring I/O Ports for Input: Setting up the microcontroller ports to read button presses.
  • Debouncing Button Inputs: Implementing debouncing techniques to avoid false triggering.
  • Using Rotate Instructions: Implementing rotate instructions to shift the LED pattern on each button press.

Objectives:

  • Learn to configure I/O ports for both input and output.
  • Understand the importance of debouncing in reading button inputs.
  • Develop skills in writing assembly programs that respond to external inputs.

License

Icon for the Creative Commons Attribution 4.0 International License

Introduction to Microcontrollers Copyright © 2024 by Lake Washington Institute of Technology is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.