• Microchip header file title line is too long in this format.
• List f ile print for standard P16F877A include f ile is suppressed
(398 lines).
• Port B initialisation include file path is not specified, uses default ().
• Delay macro does not need to be skipped in program execution.
• Special instruction BNZ is used in delay macro.
• Text substitution is used for input testing.
• Macro expansion is indicated by ‘M’ instead of line number.
• END is the only essential assembler directive.
• Warnings and messages are suppressed.
• Memory map and symbol list are suppressed.
In order to keep the sample programs, provided later, on interfacing as easy to understand as possible, most of these assembler options are to be avoided. Once the essentials of the assembly language have been mastered, the more powerful features of the assembler can be incorporated in your applications, based on a close study of the description of the PIC assembler directives given the help files provided with MPLAB.
Software Design
When the principles of assembly language programming are reasonably well understood, methods of software design need to be considered. This involves taking the program specif ication and working out how to construct the program; a design method is needed to outline the program structure and logic.
The language to be used to write the program will influence how this is done. The main alternative to assembly language is ‘C’, which has a more user- friendly syntax than assembler. It uses functions to represent blocks of assem- bly language; the C compiler converts source code functions and statements into the pre-defined machine code blocks. The component functions may read- ily be compiled in a library (collection of commonly used functions) or written by the user.
A C program can be best represented by pseudocode, a program description using structured text statements. By contrast, assembly language is more con- veniently represented by flowcharts, especially for learning purposes, as it is a graphical design aid. More complex programs can be represented by struc- ture charts. To illustrate the use of these techniques, we will analyse program BIN4.