Microchip Technology DM164130-9 User Manual
PICkit™ 3 Starter Kit User’s Guide
DS41628B-page 20
2012 Microchip Technology Inc.
2.3
DATA/PROGRAM BUS
The data bus is connected to the outside world via port pins, as well as all of the periph-
eral registers (timers, ADC, PWM). The program bus connects to the Flash memory
where the program is stored. This is where assembled code is programmed to.
eral registers (timers, ADC, PWM). The program bus connects to the Flash memory
where the program is stored. This is where assembled code is programmed to.
2.4
ACCUMULATOR
There is only one accumulator – the working register (WREG). The accumulator han-
dles all data bus related tasks, such as mathematical operations. The ALU only deals
with 8-bit sized data – hence the categorical names of 8/16/32-bit micros.
dles all data bus related tasks, such as mathematical operations. The ALU only deals
with 8-bit sized data – hence the categorical names of 8/16/32-bit micros.
2.5
INSTRUCTIONS
Instructions tell what the PIC device should do, whether it is shifting a few bits or jump-
ing to a new line in code. They form the very essence of each program in program
memory. All enhanced mid-range PIC devices have only 49 instructions. The PIC18
has 75 available instructions. Since there are very few instructions needed to learn, the
PIC device can be referred to as a “reduced instruction set computing”, or RISC,
processor.
Each instruction will be explained in detail as they are introduced in each lesson. For
now, the basis of what makes up each instruction will be explained.
One instruction cycle consists of four clock cycles. This means that if the PIC MCU is
running at 4 MHz, each instruction will take one microsecond, as seen in
ing to a new line in code. They form the very essence of each program in program
memory. All enhanced mid-range PIC devices have only 49 instructions. The PIC18
has 75 available instructions. Since there are very few instructions needed to learn, the
PIC device can be referred to as a “reduced instruction set computing”, or RISC,
processor.
Each instruction will be explained in detail as they are introduced in each lesson. For
now, the basis of what makes up each instruction will be explained.
One instruction cycle consists of four clock cycles. This means that if the PIC MCU is
running at 4 MHz, each instruction will take one microsecond, as seen in
EQUATION 2-1:
INSTRUCTION TIME
All instructions are executed in a single instruction cycle, unless a conditional test is
true, or the program counter (PC) is changed. In these cases, the execution takes two
instruction cycles, with the additional instruction cycle executed as a NOP (do nothing),
true, or the program counter (PC) is changed. In these cases, the execution takes two
instruction cycles, with the additional instruction cycle executed as a NOP (do nothing),
see
EXAMPLE 2-1:
This takes two instruction cycles only if pin RA0 is set (active-high), since the skip oper-
ation affects the PC.
The PIC18 has a larger word size than the enhanced PIC16 architecture. The PIC18
has a 16-bit wide word containing the operation code (opcode) and all required oper-
ands. The enhanced PIC16 has a 14-bit wide word. An opcode is interpreted by the
processor and is unique to each instruction.
The opcodes are broken into four formats:
1. Byte oriented
2. Bit oriented
3. Literal
4. Control
ation affects the PC.
The PIC18 has a larger word size than the enhanced PIC16 architecture. The PIC18
has a 16-bit wide word containing the operation code (opcode) and all required oper-
ands. The enhanced PIC16 has a 14-bit wide word. An opcode is interpreted by the
processor and is unique to each instruction.
The opcodes are broken into four formats:
1. Byte oriented
2. Bit oriented
3. Literal
4. Control
T clock cycle
1
F
OSC
-------------
=
4 * T
4
F
OSC
-------------
4
4 MHz
-----------------
1 µs
=
=
=
BTFSS PORTA, RA0