PIC16F676-E/P Microchip Technology, PIC16F676-E/P Datasheet - Page 53
![IC MCU FLASH 1KX14 W/AD 14DIP](/photos/6/59/65935/150-14-dip_sml.jpg)
PIC16F676-E/P
Manufacturer Part Number
PIC16F676-E/P
Description
IC MCU FLASH 1KX14 W/AD 14DIP
Manufacturer
Microchip Technology
Series
PIC® 16Fr
Datasheets
1.PIC16F616T-ISL.pdf
(8 pages)
2.PIC12F629T-ISN.pdf
(24 pages)
3.PIC16F630-ISL.pdf
(132 pages)
4.PIC16F630-ISL.pdf
(2 pages)
5.PIC16F630-ISL.pdf
(10 pages)
6.PIC16F676-EP.pdf
(132 pages)
Specifications of PIC16F676-E/P
Program Memory Type
FLASH
Program Memory Size
1.75KB (1K x 14)
Package / Case
14-DIP (0.300", 7.62mm)
Core Processor
PIC
Core Size
8-Bit
Speed
20MHz
Peripherals
Brown-out Detect/Reset, POR, WDT
Number Of I /o
12
Eeprom Size
128 x 8
Ram Size
64 x 8
Voltage - Supply (vcc/vdd)
2 V ~ 5.5 V
Data Converters
A/D 8x10b
Oscillator Type
Internal
Operating Temperature
-40°C ~ 125°C
Processor Series
PIC16F
Core
PIC
Data Bus Width
8 bit
Data Ram Size
64 B
Interface Type
RS- 232/USB
Maximum Clock Frequency
20 MHz
Number Of Programmable I/os
12
Number Of Timers
2
Operating Supply Voltage
2 V to 5.5 V
Maximum Operating Temperature
+ 125 C
Mounting Style
Through Hole
3rd Party Development Tools
52715-96, 52716-328, 52717-734
Development Tools By Supplier
PG164130, DV164035, DV244005, DV164005, PG164120, ICE2000, DM163014, DM164120-4
Minimum Operating Temperature
- 40 C
On-chip Adc
8-ch x 10-bit
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With
DM163029 - BOARD PICDEM FOR MECHATRONICS
Connectivity
-
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
8.3
To read a data memory location, the user must write the
address to the EEADR register and then set control bit
RD (EECON1<0>), as shown in Example 8-1. The data
is available in the very next cycle in the EEDATA
register. Therefore, it can be read in the next
instruction. EEDATA holds this value until another read,
or until it is written to by the user (during a write
operation).
EXAMPLE 8-1:
8.4
To write an EEPROM data location, the user must first
write the address to the EEADR register and the data
to the EEDATA register. Then the user must follow a
specific sequence to initiate the write for each byte, as
shown in Example 8-2.
EXAMPLE 8-2:
The write will not initiate if the above sequence is not
exactly followed (write 55h to EECON2, write AAh to
EECON2, then set WR bit) for each byte. We strongly
recommend that interrupts be disabled during this
code segment. A cycle count is executed during the
required sequence. Any number that is not equal to the
required cycles to execute the required sequence will
prevent the data from being written into the EEPROM.
Additionally, the WREN bit in EECON1 must be set to
enable write. This mechanism prevents accidental
writes to data EEPROM due to errant (unexpected)
code execution (i.e., lost programs). The user should
keep the WREN bit clear at all times, except when
updating EEPROM. The WREN bit is not cleared
by hardware.
2010 Microchip Technology Inc.
BSF
MOVLW CONFIG_ADDR
MOVWF EEADR
BSF
MOVF
BSF
BSF
BCF
MOVLW 55h
MOVWF EECON2
MOVLW AAh
MOVWF EECON2
BSF
BSF
READING THE EEPROM DATA
MEMORY
WRITING TO THE EEPROM DATA
MEMORY
STATUS,RP0
EECON1,RD
EEDATA,W
STATUS,RP0
EECON1,WREN
INTCON,GIE
EECON1,WR
INTCON,GIE
DATA EEPROM READ
DATA EEPROM WRITE
;Bank 1
;
;Address to read
;EE Read
;Move data to W
;Bank 1
;Enable write
;Disable INTs
;Unlock write
;
;
;
;Start the write
;Enable INTS
After a write sequence has been initiated, clearing the
WREN bit will not affect this write cycle. The WR bit will
be inhibited from being set unless the WREN bit is set.
At the completion of the write cycle, the WR bit is
cleared in hardware and the EE Write Complete
Interrupt Flag bit (EEIF) is set. The user can either
enable this interrupt or poll this bit. The EEIF bit
(PIR<7>) register must be cleared by software.
8.5
Depending on the application, good programming
practice may dictate that the value written to the data
EEPROM should be verified (see Example 8-3) to the
desired value to be written.
EXAMPLE 8-3:
8.5.1
The data EEPROM is a high-endurance, byte address-
able array that has been optimized for the storage of
frequently
variables or other data that are updated often).
Frequently changing values will typically be updated
more often than specifications D120 or D120A. If this is
not the case, an array refresh must be performed. For
this reason, variables that change infrequently (such as
constants, IDs, calibration, etc.) should be stored in
Flash program memory.
8.6
There are conditions when the user may not want to
write to the data EEPROM memory. To protect against
spurious EEPROM writes, various mechanisms have
been built in. On power-up, WREN is cleared. Also, the
Power-up
EEPROM write.
The write initiate sequence and the WREN bit together
help prevent an accidental write during:
• brown-out
• power glitch
• software malfunction
BCF
:
BSF
MOVF
BSF
XORWF EEDATA,W
BTFSS STATUS,Z
GOTO
:
WRITE VERIFY
PROTECTION AGAINST
SPURIOUS WRITE
USING THE DATA EEPROM
changing
Timer
STATUS,RP0
STATUS,RP0
EEDATA,W
EECON1,RD
WRITE_ERR
PIC16F630/676
(72
WRITE VERIFY
information
ms
;Bank 0
;Any code
;Bank 1 READ
;EEDATA not changed
;from previous write
;YES, Read the
;value written
;Is data the same
;No, handle error
;Yes, continue
duration)
DS40039F-page 53
(e.g.,
prevents
program