Академический Документы
Профессиональный Документы
Культура Документы
Caracterı́stica Descripción
Arquitectura Harvard
Frecuencia de operación 20 MHz
Memoria FLASH de programa 1024 words
Memoria de datos 68 Bytes
Memoria de datos EEPROM 64 Bytes
Interrupciones 4
Puertos de E/S 2 (A,B)
Conjunto de Instrucciones 35
Encapsulado
SSOP
RA2 •1 20 RA1
RA3 2 19 RA0
RA4/T0CKI 3 18 OSC1/CLKIN
PIC16F84A
MCLR 4 17 OSC2/CLKOUT
VSS 5 16 VDD
VSS 6 15 VDD
RB0/INT 7 14 RB7
RB1 8 13 RB6
RB2 9 12 RB5
RB3 10 11 RB4
device architecture and operation of the peripheral • Change on PORTB interrupt
modules. • Timer0 clock input
El PIC 16F84A internamente
The PIC16F84A belongs to the mid-range family of the
PICmicro® microcontroller devices. A block diagram of
Table 1-1 details the pinout of the device with descrip-
tions and details for each pin.
the device is shown in Figure 1-1.
13 Data Bus 8
Program Counter EEPROM Data Memory
FLASH
Program
Memory
RAM EEPROM
1K x 14 8 Level Stack File Registers EEDATA Data Memory
(13-bit) 64 x 8
68 x 8
Program
Bus 14
7 RAM Addr EEADR
Instruction Register Addr Mux
MUX
Power-up
Timer I/O Ports
8
Instruction Oscillator
Decode & Start-up Timer
Control ALU
Power-on RA3:RA0
Reset
Timing Watchdog RB7:RB1
Timer W reg
Generation
RB0/INT
3FFh
Memory Organization
13-bit program counter capable
x 14 program memory space. For
first 1K x 14 (0000h-03FFh) are
1FFFh
ed (Figure 2-1). Accessing a loca-
ically implemented address will
For example, for locations 20h,
020h, 1420h, 1820h, and 1C20h,
Memoria
PIC16F84Ade Datos
2.2 Data Memory Organization FIGURE 2-2: REGISTER FILE MAP -
PIC16F84A
The data memory is partitioned into two areas. The first
is the Special Function Registers (SFR) area, while the File Address File Address
second is the General Purpose Registers (GPR) area. 00h Indirect addr.(1) Indirect addr.(1) 80h
The SFRs control the operation of the device.
01h TMR0 OPTION_REG 81h
Portions of data memory are banked. This is for both
02h PCL PCL 82h
the SFR area and the GPR area. The GPR area is
banked to allow greater than 116 bytes of general 03h STATUS STATUS 83h
purpose RAM. The banked areas of the SFR are for the 04h FSR FSR 84h
registers that control the peripheral functions. Banking
requires the use of control bits for bank selection. 05h PORTA TRISA 85h
These control bits are located in the STATUS Register. 06h PORTB TRISB 86h
Figure 2-2 shows the data memory map organization. 07h — — 87h
Instructions MOVWF and MOVF can move values from 08h EEDATA EECON1 88h
the W register to any location in the register file (“F”), 09h EEADR EECON2(1) 89h
and vice-versa.
0Ah PCLATH PCLATH 8Ah
The entire data memory can be accessed either
0Bh INTCON INTCON 8Bh
directly using the absolute address of each register file
or indirectly through the File Select Register (FSR) 0Ch 8Ch
(Section 2.5). Indirect addressing uses the present
value of the RP0 bit for access into the banked areas of
data memory. 68
General Mapped
Data memory is partitioned into two banks which Purpose (accesses)
contain the general purpose registers and the special Registers in Bank 0
(SRAM)
function registers. Bank 0 is selected by clearing the
RP0 bit (STATUS<5>). Setting the RP0 bit selects Bank
1. Each Bank extends up to 7Fh (128 bytes). The first
twelve locations of each Bank are reserved for the
Special Function Registers. The remainder are Gen-
eral Purpose Registers, implemented as static RAM. 4Fh CFh
50h D0h
2.2.1 GENERAL PURPOSE REGISTER
FILE
Each General Purpose Register (GPR) is 8-bits wide
and is accessed either directly or indirectly through the
FSR (Section 2.5).
7Fh FFh
The GPR addresses in Bank 1 are mapped to Bank 0 Bank 1
addresses in Bank 0. As an example, addressing loca- Unimplemented data memory location, read as ’0’.
tion 0Ch or 8Ch will access the same GPR.
Note 1: Not a physical register.
Selección de Bancos
banksel NombreDelRegistro
Registro: W
Registro: STATUS
as 000u u1uu (where u = unchanged).
Only the BCF, BSF, SWAPF and MOVWF instructions
will be updated according to device logic
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ’1’ = Bit is set ’0’ = Bit is cleared x = Bit is unknown
Los PICs tienen la caracterı́stica de que sus pines pueden ser todos
configurados de acuerdo a la necesidad de la aplicación, es decir,
que los pines de un mismo puerto pueden ser usados como
entradas o como salidas.
Los PIC 16F84A cuentan con tres puertos de E/S.
Puerto A: Puerto bidireccional de 5 bits.
Puerto B: Puerto bidireccional de 8 bits.
Registros TRIS
config CP OFF & XT OSC & WDT OFF & PWRTE OFF
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ’1’ = Bit is set ’0’ = Bit is cleared x = Bit is unknown
2.3.2 OPTION REGISTER Note: When the prescaler is assigned to
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
- n = Value at POR ’1’ = Bit is set ’0’ = Bit is cleared x = Bit is unknown
6.9 Context Saving During Interrupts Example 6-1 does the following:
Salvando los registros
During an interrupt, only the return PC value is saved a) Stores the W register.
on the stack. Typically, users wish to save key register b) Stores the STATUS register in STATUS_TEMP.
values during an interrupt (e.g., W register and c) Executes the Interrupt Service Routine code.
STATUS register). This is implemented in software. d) Restores the STATUS (and bank select bit)
The code in Example 6-1 stores and restores the register.
STATUS and W register’s values. The user defined e) Restores the W register.
registers, W_TEMP and STATUS_TEMP are the tem-
porary storage locations for the W and STATUS
registers values.
Descarga: www.microchip.com
MPLab - Primeros pasos