If ’a’ is 0, the Access Bank will be selected, overriding the BSR value... If ’a’ is 0, the Access Bank will be selected, overriding the BSR value.. If ’a’ is 0, the Access Bank will be
Trang 1
MOVLW Move literal to W
Location 'f' can be anywhere in the
256 byte bank If ‘a’ is 0, the Access Bank will be selected, over-riding the BSR value If ‘a’ = 1, then the bank will be selected as per the BSR value (default)
Write register 'f'
Trang 2
MULLW Multiply Literal with W
car-ried out between the contents of
W and the 8-bit literal 'k' The 16-bit result is placed in PRODH:PRODL register pair
PRODH contains the high byte
Write registers PRODH:
MULWF Multiply W with f
car-ried out between the contents of
W and the register file location 'f' The 16-bit result is stored in the PRODH:PRODL register pair PRODH contains the high byte.Both W and 'f' are unchanged.None of the status flags are affected
Note that neither overflow nor carry is possible in this opera-tion A zero result is possible but not detected If ‘a’ is 0, the Access Bank will be selected, overriding the BSR value If
‘a’ = 1, then the bank will be selected as per the BSR value (default)
Write registers PRODH: PRODL
Trang 3complement The result is placed in the data memory location 'f' If ’a’ is
0, the Access Bank will be selected, overriding the BSR value
If ’a’ = 1, then the bank will be selected as per the BSR value
Write register 'f'
0000 xxxx
0000 xxxx
No operation
Example:
None
Trang 4POP Pop Top of Return Stack
return stack and is discarded The TOS value then becomes the previ-ous value that was pushed onto the return stack
This instruction is provided to enable the user to properly manage the return stack to incorporate a software stack
No operation
PUSH Push Top of Return Stack
the return stack The previous TOS value is pushed down on the stack.This instruction allows to implement
a software stack by modifying TOS, and then push it onto the return stack
No operation
No operation
Trang 5
RCALL Relative Call
1K from the current location First, return address (PC+2) is pushed onto the stack Then, add the 2’s complement number ’2n’ to the PC
Since the PC will have incremented
to fetch the next instruction, the new address will be PC+2+2n
This instruction is a two-cycle instruction
Process Data
Write to PC
No
operation
No operation
No operation
No operation
are affected by a MCLR Reset
execute a MCLR Reset in software
No operation
After Instruction
Registers = Reset Value Flags* = Reset Value
Trang 6
RETFIE Return from Interrupt
PCLATU, PCLATH are unchanged
popped and Top-of-Stack (TOS) is loaded into the PC Interrupts are enabled by setting either the high
or low priority global interrupt enable bit If ‘s’ = 1, the contents of the shadow registers WS,
STATUSS and BSRS are loaded into their corresponding registers,
W, STATUS and BSR If ‘s’ = 0, no update of these registers occurs (default)
pop PC from stack Set GIEH or GIEL
No
operation
No operation
No operation
No operation
RETLW Return Literal to W
PCLATU, PCLATH are unchanged
'k' The program counter is loaded from the top of the stack (the return address) The high address latch (PCLATH) remains unchanged
pop PC from stack, Write
to W
No operation
No operation
No operation
No operation
TABLE ADDWF PCL ; W = offset RETLW k0 ; Begin table RETLW k1 ;
: : RETLW kn ; End of table
Before Instruction
After Instruction
W = value of kn
Trang 7
RETURN Return from Subroutine
PCLATU, PCLATH are unchanged
is popped and the top of the stack (TOS) is loaded into the program counter If ‘s’= 1, the contents of the shadow registers WS, STATUSS and BSRS are loaded into their cor-responding registers, W, STATUS and BSR If ‘s’ = 0, no update of these registers occurs (default)
pop PC from stack
No
operation
No operation
No operation
No operation
After Interrupt
PC = TOS
RLCF Rotate Left f through Carry
rotated one bit to the left through the Carry Flag If 'd' is 0, the result
is placed in W If 'd' is 1, the result
is stored back in register 'f' (default) If ‘a’ is 0, the Access Bank will be selected, overriding the BSR value If ’a’ = 1, then the bank will be selected as per the BSR value (default)
Write to destination
Trang 8
RLNCF Rotate Left f (no carry)
rotated one bit to the left If 'd' is 0, the result is placed in W If 'd' is 1, the result is stored back in register 'f' (default) If ’a’ is 0, the Access Bank will be selected, overriding the BSR value If ’a’ is 1, then the bank will be selected as per the BSR value (default)
Write to destination
RRCF Rotate Right f through Carry
rotated one bit to the right through the Carry Flag If 'd' is 0, the result
is placed in W If 'd' is 1, the result
is placed back in register 'f' (default) If ‘a’ is 0, the Access Bank will be selected, overriding the BSR value If ’a’ is 1, then the bank will be selected as per the BSR value (default)
Write to destination
Trang 9
RRNCF Rotate Right f (no carry)
rotated one bit to the right If 'd' is 0, the result is placed in W If 'd' is 1, the result is placed back in register 'f' (default) If ’a’ is 0, the Access Bank will be selected, overriding the BSR value If ’a’ is 1, then the bank will be selected as per the BSR value (default)
Write to destination
regis-ter are set to FFh If ’a’ is 0, the Access Bank will be selected, over-riding the BSR value If ’a’ is 1, then the bank will be selected as per the BSR value (default)
Write register 'f'
Before Instruction
After Instruction
Trang 10
SLEEP Enter SLEEP mode
cleared The time-out status bit (TO) is set Watchdog Timer and its postscaler are cleared
The processor is put into SLEEP mode with the oscillator stopped
Go to sleep
† If WDT causes wake-up, this bit is cleared
SUBFWB Subtract f from W with borrow
(borrow) from W (2’s complement method) If 'd' is 0, the result is stored in W If 'd' is 1, the result is stored in register 'f' (default) If ’a’ is
0, the Access Bank will be selected, overriding the BSR value If ’a’ is 1, then the bank will be selected as per the BSR value (default)
Write to destination
Trang 11
SUBLW Subtract W from literal
literal 'k' The result is placed
SUBWF Subtract W from f
1, then the bank will be selected
as per the BSR value (default)
Write to destination
Trang 12
SUBWFB Subtract W from f with Borrow
(bor-row) from register 'f' (2’s complement method) If 'd' is 0, the result is stored
in W If 'd' is 1, the result is stored back in register 'f' (default) If ’a’ is 0, the Access Bank will be selected, overriding the BSR value If ’a’ is 1, then the bank will be selected as per the BSR value (default)
Write to destination
reg-ister 'f' are exchanged If 'd' is 0, the result is placed in W If 'd' is 1, the result is placed in register 'f' (default) If ’a’ is 0, the Access Bank will be selected, overriding the BSR value If ’a’ is 1, then the bank will be selected as per the BSR value (default)
Write to destination
Before Instruction
After Instruction
Trang 13=2 =3 +*
con-tents of Program Memory (P.M.) To
address the program memory, a pointer
called Table Pointer (TBLPTR) is used
The TBLPTR (a 21-bit pointer) points
to each byte in the program memory
TBLPTR has a 2 Mbyte address range
TBLPTR[0] = 0: Least Significant
Byte of Program Memory WordTBLPTR[0] = 1: Most Significant
Byte of Program Memory WordThe TBLRD instruction can modify the
No operation
No
operation
No operation (Read Program
Memory)
No operation
No operation (Write TABLAT)
TBLRD Table Read (cont’d)
After Instruction
Trang 14Status Affected: None
nn=0 * =1 *+
=2 =3 +*
TBLPTR to determine which of the 8 holding registers the TABLAT data is written to The 8 holding registers are used to program the contents of Pro-gram Memory (P.M.) See Section 5.0 for information on writing to FLASH memory
The TBLPTR (a 21-bit pointer) points
to each byte in the program memory
TBLPTR has a 2 MBtye address range The LSb of the TBLPTR selects which byte of the program memory location to access
TBLPTR[0] = 0: Least Significant
Byte of Program Memory WordTBLPTR[0] = 1: Most Significant
Byte of Program Memory WordThe TBLWT instruction can modify the value of TBLPTR as follows:
No operation
No
operation
No operation
(Read TABLAT)
No operation
No operation (Write to Holding Register or Memory)
TBLWT Table Write (Continued)
Trang 15fetched during the current tion execution, is discarded and a NOP is executed, making this a two-cycle instruction If ’a’ is 0, the Access Bank will be selected, over-riding the BSR value If ’a’ is 1, then the bank will be selected as per the BSR value (default).
No operation
No operation
No operation
If skip and followed by 2-word instruction:
No
operation
No operation
No operation
No operation
No
operation
No operation
No operation
No operation
NZERO : ZERO :
XORLW Exclusive OR literal with W
with the 8-bit literal 'k' The result
Trang 16
XORWF Exclusive OR W with f
with register 'f' If 'd' is 0, the result
is stored in W If 'd' is 1, the result is stored back in the register 'f' (default) If ‘a’ is 0, the Access Bank will be selected, overriding the BSR value If ’a’ is 1, then the bank will be selected as per the BSR value (default)
Write to destination
Trang 1721.0 DEVELOPMENT SUPPORT
full range of hardware and software development tools:
• Integrated Development Environment
• Assemblers/Compilers/Linkers
- MPLAB C17 and MPLAB C18 C Compilers
• Simulators
- MPLAB SIM Software Simulator
• Emulators
- MPLAB ICE 2000 In-Circuit Emulator
- ICEPIC™ In-Circuit Emulator
• In-Circuit Debugger
- MPLAB ICD
• Device Programmers
Programmer
• Low Cost Demonstration Boards
- PICDEM 2 Demonstration Board
21.1 MPLAB Integrated Development
Environment Software
The MPLAB IDE software brings an ease of software
development previously unseen in the 8-bit
application that contains:
• An interface to debugging tools
- simulator
- programmer (sold separately)
- emulator (sold separately)
- in-circuit debugger (sold separately)
The MPLAB IDE allows you to:
• Edit your source files (either assembly or ‘C’)
• One touch assemble (or compile) and download
to PICmicro emulator and simulator tools matically updates all project information)
(auto-• Debug using:
- source files
- absolute listing file
- machine codeThe ability to use MPLAB IDE with multiple debuggingtools allows users to easily switch from the cost-effective simulator to a full-featured emulator withminimal retraining
detail memory usage and symbol reference, an lute LST file that contains source lines and generatedmachine code, and a COD file for debugging
abso-The MPASM assembler features include:
• Integration into MPLAB IDE projects
• User-defined macros to streamline assembly code
• Conditional assembly for multi-purpose source files
• Directives that allow complete control over the assembly process
21.3 MPLAB C17 and MPLAB C18
C Compilers
The MPLAB C17 and MPLAB C18 Code DevelopmentSystems are complete ANSI ‘C’ compilers forMicrochip’s PIC17CXXX and PIC18CXXX family ofmicrocontrollers, respectively These compilers providepowerful integration capabilities and ease of use notfound with other compilers
For easier source level debugging, the compilers vide symbol information that is compatible with theMPLAB IDE memory display
Trang 18pro-21.4 MPLINK Object Linker/
MPLIB Object Librarian
The MPLINK object linker combines relocatable
objects created by the MPASM assembler and the
MPLAB C17 and MPLAB C18 C compilers It can also
link relocatable objects from pre-compiled libraries,
using directives from a linker script
The MPLIB object librarian is a librarian for
pre-compiled code to be used with the MPLINK object
linker When a routine from a library is called from
another source file, only the modules that contain that
routine will be linked in with the application This allows
large libraries to be used efficiently in many different
applications The MPLIB object librarian manages the
creation and modification of library files
The MPLINK object linker features include:
• Integration with MPASM assembler and MPLAB
C17 and MPLAB C18 C compilers
• Allows all memory areas to be defined as sections
to provide link-time flexibility
The MPLIB object librarian features include:
• Easier linking because single libraries can be
included instead of many smaller files
• Helps keep code maintainable by grouping
related modules together
• Allows libraries to be created and modules to be
added, listed, replaced, deleted or extracted
21.5 MPLAB SIM Software Simulator
The MPLAB SIM software simulator allows code
devel-opment in a PC-hosted environment by simulating the
PICmicro series microcontrollers on an instruction
level On any given instruction, the data areas can be
examined or modified and stimuli can be applied from
a file, or user-defined key press, to any of the pins The
execution can be performed in single step, execute
until break, or trace mode
The MPLAB SIM simulator fully supports symbolic
debug-ging using the MPLAB C17 and the MPLAB C18 C
com-pilers and the MPASM assembler The software simulator
offers the flexibility to develop and debug code outside of
the laboratory environment, making it an excellent
multi-project software development tool
21.6 MPLAB ICE High Performance
Universal In-Circuit Emulator with MPLAB IDE
The MPLAB ICE universal in-circuit emulator is intended
to provide the product development engineer with acomplete microcontroller design tool set for PICmicromicrocontrollers (MCUs) Software control of theMPLAB ICE in-circuit emulator is provided by theMPLAB Integrated Development Environment (IDE),which allows editing, building, downloading and sourcedebugging from a single environment
The MPLAB ICE 2000 is a full-featured emulator tem with enhanced trace, trigger and data monitoringfeatures Interchangeable processor modules allow thesystem to be easily reconfigured for emulation of differ-ent processors The universal architecture of theMPLAB ICE in-circuit emulator allows expansion tosupport new PICmicro microcontrollers
sys-The MPLAB ICE in-circuit emulator system has beendesigned as a real-time emulation system, withadvanced features that are generally found on moreexpensive development tools The PC platform and
make these features available to you, the end user
21.7 ICEPIC In-Circuit Emulator
The ICEPIC low cost, in-circuit emulator is a solutionfor the Microchip Technology PIC16C5X, PIC16C6X,PIC16C7X and PIC16CXXX families of 8-bit One-Time-Programmable (OTP) microcontrollers The mod-ular system can support different subsets of PIC16C5X
or PIC16CXXX products through the use of changeable personality modules, or daughter boards.The emulator is capable of emulating without targetapplication circuitry being present
Trang 19inter-21.8 MPLAB ICD In-Circuit Debugger
Microchip's In-Circuit Debugger, MPLAB ICD, is a
pow-erful, low cost, run-time development tool This tool is
based on the FLASH PICmicro MCUs and can be used
to develop for this and other PICmicro microcontrollers
The MPLAB ICD utilizes the in-circuit debugging
capa-bility built into the FLASH devices This feature, along
proto-col, offers cost-effective in-circuit FLASH debugging
from the graphical user interface of the MPLAB
Integrated Development Environment This enables a
designer to develop and debug source code by
watch-ing variables, swatch-ingle-steppwatch-ing and settwatch-ing break points
Running at full speed enables testing hardware in
real-time
21.9 PRO MATE II Universal Device
Programmer
The PRO MATE II universal device programmer is a
full-featured programmer, capable of operating in
stand-alone mode, as well as PC-hosted mode The
PRO MATE II device programmer is CE compliant
The PRO MATE II device programmer has
max-imum reliability It has an LCD display for instructions
and error messages, keys to enter commands and a
modular detachable socket assembly to support various
package types In stand-alone mode, the PRO MATE II
device programmer can read, verify, or program
PICmicro devices It can also set code protection in this
mode
21.10 PICSTART Plus Entry Level
Development Programmer
The PICSTART Plus development programmer is an
easy-to-use, low cost, prototype programmer It
con-nects to the PC via a COM (RS-232) port MPLAB
Integrated Development Environment software makes
using the programmer simple and efficient
The PICSTART Plus development programmer
sup-ports all PICmicro devices with up to 40 pins Larger pin
count devices, such as the PIC16C92X and
PIC17C76X, may be supported with an adapter socket
The PICSTART Plus development programmer is CE
to the microcontroller socket(s) Some of the featuresinclude an RS-232 interface, a potentiometer for simu-lated analog input, push button switches and eightLEDs connected to PORTB
21.12 PICDEM 2 Low Cost PIC16CXX
Demonstration Board
The PICDEM 2 demonstration board is a simple onstration board that supports the PIC16C62,PIC16C64, PIC16C65, PIC16C73 and PIC16C74microcontrollers All the necessary hardware and soft-ware is included to run the basic demonstration pro-grams The user can program the samplemicrocontrollers provided with the PICDEM 2 demon-stration board on a PRO MATE II device programmer,
dem-or a PICSTART Plus development programmer, andeasily test firmware The MPLAB ICE in-circuit emula-tor may also be used with the PICDEM 2 demonstrationboard to test firmware A prototype area has been pro-vided to the user for adding additional hardware andconnecting it to the microcontroller socket(s) Some ofthe features include a RS-232 interface, push buttonswitches, a potentiometer for simulated analog input, a
and separate headers for connection to an LCDmodule and a keypad