PIC Microcontrollers: Know It All

Chapter 5: Building Assembler Programs

Overview

In Chapter 4 the basic rules of assembler programming were introduced, along with some of the instructions from the PIC 16 Series instruction set. It's as if we have now learned some introductory skills in bricklaying. We need to develop those skills further, but we need to begin to think about the structures that the bricks are going to be built into. Therefore, we now need to develop this introductory knowledge so that we can actually build up programs that have structure, and are functional and reliable.

In this chapter you will learn about:

  • How to visualize a program and represent it diagrammatically

  • How to use subroutines

  • How to implement delays

  • How to use look-up tables

  • Logical and arithmetic instructions

  • How to simplify and optimize assembler programming

  • More advanced features of software simulators.

5.1 The Main Idea Building Structured Programs

When we actually design a program that is to do anything more than some minimalist task, it is important to think about and plan its structure before starting to write the code. This is especially true in assembler Chapter 4 warned that one of the problems of assembler programming was that it leads to unstructured "spaghetti" programs. Therefore, we must consider means of representing the program diagrammatically. Let us consider how we might do this, with two examples of commonplace domestic products.

5.1.1 Flow Diagrams

A well-established diagramming technique is the flow diagram. While this has many symbols that can be used, we can develop good flow diagrams with just...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Robot Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.