Specifications

Chapter 3 - Instruction Set
Previous page Table of contents Chapter overview Next page
CHAPTER 3
Instruction Set
Introduction
Instruction set in PIC16Cxx microcontroller family
Data Transfer
Arithmetic and logic
Bit operations
Directing the program flow
Instruction execution period
Word list
Introduction
We have already mentioned that microcontroller is not like any other integrated circuit. When they
come out of production most integrated circuits are ready to be built into devices which is not the
case with microcontrollers. In order to "make" microcontroller perform a task, we have to tell it
exactly what to do, or in other words we must write the program microcontroller will execute. We
will describe in this chapter instructions which make up the assembler, or lower-level program
language for PIC microcontrollers.
Instruction Set in PIC16Cxx Microcontroller Family
Complete set which includes 35 instructions is given in the following table. A reason for such a small
number of instructions lies primarily in the fact that we are talking about a RISC microcontroller
whose instructions are well optimized considering the speed of work, architectural simplicity and
code compactness. The only drawback is that programmer is expected to master "uncomfortable"
technique of using a reducedt set of 35 instructions.
Data transfer
Transfer of data in a microcontroller is done between work (W) register and an 'f' register that
represents any location in internal RAM (regardless whether those are special or general purpose
registers).
First three instructions (look at the following table) provide for a constant being written in W register
(MOVLW is short for MOVe Literal to W), and for data to be copied from W register onto RAM and
data from RAM to be copied onto W register (or on the same RAM location, at which point only the
status of Z flag changes). Instruction CLRF writes constant 0 in 'f ' register, and CLRW writes
constant 0 in register W. SWAPF instruction exchanges places of the 4-bit nibbles field inside a
register.
http://www.mikroelektronika.co.yu/english/product/books/PICbook/3_Poglavlje.htm (1 of 4) [4/2/2003 16:18:03]