PIC12F683 Data Sheet - Microchip

PIC12F683 Data Sheet - Microchip PIC12F683 Data Sheet - Microchip

21.01.2015 Views

PIC12F683 10.5 Protection Against Spurious Write 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 Timer (64 ms duration) prevents EEPROM write. The write initiate sequence and the WREN bit together help prevent an accidental write during: • Brown-out • Power Glitch • Software Malfunction 10.6 Data EEPROM Operation During Code-Protect Data memory can be code-protected by programming the CPD bit in the Configuration Word register (Register 12-1) to ‘0’. When the data memory is code-protected, the CPU is able to read and write data to the data EEPROM. It is recommended to code-protect the program memory when code-protecting data memory. This prevents anyone from programming zeroes over the existing code (which will execute as NOPs) to reach an added routine, programmed in unused program memory, which outputs the contents of data memory. Programming unused locations in program memory to ‘0’ will also help prevent data memory code protection from becoming breached. TABLE 10-1: SUMMARY OF ASSOCIATED DATA EEPROM REGISTERS Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Value on POR, BOR Value on all other Resets INTCON GIE PEIE T0IE INTE GPIE T0IF INTF GPIF 0000 0000 0000 0000 PIR1 EEIF ADIF CCP1IF — CMIF OSFIF TMR2IF TMR1IF 000- 0000 000- 0000 PIE1 EEIE ADIE CCP1IE — CMIE OSFIE TMR2IE TMR1IE 000- 0000 000- 0000 EEDAT EEDAT7 EEDAT6 EEDAT5 EEDAT4 EEDAT3 EEDAT2 EEDAT1 EEDAT0 0000 0000 0000 0000 EEADR EEADR7 EEADR6 EEADR5 EEADR4 EEADR3 EEADR2 EEADR1 EEADR0 0000 0000 0000 0000 EECON1 — — — — WRERR WREN WR RD ---- x000 ---- q000 EECON2 (1) EEPROM Control Register 2 ---- ---- ---- ---- Legend: x = unknown, u = unchanged, – = unimplemented read as ‘0’, q = value depends upon condition. Shaded cells are not used by the Data EEPROM module. Note 1: EECON2 is not a physical register. DS41211D-page 74 © 2007 Microchip Technology Inc.

PIC12F683 11.0 CAPTURE/COMPARE/PWM (CCP) MODULE The Capture/Compare/PWM module is a peripheral which allows the user to time and control different events. In Capture mode, the peripheral allows the timing of the duration of an event.The Compare mode allows the user to trigger an external event when a predetermined amount of time has expired. The PWM mode can generate a Pulse-Width Modulated signal of varying frequency and duty cycle. The timer resources used by the module are shown in Table 11-1 Additional information on CCP modules is available in the Application Note AN594, “Using the CCP Modules” (DS00594). TABLE 11-1: CCP Mode Capture Compare PWM CCP MODE – TIMER RESOURCES REQUIRED Timer Resource Timer1 Timer1 Timer2 REGISTER 11-1: CCP1CON: CCP1 CONTROL REGISTER U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 — — DC1B1 DC1B0 CCP1M3 CCP1M2 CCP1M1 CCP1M0 bit 7 bit 0 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 bit 7-6 Unimplemented: Read as ‘0’ bit 5-4 DC1B: PWM Duty Cycle Least Significant bits Capture mode: Unused. Compare mode: Unused. PWM mode: These bits are the two LSbs of the PWM duty cycle. The eight MSbs are found in CCPR1L. bit 3-0 CCP1M: CCP Mode Select bits 0000 = Capture/Compare/PWM off (resets CCP module) 0001 = Unused (reserved) 0010 = Unused (reserved) 0011 = Unused (reserved) 0100 = Capture mode, every falling edge 0101 = Capture mode, every rising edge 0110 = Capture mode, every 4th rising edge 0111 = Capture mode, every 16th rising edge 1000 = Compare mode, set output on match (CCP1IF bit is set) 1001 = Compare mode, clear output on match (CCP1IF bit is set) 1010 = Compare mode, generate software interrupt on match (CCP1IF bit is set, CCP1 pin is unaffected) 1011 = Compare mode, trigger special event (CCP1IF bit is set, TMR1 is reset and A/D conversion is started if the ADC module is enabled. CCP1 pin is unaffected.) 110x = PWM mode active-high 111x = PWM mode active-low © 2007 Microchip Technology Inc. DS41211D-page 75

<strong>PIC12F683</strong><br />

10.5 Protection Against Spurious Write<br />

There are conditions when the user may not want to<br />

write to the data EEPROM memory. To protect against<br />

spurious EEPROM writes, various mechanisms have<br />

been built in. On power-up, WREN is cleared. Also, the<br />

Power-up Timer (64 ms duration) prevents<br />

EEPROM write.<br />

The write initiate sequence and the WREN bit together<br />

help prevent an accidental write during:<br />

• Brown-out<br />

• Power Glitch<br />

• Software Malfunction<br />

10.6 <strong>Data</strong> EEPROM Operation During<br />

Code-Protect<br />

<strong>Data</strong> memory can be code-protected by programming<br />

the CPD bit in the Configuration Word register<br />

(Register 12-1) to ‘0’.<br />

When the data memory is code-protected, the CPU is<br />

able to read and write data to the data EEPROM. It is<br />

recommended to code-protect the program memory<br />

when code-protecting data memory. This prevents<br />

anyone from programming zeroes over the existing<br />

code (which will execute as NOPs) to reach an added<br />

routine, programmed in unused program memory,<br />

which outputs the contents of data memory.<br />

Programming unused locations in program memory to<br />

‘0’ will also help prevent data memory code protection<br />

from becoming breached.<br />

TABLE 10-1:<br />

SUMMARY OF ASSOCIATED DATA EEPROM REGISTERS<br />

Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0<br />

Value on<br />

POR, BOR<br />

Value on<br />

all other<br />

Resets<br />

INTCON GIE PEIE T0IE INTE GPIE T0IF INTF GPIF 0000 0000 0000 0000<br />

PIR1 EEIF ADIF CCP1IF — CMIF OSFIF TMR2IF TMR1IF 000- 0000 000- 0000<br />

PIE1 EEIE ADIE CCP1IE — CMIE OSFIE TMR2IE TMR1IE 000- 0000 000- 0000<br />

EEDAT EEDAT7 EEDAT6 EEDAT5 EEDAT4 EEDAT3 EEDAT2 EEDAT1 EEDAT0 0000 0000 0000 0000<br />

EEADR EEADR7 EEADR6 EEADR5 EEADR4 EEADR3 EEADR2 EEADR1 EEADR0 0000 0000 0000 0000<br />

EECON1 — — — — WRERR WREN WR RD ---- x000 ---- q000<br />

EECON2 (1) EEPROM Control Register 2 ---- ---- ---- ----<br />

Legend: x = unknown, u = unchanged, – = unimplemented read as ‘0’, q = value depends upon condition. Shaded cells are not<br />

used by the <strong>Data</strong> EEPROM module.<br />

Note 1: EECON2 is not a physical register.<br />

DS41211D-page 74<br />

© 2007 <strong>Microchip</strong> Technology Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!