Figure 6.10 PIC microcontroller processor block diagram with the STATUS register added.
QR Code JIS X 0510 Decoder In None
Using Barcode Control SDK for Software Control to generate, create, read, scan barcode image in Software applications.
QR Creator In None
Using Barcode maker for Software Control to generate, create QR Code image in Software applications.
THE MICROCHIP PIC MCU PROCESSOR ARCHITECTURE
QR Code ISO/IEC18004 Recognizer In None
Using Barcode reader for Software Control to read, scan read, scan image in Software applications.
Generating Denso QR Bar Code In C#.NET
Using Barcode maker for .NET Control to generate, create QR Code image in VS .NET applications.
QR Code 2d Barcode Creation In .NET
Using Barcode generation for ASP.NET Control to generate, create QR Code JIS X 0510 image in ASP.NET applications.
QR Code JIS X 0510 Creator In .NET Framework
Using Barcode generation for VS .NET Control to generate, create QR Code ISO/IEC18004 image in VS .NET applications.
Earlier in this chapter I indicated that there are three methods of accessing or addressing data within the PIC microcontroller application. These three methods correspond to the traditional addressing modes presented in introductory assembly-language programming classes. While these three modes are available to you, there are features built into the PIC microcontroller that actually make the different data addressing modes much richer and will help you to create complex but ef cient applications. In the following sections I want to discuss the different addressing modes and how the PIC microcontroller architecture has been designed to give much more exibility to instruction execution than you might rst suspect looking at the architecture or the instruction set.
Creating Denso QR Bar Code In Visual Basic .NET
Using Barcode creator for .NET framework Control to generate, create Quick Response Code image in VS .NET applications.
Printing EAN 13 In None
Using Barcode drawer for Software Control to generate, create GTIN - 13 image in Software applications.
DIRECT ADDRESSING: REGISTER READS AND RESULT SAVING
Creating USS Code 128 In None
Using Barcode creation for Software Control to generate, create Code128 image in Software applications.
Draw Code 39 Full ASCII In None
Using Barcode printer for Software Control to generate, create Code-39 image in Software applications.
When the register address within the current bank is speci ed within an instruction, it is known as direct addressing. These instructions can be used for loading or storing data to and from, respectively, the w register, but they allow you to implement arithmetic and bitwise operations that take up less space and run in fewer cycles than similar instructions available in other processors. These arithmetic and bitwise instructions allow the result of the operation to be stored in either the w register or the source register, which often eliminates the need for an extra instruction used to store the result in the appropriate location. Earlier in this chapter I introduced this capability as something to note in the architecture block diagrams. Looking at Fig. 6.10, you can see that the result from the ALU can be stored either back into the le registers or into the w register. When storing the result back into the le registers, the same address as the source is used for the destination. This capability gives you the option of performing an operation without changing the value saved in either the w register or the source register. The obvious use of this feature is to subtract two values without saving the result and to place the important parts of the result (the arithmetic ag registers) into the STATUS bits and ignore the result of the subtraction operation by leaving it in the w register, where it can be overwritten later. To select where the result of an operation is saved, the last argument of a register s arithmetic or bitwise assembly-language instruction statement is either a 0 or a 1 (or w or f, respectively), as is shown in the addwf instruction:
UPC Code Maker In None
Using Barcode creator for Software Control to generate, create Universal Product Code version A image in Software applications.
EAN / UCC - 14 Encoder In None
Using Barcode printer for Software Control to generate, create GS1 128 image in Software applications.
addwf register, w|f
Delivery Point Barcode (DPBC) Maker In None
Using Barcode encoder for Software Control to generate, create Postnet image in Software applications.
Bar Code Recognizer In Visual Basic .NET
Using Barcode scanner for VS .NET Control to read, scan read, scan image in .NET applications.
In this instruction, the contents of the w register are added to the contents of register. If w (or 0) is speci ed as the destination, then the result is stored in the w register. If f (or 1) is speci ed, then the result of the addition instruction is stored in register. This is one of the most confusing and powerful concepts of the PIC microcontroller and can be a problem for many new PIC microcontroller programmers. The ability to immediately store an arithmetic operation s result is unusual in 8-bit processors and is not described in most beginner courses in assembly-language programming.
Barcode Generator In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create bar code image in ASP.NET applications.
Code 128 Encoder In Java
Using Barcode encoder for Java Control to generate, create Code 128B image in Java applications.
Decode Bar Code In Visual C#.NET
Using Barcode Control SDK for VS .NET Control to generate, create, read, scan barcode image in .NET framework applications.
Make Matrix Barcode In .NET
Using Barcode drawer for .NET framework Control to generate, create 2D Barcode image in .NET framework applications.
This feature will make applications more ef cient and often simpler than what could be written in less radical processor architectures. For example, if you had to implement the statement
Barcode Creator In Java
Using Barcode printer for Eclipse BIRT Control to generate, create bar code image in Eclipse BIRT applications.
Print Code 3 Of 9 In None
Using Barcode maker for Online Control to generate, create ANSI/AIM Code 39 image in Online applications.
A = A + 4
in a typical processor, the instructions would be
Accumulator = 4 Accumulator = Accumulator + 4 A = Accumulator
If the register destination option in the PIC microcontroller is used, then the code could be simpli ed to
Accumulator = 4 A = A + Accumulator
If you are familiar with the C programming language, you could think of this instruction sequence as the statement
A + = 4; // Add 4 to the value of A
In this example, by simply storing the addition result back into the source register, I decreased the space and cycles required for implementing the A = A + 4 statement in the PIC microcontroller assembler by one-third over what would be expected in other devices. When I write PIC microcontroller assembly language, I continually look for opportunities to save the result in one of the parameters instead of saving it temporarily in the w register and then providing an explicit Store instruction.