Part Number Hot Search : 
MT90732 SFT4959 SB2501 3F51BMR 00SERI XR1099 NDL5471R YD78L06
Product Description
Full Text Search
 

To Download PIC10F322 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ? 2011 microchip technology inc. preliminary ds41585a pic10(l)f320/322 data sheet 6/8-pin, high-performance, flash microcontrollers www.datasheet.co.kr datasheet pdf - http://www..net/
ds41585a-page 2 preliminary ? 2011 microchip technology inc. information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. it is your responsibility to ensure that your application meets with your specifications. microchip makes no representations or warranties of any kind whether express or implied, written or oral, statutory or otherwise, related to the information, including but not limited to its condition, quality, performance, merchantability or fitness for purpose . microchip disclaims all liability arising from this information and its use. use of microchip devices in life support and/or safety applications is entirely at the buyer?s risk, and the buyer agrees to defend, indemnify and hold harmless microchip from any and all damages, claims, suits, or expenses resulting from such use. no licenses are conveyed, implicitly or otherwise, under any microchip intellectual property rights. trademarks the microchip name and logo, the microchip logo, dspic, k ee l oq , k ee l oq logo, mplab, pic, picmicro, picstart, pic 32 logo, rfpic and uni/o are registered trademarks of microchip technology incorporated in the u.s.a. and other countries. filterlab, hampshire, hi-tech c, linear active thermistor, mxdev, mxlab, seeval and the embedded control solutions company are registered trademarks of microchip technology incorporated in the u.s.a. analog-for-the-digital age, app lication maestro, chipkit, chipkit logo, codeguard, dspicdem, dspicdem.net, dspicworks, dsspeak, ecan, economonitor, fansense, hi-tide, in-circuit serial programming, icsp, mindi, miwi, mpasm, mplab certified logo, mplib, mplink, mtouch, omniscient code generation, picc, picc-18, picdem, picdem.net, pickit, pictail, real ice, rflab, select mode, total endurance, tsharc, uniwindriver, wiperlock and zena are trademarks of microchip technology incorporated in the u.s.a. and other countries. sqtp is a service mark of microchip technology incorporated in the u.s.a. all other trademarks mentioned herein are property of their respective companies. ? 2011, microchip technology incorporated, printed in the u.s.a., all rights reserved. printed on recycled paper. isbn: 978-1-61341-380-7 note the following details of the code protection feature on microchip devices: ? microchip products meet the specification cont ained in their particular microchip data sheet. ? microchip believes that its family of products is one of the mo st secure families of its kind on the market today, when used i n the intended manner and under normal conditions. ? there are dishonest and possibly illegal methods used to breach the code protection feature. all of these methods, to our knowledge, require using the microchip produc ts in a manner outside the operating specifications contained in microchip?s data sheets. most likely, the person doing so is engaged in theft of intellectual property. ? microchip is willing to work with the customer who is concerned about the integrity of their code. ? neither microchip nor any other semiconductor manufacturer c an guarantee the security of their code. code protection does not mean that we are guaranteeing the product as ?unbreakable.? code protection is constantly evolving. we at microchip are co mmitted to continuously improvi ng the code protection features of our products. attempts to break microchip?s c ode protection feature may be a violation of the digital millennium copyright act. if such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that act. microchip received iso/ts-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in chandler and tempe, arizona; gresham, oregon and design centers in california and india. the company?s quality system processes and procedures are for its pic ? mcus and dspic ? dscs, k ee l oq ? code hopping devices, serial eeproms, microperipherals, nonvolatile memory and analog products. in addition, microchip?s quality system for the design and manufacture of development systems is iso 9001:2000 certified. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 3 pic10(l)f320/322 high-performance risc cpu: ? only 35 instructions to learn: - all single-cycle instructions, except branches ? operating speed: - dc ? 16 mhz clock input - dc ? 250 ns instruction cycle ? up to 512 words of flash program memory ? 64 bytes data memory ? eight-level deep hardware stack ? interrupt capability ? processor self-write/read access to program memory ? pinout compatible to other 6-pin pic10fxxx microcontrollers special microcontroller features: ? low-power 16 mhz internal oscillator: - software selectable frequency range from 16 mhz to 31 khz - factory calibrated to ? 1%, typical ? wide operating range: - 1.8v to 3.6v (pic10lf320/322) - 2.3v to 5.5v (pic10f320/322) ? power-on reset (por) ? power-up timer (pwrt) ? brown-out reset (bor) ? ultra low-power sleep regulator ? extended watchdog timer (wdt) ? programmable code protection ? power-saving sleep mode ? selectable oscillator options (ec mode or internal oscillator) ? in-circuit serial programming? (icsp?) (via two pins) ? in-circuit debugger support ? fixed voltage reference (fvr) with 1.024v, 2.048v and 4.096v (?f? variant only) output levels ? integrated temperature indicator ? 40-year flash data retention low-power features (pic10lf320/322): ? standby current: - 20 na @ 1.8v, typical ? operating current: -25 ? a @ 1 mhz, 1.8v, typical ? watchdog timer current: - 500 na @ 1.8v, typical peripheral features: ? 4 i/o pins: - 1 input-only pin - high current sink/source for led drivers - individually selectable weak pull-ups - interrupt-on-change ? timer0: 8-bit timer/counter with 8-bit programmable prescaler ? timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler ? two pwm modules: - 10-bit pwm, max. frequency 16 khz - combined to single 2-phase output ? a/d converter: - 8-bit resolution with 3 channels ? configurable logic cell (clc): - 8 selectable input source signals - two inputs per module - software selectable logic functions including: and/or/xor/d flop/d latch/sr/jk - external or internal inputs/outputs - operation while in sleep ? numerically controlled oscillator (nco): - 20-bit accumulator - 16-bit increment - linear frequency control - high-speed clock input - selectable output modes - fixed duty cycle (fdc) - pulse frequency (pf) mode ? complementary waveform generator (cwg): - selectable falling and rising edge dead-band control - polarity control - 2 auto-shutdown sources - multiple input sources: pwm, clc, nco 6/8-pin flash-based, 8-bit microcontrollers www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 4 preliminary ? 2011 microchip technology inc. figure 1: 6-pin diag ram, pic10(l)f320/322 figure 2: 8-pin diag ram, pic10(l)f320/322 table 2: 6 and 8-pin allocatio n table (pic10(l)f320/322) table 1: pic10(l)f320/322 feature summary device program memory flash (words) sram (bytes) i/o (1) 8-bit a/d (ch) clc 10-bit pwm timers 8-bit nco cwg pic10f320 256 64 4 3 1 2 2 1 1 pic10lf320 256 64 4 3 1 2 2 1 1 PIC10F322 512 64 4 3 1 2 2 1 1 pic10lf322 512 64 4 3 1 2 2 1 1 note 1: one pin is input-only. i/o 6-pin 8-pin analog timer pwm interrupts pull-ups cwg nco clc basic icsp ra0 1 5 an0 ? pwm1 ioc0 y cwg1a ? clc1in1 ? icspdat ra1 3 4 an1 ? pwm2 ioc1 y cwg1b nco1clk clc1 clkin icspclk ra2 4 3 an2 t0cki ? int/ioc2 y cwg1flt nco1 clc1in2 clkr ra3 6 8 ? ? ? ioc3 y ? ? ? mclr v pp n/c ? 1 ? ? ? ? ? ? ? ? ? ? n/c ? 6 ? ? ? ? ? ? ? ? ? ? v dd 5 2 ? ? ? ? ? ? ? ? v dd ? v ss 27 ? ?? ? ? ? ? ? v ss ? 1 2 3 4 5 6 pic10(l)f320 pic10(l)f322 ra3/mclr /v pp v dd ra2 icspclk/ra1 icspdat/ra0 v ss sot-23 1 2 3 4 5 6 7 8 pic10(l)f320 pic10(l)f322 ra3/m cl r /v pp v ss n/c ra0/icspdat icspclk/ra1 n/c v dd ra2 pdip, dfn www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 5 pic10(l)f320/322 table of contents 1.0 device overview ............................................................................................................. ............................................................. 7 2.0 memory organization ......................................................................................................... ........................................................ 11 3.0 device configuration ........................................................................................................ .......................................................... 21 4.0 oscillator module........................................................................................................... ............................................................. 27 5.0 resets ...................................................................................................................... .................................................................. 33 6.0 interrupts .................................................................................................................. .................................................................. 41 7.0 power-down mode (sleep) ..................................................................................................... ................................................... 51 8.0 watchdog timer (wdt) ........................................................................................................ ..................................................... 53 9.0 flash program memory control ................................................................................................ ................................................. 57 10.0 i/o port ................................................................................................................... .................................................................... 75 11.0 interrupt-on-change ........................................................................................................ .......................................................... 81 12.0 fixed voltage reference (fvr) .............................................................................................. ................................................... 85 13.0 internal voltage regulator (ivr) ........................................................................................... ..................................................... 87 14.0 temperature indicator module ............................................................................................... .................................................... 89 15.0 analog-to-digital converter (adc) module ................................................................................... ............................................. 91 16.0 timer0 module .............................................................................................................. ........................................................... 101 17.0 timer2 module .............................................................................................................. ........................................................... 105 18.0 pulse width modulation (pwm) module........................................................................................ ........................................... 107 19.0 configurable cell logic (clc).............................................................................................. .................................................... 113 20.0 numerically controlled oscillator (nco) module ............................................................................. ........................................ 129 21.0 complementary waveform generator (cwg) module .............................................................................. .............................. 139 22.0 in-circuit serial programming? (icsp?) ..................................................................................... .......................................... 155 23.0 instruction set summary .................................................................................................... ...................................................... 159 24.0 electrical specifications.................................................................................................. .......................................................... 169 25.0 dc and ac characteristics graphs and charts ................................................................................ ....................................... 187 26.0 development support........................................................................................................ ....................................................... 189 27.0 packaging information...................................................................................................... ........................................................ 193 appendix a: data sheet revision history........................................................................................ .................................................. 201 index .......................................................................................................................... ........................................................................ 203 the microchip web site ......................................................................................................... ............................................................ 207 customer change notification service ........................................................................................... ................................................... 207 customer support............................................................................................................... ............................................................... 207 reader response ................................................................................................................ .............................................................. 208 product identification system .................................................................................................. .......................................................... 209 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 6 preliminary ? 2011 microchip technology inc. to our valued customers it is our intention to provide our valued customers with the be st documentation possible to ensure successful use of your micro chip products. to this end, we will continue to improve our publications to better suit your needs. our publications will be refined and enhanced as new volumes and updates are introduced. if you have any questions or comments regardi ng this publication, please contact the marketing communications department via e-mail at docerrors@microchip.com or fax the reader response form in the back of this data sheet to (480) 792-4150. we welcome your feedback. most current data sheet to obtain the most up-to-date version of this data s heet, please register at our worldwide web site at: http://www.microchip.com you can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page . the last character of the literature number is the vers ion number, (e.g., ds30000a is version a of document ds30000). errata an errata sheet, describing minor operational differences fr om the data sheet and recommended workarounds, may exist for curren t devices. as device/documentation issues become known to us, we will publish an errata sheet. the errata will specify the revisi on of silicon and revision of document to which it applies. to determine if an errata sheet exists for a particular device, please check with one of the following: ? microchip?s worldwide web site; http://www.microchip.com ? your local microchip sales office (see last page) when contacting a sales office, please specify which device, re vision of silicon and data sheet (include literature number) you are using. customer notification system register on our web site at www.microchip.com to receive the most current information on all of our products. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 7 pic10(l)f320/322 1.0 device overview the pic10(l)f320/322 are described within this data sheet. they are available in 6/8-pin packages. figure 1-1 shows a block diagram of the pic10(l)f320/322 devices. tab le 1 - 2 shows the pinout descriptions. reference tab l e 1 - 1 for peripherals available per device. table 1-1: device peripheral summary peripheral pic10(l)f320 pic10(l)f322 analog-to-digital converter (adc) configurable logic cell (clc) complementary wave generator (cwg) fixed voltage reference (fvr) numerically controlled oscillator (nco) temperature indicator pwm modules pwm1 pwm2 timers timer0 timer2 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 8 preliminary ? 2011 microchip technology inc. figure 1-1: pic10(l)f320/322 block diagram porta note 1: see applicable chapters for more information on peripherals. cpu program flash memory ram timing generation intrc oscillator mclr figure 2-1 clkin clkr adc 8-bit fvr te m p . indicator timer2 timer0 pwm1 pwm2 nco clc cwg www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 9 pic10(l)f320/322 table 1-2: pic10(l)f320/322 pinout description name function input type output type description ra0/pwm1/clc1in1/cwg1a/ an0/icspdat ra0 ttl cmos general purpose i/o with ioc and wpu. pwm1 ? cmos pwm output. clc1in1 st ? clc input. cwg1a ? cmos cwg primary output. an0 an ? a/d channel input. icspdat st cmos icsp? data i/o. ra1/pwm2/clc1/cwg1b/an1/ clkin/icspclk/nco1clk ra1 ttl cmos general purpose i/o with ioc and wpu. pwm2 ? cmos pwm output. clc1 ? cmos clc output. cwg1b ? cmos cwg complementary output. an1 an ? a/d channel input. clkin st ? external clock input (ec mode). icspclk st ? serial programming clock. nco1clk st ? numerical controlled oscillator external clock input. ra2/int/t0cki/nco1/clc1in2/ clkr/an2/cwg1flt ra2 ttl cmos general purpose i/o with ioc and wpu. int st ? external interrupt. t0cki st ? timer0 clock input. nco1 ? cmos numerically controlled oscillator output. clc1in2 st ? clc input. clkr ? cmos clock reference output. an2 an ? a/d channel input. cwg1flt st ? complementary waveform generator fault 1 source input. ra3/mclr /v pp ra3 ttl ? general purpose input. mclr st ? master clear with internal pull-up. v pp hv ? programming voltage. v dd v dd power ? positive supply. v ss v ss power ? ground reference. legend: an = analog input or output cmos = cmos compatible input or output ttl = cmos input with ttl levels st = cmos input with schmitt trigger levels hv = high voltage www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 10 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 11 pic10(l)f320/322 2.0 memory organization these devices contain the following types of memory: ? program memory - configuration words - device id -user id - flash program memory ? data memory - core registers - special function registers - general purpose ram - common ram the following features are associated with access and control of program memory and data memory: ? pcl and pclath ?stack ? indirect addressing 2.1 program memory organization the mid-range core has a 13-bit program counter capable of addressing 8k x 14 program memory space. this device family only implements up to 512 words of the 8k program memory space. table 2-1 shows the memory sizes implemented for the pic10(l)f320/322 family. accessing a location above these boundaries will cause a wrap-around within the implemented memory space. the reset vector is at 0000h and the interrupt vector is at 0004h (see figures 2-1 , and 2-2 ). table 2-1: device sizes and addresses device program memory space (words) last program memory address pic10(l)f320 256 00ffh pic10(l)f322 512 01ffh www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 12 preliminary ? 2011 microchip technology inc. figure 2-1: program memory map and stack for pic10(l)f320 figure 2-2: program memory map and stack for pic10(l)f322 pc<12:0> 13 0000h 0004h stack level 0 stack level 8 reset vector interrupt vector stack level 1 0005h on-chip program memory page 0 00ffh wraps to page 0 wraps to page 0 wraps to page 0 0100h call , return , retlw retfie rollover to page 0 rollover to page 0 fffh pc<12:0> 13 0000h 0004h stack level 0 stack level 8 reset vector interrupt vector stack level 1 0005h on-chip program memory page 0 01ffh wraps to page 0 wraps to page 0 0200h call return , retlw retfie rollover to page 0 rollover to page 0 fffh www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 13 pic10(l)f320/322 2.2 data memory organization the data memory is in one bank, which contains the general purpose registers (gpr) and the special function registers (sfr). the rp<1:0> bits of the status register are the bank select bits. rp1 rp0 00 ? bank 0 is selected the bank extends up to 7fh (128 bytes). the lower locations of the bank are reserved for the special func- tion registers. above the special function registers are the general purpose registers, implemented as static ram. 2.2.1 general purpose register file the register file is organized as 64 x 8 in the pic10(l)f320/322. each register is accessed, either directly or indirectly, through the file select register (fsr) (see section 2.4 ?indirect addressing, indf and fsr registers? ). 2.2.2 special function registers the special function registers are registers used by the cpu and peripheral functions for controlling the desired operation of the device (see tab l e 2 - 3 ). these registers are static ram. the special registers can be classified into two sets: core and peripheral. the special function registers associated with the ?core? are described in this section. those related to the operation of the peripheral features are described in the section of that peripheral feature. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 14 preliminary ? 2011 microchip technology inc. 2.2.2.1 status register the status register, shown in register 2-1 , contains: ? the arithmetic status of the alu ? the reset status ? the bank select bits for data memory (sram) the status register can be the destination for any instruction, like any other register. if the status register is the destination for an instruction that affects the z, dc or c bits, then the write to these three bits is disabled. these bits are set or cleared according to the device logic. furthermore, the to and pd bits are not writable. therefore, the result of an instruction with the status register as destination may be different than intended. for example, clrf status will clear the upper three bits and set the z bit. this leaves the status register as ?000u u1uu? (where u = unchanged). it is recommended, therefore, that only bcf, bsf, swapf and movwf instructions are used to alter the status register, because these instructions do not affect any status bits. for other instructions not affect- ing any status bits (see section 23.0 ?instruction set summary? ). note 1: bits irp and rp1 of the status register are not used by the pic10(l)f320 and should be maintained as clear. use of these bits is not recommended, since this may affect upward compatibility with future products. 2: the c and dc bits operate as a borrow and digit borrow out bit, respectively, in subtraction. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 15 pic10(l)f320/322 register 2-1: status: status register r/w-0/0 r/w-0/0 r/w-0/0 r-1/q r-1/q r/w-x/u r/w-x/u r/w-x/u irp rp1 rp0 to pd zdcc bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7 irp: reserved (2) bit 6-5 rp<1:0>: reserved (2) bit 4 to : time-out bit 1 = after power-up, clrwdt instruction or sleep instruction 0 = a wdt time-out occurred bit 3 pd : power-down bit 1 = after power-up or by the clrwdt instruction 0 = by execution of the sleep instruction bit 2 z: zero bit 1 = the result of an arithmetic or logic operation is zero 0 = the result of an arithmetic or logic operation is not zero bit 1 dc: digit carry/borrow bit ( addwf , addlw , sublw , subwf instructions) (1) 1 = a carry-out from the 4th low-order bit of the result occurred 0 = no carry-out from the 4th low-order bit of the result bit 0 c: carry/borrow bit ( addwf , addlw , sublw , subwf instructions) (1) 1 = a carry-out from the most significant bit of the result occurred 0 = no carry-out from the most significant bit of the result occurred note 1: for borrow , the polarity is reversed. a subtraction is executed by adding the two?s complement of the second operand. for rotate ( rrf , rlf ) instructions, this bit is loaded with either the high or low-order bit of the source register. 2: maintain as ? 0 ?. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 16 preliminary ? 2011 microchip technology inc. 2.2.3 device memory maps the memory maps for pic10(l)f320/322 are as shown in table 2-2 . table 2-2: pic10(l)f320/ 322 memory map (bank 0) legend: = unimplemented data memory locations, read as ? 0 ?. * = not a physical register. indf (*) 00h pmadrl 20h general purpose registers 32 bytes 40h 5fh general purpose registers 32 bytes 60h 7fh tmr0 01h pmadrh 21h pcl 02h pmdatl 22h status 03h pmdath 23h fsr 04h pmcon1 24h porta 05h pmcon2 25h trisa 06h clkrcon 26h lata 07h nco1accl 27h ansela 08h nco1acch 28h wpua 09h nco1accu 29h pclath 0ah nco1incl 2ah intcon 0bh nco1inch 2bh pir1 0ch reserved 2ch pie1 0dh nco1con 2dh option_reg 0eh nco1clk 2eh pcon 0fh reserved 2fh osccon 10h wdtcon 30h tmr2 11h clc1con 31h pr2 12h clc1sel1 32h t2con 13h clc1sel2 33h pwm1dcl 14h clc1pol 34h pwm1dc 15h clc1gate1 35h pwm1con 16h clc1gate2 36h pwm2dcl 17h clc1gate3 37h pwm2dc 18h clc1gate4 38h pwm2con 19h cwg1con0 39h iocap 1ah cwg1con1 3ah iocan 1bh cwg1asd 3bh iocaf 1ch cwg1rc 3ch fvrcon 1dh cwg1fc 3dh adres 1eh vregcon 3eh adcon 1fh borcon 3fh www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 17 pic10(l)f320/322 table 2-3: special function register summary (bank 0) address 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 bank 0 00h indf addressing this location uses contents of fsr to address data memory (not a physical register) xxxx xxxx xxxx xxxx 01h tmr0 timer0 module register xxxx xxxx uuuu uuuu 02h pcl program counter (pc) least significant byte 0000 0000 0000 0000 03h status irp rp1 rp0 to pd zdcc 0001 1xxx 000q quuu 04h fsr indirect data memory address pointer xxxx xxxx uuuu uuuu 05h porta ? ? ? ? ra3 ra2 ra1 ra0 ---- xxxx ---- uuuu 06h trisa ? ? ? ? ? (1) trisa2 trisa1 trisa0 ---- 1111 ---- 1111 07h lata ? ? ? ? ? lata2 lata1 lata0 ---- -xxx ---- -uuu 08h ansela ? ? ? ? ? ansa2 ansa1 ansa0 ---- -111 ---- -111 09h wpua ? ? ? ? wpua3 wpua2 wpua1 wpua0 ---- 1111 ---- 1111 0ah pclath ? ? ? ? ? ? ? pclh0 ---- ---0 ---- ---0 0bh intcon gie peie tmr0ie inte iocie tmr0if intf iocif 0000 0000 0000 000u 0ch pir1 ?adif ? nco1if clc1if ?tmr2if ? -0-0 0-0- -0-0 0-0- 0dh pie1 ?adie ? nco1ie clc1ie ?tmr2ie ? -0-0 0-0- -0-0 0-0- 0eh option_reg wpuen intedg t0cs t0se psa ps<2:0> 1111 1111 uuuu uuuu 0fh pcon ? ? ? ? ? ?por bor ---- --qq ---- --uu 10h osccon ? ircf<2:0> hfiofr ? lfiofr hfiofs -110 0-00 -110 0-00 11h tmr2 timer2 module register 0000 0000 0000 0000 12h pr2 timer2 period register 1111 1111 1111 1111 13h t2con ? toutps<3:0> tmr2on t2ckps1 t2ckps0 -000 0000 -000 0000 14h pwm1dcl pwm1dcl<1:0> ? ? ? ? ? ? xx-- ---- uu-- ---- 15h pwm1dch pwm1dch<7:0> xxxx xxxx uuuu uuuu 16h pwm1con pwm1en pwm1oe pwm1out pwm1pol ? ? ? ? 0000 ---- 0000 ---- 17h pwm2dcl pwm2dcl<1:0> ? ? ? ? ? ? xx-- ---- uu-- ---- 18h pwm2dch pwm2dch<7:0> xxxx xxxx uuuu uuuu 19h pwm2con pwm2en pwm2oe pwm2out pwm2pol ? ? ? ? 0000 ---- 0000 ---- 1ah iocap ? ? ? ? iocap3 iocap2 iocap1 iocap0 ---- 0000 ---- 0000 1bh iocan ? ? ? ? iocan3 iocan2 iocan1 iocan0 ---- 0000 ---- 0000 1ch iocaf ? ? ? ? iocaf3 iocaf2 iocaf1 iocaf0 ---- 0000 ---- 0000 1dh fvrcon fvren fvrrdy tsen tsrng ? ?adfvr<1:0> 0x00 --00 0x00 --00 1eh adres a/d result register xxxx xxxx uuuu uuuu 1fh adcon adcs<2:0> chs<2:0> go/ done adon 0000 0000 0000 0000 legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, read as ? 0 ?, r = reserved. shaded locations are unimplemented, read as ? 0 ?. note 1: unimplemented, read as ? 1 ?. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 18 preliminary ? 2011 microchip technology inc. bank 0 (continued) 20h pmadrl pmadr<7:0> 0000 0000 0000 0000 21h pmadrh ? ? ? ? ? ? ? pmadr8 ---- ---0 ---- ---0 22h pmdatl pmdat<7:0> xxxx xxxx uuuu uuuu 23h pmdath ? ?pmdat<13:8> --xx xxxx --uu uuuu 24h pmcon1 ? cfgs lwlo free wrerr wren wr rd 1000 0000 1000 q000 25h pmcon2 program memory control register 2 (not a physical register) 0000 0000 0000 0000 26h clkrcon ?clkroe ? ? ? ? ? ? -0-- ---- -0-- ---- 27h nco1accl nco1 accumulator <7:0> 0000 0000 0000 0000 28h nco1acch nco1 accumulator <15:8> 0000 0000 0000 0000 29h nco1accu ? nco1 accumulator <19..16> ---- 0000 ---- 0000 2ah nco1incl nco1 increment <7:0> 0000 0001 0000 0001 2bh nco1inch nco1 increment <15:8> 0000 0000 0000 0000 2ch ? unimplemented ? ? 2dh nco1con n1en n1oe n1out n1pol ? ? ?n1pfm 0000 ---0 00x0 ---0 2eh nco1clk n1pws<2:0> ? ? ?n1cks<1:0> 000- --00 000- --00 2fh reserved reserved xxxx xxxx uuuu uuuu 30h wdtcon ? ?wdtps<4:0>swdten --01 0110 --01 0110 31h clc1con lc1en lc1oe lc1out lc1intp lc1intn lc1mode<2:0> 00x0 -000 00x0 -000 32h clc1sel0 ? lc1d2s<2:0> ? lc1d1s<2:0> -xxx -xxx -uuu -uuu 33h clc1sel1 ? lc1d4s<2:0> ? lc1d3s<2:0> -xxx -xxx -uuu -uuu 34h clc1pol lc1pol ? ? ? lc1g4pol lc1g3pol lc1g2pol lc1g1pol 0--- xxxx 0--- uuuu 35h clc1gls0 lc1g1d4t lc1g1d4n lc1g1d3t lc1g1d3n lc1g1d2t lc1g1d2n lc1g1d1t lc1g1d1n xxxx xxxx uuuu uuuu 36h clc1gls1 lc1g2d4t lc1g2d4n lc1g2d3t lc1g2d3n lc1g2d2t lc1g2d2n lc1g2d1t lc1g2d1n xxxx xxxx uuuu uuuu 37h clc1gls2 lc1g3d4t lc1g3d4n lc1g3d3t lc1g3d3n lc1g3d2t lc1g3d2n lc1g3d1t lc1g3d1n xxxx xxxx uuuu uuuu 38h clc1gls3 lc1g4d4t lc1g4d4n lc1g4d3t lc1g4d3n lc1g4d2t lc1g4d2n lc1g4d1t lc1g4d1n xxxx xxxx uuuu uuuu 39h cwg1con0 g1en g1oeb g1oea g1polb g1pola ? ? g1cs0 0000 0--0 0000 0--0 3ah cwg1con1 g1asdlb<1:0> g1asdla<1:0> ? ? g1is<1:0> xxxx --xx uuuu --uu 3bh cwg1con2 g1ase g1arsen ? ? ? ? g1asdclc1 g1asdflt xx-- --xx uu-- --uu 3ch cwg1dbr ? ?cwg1dbr<5:0> --xx xxxx --uu uuuu 3dh cwg1dbf ? ?cwg1dbf<5:0> --xx xxxx --uu uuuu 3eh vregcon ? ? ? ? ? ?vregpm1 reserved ---- --01 ---- --01 3fh borcon sboren borfs ? ? ? ? ? borrdy 10-- ---q uu-- ---u table 2-3: special function regist er summary (bank 0) (continued) address 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 legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, read as ? 0 ?, r = reserved. shaded locations are unimplemented, read as ? 0 ?. note 1: unimplemented, read as ? 1 ?. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 19 pic10(l)f320/322 2.3 pcl and pclath the program counter (pc) is 13 bits wide. the low byte comes from the pcl register, which is a readable and writable register. the high byte (pc<12:8>) is not directly readable or writable and comes from pclath. on any reset, the pc is cleared. figure 2-3 shows the two situations for the loading of the pc. the upper example in figure 2-3 shows how the pc is loaded on a write to pcl (pclath<4:0> ? pch). the lower example in figure 2-3 shows how the pc is loaded during a call or goto instruction (pclath<4:3> ? pch). figure 2-3: loading of pc in different situations 2.3.1 modifying pcl executing any instruction with the pcl register as the destination simultaneously causes the program counter pc<12:8> bits (pch) to be replaced by the contents of the pclath register. this allows the entire contents of the program counter to be changed by writing the desired upper 5 bits to the pclath register. when the lower 8 bits are written to the pcl register, all 13 bits of the program counter will change to the values contained in the pclath register and those being written to the pcl register. a computed goto is accomplished by adding an offset to the program counter ( addwf pcl ). care should be exercised when jumping into a look-up table or program branch table (computed goto ) by modifying the pcl register. assuming that pclath is set to the table start address, if the table length is greater than 255 instructions or if the lower 8 bits of the memory address rolls over from 0xff to 0x00 in the middle of the table, then pclath must be incremented for each address rollover that occurs between the table beginning and the target location within the table. for more information refer to application note an556, ? implementing a table read ? (ds00556). 2.3.2 stack all devices have an 8-level x 13-bit wide hardware stack (see figure 2-1 ). the stack space is not part of either program or data space and the stack pointer is not readable or writable. the pc is pushed onto the stack when a call instruction is executed or an inter- rupt causes a branch. the stack is poped in the event of a return, retlw or a retfie instruction execu- tion. pclath is not affected by a push or pop oper- ation. the stack operates as a circular buffer. this means that after the stack has been pushed eight times, the ninth push overwrites the value that was stored from the first push. the tenth push overwrites the second push (and so on). 2.4 indirect addressing, indf and fsr registers the indf register is not a physical register. addressing the indf register will cause indirect addressing. indirect addressing is possible by using the indf register. any instruction using the indf register actually accesses data pointed to by the file select register (fsr). reading indf itself indirectly will produce 00h. writing to the indf register indirectly results in a no operation (although status bits may be affected). an effective 9-bit address is obtained by concatenating the 8-bit fsr and the irp bit of the status register, as shown in figure 2-4 . a simple program to clear ram location 40h-7fh using indirect addressing is shown in example 2-1 . example 2-1: indirect addressing pc 12 8 7 0 5 pclath<4:0> pclath instruction with alu result goto, call opcode <10:0> 8 pc 12 11 10 0 11 pclath<4:3> pch pcl 87 2 pclath pch pcl pcl as destination note 1: there are no status bits to indicate stack overflow or stack underflow conditions. 2: there are no instructions/mnemonics called push or pop. these are actions that occur from the execution of the call, return, retlw and retfie instructions or the vectoring to an interrupt address. movlw 0x40 ;initialize pointer movwf fsr ;to ram next clrf indf ;clear indf register incf fsr ;inc pointer btfss fsr,7 ;all done? goto next ;no clear next continue ;yes continue www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 20 preliminary ? 2011 microchip technology inc. figure 2-4: direct/indirect addressing pic10(l)f320/322 data memory indirect addressing direct addressing location select 6 0 from opcode file select register 7 0 location select 00h 7fh bank 0 for memory map detail, see figure 2-2 . www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 21 pic10(l)f320/322 3.0 device configuration device configuration consists of configuration word and device id. 3.1 configuration word there are several configuration word bits that allow different oscillator and memory protection options. these are implemented as configuration word at 2007h. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 22 preliminary ? 2011 microchip technology inc. register 3-1: config : configuration word u-1 r/p-1/1 r/p-1/1 r/p-1/1 r/p-1/1 r/p-1/1 ? wrt<1:0> borv lpbor lvp bit 13 bit 8 r/p-1/1 r/p-1/1 r/p-1/1 r/p-1/1 r/p-1/1 r/p-1/1 r/p-1/1 r/p-1/1 cp mclre pwrte wdte<1:0> boren<1:0> fosc bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared p = programmable bit bit 13 unimplemented : read as ? 1 ? bit 12-11 wrt<1:0>: flash memory self-write protection bits 256 w flash memory: pic10(l)f320: 11 =write protection off 10 =000h to 03fh write-protected, 040h to 0ffh may be modified by pmcon control 01 =000h to 07fh write-protected, 080h to 0ffh may be modified by pmcon control 00 =000h to 0ffh write-protected, no addresses may be modified by pmcon control 512 w flash memory: pic10(l)f322: 11 =write protection off 10 =000h to 07fh write-protected, 080h to 1ffh may be modified by pmcon control 01 =000h to 0ffh write-protected, 100h to 1ffh may be modified by pmcon control 00 =000h to 1ffh write-protected, no addresses may be modified by pmcon control bit 10 borv: brown-out reset voltage selection bit 1 = brown-out reset voltage (v bor ) set to 1.9v (pic10lf320/322) or 2.4v (pic10f320/322) 0 = brown-out reset voltage (v bor ) set to 2.7v bit 9 lpbor: low-power brown-out reset enable bit 1 = low-power brown-out reset is enabled 0 = low-power brown-out reset is disabled bit 8 lvp: low-voltage programming enable bit 1 = low-voltage programming enabled. mclr /v pp pin function is mclr . 0 = high voltage on mclr /v pp must be used for programming bit 7 cp : code protection bit (2) 1 = program memory code protection is disabled 0 = program memory code protection is enabled bit 6 mclre: mclr /v pp pin function select bit if lvp bit = 1 : this bit is ignored. if lvp bit = 0 : 1 =mclr /v pp pin function is mclr ; weak pull-up enabled. 0 =mclr /v pp pin function is digital input; mclr internally disabled; weak pull-up under control of wpua3 bit. bit 5 pwrte : power-up timer enable bit (1) 1 = pwrt disabled 0 = pwrt enabled note 1: enabling brown-out reset does not automatically enable power-up timer. 2: once enabled, code-protect can only be disabled by bulk erasing the device. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 23 pic10(l)f320/322 bit 4-3 wdte<1:0>: watchdog timer enable bit 11 = wdt enabled 10 = wdt enabled while running and disabled in sleep 01 = wdt controlled by the swdten bit in the wdtcon register 00 = wdt disabled bit 2-1 boren<1:0>: brown-out reset enable bits 11 = brown-out reset enabled; sboren bit is ignored 10 = brown-out reset enabled while running, disabled in sleep; sboren bit is ignored 01 = brown-out reset controlled by the sboren bit in the borcon register 00 = brown-out reset disabled; sboren bit is ignored bit 0 fosc: oscillator selection bit 1 = ec on clkin pin 0 = intosc oscillator i/o function available on clkin pin register 3-1: conf ig: configuration word (continued) note 1: enabling brown-out reset does not automatically enable power-up timer. 2: once enabled, code-protect can only be disabled by bulk erasing the device. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 24 preliminary ? 2011 microchip technology inc. 3.2 code protection code protection allows the device to be protected from unauthorized access. program memory protection and data memory protection are controlled independently. internal access to the program memory and data memory are unaffected by any code protection setting. 3.2.1 program memory protection the entire program memory space is protected from external reads and writes by the cp bit in configuration word. when cp = 0 , external reads and writes of program memory are inhibited and a read will return all ? 0 ?s. the cpu can continue to read program memory, regardless of the protection bit settings. writing the program memory is dependent upon the write protection setting. see section 3.3 ?write protection? for more information. 3.3 write protection write protection allows the device to be protected from unintended self-writes. applications, such as boot loader software, can be protected while allowing other regions of the program memory to be modified. the wrt<1:0> bits in configuration word define the size of the program memory block that is protected. 3.4 user id four memory locations (2000h-2003h) are designated as id locations where the user can store checksum or other code identification numbers. these locations are readable and writable during normal execution. see section 3.5 ?device id and revision id? for more information on accessing these memory locations. for more information on checksum calculation, see the ?pic10(l)f320/322 flash memory programming specification? (ds41572). www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 25 pic10(l)f320/322 3.5 device id and revision id the memory location 2006h is where the device id and revision id are stored. the upper nine bits hold the device id. the lower five bits hold the revision id. see section 9.4 ?user id, device id and configuration word access? for more information on accessing these memory locations. development tools, such as device programmers and debuggers, may be used to read the device id and revision id. register 3-2: deviceid: device id register (1) rrrrrr dev8 dev7 dev6 dev5 dev4 dev3 bit 13 bit 8 rrrrrrrr dev2 dev1 dev0 rev4 rev3 rev2 rev1 rev0 bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit w = writable bit ?0? = bit is cleared -n = value at por ?1? = bit is set x = bit is unknown bit 13-5 dev<8:0>: device id bits bit 4-0 rev<4:0>: revision id bits these bits are used to identify the revision. note 1: this location cannot be written. device deviceid<13:0> values dev<8:0> rev<4:0> pic10f320 10 1001 101 x xxxx pic10lf320 10 1001 111 x xxxx PIC10F322 10 1001 100 x xxxx pic10lf322 10 1001 110 x xxxx www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 26 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 27 pic10(l)f320/322 4.0 oscillator module 4.1 overview the oscillator module has a variety of clock sources and selection features that allow it to be used in a range of applications while maximizing performance and minimizing power consumption. figure 4-1 illustrates a block diagram of the oscillator module. the system can be configured to use an internal calibrated high-frequency oscillator as clock source, with a choice of selectable speeds via software. clock source modes are configured by the fosc bit in configuration word (config). 1. ec oscillator from clkin. 2. intosc oscillator, clkin not enabled. figure 4-1: pic10(l)f320/322 clock source block diagram hfintosc 16 mhz hfiofr (1) hfiofs (1) divider 16 mhz 8 mhz 4 mhz 2 mhz 1 mhz 500 khz 250 khz mux 111 110 101 100 011 010 001 lfintosc 31 khz 000 ircf<2:0> intosc lfiofr (1) clkin ec mux f osc (configuration word) system clock (cpu and peripherals) clkroe clkr 31 khz 0 1 3 note 1: hfiofr, hfiofs and lfiofr are status bits in the osccon register. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 28 preliminary ? 2011 microchip technology inc. 4.2 clock source modes clock source modes can be classified as external or internal. ? internal clock source (intosc) is contained within the oscillator module, which has eight selectable output frequencies, with a maximum internal frequency of 16 mhz. ? the external clock mode (ec) relies on an external signal for the clock source. the system clock can be selected between external or internal clock sources via the fosc bit of the configuration word. 4.3 internal clock modes the internal clock sources are contained within the oscillator module. the internal oscillator block has two internal oscillators that are used to generate all internal system clock sources: the 16 mhz high-frequency internal oscillator (hfintosc) and the 31 khz (lfintosc). the hfintosc consists of a primary and secondary clock. the secondary clock starts first with rapid start- up time, but low accuracy. the secondary clock ready signal is indicated with the hfiofr bit of the osccon register. the primary clock follows with slower start-up time and higher accuracy. the primary clock is stable when the hfiofs bit of the osccon register bit goes high. 4.3.1 intosc mode when the fosc bit of the configuration word is cleared, the intosc mode is selected. when intosc is selected, clkin pin is available for general purpose i/o. see section 3.0 ?device configuration? for more information. 4.3.2 frequency select bits (ircf) the output of the 16 mhz hfintosc is connected to a divider and multiplexer (see figure 4-1 ). the internal oscillator frequency select bits (ircf) of the osccon register select the frequency output of the internal oscillator: ?hfintosc -16 mhz - 8 mhz (default after reset) -4 mhz -2 mhz -1 mhz -500 khz -250 khz ?lfintosc -31 khz there is no delay when switching between hfintosc frequencies with the ircf bits. this is because the switch involves only a change to the frequency output divider. start-up delay specifications are located in section 24.0 ?electrical specifications? . note: following any reset, the ircf<2:0> bits of the osccon register are set to ? 110 ? and the frequency selection is set to 8 mhz. the user can modify the ircf bits to select a different frequency. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 29 pic10(l)f320/322 4.3.3 reference clock output control f osc /4 output is enabled via the clkroe bit of clkrcon register. the signal drives the pin regardless of the tris setting. register 4-1: clkrcon ? refere nce clock control register u-0 r/w-0/0 u-0 u-0 u-0 u-0 u-0 u-0 ?clkroe ? ? ? ? ? ? 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 q = value depends on condition bit 7 unimplemented: read as ? 0 ? bit 6 clkroe: reference clock output enable bit 1 = reference clock output (clkr), regardless of tris 0 = reference clock output disabled bit 5-0 unimplemented: read as ? 0 ? www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 30 preliminary ? 2011 microchip technology inc. 4.4 oscillator control registers 4.4.1 oscillator control the oscillator control (osccon) register ( register 4-2 ) displays the oscillator readiness, stability and allows frequency selection of the internal oscillator (intosc) system clock. register 4-2: osccon: os cillator control register u-0 r/w-1/1 r/w-1/1 r/w-0/0 r-0/0 u-0 r-0/0 r-0/0 ? ircf<2:0> hfiofr ?lfiofrhfiofs bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7 unimplemented: read as ? 0 ? bit 6-4 ircf<2:0>: intosc (f osc ) frequency select bits 111 = 16 mhz 110 = 8 mhz (default value) 101 = 4 mhz 100 = 2 mhz 011 = 1 mhz 010 = 500 khz 001 = 250 khz 000 = 31 khz (lfintosc) bit 3 hfiofr: high-frequency internal oscillator ready bit 1 = 16 mhz internal oscillator (hfintosc) is ready 0 = 16 mhz internal oscillator (hfintosc) is not ready bit 2 unimplemented: read as ? 0 ? bit 1 lfiofr: low-frequency internal oscillator ready bit 1 = 31 khz internal oscillator (lfintosc) is ready 0 = 31 khz internal oscillator (lfintosc) is not ready bit 0 hfiofs: high-frequency internal oscillator stable bit 1 = 16 mhz internal oscillator (hfintosc) is stable 0 = 16 mhz internal oscillator (hfintosc) is not stable www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 31 pic10(l)f320/322 4.5 external clock mode 4.5.1 ec mode the external clock (ec) mode allows an externally generated logic level as the system clock source. when operating in this mode, an external clock source is connected to the clkin input. table 4-1: summary of registers associated with clock sources table 4-2: summary of configura tion word with clock sources name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page clkrcon ?clkroe ? ? ? ? ? ? 29 osccon ? ircf<2:0> hfiofr ? lfiofr hfiofs 30 legend: x = unknown, u = unchanged, ? = unimplemented locations read as ? 0 ?. shaded cells are not used by ecwg. name bits bit -/7 bit -/6 bit 13/5 bit 12/4 bit 11/3 bit 10/2 bit 9/1 bit 8/0 register on page config 13:8 ? ? ? wrt<1:0> borv lpbor lvp 22 7:0 cp mclre pwrte wdte<1:0> boren<1:0> fosc legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used by clock sources. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 32 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 33 pic10(l)f320/322 5.0 resets there are multiple ways to reset this device: ? power-on reset (por) ? brown-out reset (bor) ? low-power brown-out reset (lpbor) ?mclr reset ?wdt reset ? programming mode exit to allow v dd to stabilize, an optional power-up timer can be enabled to extend the reset time after a bor or por event. a simplified block diagram of the on-chip reset circuit is shown in figure 5-1 . figure 5-1: simplified block di agram of on-chip reset circuit note 1: see ta b l e 5 - 1 for bor active conditions. device reset power-on reset wdt time-out brown-out reset lpbor reset icsp? programming mode exit mclre sleep bor active (1) pwrte lfintosc v dd pwrt r done www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 34 preliminary ? 2011 microchip technology inc. 5.1 power-on reset (por) the por circuit holds the device in reset until v dd has reached an acceptable level for minimum operation. slow rising v dd , fast operating speeds or analog performance may require greater than minimum v dd . the pwrt, bor or mclr features can be used to extend the start-up period until all device operation conditions have been met. 5.1.1 power-up timer (pwrt) the power-up timer provides a nominal 64 ms time- out on por or brown-out reset. the device is held in reset as long as pwrt is active. the pwrt delay allows additional time for the v dd to rise to an acceptable level. the power-up timer is enabled by clearing the pwrte bit in configuration word. the power-up timer starts after the release of the por and bor. for additional information, refer to application note an607, ?power-up trouble shooting? (ds00607). 5.2 brown-out reset (bor) the bor circuit holds the device in reset when v dd reaches a selectable minimum level. between the por and bor, complete voltage range coverage for execution protection can be implemented. the brown-out reset module has four operating modes controlled by the boren<1:0> bits in configu- ration word. the four operating modes are: ? bor is always on ? bor is off when in sleep ? bor is controlled by software ? bor is always off refer to tab le 5 - 1 for more information. the brown-out reset voltage level is selectable by configuring the borv bit in register 3-1 . a v dd noise rejection filter prevents the bor from trig- gering on small events. if v dd falls below v bor for a duration greater than parameter t bordc , the device will reset. see figure 5-2 for more information. table 5-1: bor operating modes 5.2.1 bor is always on when the boren bits of configuration word are programmed to ? 11 ?, the bor is always on. the device start-up will be delayed until the bor is ready and v dd is higher than the bor threshold. bor protection is active during sleep. the bor does not delay wake-up from sleep. 5.2.2 bor is off in sleep when the boren bits of configuration word are programmed to ? 10 ?, the bor is on, except in sleep. the device start-up will be delayed until the bor is ready and v dd is higher than the bor threshold. bor protection is not active during sleep. the device wake-up will be delayed until the bor is ready. 5.2.3 bor controlled by software when the boren bits of configuration word are programmed to ? 01 ?, the bor is controlled by the sboren bit of the borcon register. the device start- up is not delayed by the bor ready condition or the v dd level. bor protection begins as soon as the bor circuit is ready. the status of the bor circuit is reflected in the borrdy bit of the borcon register. bor protection is unchanged by sleep. boren<1:0> sboren device mode bor mode device operation upon: release of por/wake- up from sleep 11 x x active waits for bor ready (1) 10 x awake active waits for bor ready sleep disabled 01 1 xactive begins immediately 0 xdisabled 00 x xdisabled note 1: even though this case specifically waits for the bor, the bor is already operating, so there is no delay in start-up. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 35 pic10(l)f320/322 figure 5-2: brown -out situations register 5-1: borco n: brown-out reset control register r/w-1/u r/w-0/u u-0 u-0 u-0 u-0 u-0 r-q/u sboren borfs ? ? ? ? ?borrdy bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7 sboren: software brown-out reset enable bit if boren <1:0> in configuration word ? 01 : sboren is read/write, but has no effect on the bor. if boren <1:0> in configuration word = 01 : 1 = bor enabled 0 = bor disabled bit 6 borfs: brown-out reset fast start bit (1) if boren<1:0> = 11 (always on) or boren<1:0> = 00 (always off) borfs is read/write, but has no effect. if boren <1:0> = 10 (disabled in sleep) or boren<1:0> = 01 (under software control): 1 = band gap is forced on always (covers sleep/wake-up/operating cases) 0 =b and gap operates normally, and may turn off bit 5-1 unimplemented: read as ? 0 ? bit 0 borrdy: brown-out reset circuit ready status bit 1 = the brown-out reset circuit is active 0 = the brown-out reset circuit is inactive note 1: boren<1:0> bits are located in configuration word. t pwrt (1) v bor v dd internal reset v bor v dd internal reset t pwrt (1) < t pwrt t pwrt (1) v bor v dd internal reset note 1: t pwrt delay only if pwrte bit is programmed to ? 0 ?. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 36 preliminary ? 2011 microchip technology inc. 5.3 low-power brown-out reset (lpbor) the low-power brown-out reset (lpbor) is an essential part of the reset subsystem. refer to figure 5-1 to see how the bor interacts with other modules. the lpbor is used to monitor the external v dd pin. when too low of a voltage is detected, the device is held in reset. when this occurs, a register bit (bor ) is changed to indicate that a bor reset has occurred. the same bit is set for both the bor and the lpbor. refer to register 5-2 . 5.3.1 enabling lpbor the lpbor is controlled by the lpbor bit of configuration word. when the device is erased, the lpbor module defaults to disabled. 5.3.1.1 lpbor module output the output of the lpbor module is a signal indicating whether or not a reset is to be asserted. this signal is or?d together with the reset signal of the bor mod- ule to provide the generic bor signal which goes to the pcon register and to the power control block. 5.4 mclr the mclr is an optional external input that can reset the device. the mclr function is controlled by the mclre and the lvp bit of configuration word ( table 5- 2 ). 5.4.1 mclr enabled when mclr is enabled and the pin is held low, the device is held in reset. the mclr pin is connected to v dd through an internal weak pull-up. the device has a noise filter in the mclr reset path. the filter will detect and ignore small pulses. 5.4.2 mclr disabled when mclr is disabled, the pin functions as a general purpose input and the internal weak pull-up is under software control. 5.5 watchdog timer (wdt) reset the watchdog timer generates a reset if the firmware does not issue a clrwdt instruction within the time-out period. the to and pd bits in the status register are changed to indicate the wdt reset. see section 8.0 ?watchdog timer? for more information. 5.6 programming mode icsp exit upon exit of programming mode, the device will behave as if a por had just occurred. 5.7 power-up timer the power-up timer optionally delays device execution after a bor or por event. this timer is typically used to allow v dd to stabilize before allowing the device to start running. the power-up timer is controlled by the pwrte bit of configuration word. 5.8 start-up sequence upon the release of a por or bor, the following must occur before the device will begin executing: 1. power-up timer runs to completion (if enabled). 2. mclr must be released (if enabled). the total time-out will vary based on oscillator configu- ration and power-up timer configuration. see section 4.0 ?oscillator module? for more informa- tion. the power-up timer runs independently of mclr reset. if mclr is kept low long enough, the power-up timer will expire. upon bringing mclr high, the device will begin execution immediately (see figure 5-3 ). this is useful for testing purposes or to synchronize more than one device operating in parallel. table 5-2: mclr configuration mclre lvp mclr 00 disabled 10 enabled x1 enabled note: a reset does not drive the mclr pin low. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 37 pic10(l)f320/322 figure 5-3: reset start-up sequence t mclr t pwrt v dd internal por power-up timer mclr internal reset oscillator modes internal oscillator oscillator f osc external clock (ec) clkin f osc www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 38 preliminary ? 2011 microchip technology inc. 5.9 determining the cause of a reset upon any reset, multiple bits in the status and pcon register are updated to indicate the cause of the reset. ta b l e 5 - 3 and ta b l e 5 - 4 show the reset condi- tions of these registers. table 5-3: reset status bits and their significance table 5-4: reset condition for special registers por bor to pd condition 0x11 power-on reset u011 brown-out reset uu0u wdt reset uu00 wdt wake-up from sleep uuuu mclr reset during normal operation uu10 mclr reset during sleep condition program counter status register pcon register power-on reset 0000h 0001 1000 ---- --0x mclr reset during normal operation 0000h 000u uuuu ---- --uu mclr reset during sleep 0000h 0001 0uuu ---- --uu wdt reset 0000h 0000 uuuu ---- --uu wdt wake-up from sleep pc + 1 0000 0uuu ---- --uu brown-out reset 0000h 0001 1uuu ---- --u0 interrupt wake-up from sleep pc + 1 (1) 0001 0uuu ---- --uu legend: u = unchanged, x = unknown, - = unimplemented bit, reads as ? 0 ?. note 1: when the wake-up is due to an interrupt and global enable bit (gie) is set, the return address is pushed on the stack and pc is loaded with the interrupt vector (0004h) after execution of pc + 1. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 39 pic10(l)f320/322 5.10 power control (pcon) register the power control (pcon) register contains flag bits to differentiate between a: ? power-on reset (por ) ? brown-out reset (bor ) the pcon register bits are shown in register 5-2 . table 5-5: summary of registers associated with resets table 5-6: summary of config uration word with resets register 5-2: pcon: power control register u-0 u-0 u-0 u-0 u-0 u-0 r/w/hc-q/u r/w/hc-q/u ? ? ? ? ? ? por bor bit 7 bit 0 legend: hc = bit is cleared by hardware r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7-2 unimplemented: read as ? 0 ? bit 1 por : power-on reset status bit 1 = no power-on reset occurred 0 = a power-on reset occurred (must be set in software after a power-on reset occurs) bit 0 bor : brown-out reset status bit 1 = no brown-out reset occurred 0 = a brown-out reset occurred (must be set in software after a power-on reset or brown-out reset occurs) name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page borcon sboren borfs ? ? ? ? ? borrdy 35 pcon ? ? ? ? ? ?por bor 39 status irp rp1 rp0 to pd z dc c 15 wdtcon ? ? wdtps<4:0> swdten 55 legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used by resets. name bits bit -/7 bit -/6 bit 13/5 bit 12/4 bit 11/3 bit 10/2 bit 9/1 bit 8/0 register on page config 13:8 ? ? ? wrt<1:0> borv lpbor lvp 22 7:0 cp mclre pwrte wdte<1:0> boren<1:0> fosc legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used by clock sources. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 40 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 41 pic10(l)f320/322 6.0 interrupts the interrupt feature allows certain events to preempt normal program flow. firmware is used to determine the source of the interrupt and act accordingly. some interrupts can be configured to wake the mcu from sleep mode. this chapter contains the following information for interrupts: ? operation ? interrupt latency ? interrupts during sleep ?int pin ? context saving during interrupts many peripherals produce interrupts. refer to the corresponding chapters for details. a block diagram of the interrupt logic is shown in figure 6-1 . figure 6-1: interrupt logic tmr0if tmr0ie intf inte iocif iocie interrupt to cpu wake-up (if in sleep mode) gie (tmr2if) pir1<0> pirn<7> pien<7> peie peripheral interrupts (tmr2ie) pie1<0> www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 42 preliminary ? 2011 microchip technology inc. 6.1 operation interrupts are disabled upon any device reset. they are enabled by setting the following bits: ? gie bit of the intcon register ? interrupt enable bit(s) for the specific interrupt events) ? peie bit of the intcon register (if the interrupt enable bit of the interrupt event is contained in the pie1 register) the intcon and pir1 registers record individual inter- rupts via interrupt flag bits. interrupt flag bits will be set, regardless of the status of the gie, peie and individual interrupt enable bits. the following events happen when an interrupt event occurs while the gie bit is set: ? current prefetched instruction is flushed ? gie bit is cleared ? current program counter (pc) is pushed onto the stack ? pc is loaded with the interrupt vector 0004h the firmware within the interrupt service routine (isr) should determine the source of the interrupt by polling the interrupt flag bits. the interrupt flag bits must be cleared before exiting the isr to avoid repeated interrupts. because the gie bit is cleared, any interrupt that occurs while executing the isr will be recorded through its interrupt flag, but will not cause the processor to redirect to the interrupt vector. the retfie instruction exits the isr by popping the previous address from the stack, and setting the gie bit. for additional information on a specific interrupt?s operation, refer to its peripheral chapter. 6.2 interrupt latency interrupt latency is defined as the time from when the interrupt event occurs to the time code execution at the interrupt vector begins. the latency for synchronous interrupts is 3 or 4 instruction cycles. for asynchronous interrupts, the latency is 3 to 5 instruction cycles, depending on when the interrupt occurs. see figure 6-2 and section 6.3 ?interrupts during sleep? for more details. note 1: individual interrupt flag bits are set, regardless of the state of any other enable bits. 2: all interrupts will be ignored while the gie bit is cleared. any interrupt occurring while the gie bit is clear will be serviced when the gie bit is set again. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 43 pic10(l)f320/322 figure 6-2: interrupt latency q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 intosc clkr pc 0004h 0005h pc inst(0004h) nop gie q1 q2 q3 q4 q1 q2 q3 q4 1 cycle instruction at pc pc inst(0004h) nop 2 cycle instruction at pc fsr addr pc+1 pc+2 0004h 0005h pc inst(0004h) nop gie pc pc-1 3 cycle instruction at pc execute interrupt inst(pc) interrupt sampled during q1 inst(pc) pc-1 pc+1 nop pc new pc/ pc+1 0005h pc-1 pc+1/fsr addr 0004h nop interrupt gie interrupt inst(pc) nop nop fsr addr pc+1 pc+2 0004h 0005h pc inst(0004h) nop gie pc pc-1 3 cycle instruction at pc interrupt inst(pc) nop nop nop inst(0005h) execute execute execute www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 44 preliminary ? 2011 microchip technology inc. figure 6-3: int pin interrupt timing q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 intosc clkr int pin intf gie instruction flow pc instruction fetched instruction executed interrupt latency pc pc + 1 pc + 1 0004h 0005h inst (0004h) inst (0005h) forced nop inst (pc) inst (pc + 1) inst (pc ? 1) inst (0004h) forced nop inst (pc) ? note 1: intf flag is sampled here (every q1). 2: asynchronous interrupt latency = 3-5 t cy . synchronous latency = 3-4 t cy , where t cy = instruction cycle time. latency is the same whether inst (pc) is a single cycle or a 2-cycle instruction. 3: for minimum width of int pulse, refer to ac specifications in section 24.0 ?electrical specifications? . 4: intf is enabled to be set any time during the q4-q1 cycles. (1) (2) (3) (4) (1) www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 45 pic10(l)f320/322 6.3 interrupts during sleep some interrupts can be used to wake from sleep. to wake from sleep, the peripheral must be able to operate without the system clock. the interrupt source must have the appropriate interrupt enable bit(s) set prior to entering sleep. on waking from sleep, if the gie bit is also set, the processor will branch to the interrupt vector. otherwise, the processor will continue executing instructions after the sleep instruction. the instruction directly after the sleep instruction will always be executed before branching to the isr. refer to the section 7.0 ?power- down mode (sleep)? for more details. 6.4 int pin the int pin can be used to generate an asynchronous edge-triggered interrupt. this interrupt is enabled by setting the inte bit of the intcon register. the intedg bit of the option_reg register determines on which edge the interrupt will occur. when the intedg bit is set, the rising edge will cause the interrupt. when the intedg bit is clear, the falling edge will cause the interrupt. the intf bit of the intcon register will be set when a valid edge appears on the int pin. if the gie and inte bits are also set, the processor will redirect program execution to the interrupt vector. 6.5 context saving during interrupts during an interrupt, only the return pc value is saved on the stack. typically, users may wish to save key registers during an interrupt (e.g., w and status registers). this must be implemented in software. temporary holding registers w_temp and status_temp should be placed in the last 16 bytes of gpr (see figure 2-2 ). these 16 locations are common to all banks and do not require banking. this makes context save and restore operations simpler. the code shown in example 6-1 can be used to: ? store the w register ? store the status register ? execute the isr code ? restore the status (and bank select bit register) ? restore the w register example 6-1: saving status and w registers in ram note: these devices do not require saving the pclath. however, if computed goto s are used in both the isr and the main code, the pclath must be saved and restored in the isr. movwf w_temp ;copy w to temp register swapf status,w ;swap status to be saved into w ;swaps are used because they do not affect the status bits movwf status_temp ;save status to bank zero status_temp register : :(isr) ;insert user code here : swapf status_temp,w ;swap status_temp register into w ;(sets bank to original state) movwf status ;move w into status register swapf w_temp,f ;swap w_temp swapf w_temp,w ;swap w_temp into w www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 46 preliminary ? 2011 microchip technology inc. 6.6 interrupt control registers 6.6.1 intcon register the intcon register is a readable and writable register, which contains the various enable and flag bits for tmr0 register overflow, interrupt-on-change and external int pin interrupts. note: interrupt flag bits are set when an interrupt condition occurs, regardless of the state of its corresponding enable bit or the global interrupt enable bit, gie, of the intcon register. user software should ensure the appropriate interrupt flag bits are clear prior to enabling an interrupt. register 6-1: intcon: interrupt control register r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r-0/0 gie peie tmr0ie inte iocie tmr0if intf iocif (1) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 gie: global interrupt enable bit 1 = enables all active interrupts 0 = disables all interrupts bit 6 peie: peripheral interrupt enable bit 1 = enables all active peripheral interrupts 0 = disables all peripheral interrupts bit 5 tmr0ie: timer0 overflow interrupt enable bit 1 = enables the timer0 interrupt 0 = disables the timer0 interrupt bit 4 inte: int external interrupt enable bit 1 = enables the int external interrupt 0 = disables the int external interrupt bit 3 iocie: interrupt-on-change interrupt enable bit 1 = enables the interrupt-on-change interrupt 0 = disables the interrupt-on-change interrupt bit 2 tmr0if: timer0 overflow interrupt flag bit 1 = tmr0 register has overflowed 0 = tmr0 register did not overflow bit 1 intf: int external interrupt flag bit 1 = the int external interrupt occurred 0 = the int external interrupt did not occur bit 0 iocif: interrupt-on-change interrupt flag bit (1) 1 = when at least one of the interrupt-on-change pins changed state 0 = none of the interrupt-on-change pins have changed state note 1: the iocif flag bit is read-only and cleared when all the interrupt-on-change flags in the iocaf register have been cleared by software. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 47 pic10(l)f320/322 6.6.2 pie1 register the pie1 register contains the interrupt enable bits, as shown in register 6-2 . note: bit peie of the intcon register must be set to enable any peripheral interrupt. register 6-2: pie1: peripheral interrupt enable register 1 u-0 r/w-0/0 u-0 r/w-0/0 r/w-0/0 u-0 r/w-0/0 u-0 ?adie ? nco1ie clc1ie ?tmr2ie ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 unimplemented : read as ? 0 ? bit 6 adie: a/d converter interrupt enable bit 1 = enables the a/d converter interrupt 0 = disables the a/d converter interrupt bit 5 unimplemented : read as ? 0 ? bit 4 nco1ie: numerically controlled oscillator interrupt enable bit 1 = enables the nco overflow interrupt 0 = disables the nco overflow interrupt bit 3 clc1ie: configurable logic block interrupt enable bit 1 = enables the clc interrupt 0 = disables the clc interrupt bit 2 unimplemented : read as ? 0 ? bit 1 tmr2ie: tmr2 to pr2 match interrupt enable bit 1 = enables the tmr2 to pr2 match interrupt 0 = disables the tmr2 to pr2 match interrupt bit 0 unimplemented : read as ? 0 ? www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 48 preliminary ? 2011 microchip technology inc. 6.6.3 pir1 register the pir1 register contains the interrupt flag bits, as shown in register 6-3 . note: interrupt flag bits are set when an interrupt condition occurs, regardless of the state of its corresponding enable bit or the global interrupt enable bit, gie, of the intcon register. user software should ensure the appropriate interrupt flag bits are clear prior to enabling an interrupt. register 6-3: pir1: peripheral interrupt request register 1 u-0 r/w-0/0 u-0 r/w-0/0 r/w-0/0 u-0 r/w-0/0 u-0 ?adif ? nco1if clc1if ?tmr2if ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 unimplemented : read as ? 0 ? bit 6 adif: a/d converter interrupt flag bit 1 = the a/d conversion completed 0 = the a/d conversion is not complete bit 5 unimplemented : read as ? 0 ? bit 4 nco1if: numerically controlled oscillator interrupt flag bit 1 = nco1 overflow occurred (must be cleared in software) 0 = no nco1 overflow bit 3 clc1if: configurable logic block rising edge interrupt flag bit 1 = clc interrupt occurred (must be cleared in software) 0 = no clc interrupt bit 2 unimplemented : read as ? 0 ? bit 1 tmr2if: tmr2 to pr2 match interrupt flag bit 1 = tmr2 to pr2 match occurred (must be cleared in software) 0 = no tmr2 to pr2 match note: the match must occur the number of times specified by the tmr2 postscaler ( register 17-1 ). bit 0 unimplemented : read as ? 0 ? www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 49 pic10(l)f320/322 table 6-1: summary of registers associated with interrupts name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page intcon gie peie tmr0ie inte iocie tmr0if intf iocif 46 iocaf ? ? ? ? iocaf3 iocaf2 iocaf1 iocaf0 84 iocan ? ? ? ? iocan3 iocan2 iocan1 iocan0 83 iocap ? ? ? ? iocap3 iocap2 iocap1 iocap0 83 option_reg wpuen intedg t0cs t0se psa ps<2:0> 103 pie1 ? adie ? nco1ie clc1ie ? tmr2ie ? 47 pir1 ? adif ? nco1if clc1if ? tmr2if ? 48 legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used by interrupts. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 50 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 51 pic10(l)f320/322 7.0 power-down mode (sleep) the power-down mode is entered by executing a sleep instruction. upon entering sleep mode, the following conditions exist: 1. wdt will be cleared but keeps running, if enabled for operation during sleep. 2. pd bit of the status register is cleared. 3. to bit of the status register is set. 4. cpu clock is disabled. 5. 31 khz lfintosc is unaffected and peripherals that operate from it may continue operation in sleep. 6. adc is unaffected, if the dedicated frc clock is selected. 7. i/o ports maintain the status they had before sleep was executed (driving high, low or high- impedance). 8. resets other than wdt are not affected by sleep mode. refer to individual chapters for more details on peripheral operation during sleep. to minimize current consumption, the following condi- tions should be considered: ? i/o pins should not be floating ? external circuitry sinking current from i/o pins ? internal circuitry sourcing current from i/o pins ? current draw from pins with internal weak pull-ups ? modules using 31 khz lfintosc ? cwg and nco modules using hfintosc i/o pins that are high-impedance inputs should be pulled to v dd or v ss externally to avoid switching cur- rents caused by floating inputs. examples of internal circuitry that might be sourcing current include the fvr module. see section 12.0 ?fixed voltage reference (fvr)? for more informa- tion on these modules. 7.1 wake-up from sleep the device can wake-up from sleep through one of the following events: 1. external reset input on mclr pin, if enabled 2. bor reset, if enabled 3. por reset 4. watchdog timer, if enabled 5. any external interrupt 6. interrupts by peripherals capable of running dur- ing sleep (see individual peripheral for more information) the first three events will cause a device reset. the last three events are considered a continuation of pro- gram execution. to determine whether a device reset or wake-up event occurred, refer to section 5.9 ?determining the cause of a reset? . when the sleep instruction is being executed, the next instruction (pc + 1) is prefetched. for the device to wake-up through an interrupt event, the corresponding interrupt enable bit must be enabled. wake-up will occur regardless of the state of the gie bit. if the gie bit is disabled, the device continues execution at the instruction after the sleep instruction. if the gie bit is enabled, the device executes the instruction after the sleep instruction, the device will then call the interrupt service routine. in cases where the execution of the instruction following sleep is not desirable, the user should have a nop after the sleep instruction. the wdt is cleared when the device wakes up from sleep, regardless of the source of wake-up. the complementary waveform generator (cwg) and the numerically controlled oscillator (nco) modules can utilize the hfintosc oscillator as their respective clock source. under certain conditions, when the hfin- tosc is selected for use with the cwg or nco mod- ules, the hfintosc will remain active during sleep. this will have a direct effect on the sleep mode current. please refer to 21.0 ?complementary waveform generator (cwg) module? and 20.0 ?numerically controlled oscillator (nco) module? for more infor- mation. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 52 preliminary ? 2011 microchip technology inc. 7.1.1 wake-up using interrupts when global interrupts are disabled (gie cleared) and any interrupt source has both its interrupt enable bit and interrupt flag bit set, one of the following will occur: ? if the interrupt occurs before the execution of a sleep instruction - sleep instruction will execute as a nop . - wdt and wdt prescaler will not be cleared -to bit of the status register will not be set -pd bit of the status register will not be cleared. ? if the interrupt occurs during or after the execu- tion of a sleep instruction - sleep instruction will be completely exe- cuted - device will immediately wake-up from sleep - wdt and wdt prescaler will be cleared -to bit of the status register will be set -pd bit of the status register will be cleared. even if the flag bits were checked before executing a sleep instruction, it may be possible for flag bits to become set before the sleep instruction completes. to determine whether a sleep instruction executed, test the pd bit. if the pd bit is set, the sleep instruction was executed as a nop . figure 7-1: wake-up from sleep through interrupt table 7-1: summary of registers as sociated with power-down mode q1 q2 q3 q4 q1 q2 q3 q4 q1 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 intosc clkr interrupt flag gie bit (intcon reg.) instruction flow pc instruction fetched instruction executed pc pc + 1 pc + 2 inst(pc) = sleep inst(pc - 1) inst(pc + 1) sleep processor in sleep interrupt latency (1) inst(pc + 2) inst(pc + 1) inst(0004h) inst(0005h) inst(0004h) forced nop pc + 2 0004h 0005h forced nop pc + 2 note 1: gie = 1 assumed. in this case after wake-up, the processor calls the isr at 0004h. if gie = 0 , execution will continue in-line. name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page status irp rp1 rp0 to pd zdcc 15 wdtcon ? ? wdtps<4:0> swdten 55 legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used in power-down mode. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 53 pic10(l)f320/322 8.0 watchdog timer the watchdog timer is a system timer that generates a reset if the firmware does not issue a clrwdt instruction within the time-out period. the watchdog timer is typically used to recover the system from unexpected events. the wdt has the following features: ? independent clock source ? multiple operating modes - wdt is always on - wdt is off when in sleep - wdt is controlled by software - wdt is always off ? configurable time-out period is from 1 ms to 256 seconds (typical) ? multiple reset conditions ? operation during sleep figure 8-1: watchdog ti mer block diagram lfintosc 23-bit programmable prescaler wdt wdt time-out wdtps<4:0> swdten sleep wdte<1:0> = 11 wdte<1:0> = 01 wdte<1:0> = 10 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 54 preliminary ? 2011 microchip technology inc. 8.1 independent clock source the wdt derives its time base from the 31 khz lfintosc internal oscillator. time intervals in this chapter are based on a nominal interval of 1ms. see section 24.0 ?electrical specifications? for the lfintosc tolerances. 8.2 wdt operating modes the watchdog timer module has four operating modes controlled by the wdte<1:0> bits in configuration word. see tab le 8 -1 . 8.2.1 wdt is always on when the wdte bits of configuration word are set to ? 11 ?, the wdt is always on. wdt protection is active during sleep. 8.2.2 wdt is off in sleep when the wdte bits of configuration word are set to ? 10 ?, the wdt is on, except in sleep. wdt protection is not active during sleep. 8.2.3 wdt controlled by software when the wdte bits of configuration word are set to ? 01 ?, the wdt is controlled by the swdten bit of the wdtcon register. wdt protection is unchanged by sleep. see table 8-1 for more details. table 8-1: wdt operating modes 8.3 time-out period the wdtps bits of the wdtcon register set the time- out period from 1 ms to 256 seconds (nominal). after a reset, the default time-out period is 2 seconds. 8.4 clearing the wdt the wdt is cleared when any of the following condi- tions occur: ?any reset ? clrwdt instruction is executed ? device enters sleep ? device wakes up from sleep ? oscillator fail ? wdt is disabled see table 8-2 for more information. 8.5 operation during sleep when the device enters sleep, the wdt is cleared. if the wdt is enabled during sleep, the wdt resumes counting. when the device exits sleep, the wdt is cleared again. when a wdt time-out occurs while the device is in sleep, no reset is generated. instead, the device wakes up and resumes operation. the to and pd bits in the status register are changed to indicate the event. see section 2.0 ?memory organization? and register 2-1 for more information. wdte<1:0> swdten device mode wdt mode 11 x xactive 10 x awake active sleep disabled 01 1 x active 0 disabled 00 x x disabled table 8-2: wdt clearing conditions conditions wdt wdte<1:0> = 00 cleared wdte<1:0> = 01 and swdten = 0 wdte<1:0> = 10 and enter sleep clrwdt command exit sleep change intosc divider (ircf bits) unaffected www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 55 pic10(l)f320/322 8.6 watchdog control register register 8-1: wdtcon: wat chdog timer control register u-0 u-0 r/w-0/0 r/w-1/1 r/w-0/0 r/w-1/1 r/w-1/1 r/w-0/0 ? ? wdtps<4:0> swdten bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-6 unimplemented: read as ? 0 ? bit 5-1 wdtps<4:0>: watchdog timer period select bits (1) bit value = prescale rate 11111 = reserved. results in minimum interval (1:32) ? ? ? 10011 = reserved. results in minimum interval (1:32) 10010 = 1:8388608 (2 23 ) (interval 256s nominal) 10001 = 1:4194304 (2 22 ) (interval 128s nominal) 10000 = 1:2097152 (2 21 ) (interval 64s nominal) 01111 = 1:1048576 (2 20 ) (interval 32s nominal) 01110 = 1:524288 (2 19 ) (interval 16s nominal) 01101 = 1:262144 (2 18 ) (interval 8s nominal) 01100 = 1:131072 (2 17 ) (interval 4s nominal) 01011 = 1:65536 (interval 2s nominal) (reset value) 01010 = 1:32768 (interval 1s nominal) 01001 = 1:16384 (interval 512 ms nominal) 01000 = 1:8192 (interval 256 ms nominal) 00111 = 1:4096 (interval 128 ms nominal) 00110 = 1:2048 (interval 64 ms nominal) 00101 = 1:1024 (interval 32 ms nominal) 00100 = 1:512 (interval 16 ms nominal) 00011 = 1:256 (interval 8 ms nominal) 00010 = 1:128 (interval 4 ms nominal) 00001 = 1:64 (interval 2 ms nominal) 00000 = 1:32 (interval 1 ms nominal) bit 0 swdten: software enable/disable for watchdog timer bit if wdte<1:0> = 00 : this bit is ignored. if wdte<1:0> = 01 : 1 = wdt is turned on 0 = wdt is turned off if wdte<1:0> = 1x : this bit is ignored. note 1: times are approximate. wdt time is based on 31 khz lfintosc. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 56 preliminary ? 2011 microchip technology inc. table 8-3: summary of registers associated with watchdog timer table 8-4: summary of configuration word with watchdog timer name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page osccon ? ircf<2:0> hfiofr ? lfiofr hfiofs 30 status irp rp1 rp0 to pd z dc c 15 wdtcon ? ? wdtps<4:0> swdten 55 legend: x = unknown, u = unchanged, ? = unimplemented locations read as ?0?. shaded cells are not used by watchdog timer. name bits bit -/7 bit -/6 bit 13/5 bit 12/4 bit 11/3 bit 10/2 bit 9/1 bit 8/0 register on page config 13:8 ? ? ? wrt<1:0> borv lpbor lvp 22 7:0 cp mclre pwrte wdte<1:0> boren<1:0> fosc legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used by watchdog timer. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 57 pic10(l)f320/322 9.0 flash program memory control the flash program memory is readable and writable during normal operation over the full v dd range. program memory is indirectly addressed using special function registers (sfrs). the sfrs used to access program memory are: ?pmcon1 ?pmcon2 ?pmdatl ?pmdath ? pmadrl ?pmadrh when accessing the program memory, the pmdath:pmdatl register pair forms a 2-byte word that holds the 14-bit data for read/write, and the pmadrh:pmadrl register pair forms a 2-byte word that holds the 9-bit address of the program memory location being read. the write time is controlled by an on-chip timer. the write/ erase voltages are generated by an on-chip charge pump rated to operate over the operating voltage range of the device. the flash program memory can be protected in two ways; by code protection (cp bit in configuration word) and write protection (wrt<1:0> bits in configuration word). code protection (cp = 0 ) (1) , disables access, reading and writing, to the flash program memory via external device programmers. code protection does not affect the self-write and erase functionality. code protection can only be reset by a device programmer performing a bulk erase to the device, clearing all flash program memory, configuration bits and user ids. write protection prohibits self-write and erase to a portion or all of the flash program memory as defined by the bits wrt<1:0>. write protection does not affect a device programmers ability to read, write or erase the device. 9.1 pmadrl and pmadrh registers the pmadrh:pmadrl register pair can address up to a maximum of 512 words of program memory. when selecting a program address value, the msb of the address is written to the pmadrh register and the lsb is written to the pmadrl register. 9.1.1 pmcon1 and pmcon2 registers pmcon1 is the control register for flash program memory accesses. control bits rd and wr initiate read and write, respectively. these bits cannot be cleared, only set, in software. they are cleared by hardware at completion of the read or write operation. the inability to clear the wr bit in software prevents the accidental, premature termination of a write operation. the wren bit, when set, will allow a write operation to occur. on power-up, the wren bit is clear. the wrerr bit is set when a write operation is interrupted by a reset during normal operation. in these situations, following reset, the user can check the wrerr bit and execute the appropriate error handling routine. the pmcon2 register is a write-only register. attempting to read the pmcon2 register will return all ? 0 ?s. to enable writes to the program memory, a specific pattern (the unlock sequence), must be written to the pmcon2 register. the required unlock sequence prevents inadvertent writes to the program memory write latches and flash program memory. 9.2 flash program memory overview it is important to understand the flash program memory structure for erase and programming operations. flash program memory is arranged in rows. a row consists of a fixed number of 14-bit program memory words. a row is the minimum size that can be erased by user software. after a row has been erased, the user can reprogram all or a portion of this row. data to be written into the program memory row is written to 14-bit wide data write latches. these write latches are not directly accessible to the user, but may be loaded via sequential writes to the pmdath:pmdatl register pair. see ta b l e 9 - 1 for erase row size and the number of write latches for flash program memory. note 1: code protection of the entire flash program memory array is enabled by clearing the cp bit of configuration word. note: if the user wants to modify only a portion of a previously programmed row, then the contents of the entire row must be read and saved in ram prior to the erase. then, new data and retained data can be written into the write latches to reprogram the row of flash program memory. how- ever, any unprogrammed locations can be written without first erasing the row. in this case, it is not necessary to save and rewrite the other previously programmed locations. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 58 preliminary ? 2011 microchip technology inc. 9.2.1 reading the flash program memory to read a program memory location, the user must: 1. write the desired address to the pmadrh:pmadrl register pair. 2. clear the cfgs bit of the pmcon1 register. 3. then, set control bit rd of the pmcon1 register. once the read control bit is set, the program memory flash controller will use the second instruction cycle to read the data. this causes the second instruction immediately following the ? bsf pmcon1,rd ? instruction to be ignored. the data is available in the very next cycle, in the pmdath:pmdatl register pair; therefore, it can be read as two bytes in the following instructions. pmdath:pmdatl register pair will hold this value until another read or until it is written to by the user. figure 9-1: flash program memory read flowchart table 9-1: flash memory organization by device device row erase (words) write latches (words) pic10(l)f320 16 16 pic10(l)f322 note: the two instructions following a program memory read are required to be nop s. this prevents the user from executing a two-cycle instruction on the next instruction after the rd bit is set. start read operation select program or configuration memory (cfgs) select word address (pmadrh:pmadrl) end read operation instruction fetched ignored nop execution forced instruction fetched ignored nop execution forced initiate read operation (rd = 1 ) data read now in pmdath:pmdatl www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 59 pic10(l)f320/322 figure 9-2: flash program me mory read cycle execution example 9-1: flash program memory read q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 bsf pmcon1,rd executed here instr(pc + 1) executed here pc pc + 1 pmadrh,pmadrl pc+3 pc + 5 flash addr rd bit pmdath,pmdatl pc + 3 pc + 4 instr (pc + 1) instr(pc - 1) executed here instr(pc + 3) executed here instr(pc + 4) executed here flash data pmdath pmdatl register instr (pc) instr (pc + 3) instr (pc + 4) instruction ignored forced nop instr(pc + 2) executed here instruction ignored forced nop * this code block will read 1 word of program * memory at the memory address: prog_addr_hi: prog_addr_lo * data will be returned in the variables; * prog_data_hi, prog_data_lo banksel pmadrl ; not required on devices with 1 bank of sfrs movlw prog_addr_lo ; movwf pmadrl ; store lsb of address movlw prog_addr_hi ; movwf pmadrh ; store msb of address bcf pmcon1,cfgs ; do not select configuration space bsf pmcon1,rd ; initiate read nop ; ignored ( figure 9-2 ) nop ; ignored ( figure 9-2 ) movf pmdatl,w ; get lsb of word movwf prog_data_lo ; store in user location movf pmdath,w ; get msb of word movwf prog_data_hi ; store in user location www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 60 preliminary ? 2011 microchip technology inc. 9.2.2 flash memory unlock sequence the unlock sequence is a mechanism that protects the flash program memory from unintended self-write pro- gramming or erasing. the sequence must be executed and completed without interruption to successfully complete any of the following operations: ?row erase ? load program memory write latches ? write of program memory write latches to pro- gram memory ? write of program memory write latches to user ids the unlock sequence consists of the following steps: 1. write 55h to pmcon2 2. write aah to pmcon2 3. set the wr bit in pmcon1 4. nop instruction 5. nop instruction once the wr bit is set, the processor will always force two nop instructions. when an erase row or program row operation is being performed, the processor will stall internal operations (typical 2 ms), until the operation is complete and then resume with the next instruction. when the operation is loading the program memory write latches, the processor will always force the two nop instructions and continue uninterrupted with the next instruction. since the unlock sequence must not be interrupted, global interrupts should be disabled prior to the unlock sequence and re-enabled after the unlock sequence is completed. figure 9-3: flash program memory unlock sequence flowchart write 055h to pmcon2 start unlock sequence write 0aah to pmcon2 initiate write or erase operation (wr = 1 ) instruction fetched ignored nop execution forced end unlock sequence instruction fetched ignored nop execution forced www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 61 pic10(l)f320/322 9.2.3 erasing flash program memory while executing code, program memory can only be erased by rows. to erase a row: 1. load the pmadrh:pmadrl register pair with any address within the row to be erased. 2. clear the cfgs bit of the pmcon1 register. 3. set the free and wren bits of the pmcon1 register. 4. write 55h, then aah, to pmcon2 (flash programming unlock sequence). 5. set control bit wr of the pmcon1 register to begin the erase operation. see example 9-2 . after the ? bsf pmcon1,wr ? instruction, the processor requires two cycles to set up the erase operation. the user must place two nop instructions after the wr bit is set. the processor will halt internal operations for the typical 2 ms erase time. this is not sleep mode as the clocks and peripherals will continue to run. after the erase cycle, the processor will resume operation with the third instruction after the pmcon1 write instruction. figure 9-4: flash program memory erase flowchart disable interrupts (gie = 0 ) start erase operation select program or configuration memory (cfgs) select row address (pmadrh:pmadrl) select erase operation (free = 1 ) enable write/erase operation (wren = 1 ) unlock sequence (figure x-x) disable write/erase operation (wren = 0 ) re-enable interrupts (gie = 1 ) end erase operation cpu stalls while erase operation completes (2ms typical) figure 9-3 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 62 preliminary ? 2011 microchip technology inc. example 9-2: erasing one row of program memory ; this row erase routine assumes the following: ; 1. a valid address within the erase row is loaded in addrh:addrl ; 2. addrh and addrl are located in shared data memory 0x70 - 0x7f (common ram) bcf intcon,gie ; disable ints so required sequences will execute properly banksel pmadrl ; not required on devices with 1 bank of sfrs movf addrl,w ; load lower 8 bits of erase address boundary movwf pmadrl movf addrh,w ; load upper 6 bits of erase address boundary movwf pmadrh bcf pmcon1,cfgs ; not configuration space bsf pmcon1,free ; specify an erase operation bsf pmcon1,wren ; enable writes movlw 55h ; start of required sequence to initiate erase movwf pmcon2 ; write 55h movlw 0aah ; movwf pmcon2 ; write aah bsf pmcon1,wr ; set wr bit to begin erase nop ; nop instructions are forced as processor starts nop ; row erase of program memory. ; ; the processor stalls until the erase process is complete ; after erase processor continues with 3rd instruction bcf pmcon1,wren ; disable writes bsf intcon,gie ; enable interrupts required sequence www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 63 pic10(l)f320/322 9.2.4 writing to flash program memory program memory is programmed using the following steps: 1. load the address in pmadrh:pmadrl of the row to be programmed. 2. load each write latch with data. 3. initiate a programming operation. 4. repeat steps 1 through 3 until all data is written. before writing to program memory, the word(s) to be written must be erased or previously unwritten. pro- gram memory can only be erased one row at a time. no automatic erase occurs upon the initiation of the write. program memory can be written one or more words at a time. the maximum number of words written at one time is equal to the number of write latches. see figure 9-5 (row writes to program memory with 16 write latches) for more details. the write latches are aligned to the flash row address boundary defined by the upper 10-bits of pmadrh:pmadrl, (pmadrh<6:0>:pmadrl<7:5>) with the lower 5-bits of pmadrl, (pmadrl<4:0>) determining the write latch being loaded. write opera- tions do not cross these boundaries. at the completion of a program memory write operation, the data in the write latches is reset to contain 0x3fff. the following steps should be completed to load the write latches and program a row of program memory. these steps are divided into two parts. first, each write latch is loaded with data from the pmdath:pmdatl using the unlock sequence with lwlo = 1 . when the last word to be loaded into the write latch is ready, the lwlo bit is cleared and the unlock sequence executed. this initiates the programming operation, writing all the latches into flash program memory. 1. set the wren bit of the pmcon1 register. 2. clear the cfgs bit of the pmcon1 register. 3. set the lwlo bit of the pmcon1 register. when the lwlo bit of the pmcon1 register is ? 1 ?, the write sequence will only load the write latches and will not initiate the write to flash program memory. 4. load the pmadrh:pmadrl register pair with the address of the location to be written. 5. load the pmdath:pmdatl register pair with the program memory data to be written. 6. execute the unlock sequence ( section 9.2.2 ?flash memory unlock sequence? ). the write latch is now loaded. 7. increment the pmadrh:pmadrl register pair to point to the next location. 8. repeat steps 5 through 7 until all but the last write latch has been loaded. 9. clear the lwlo bit of the pmcon1 register. when the lwlo bit of the pmcon1 register is ? 0 ?, the write sequence will initiate the write to flash program memory. 10. load the pmdath:pmdatl register pair with the program memory data to be written. 11. execute the unlock sequence ( section 9.2.2 ?flash memory unlock sequence? ). the entire program memory latch content is now written to flash program memory. an example of the complete write sequence is shown in example 9-3 . the initial address is loaded into the pmadrh:pmadrl register pair; the data is loaded using indirect addressing. note: the special unlock sequence is required to load a write latch with data or initiate a flash programming operation. if the unlock sequence is interrupted, writing to the latches or program memory will not be initiated. note: the program memory write latches are reset to the blank state (0x3fff) at the completion of every write or erase operation. as a result, it is not necessary to load all the program memory write latches. unloaded latches will remain in the blank state. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 64 preliminary ? 2011 microchip technology inc. figure 9-5: block wr ites to flash program memory with 16 write latches pmdath pmdatl 7 5 0 7 0 6 8 14 14 14 write latch #15 0fh 14 14 pmadrh pmadrl 7 1 0 7 4 3 0 program memory write latches 14 14 14 4 5 pmadrh<0>: pmadrl<7:4> flash program memory row row address decode addr write latch #14 0eh write latch #1 01h write latch #0 00h addr addr addr 000h 000fh 000eh 0000h 0001h 001h 001fh 001eh 0010h 0011h 002h 002fh 002eh 0020h 0021h 01eh 01efh 01eeh 01e0h 01e1h 01fh 01ffh 01feh 01f0h 01f1h 14 - - - - - r4 r3 - r1 r0 c3 c2 c1 c0 r2 pmadrl<3:0> 000h 2008h ? 2000h - 2003h configuration word user id 0 - 3 2007h 2006h deviceid revid reserved 2004h - 2005h reserved configuration memory cfgs = 0 cfgs = 1 - - - www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 65 pic10(l)f320/322 figure 9-6: flash program memory write flowchart disable interrupts (gie = 0 ) start write operation select program or config. memory (cfgs) select row address (pmadrh:pmadrl) select write operation (free = 0 ) enable write/erase operation (wren = 1 ) unlock sequence (figure x-x) disable write/erase operation (wren = 0 ) re-enable interrupts (gie = 1 ) end write operation no delay when writing to program memory latches determine number of words to be written into program or configuration memory. the number of words cannot exceed the number of words per row. (word_cnt) load the value to write (pmdath:pmdatl) update the word counter (word_cnt--) last word to write ? increment address (pmadrh:pmadrl++) unlock sequence (figure x-x) cpu stalls while write operation completes (2ms typical) load write latches only (lwlo = 1 ) write latches to flash (lwlo = 0 ) no yes figure 9-3 figure 9-3 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 66 preliminary ? 2011 microchip technology inc. example 9-3: writing to flash program memory ; this write routine assumes the following: ; 1. 64 bytes of data are loaded, starting at the address in data_addr ; 2. each word of data to be written is made up of two adjacent bytes in data_addr, ; stored in little endian format ; 3. a valid starting address (the least significant bits = 00000) is loaded in addrh:addrl ; 4. addrh and addrl are located in shared data memory 0x70 - 0x7f (common ram) ; bcf intcon,gie ; disable ints so required sequences will execute properly banksel pmadrh ; not required on devices with 1 bank of sfrs movf addrh,w ; load initial address movwf pmadrh ; movf addrl,w ; movwf pmadrl ; movlw low data_addr ; load initial data address movwf fsr0 ; bcf pmcon1,cfgs ; not configuration space bsf pmcon1,wren ; enable writes bsf pmcon1,lwlo ; only load write latches loop moviw fsr0++ ; load first data byte into lower movwf pmdatl ; moviw fsr0++ ; load second data byte into upper movwf pmdath ; movf pmadrl,w ; check if lower bits of address are '00000' xorlw 0x1f ; check if we're on the last of 16 addresses andlw 0x1f ; btfsc status,z ; exit if last of 16 words, goto start_write ; movlw 55h ; start of required write sequence: movwf pmcon2 ; write 55h movlw 0aah ; movwf pmcon2 ; write aah bsf pmcon1,wr ; set wr bit to begin write nop ; nop instructions are forced as processor ; loads program memory write latches nop ; incf pmadrl,f ; still loading latches increment address goto loop ; write next latches start_write bcf pmcon1,lwlo ; no more loading latches - actually start flash program ; memory write movlw 55h ; start of required write sequence: movwf pmcon2 ; write 55h movlw 0aah ; movwf pmcon2 ; write aah bsf pmcon1,wr ; set wr bit to begin write nop ; nop instructions are forced as processor writes ; all the program memory write latches simultaneously nop ; to program memory. ; after nops, the processor ; stalls until the self-write process in complete ; after write processor continues with 3rd instruction bcf pmcon1,wren ; disable writes bsf intcon,gie ; enable interrupts required sequence required sequence www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 67 pic10(l)f320/322 9.3 modifying flash program memory when modifying existing data in a program memory row, and data within that row must be preserved, it must first be read and saved in a ram image. program memory is modified using the following steps: 1. load the starting address of the row to be modified. 2. read the existing data from the row into a ram image. 3. modify the ram image to contain the new data to be written into program memory. 4. load the starting address of the row to be rewritten. 5. erase the program memory row. 6. load the write latches with data from the ram image. 7. initiate a programming operation. figure 9-7: flash program memory modify flowchart start modify operation read operation (figure x.x) erase operation (figure x.x) modify image the words to be modified are changed in the ram image end modify operation write operation use ram image (figure x.x) an image of the entire row read must be stored in ram figure 9-2 figure 9-4 figure 9-5 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 68 preliminary ? 2011 microchip technology inc. 9.4 user id, device id and configuration word access instead of accessing program memory, the user id?s, device id/revision id and configuration word can be accessed when cfgs = 1 in the pmcon1 register. this is the region that would be pointed to by pc<13> = 1 , but not all addresses are accessible. different access may exist for reads and writes. refer to tab le 9 -2 . when read access is initiated on an address outside the parameters listed in ta bl e 9 - 2 , the pmdath:pmdatl register pair is cleared, reading back ? 0 ?s. table 9-2: user id, device id and configuration word access (cfgs = 1 ) example 9-4: conf iguration word and device id access address function read access write access 2000h-2003h user ids yes yes 2006h device id/revision id yes no 2007h configuration word yes no * this code block will read 1 word of program memory at the memory address: * prog_addr_lo (must be 00h-08h) data will be returned in the variables; * prog_data_hi, prog_data_lo banksel pmadrl ; not required on devices with 1 bank of sfrs movlw prog_addr_lo ; movwf pmadrl ; store lsb of address clrf pmadrh ; clear msb of address bsf pmcon1,cfgs ; select configuration space bcf intcon,gie ; disable interrupts bsf pmcon1,rd ; initiate read nop ; executed (see figure 9-2 ) nop ; ignored (see figure 9-2 ) bsf intcon,gie ; restore interrupts movf pmdatl,w ; get lsb of word movwf prog_data_lo ; store in user location movf pmdath,w ; get msb of word movwf prog_data_hi ; store in user location www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 69 pic10(l)f320/322 9.5 write verify it is considered good programming practice to verify that program memory writes agree with the intended value. since program memory is stored as a full page then the stored program memory contents are compared with the intended data stored in ram after the last write is complete. figure 9-8: flash program memory verify flowchart start verify operation read operation (figure x.x) end verify operation this routine assumes that the last row of data written was from an image saved in ram. this image will be used to verify the data currently stored in flash program memory. pmdat = ram image ? last word ? fail verify operation no yes yes no figure 9-2 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 70 preliminary ? 2011 microchip technology inc. 9.6 flash program memory control registers register 9-1: pmdatl: program memory data low r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u pmdat<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-0 pmdat<7:0> : the value of the program memory word pointed to by pmadrh and pmadrl after a program memory read command. register 9-2: pmdath: program memory data high u-0 u-0 r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u ? ?pmdat<13:8> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-6 unimplemented: read as ? 0 ? bit 5-0 pmdat<13:8> : the value of the program memory word pointed to by pmadrh and pmadrl after a program memory read command. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 71 pic10(l)f320/322 register 9-3: pmadrl: prog ram memory address low r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 pmadr<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-0 pmadr<7:0> : program memory read address low bits register 9-4: pmadrh: program memory address high u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0/0 ? ? ? ? ? ? ?pmadr8 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-1 unimplemented: read as ? 0 ? bit 0 pmadr8: program memory read address high bit www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 72 preliminary ? 2011 microchip technology inc. register 9-5: pmcon1: progra m memory control 1 register u-1 (1) r/w-0/0 r/w-0/0 r/w/hc-0/0 r/w/hc-0/q (2) r/w-0/0 r/s/hc-0/0 r/s/hc-0/0 ? cfgs lwlo free wrerr wren wr rd bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? s = bit can only be set x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared hc = bit is cleared by hardware bit 7 unimplemented: read as ? 1 ? bit 6 cfgs: configuration select bit 1 = access configuration, user id and device id registers 0 = access flash program memory bit 5 lwlo: load write latches only bit (3) 1 = only the addressed program memory write latch is loaded/updated on the next wr command 0 = the addressed program memory write latch is loaded/updated and a write of all program memory write latches will be initiated on the next wr command bit 4 free: program flash erase enable bit 1 = performs an erase operation on the next wr command (hardware cleared upon completion) 0 = performs an write operation on the next wr command bit 3 wrerr: program/erase error flag bit 1 = condition indicates an improper program or erase sequence attempt or termination (bit is set automatically on any set attempt (write ? 1 ?) of the wr bit). 0 = the program or erase operation completed normally. bit 2 wren: program/erase enable bit 1 = allows program/erase cycles 0 = inhibits programming/erasing of program flash bit 1 wr: write control bit 1 = initiates a program flash program/erase operation. the operation is self-timed and the bit is cleared by hardware once operation is complete. the wr bit can only be set (not cleared) in software. 0 = program/erase operation to the flash is complete and inactive. bit 0 rd: read control bit 1 = initiates a program flash read. read takes one cycle. rd is cleared in hardware. the rd bit can only be set (not cleared) in software. 0 = does not initiate a program flash read. note 1: unimplemented bit, read as ? 1 ?. 2: the wrerr bit is automatically set by hardware when a program memory write or erase operation is started (wr = 1 ). 3: the lwlo bit is ignored during a program memory erase operation (free = 1 ). www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 73 pic10(l)f320/322 table 9-3: summary of registers asso ciated with flash program memory table 9-4: summary of configuration word with flash program memory register 9-6: pmcon2: progra m memory control 2 register w-0/0 w-0/0 w-0/0 w-0/0 w-0/0 w-0/0 w-0/0 w-0/0 program memory control register 2 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? s = bit can only be set x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-0 flash memory unlock pattern bits to unlock writes, a 55h must be written first, followed by an aah, before setting the wr bit of the pmcon1 register. the value written to this register is used to unlock the writes. there are specific timing requirements on these writes. name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page intcon gie peie tmr0ie inte iocie tmr0if intf iocif 46 pmcon1 ? cfgs lwlo free wrerr wren wr rd 72 pmcon2 program memory control register 2 73 pmadrl pmadr<7:0> 71 pmadrh ? ? ? ? ? ? ?pmadr8 71 pmdatl pmdat<7:0> 70 pmdath ? ? pmdat<13:8> 70 legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used by flash program memory module. name bits bit -/7 bit -/6 bit 13/5 bit 12/4 bit 11/3 bit 10/2 bit 9/1 bit 8/0 register on page config 13:8 ? ? ? wrt<1:0> borv lpbor lvp 22 7:0 cp mclr pwrte wdte<1:0> boren<1:0> fosc legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used by flash program memory. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 74 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 75 pic10(l)f320/322 10.0 i/o port depending on which peripherals are enabled, some or all of the pins may not be available as general purpose i/o. in general, when a peripheral is enabled on a port pin, that pin cannot be used as a general purpose output. however, the pin can still be read. porta has three standard registers for its operation. these registers are: ? trisa register (data direction) ? porta register (reads the levels on the pins of the device) ? lata register (output latch) some ports may have one or more of the following additional registers. these registers are: ? ansela (analog select) ? wpua (weak pull-up) the data latch (lata register) is useful for read- modify-write operations on the value that the i/o pins are driving. a write operation to the lata register has the same effect as a write to the corresponding porta register. a read of the lata register reads of the values held in the i/o port latches, while a read of the porta register reads the actual i/o pin value. ports that support analog inputs have an associated ansela register. when an ansel bit is set, the digital input buffer associated with that bit is disabled. disabling the input buffer prevents analog signal levels on the pin between a logic high and low from causing excessive current in the logic input circuitry. a simplified model of a generic i/o port, without the interfaces to other peripherals, is shown in figure 10-1 . figure 10-1: i/o po rt operation example 10-1: initializing porta q d ck write lata data register i/o pin read porta write porta trisa read lata data bus to peripherals ansela v dd v ss ; this code example illustrates ; initializing the porta register. the ; other ports are initialized in the same ; manner. banksel porta ;not required on devices with 1 bank of sfrs clrf porta ;init porta banksel lata ;not required on devices with 1 bank of sfrs clrf lata ; banksel ansela ;not required on devices with 1 bank of sfrs clrf ansela ;digital i/o banksel trisa ;not required on devices with 1 bank of sfrs movlw b'00000011' ;set ra<1:0> as inputs movwf trisa ;and set ra<2:3> as ;outputs www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 76 preliminary ? 2011 microchip technology inc. 10.1 porta registers porta is a 8-bit wide, bidirectional port. the corresponding data direction register is trisa ( register 10-2 ). setting a trisa bit (= 1 ) will make the corresponding porta pin an input (i.e., disable the output driver). clearing a trisa bit (= 0 ) will make the corresponding porta pin an output (i.e., enables output driver and puts the contents of the output latch on the selected pin). example 10-1 shows how to initialize porta. reading the porta register ( register 10-1 ) reads the status of the pins, whereas writing to it will write to the port latch. all write operations are read-modify-write operations. therefore, a write to a port implies that the port pins are read, this value is modified and then written to the port data latch (lata). the trisa register ( register 10-2 ) controls the porta pin output drivers, even when they are being used as analog inputs. the user should ensure the bits in the trisa register are maintained set when using them as analog inputs. i/o pins configured as analog input always read ? 0 ?. 10.1.1 weak pull-ups each of the porta pins has an individually configu- rable internal weak pull-up. control bits wpua<3:0> enable or disable each pull-up (see register 10-5 ). each weak pull-up is automatically turned off when the port pin is configured as an output. all pull-ups are dis- abled on a power-on reset by the wpuen bit of the option_reg register. 10.1.2 ansela register the ansela register ( register 10-4 ) is used to configure the input mode of an i/o pin to analog. setting the appropriate ansela bit high will cause all digital reads on the pin to be read as ? 0 ? and allow analog functions on the pin to operate correctly. the state of the ansela bits has no effect on digital output functions. a pin with tris clear and ansel set will still operate as a digital output, but the input mode will be analog. this can cause unexpected behavior when executing read-modify-write instructions on the affected port. 10.1.3 porta functions and output priorities each porta pin is multiplexed with other functions. the pins, their combined functions and their output priorities are shown in table 10-1 . when multiple outputs are enabled, the actual pin control goes to the peripheral with the highest priority. digital output functions may control the pin when it is in analog mode with the priority shown in table 10-1 . note: the ansela bits default to the analog mode after reset. to use any pins as digital general purpose or peripheral inputs, the corresponding ansel bits must be initialized to ? 0 ? by user software. table 10-1: porta output priority pin name function priority (1) ra0 icspdat cwg1a pwm1 ra0 ra1 cwg1b pwm2 clc1 ra1 ra2 nco1 clkr ra2 ra3 none note 1: priority listed from highest to lowest. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 77 pic10(l)f320/322 register 10-1: porta: porta register u-0 u-0 u-0 u-0 r-x/x r/w-x/x r/w-x/x r/w-x/x ? ? ? ? ra3 ra2 ra1 ra0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-4 unimplemented : read as ? 0 ? bit 3-0 ra<3:0>: porta i/o value bits (ra3 is read-only) note 1: writes to portx are actually written to the corresponding latx register. reads from portx register return actual i/o pin values. register 10-2: trisa: porta tri-state register u-0 u-0 u-0 u-0 u-1 r/w-1/1 r/w-1/1 r/w-1/1 ? ? ? ? ? (1) trisa2 trisa1 trisa0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-4 unimplemented : read as ? 0 ? bit 3 unimplemented : read as ? 1 ? bit 2-0 trisa<2:0>: ra<2:0> port i/o tri-state control bits 1 = port output driver is disabled 0 = port output driver is enabled note 1: unimplemented, read as ? 1 ?. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 78 preliminary ? 2011 microchip technology inc. register 10-3: lata: porta data latch register u-0 u-0 u-0 u-0 u-0 r/w-x/u r/w-x/u r/w-x/u ? ? ? ? ? lata2 lata1 lata0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-3 unimplemented : read as ? 0 ? bit 2-0 lata<2:0>: ra<2:0> output latch value bits note 1: writes to portx are actually written to the corresponding latx register. reads from latx register return register values, not i/o pin values. register 10-4: ansela: porta analog select register u-0 u-0 u-0 u-0 u-0 r/w-1/1 r/w-1/1 r/w-1/1 ? ? ? ? ? ansa2 ansa1 ansa0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-3 unimplemented: read as ? 0 ? bit 2-0 ansa<2:0> : analog select between analog or digital function on pins ra<2:0>, respectively 1 = analog input. pin is assigned as analog input (1) . digital input buffer disabled. 0 = digital i/o. pin is assigned to port or digital special function. note 1: setting a pin to an analog input automatically disables the digital input circuitry. weak pull-ups, if available, are unaffected. the corresponding tris bit must be set to input mode by the user in order to allow external control of the voltage on the pin. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 79 pic10(l)f320/322 register 10-5: wpua: weak pull-up porta register u-0 u-0 u-0 u-0 r/w-1/1 r/w-1/1 r/w-1/1 r/w-1/1 ? ? ? ? wpua3 (2) wpua2 wpua1 wpua0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-4 unimplemented: read as ? 0 ? bit 3-0 wpua<3:0>: weak pull-up porta control bits 1 = weak pull-up enabled (1) 0 = weak pull-up disabled. note 1: enabling weak pull-ups also requires that the wpuen bit of the option_reg register be cleared ( register 16-1 ). 2: if mclre = 1 , weak pull-up on ra3 is internally enabled, but not reported here. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 80 preliminary ? 2011 microchip technology inc. table 10-2: summary of regist ers associated with porta name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page ansela ? ? ? ? ? ansa2 ansa1 ansa0 78 iocaf ? ? ? ? iocaf3 iocaf2 iocaf1 iocaf0 84 iocan ? ? ? ? iocan3 iocan2 iocan1 iocan0 83 iocap ? ? ? ? iocap3 iocap2 iocap1 iocap0 83 lata ? ? ? ? ? lata2 lata1 lata0 78 porta ? ? ? ? ra3 ra2 ra1 ra0 77 trisa ? ? ? ? ? (1) trisa2 trisa1 trisa0 77 wpua ? ? ? ? wpua3 wpua2 wpua1 wpua0 79 legend: x = unknown, u = unchanged, ? = unimplemented locations read as ? 0 ?. shaded cells are not used by porta. note 1: unimplemented, read as ? 1 ?. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 81 pic10(l)f320/322 11.0 interrupt-on-change the porta pins can be configured to operate as interrupt-on-change (ioc) pins. an interrupt can be generated by detecting a signal that has either a rising edge or a falling edge. any individual porta pin, or combination of porta pins, can be configured to generate an interrupt. the interrupt-on-change module has the following features: ? interrupt-on-change enable (master switch) ? individual pin configuration ? rising and falling edge detection ? individual pin interrupt flags figure 11-1 is a block diagram of the ioc module. 11.1 enabling the module to allow individual porta pins to generate an interrupt, the iocie bit of the intcon register must be set. if the iocie bit is disabled, the edge detection on the pin will still occur, but an interrupt will not be generated. 11.2 individual pin configuration for each porta pin, a rising edge detector and a falling edge detector are present. to enable a pin to detect a rising edge, the associated iocapx bit of the iocap register is set. to enable a pin to detect a falling edge, the associated iocanx bit of the iocan register is set. a pin can be configured to detect rising and falling edges simultaneously by setting both the iocapx bit and the iocanx bit of the iocap and iocan registers, respectively. 11.3 interrupt flags the iocafx bits located in the iocaf register are status flags that correspond to the interrupt-on-change pins of porta. if an expected edge is detected on an appropriately enabled pin, then the status flag for that pin will be set, and an interrupt will be generated if the iocie bit is set. the iocif bit of the intcon register reflects the status of all iocafx bits. 11.4 clearing interrupt flags the individual status flags, (iocafx bits), can be cleared by resetting them to zero. if another edge is detected during this clearing operation, the associated status flag will be set at the end of the sequence, regardless of the value actually being written. in order to ensure that no detected edge is lost while clearing flags, only and operations masking out known changed bits should be performed. the following sequence is an example of what should be performed. example 11-1: 11.5 operation in sleep the interrupt-on-change interrupt sequence will wake the device from sleep mode, if the iocie bit is set. if an edge is detected while in sleep mode, the iocaf register will be updated prior to the first instruction executed out of sleep. movlw 0xff xorwf iocaf, w andwf iocaf, f www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 82 preliminary ? 2011 microchip technology inc. figure 11-1: interrupt-on-change block diagram d ck r q d ck r q iocanx iocapx q2 d ck s q q4q1 data bus = 0 or 1 write iocafx iocie to data bus iocafx edge detect ioc interrupt to cpu core from all other iocafx individual pin detectors q1 q2 q3 q4 q4q1 q1 q2 q3 q4 q1 q2 q3 q4 q4 q4q1 q4q1 q4q1 rax www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 83 pic10(l)f320/322 11.6 interrupt-on-change registers register 11-1: iocap: interrupt-on-c hange porta positive edge register u-0 u-0 u-0 u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? ? ? ? iocap3 iocap2 iocap1 iocap0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-4 unimplemented : read as ? 0 ?. bit 3-0 iocap<3:0>: interrupt-on-change porta positive edge enable bits 1 = interrupt-on-change enabled on the pin for a positive going edge. associated status bit and interrupt flag will be set upon detecting an edge. (1) 0 = interrupt-on-change disabled for the associated pin. note 1: interrupt-on-change also requires that the iocie bit of the intcon register be set ( register 6-1 ). register 11-2: iocan: interrupt-on-chan ge porta negative edge register u-0 u-0 u-0 u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? ? ? ? iocan3 iocan2 iocan1 iocan0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-4 unimplemented : read as ? 0 ?. bit 3-0 iocan<3:0>: interrupt-on-change porta negative edge enable bits 1 = interrupt-on-change enabled on the pin for a negative going edge. associated status bit and interrupt flag will be set upon detecting an edge. (1) 0 = interrupt-on-change disabled for the associated pin. note 1: interrupt-on-change also requires that the iocie bit of the intcon register be set ( register 6-1 ). www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 84 preliminary ? 2011 microchip technology inc. table 11-1: summary of registers as sociated with interrupt-on-change register 11-3: iocaf: interrupt-on-change porta flag register u-0 u-0 u-0 u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? ? ? ? iocaf3 iocaf2 iocaf1 iocaf0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared hs - bit is set in hardware bit 7-4 unimplemented : read as ? 0 ?. bit 3-0 iocaf<3:0>: interrupt-on-change porta flag bits 1 = an enable change was detected on the associated pin. set when iocapx = 1 and a rising edge was detected on rax, or when iocanx = 1 and a falling edge was detected on rax. (1) 0 = no change was detected, or the user cleared the detected change. note 1: interrupt-on-change also requires that the iocie bit of the intcon register be set ( register 6-1 ). name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page intcon gie peie tmr0ie inte iocie tmr0if intf iocif 46 iocaf ? ? ? ? iocaf3 iocaf2 iocaf1 iocaf0 84 iocan ? ? ? ? iocan3 iocan2 iocan1 iocan0 83 iocap ? ? ? ? iocap3 iocap2 iocap1 iocap0 83 trisa ? ? ? ? ? (1) trisa2 trisa1 trisa0 77 legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used by interrupt-on-change. note 1: unimplemented, read as ? 1 ?. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 85 pic10(l)f320/322 12.0 fixed voltage reference (fvr) the fixed voltage reference, or fvr, is a stable voltage reference, independent of v dd , with 1.024v, 2.048v or 4.096v selectable output levels. the output of the fvr can be configured to supply a reference voltage to the following: ? adc input channel the fvr can be enabled by setting the fvren bit of the fvrcon register. 12.1 independent gain amplifiers the output of the fvr supplied to the adc is routed through an independent programmable gain amplifier. the amplifier can be configured to amplify the reference voltage by 1x, 2x or 4x, to produce the three possible voltage levels. the adfvr<1:0> bits of the fvrcon register are used to enable and configure the gain amplifier settings for the reference supplied to the adc module. refer- ence section 15.0 ?analog-to-digital converter (adc) module? for additional information. 12.2 fvr stabilization period when the fixed voltage reference module is enabled, it requires time for the reference and amplifier circuits to stabilize. once the circuits stabilize and are ready for use, the fvrrdy bit of the fvrcon register will be set. see section 24.0 ?electrical specifications? for the minimum delay requirement. figure 12-1: voltage reference block diagram fvr (to adc module) x1 x2 x4 + - 1.024v fixed reference fvren fvrrdy 2 adfvr<1:0> any peripheral requiring the fixed reference (see table 12-1 ) table 12-1: peripherals requiring the fixed voltage reference (fvr) peripheral conditions description hfintosc fosc = 1 ec on clkin pin. bor boren<1:0> = 11 bor always enabled. boren<1:0> = 10 and borfs = 1 bor disabled in sleep mode, bor fast start enabled. boren<1:0> = 01 and borfs = 1 bor under software control, bor fast start enabled. ivr all pic10f320/322 devices, when vregpm1 = 1 and not in sleep the device runs off of the power-save mode regulator when in sleep mode. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 86 preliminary ? 2011 microchip technology inc. 12.3 fvr control registers table 12-2: summary of registers associated with fixed voltage reference register 12-1: fvrcon: fixed voltage reference control register r/w-0/0 r-q/q r/w-0/0 r/w-0/0 u-0 u-0 r/w-0/0 r/w-0/0 fvren fvrrdy (1) tsen tsrng ? ?adfvr<1:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7 fvren: fixed voltage reference enable bit 1 = fixed voltage reference is enabled 0 = fixed voltage reference is disabled bit 6 fvrrdy: fixed voltage reference ready flag bit (1) 1 = fixed voltage reference output is ready for use 0 = fixed voltage reference output is not ready or not enabled bit 5 tsen: temperature indicator enable bit (3) 1 = temperature indicator is enabled 0 = temperature indicator is disabled bit 4 tsrng: temperature indicator range selection bit (3) 1 =v out = v dd - 4v t (high range) 0 =v out = v dd - 2v t (low range) bit 3-2 unimplemented : read as ? 0 ? bit 1-0 adfvr<1:0>: adc fixed voltage reference selection bit 11 = adc fixed voltage reference peripheral output is 4x (4.096v) (2) 10 = adc fixed voltage reference peripheral output is 2x (2.048v) (2) 01 = adc fixed voltage reference peripheral output is 1x (1.024v) 00 = adc fixed voltage reference peripheral output is off. note 1: fvrrdy indicates the true state of the fvr. 2: fixed voltage reference output cannot exceed v dd . 3: see section 14.0 ?temperature indicator module? for additional information. name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page fvrcon fvren fvrrdy tsen tsrng ? ?adfvr<1:0> 86 legend: shaded cells are not used with the fixed voltage reference. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 87 pic10(l)f320/322 13.0 internal voltage regulator (ivr) the internal voltage regulator (ivr), which provides operation above 3.6v is available on: ?pic10(l)f320 ?pic10(l)f322 this circuit regulates a voltage for the internal device logic while permitting the v dd and i/o pins to operate at a higher voltage. when v dd approaches the regulated voltage, the ivr output automatically tracks the input voltage. the ivr operates in one of three power modes based on user configuration and peripheral selection. the operating power modes are: -high -low - power save sleep mode power modes are selected automatically depending on the device operation, as shown in tab l e 1 3- 1 . tracking mode is selected automatically when v dd drops below the safe operating voltage of the core. table 13-1: ivr power modes - regulated note: ivr is disabled in tracking mode, but will consume power. see section 24.0 ?electrical specifications? for more information. vregpm1 bit sleep mode memory bias power mode ivr power mode x no ec mode or intosc = 16 mhz (hp bias) high intosc = 1 to 8 mhz (mp bias) intosc = 31 khz to 500 khz (lp bias) low 0 yes don?t care low 1yes no hfintosc power save (1) no peripherals note 1: forced to low-power mode by any of the following conditions: ? bor is enabled ? hfintosc is an active peripheral source ? self-write is active ? adc is in an active conversion www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 88 preliminary ? 2011 microchip technology inc. register 13-1: vregcon: voltag e regulator control register u-0 u-0 u-0 u-0 u-0 u-0 r/w-0/0 r/w-1/1 ? ? ? ? ? ?vregpm1 reserved bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-2 unimplemented: read as ? 0 ? bit 1 vregpm1: voltage regulator power mode selection bit 1 = power-save sleep mode enabled in sleep. draws lowest current in sleep, slower wake-up. 0 = low-power mode enabled in sleep. draws higher current in sleep, faster wake-up. bit 0 reserved: maintain this bit set. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 89 pic10(l)f320/322 14.0 temperature indicator module this family of devices is equipped with a temperature circuit designed to measure the operating temperature of the silicon die. the circuit?s range of operating temperature falls between of -40c and +85c. the output is a voltage that is proportional to the device temperature. the output of the temperature indicator is internally connected to the device adc. the circuit may be used as a temperature threshold detector or a more accurate temperature indicator, depending on the level of calibration performed. a one- point calibration allows the circuit to indicate a temperature closely surrounding that point. a two-point calibration allows the circuit to sense the entire range of temperature more accurately. reference application note an1333, ? use and calibration of the internal temperature indicator ? (ds01333) for more details regarding the calibration process. 14.1 circuit operation figure 14-1 shows a simplified block diagram of the temperature circuit. the proportional voltage output is achieved by measuring the forward voltage drop across multiple silicon junctions. equation 14-1 describes the output characteristics of the temperature indicator. equation 14-1: v out ranges the temperature sense circuit is integrated with the fixed voltage reference (fvr) module. see section 12.0 ?fixed voltage reference (fvr)? for more information. the circuit is enabled by setting the tsen bit of the fvrcon register. when disabled, the circuit draws no current. the circuit operates in either high or low range. the high range, selected by setting the tsrng bit of the fvrcon register, provides a wider output voltage. this provides more resolution over the temperature range, but may be less consistent from part to part. this range requires a higher bias voltage to operate and thus, a higher v dd is needed. the low range is selected by clearing the tsrng bit of the fvrcon0 register. the low range generates a lower voltage drop and thus, a lower bias voltage is needed to operate the circuit. the low range is provided for low voltage operation. figure 14-1: temperature circuit diagram 14.2 minimum operating v dd vs. minimum sensing temperature when the temperature circuit is operated in low range, the device may be operated at any operating voltage that is within specifications. when the temperature circuit is operated in high range, the device operating voltage, v dd , must be high enough to ensure that the temperature circuit is cor- rectly biased. table 14-1 shows the recommended minimum v dd vs. range setting. table 14-1: recommended v dd vs. range 14.3 temperature output the output of the circuit is measured using the internal analog-to-digital converter. a channel is reserved for the temperature circuit output. refer to section 15.0 ?analog-to-digital converter (adc) module? for detailed information. 14.4 adc acquisition time to ensure accurate temperature measurements, the user must wait at least 200 ? s after the adc input multiplexer is connected to the temperature indicator output before the conversion is performed. in addition, the user must wait 200 ? s between sequential conversions of the temperature indicator output. high range: v out = v dd - 4v t low range: v out = v dd - 2v t min. v dd , tsrng = 1 min. v dd , tsrng = 0 3.6v 1.8v tsen tsrng v dd v out to a d c www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 90 preliminary ? 2011 microchip technology inc. table 14-2: summary of registers name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page fvrcon fvren fvrrdy tsen tsrng ? ? adfvr<1:0> 86 adcon adcs<2:0> chs<2:0> go/ done adon 96 adres a/d result register 97 legend: ? = unimplemented location, read as ? 0 ?. shaded cells are not used by interrupt-on-change. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 91 pic10(l)f320/322 15.0 analog-to-digital converter (adc) module the analog-to-digital converter (adc) converts an analog input signal to an 8-bit binary representation of that signal. this device uses three analog input channels, which are multiplexed into a single sample and hold circuit. the output of the sample and hold is connected to the input of the converter. the converter generates an 8-bit binary result via successive approximation and stores the conversion result into the adc result register (adres). figure 15-1 shows the block diagram of the adc. the adc voltage reference is software selectable to be either internally generated or externally supplied. the adc can generate an interrupt upon completion of a conversion. this interrupt can be used to wake-up the device from sleep. figure 15-1: adc simplified block diagram fvr v ref - = vss note 1: when adon = 0 , all multiplexer inputs are disconnected. 2: see adcon register ( register 15-1 ) for detailed analog channel selection per device. adon (1) go/done v ss adc 000 001 010 111 chs<2:0> (2) an0 an1 an2 adres 8 temp indicator 110 v ref + = v dd 011 100 101 reserved reserved reserved www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 92 preliminary ? 2011 microchip technology inc. 15.1 adc configuration when configuring and using the adc the following functions must be considered: ? port configuration ? channel selection ? adc conversion clock source ? interrupt control 15.1.1 port configuration the adc can be used to convert both analog and digital signals. when converting analog signals, the i/o pin should be configured for analog by setting the associated tris and ansel bits. refer to section 10.0 ?i/o port? for more information. 15.1.2 channel selection there are up to 5 channel selections available: ? an<2:0> pins ? temperature indicator ? fvr (fixed voltage reference) output refer to section 12.0 ?fixed voltage reference (fvr)? and section 14.0 ?temperature indicator module? for more information on these channel selec- tions. the chs bits of the adcon register determine which channel is connected to the sample and hold circuit. when changing channels, a delay is required before starting the next conversion. refer to section 15.2 ?adc operation? for more information. 15.1.3 adc voltage reference there is no external voltage reference connections to the adc. only v dd can be used as a reference source. the fvr is only available as an input channel and not a v ref + input to the adc. 15.1.4 conversion clock the source of the conversion clock is software select- able via the adcs bits of the adcon register ( register 15-1 ). there are seven possible clock options: ?f osc /2 ?f osc /4 ?f osc /8 ?f osc /16 ?f osc /32 ?f osc /64 ?f rc (dedicated internal oscillator) the time to complete one bit conversion is defined as t ad . one full 8-bit conversion requires 9.5 t ad periods as shown in figure 15-2 . for correct conversion, the appropriate t ad specifica- tion must be met. refer to the a/d conversion require- ments in section 24.0 ?electrical specifications? for more information. table 15-1 gives examples of appro- priate adc clock selections. note: analog voltages on any pin that is defined as a digital input may cause the input buf- fer to conduct excess current. note 1: any changes in the system clock fre- quency will change the adc clock fre- quency, which may adversely affect the adc result. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 93 pic10(l)f320/322 table 15-1: adc clock period (t ad ) v s . device operating frequencies figure 15-2: analog-to-dig ital conversion t ad cycles adc clock period (t ad ) device frequency (f osc ) adc clock source adcs<2:0> 16 mhz 8 mhz 4 mhz 1 mhz f osc /2 000 125 ns (1) 250 ns (1) 500 ns (1) 2.0 ? s f osc /4 100 250 ns (1) 500 ns (1) 1.0 ? s4.0 ? s f osc /8 001 0.5 ? s (1) 1.0 ? s2.0 ? s 8.0 ? s (2) f osc /16 101 1.0 ? s2.0 ? s4.0 ? s 16.0 ? s (2) f osc /32 010 2.0 ? s4.0 ? s 8.0 ? s (2) 32.0 ? s (2) f osc /64 110 4.0 ? s 8.0 ? s (2) 16.0 ? s (2) 64.0 ? s (2) f rc x11 1.0-6.0 ? s (1,3) 1.0-6.0 ? s (1,3) 1.0-6.0 ? s (1,3) 1.0-6.0 ? s (1,3) legend: shaded cells are outside of recommended range. note 1: these values violate the minimum required t ad time. 2: for faster conversion times, the selection of another clock source is recommended. 3: the adc clock period (t ad ) and total adc conversion time can be minimized when the adc clock is derived from the system clock f osc . however, the f rc clock source must be used when conv ersions are to be performed with the device in sleep mode. t ad 1 t ad 2 t ad 3 t ad 4 t ad 5 t ad 6 t ad 7 t ad 8 set go bit holding capacitor is disconnected from analog input t ad 9 t cy - t ad adres is loaded, go bit is cleared, adif bit is set, holding capacitor is conversion starts b7 b4 b3 b2 b1 b0 b6 b5 on the following cycle: (typically 100 ns) connected to analog input. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 94 preliminary ? 2011 microchip technology inc. 15.1.5 interrupts the adc module allows for the ability to generate an interrupt upon completion of an analog-to-digital conversion. the adc interrupt flag is the adif bit in the pir1 register. the adc interrupt enable is the adie bit in the pie1 register. the adif bit must be cleared in software. this interrupt can be generated while the device is operating or while in sleep. if the device is in sleep, the interrupt will wake-up the device. upon waking from sleep, the next instruction following the sleep instruc- tion is always executed. if the user is attempting to wake-up from sleep and resume in-line code execu- tion, the gie and peie bits of the intcon register must be disabled. if the gie and peie bits of the intcon register are enabled, execution will switch to the interrupt service routine. 15.2 adc operation 15.2.1 starting a conversion to enable the adc module, the adon bit of the adcon register must be set to a ? 1 ?. setting the go/ done bit of the adcon register to a ? 1 ? will start the analog-to-digital conversion. 15.2.2 completion of a conversion when the conversion is complete, the adc module will: ? clear the go/done bit ? set the adif interrupt flag bit ? update the adres register with new conversion result 15.2.3 terminating a conversion if a conversion must be terminated before completion, the go/done bit can be cleared in software. the adres register will be updated with the partially com- plete analog-to-digital conversion sample. incomplete bits will match the last bit converted. 15.2.4 adc operation during sleep the adc module can operate during sleep. this requires the adc clock source to be set to the f rc option. when the f rc clock source is selected, the adc waits one additional instruction before starting the conversion. this allows the sleep instruction to be executed, which can reduce system noise during the conversion. if the adc interrupt is enabled, the device will wake-up from sleep when the conversion completes. if the adc interrupt is disabled, the adc module is turned off after the conversion completes, although the adon bit remains set. when the adc clock source is something other than f rc , a sleep instruction causes the present conver- sion to be aborted and the adc module is turned off, although the adon bit remains set. note: the adif bit is set at the completion of every conversion, regardless of whether or not the adc interrupt is enabled. note: the go/done bit should not be set in the same instruction that turns on the adc. refer to section 15.2.5 ?a/d conver- sion procedure? . note: a device reset forces all registers to their reset state. thus, the adc module is turned off and any pending conversion is terminated. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 95 pic10(l)f320/322 15.2.5 a/d conversion procedure this is an example procedure for using the adc to perform an analog-to-digital conversion: 1. configure port: ? disable pin output driver (refer to the tris register) ? configure pin as analog (refer to the ansel register) 2. configure the adc module: ? select adc conversion clock ? select adc input channel ? turn on adc module 3. configure adc interrupt (optional): ? clear adc interrupt flag ? enable adc interrupt ? enable peripheral interrupt ? enable global interrupt (1) 4. wait the required acquisition time (2) . 5. start conversion by setting the go/done bit. 6. wait for adc conversion to complete by one of the following: ? polling the go/done bit ? waiting for the adc interrupt (interrupts enabled) 7. read adc result. 8. clear the adc interrupt flag (required if interrupt is enabled). note 1: the global interrupt can be disabled if the user is attempting to wake-up from sleep and resume in-line code execution. 2: refer to section 15.4 ?a/d acquisition requirements? . www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 96 preliminary ? 2011 microchip technology inc. 15.3 adc register definitions the following registers are used to control the operation of the adc. register 15-1: adcon: a/ d control register 0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 adcs<2:0> chs<2:0> go/done adon bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-5 adcs<2:0>: a/d conversion clock select bits 111 =f rc 110 =f osc /64 101 =f osc /16 100 =f osc /4 011 =f rc 010 =f osc /32 001 =f osc /8 000 =f osc /2 bit 4-2 chs<2:0>: analog channel select bits 111 = fvr (fixed voltage reference) buffer output (2) 110 = temperature indicator (1) 101 = reserved. no channel connected. 100 = reserved. no channel connected. 011 = reserved. no channel connected. 010 =an2 001 =an1 000 =an0 bit 1 go/done : a/d conversion status bit if adon = 1 : 1 = a/d conversion in progress (setting this bit starts the a/d conversion) 0 = a/d conversion not in progress (this bit is automatically cleared by hardware when the a/d con- version is complete.) if this bit is cleared while a conversion is in progress, the conversion will stop and the results of the conversion up to this point will be transferred to the result registers, but the adif interrupt flag bit will not be set. if adon = 0 : 0 = a/d conversion not in progress bit 0 adon: adc enable bit 1 = adc is enabled 0 = adc is disabled and consumes no operating current note 1: see section 14.0 ?temperature indicator module? for more information. 2: see section 12.0 ?fixed voltage reference (fvr)? for more information. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 97 pic10(l)f320/322 register 15-2: adres: adc result register r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u adres<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-0 adres<7:0> : adc result register bits 8-bit result www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 98 preliminary ? 2011 microchip technology inc. 15.4 a/d acquisition requirements for the adc to meet its specified accuracy, the charge holding capacitor (c hold ) must be allowed to fully charge to the input channel voltage level. the analog input model is shown in figure 15-3 . the source impedance (r s ) and the internal sampling switch (r ss ) impedance directly affect the time required to charge the capacitor c hold . the sampling switch (r ss ) impedance varies over the device voltage (v dd ), refer to figure 15-3 . the maximum recommended impedance for analog sources is 10 k ? . as the source impedance is decreased, the acquisition time may be decreased. after the analog input channel is selected (or changed), an a/d acquisition must be done before the conversion can be started. to calculate the minimum acquisition time, equation 15-1 may be used. this equation assumes that 1/2 lsb error is used (511 steps for the adc). the 1/2 lsb error is the maximum error allowed for the adc to meet its specified resolution. equation 15-1: acquisition time example t acq amplifier settling time hold capacitor charging time temperature coefficient ++ = t amp t c t coff ++ = 2s t c temperature - 25c ?? 0.05s/c ?? ?? ++ = t c c hold r ic r ss r s ++ ?? ln(1/511) ? = 10pf 1k ? 7k ? 10k ? ++ ?? ? ln(0.001957) = 1.12 = s v applied 1e tc ? rc --------- ? ?? ?? ?? v applied 1 1 2 n1 + ?? 1 ? -------------------------- ? ?? ?? = v applied 1 1 2 n1 + ?? 1 ? -------------------------- ? ?? ?? v chold = v applied 1e t c ? rc --------- - ? ?? ?? ?? v chold = ;[1] v chold charged to within 1/2 lsb ;[2] v chold charge response to v applied ;combining [1] and [2] the value for t c can be approximated with the following equations: solving for t c : therefore: temperature 50c and external impedance of 10k ? 5.0v v dd = assumptions: note: where n = number of bits of the adc. t acq 2s 1.12s 50c- 25c ?? 0.05 s/c ?? ?? ++ = 4.37s = note 1: the reference voltage (v ref ) has no effect on the equation, since it cancels itself out. 2: the charge holding capacitor (c hold ) is not discharged after each conversion. 3: the maximum recommended impedance for analog sources is 10 k ? . this is required to meet the pin leakage specification. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 99 pic10(l)f320/322 figure 15-3: analog input model figure 15-4: adc transfer function c pin va rs analog 5 pf v dd v t ? 0.6v v t ? 0.6v i leakage (1) r ic ? 1k sampling switch ss rss c hold = 10 pf v ss /v ref - 6v sampling switch 5v 4v 3v 2v 567891011 (k ? ) v dd legend: c pin v t i leakage r ic ss c hold = input capacitance = threshold voltage = leakage current at the pin due to = interconnect resistance = sampling switch = sample/hold capacitance various junctions r ss note 1: refer to section 24.0 ?electrical specifications? . r ss = resistance of sampling switch input pin ffh feh adc output code fdh fch 03h 02h 01h 00h full-scale fbh 0.5 lsb v ref - zero-scale transition v ref + transition 1.5 lsb full-scale range analog input voltage www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 100 preliminary ? 2011 microchip technology inc. table 15-2: summary of registers associated with adc name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page adcon adcs<2:0> chs<2:0> go/done adon 96 adres adres<7:0> 97 ansela ? ? ? ? ? ansa2 ansa1 ansa0 78 fvrcon fvren fvrrdy tsen tsrng ? ?adfvr<1:0> 86 intcon gie peie tmr0ie inte iocie tmr0if intf iocif 46 pie1 ?adie ? nco1ie clc1ie ? tmr2ie ? 47 pir1 ?adif ? nco1if clc1if ? tmr2if ? 48 trisa ? ? ? ? ? trisa2 trisa1 trisa0 77 legend: x = unknown, u = unchanged, ? = unimplemented read as ? 0 ?, q = value depends on condition. shaded cells are not used for adc module. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 101 pic10(l)f320/322 16.0 timer0 module the timer0 module is an 8-bit timer/counter with the following features: ? 8-bit timer/counter register (tmr0) ? 8-bit prescaler (independent of watchdog timer) ? programmable internal or external clock source ? programmable external clock edge selection ? interrupt on overflow figure 16-1 is a block diagram of the timer0 module. 16.1 timer0 operation the timer0 module can be used as either an 8-bit timer or an 8-bit counter. 16.1.1 8-bit timer mode the timer0 module will increment every instruction cycle, if used without a prescaler. 8-bit timer mode is selected by clearing the t0cs bit of the option_reg register. when tmr0 is written, the increment is inhibited for two instruction cycles immediately following the write. 16.1.2 8-bit counter mode in 8-bit counter mode, the timer0 module will increment on every rising or falling edge of the t0cki pin. 8-bit counter mode using the t0cki pin is selected by setting the t0cs bit in the option_reg register to ? 1 ?. the rising or falling transition of the incrementing edge for the external input source is determined by the t0se bit in the option_reg register. figure 16-1: block diagram of the timer0 prescaler note: the value written to the tmr0 register can be adjusted, in order to account for the two instruction cycle delay when tmr0 is written. t0cki t0se tmr0 ps<2:0> data bus set flag bit tmr0if on overflow t0cs 0 1 0 1 8 8 8-bit prescaler f osc /4 psa s ync 2 t cy www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 102 preliminary ? 2011 microchip technology inc. 16.1.3 software programmable prescaler a single software programmable prescaler is available for use with timer0. the prescaler assignment is controlled by the psa bit of the option_reg register. to assign the prescaler to timer0, the psa bit must be cleared to a ? 0 ?. there are 8 prescaler options for the timer0 module ranging from 1:2 to 1:256. the prescale values are selectable via the ps<2:0> bits of the option_reg register. the prescaler is not readable or writable. when assigned to the timer0 module, all instructions writing to the tmr0 register will clear the prescaler. 16.1.4 timer0 interrupt timer0 will generate an interrupt when the tmr0 register overflows from ffh to 00h. the tmr0if interrupt flag bit of the intcon register is set every time the tmr0 register overflows, regardless of whether or not the timer0 interrupt is enabled. the tmr0if bit can only be cleared in software. the timer0 interrupt enable is the tmr0ie bit of the intcon register. 16.1.5 8-bit counter mode synchronization when in 8-bit counter mode, the incrementing edge on the t0cki pin must be synchronized to the instruction clock. synchronization can be accomplished by sampling the prescaler output on the q2 and q4 cycles of the instruction clock. the high and low periods of the external clocking source must meet the timing requirements as shown in section 24.0 ?electrical specifications? . note: the timer0 interrupt cannot wake the processor from sleep since the timer is frozen during sleep. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 103 pic10(l)f320/322 register 16-1: option_reg: option register r/w-1/u r/w-1/u r/w-1/u r/w-1/u r/w-1/u r/w-1/u r/w-1/u r/w-1/u wpuen intedg t0cs t0se psa ps<2:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 wpuen : weak pull-up enable bit (1) 1 = weak pull-ups are disabled 0 = weak pull-ups are enabled by individual port latch values bit 6 intedg: interrupt edge select bit 1 = interrupt on rising edge of int pin 0 = interrupt on falling edge of int pin bit 5 t0cs: tmr0 clock source select bit 1 = transition on t0cki pin 0 = internal instruction cycle clock (f osc /4) bit 4 t0se: tmr0 source edge select bit 1 = increment on high-to-low transition on t0cki pin 0 = increment on low-to-high transition on t0cki pin bit 3 psa: prescaler assignment bit 1 = prescaler is inactive and has no effect on the timer 0 module 0 = prescaler is assigned to the timer0 module bit 2-0 ps<2:0>: prescaler rate select bits note 1: wpuen does not disable the pull-up for the mclr input when mclr = 1 . 000 001 010 011 100 101 110 111 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 1 : 256 bit value tmr0 rate table 16-1: summary of registers associated with timer0 name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page intcon gie peie tmr0ie inte iocie tmr0if intf iocif 46 option_reg wpuen intedg t0cs t0se psa ps<2:0> 103 tmr0 timer0 module register 46 trisa ? ? ? ? ? trisa2 trisa1 trisa0 77 legend: ? = unimplemented locations, read as ? 0 ?, u = unchanged, x = unknown. shaded cells are not used by the timer0 module. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 104 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 105 pic10(l)f320/322 17.0 timer2 module the timer2 module is an 8-bit timer with the following features: ? 8-bit timer register (tmr2) ? 8-bit period register (pr2) ? interrupt on tmr2 match with pr2 ? software programmable prescaler (1:1, 1:4, 1:64) ? software programmable postscaler (1:1 to 1:16) see figure 17-1 for a block diagram of timer2. 17.1 timer2 operation the clock input to the timer2 module is the system instruction clock (f osc /4). the clock is fed into the timer2 prescaler, which has prescale options of 1:1, 1:4 or 1:64. the output of the prescaler is then used to increment the tmr2 register. the values of tmr2 and pr2 are constantly compared to determine when they match. tmr2 will increment from 00h until it matches the value in pr2. when a match occurs, two things happen: ? tmr2 is reset to 00h on the next increment cycle. ? the timer2 postscaler is incremented. the match output of the timer2/pr2 comparator is then fed into the timer2 postscaler. the postscaler has postscale options of 1:1 to 1:16 inclusive. the output of the timer2 postscaler is used to set the tmr2if interrupt flag bit in the pir1 register. the tmr2 and pr2 registers are both fully readable and writable. on any reset, the tmr2 register is set to 00h and the pr2 register is set to ffh. timer2 is turned on by setting the tmr2on bit in the t2con register to a ? 1 ?. timer2 is turned off by clearing the tmr2on bit to a ? 0 ?. the timer2 prescaler is controlled by the t2ckps bits in the t2con register. the timer2 postscaler is controlled by the toutps bits in the t2con register. the prescaler and postscaler counters are cleared when: ? a write to tmr2 occurs. ? a write to t2con occurs. ? any device reset occurs (power-on reset, mclr reset, watchdog timer reset, or brown-out reset). figure 17-1: timer2 block diagram note: tmr2 is not cleared when t2con is written. comparator tmr2 sets flag tmr2 output reset postscaler prescaler pr2 2 f osc /4 1:1 to 1:16 1:1, 1:4, 1:64 eq 4 bit tmr2if toutps<3:0> t2ckps<1:0> www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 106 preliminary ? 2011 microchip technology inc. register 17-1: t2con: ti mer2 control register u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? toutps<3:0> tmr2on t2ckps<1:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 unimplemented: read as ? 0 ? bit 6-3 toutps<3:0>: timer2 output postscaler select bits 1111 = 1:16 postscaler 1110 = 1:15 postscaler 1101 = 1:14 postscaler 1100 = 1:13 postscaler 1011 = 1:12 postscaler 1010 = 1:11 postscaler 1001 = 1:10 postscaler 1000 =1:9 postscaler 0111 =1:8 postscaler 0110 =1:7 postscaler 0101 =1:6 postscaler 0100 =1:5 postscaler 0011 =1:4 postscaler 0010 =1:3 postscaler 0001 =1:2 postscaler 0000 =1:1 postscaler bit 2 tmr2on: timer2 on bit 1 = timer2 is on 0 = timer2 is off bit 1-0 t2ckps<1:0>: timer2 clock prescale select bits 1x = prescaler is 64 01 = prescaler is 4 00 = prescaler is 1 table 17-1: summary of registers associated with timer2 name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page intcon gie peie tmr0ie inte iocie tmr0if intf iocif 46 pie1 ? adie ? nco1ie clc1ie ?tmr2ie ? 47 pir1 ? adif ? nco1if clc1if ?tmr2if ? 48 pr2 timer2 module period register 105 tmr2 timer2 module register 105 t2con ? toutps<3:0> tmr2on t2ckps<1:0> 106 legend: x = unknown, u = unchanged, - = unimplemented read as ? 0 ?. shaded cells are not used for timer2 module. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 107 pic10(l)f320/322 18.0 pulse-width modulation (pwm) module the pwm module generates a pulse-width modulated signal determined by the duty cycle, period, and resolution that are configured by the following registers: ?pr2 ?t2con ? pwmxdch ? pwmxdcl ?pwmxcon figure 18-1 shows a simplified block diagram of pwm operation. figure 18-2 shows a typical waveform of the pwm signal. figure 18-1: simplified pwm block diagram for a step-by-step procedure on how to set up this module for pwm operation, refer to section 18.1.9 ?setup for pwm operation using pwmx pins? . figure 18-2: pwm output pwmxdch comparator tmr2 comparator pr2 (1) r q s duty cycle registers pwmxdcl<7:6> clear timer, pwmx pin and latch duty cycle note 1: 8-bit timer is concatenated with the two least significant bits of 1/f osc adjusted by the timer2 prescaler to create a 10-bit time base. latched (not visible to user) q output polarity (pwmxpol) tmr2 module 0 1 pwmxout to other peripherals: clc and cwg pwmx output enable (pwmxoe) tris control period pulse width tmr2 = 0 tmr2 = tmr2 = pr2 pwm x dch<7:0>:pwm x dcl<7:6> www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 108 preliminary ? 2011 microchip technology inc. 18.1 pwmx pin configuration all pwm outputs are multiplexed with the port data latch. the user must configure the pins as outputs by clearing the associated tris bits. 18.1.1 fundamental operation the pwm module produces a 10-bit resolution output. timer2 and pr2 set the period of the pwm. the pwmxdcl and pwmxdch registers configure the duty cycle. the period is common to all pwm modules, whereas the duty cycle is independently controlled. all pwm outputs associated with timer2 are set when tmr2 is cleared. each pwmx is cleared when tmr2 is equal to the value specified in the corresponding pwmxdch (8 msb) and pwmxdcl<7:6> (2 lsb) registers. when the value is greater than or equal to pr2, the pwm output is never cleared (100% duty cycle). 18.1.2 pwm output polarity the output polarity is inverted by setting the pwmxpol bit of the pwmxcon register. 18.1.3 pwm period the pwm period is specified by the pr2 register of timer2. the pwm period can be calculated using the formula of equation 18-1 . equation 18-1: pwm period when tmr2 is equal to pr2, the following three events occur on the next increment cycle: ?tmr2 is cleared ? the pwm output is active. (exception: when the pwm duty cycle = 0%, the pwm output will remain inactive.) ? the pwmxdch and pwmxdcl register values are latched into the buffers. 18.1.4 pwm duty cycle the pwm duty cycle is specified by writing a 10-bit value to the pwmxdch and pwmxdcl register pair. the pwmxdch register contains the eight msbs and the pwmxdcl<7:6>, the two lsbs. the pwmxdch and pwmxdcl registers can be written to at any time. equation 18-2 is used to calculate the pwm pulse width. equation 18-3 is used to calculate the pwm duty cycle ratio. equation 18-2: pulse width equation 18-3: duty cycle ratio the 8-bit timer tmr2 register is concatenated with the two least significant bits of 1/f osc , adjusted by the timer2 prescaler to create the 10-bit time base. the system clock is used if the timer2 prescaler is set to 1:1. note: clearing the pwmxoe bit will relinquish control of the pwmx pin. note: the timer2 postscaler is not used in the determination of the pwm frequency. the postscaler could be used to have a servo update rate at a different frequency than the pwm output. note: the pwmxdch and pwmxdcl registers are double buffered. the buffers are updated when timer2 matches pr2. care should be taken to update both registers before the timer match occurs. pwm period pr2 ?? 1 + ?? 4t osc ? ? ? = (tmr2 prescale value) note: t osc = 1/f osc note: the timer2 postscaler has no effect on the pwm operation. pulse width pwm x dch:pwmxdcl<7:6> ?? ? = t osc ? (tmr2 prescale value) note: t osc = 1/f osc duty cycle ratio pwm x dch:pwmxdcl<7:6> ?? 4 pr2 1 + ?? ----------------------------------------------------------------------------------- = www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 109 pic10(l)f320/322 18.1.5 pwm resolution the resolution determines the number of available duty cycles for a given period. for example, a 10-bit resolution will result in 1024 discrete duty cycles, whereas an 8-bit resolution will result in 256 discrete duty cycles. the maximum pwm resolution is 10 bits when pr2 is 255. the resolution is a function of the pr2 register value as shown by equation 18-4 . equation 18-4: pwm resolution 18.1.6 operation in sleep mode in sleep mode, the tmr2 register will not increment and the state of the module will not change. if the pwmx pin is driving a value, it will continue to drive that value. when the device wakes up, tmr2 will continue from its previous state. 18.1.7 changes in system clock frequency the pwm frequency is derived from the system clock frequency (f osc ). any changes in the system clock fre- quency will result in changes to the pwm frequency. refer to section 4.0 ?oscillator module? for additional details. 18.1.8 effects of reset any reset will force all ports to input mode and the pwm registers to their reset states. note: if the pulse width value is greater than the period the assigned pwm pin(s) will remain unchanged. resolution 4pr2 1 + ?? ?? log 2 ?? log ----------------------------------------- - bits = table 18-1: example pwm frequencies and resolutions (f osc = 20 mhz) pwm frequency 0.31 khz 4.88 khz 19.53 khz 78.12 khz 156.3 khz 208.3 khz timer prescale (1, 4, 64) 64 4 1 1 1 1 pr2 value 0xff 0xff 0xff 0x3f 0x1f 0x17 maximum resolution (bits) 10 10 10 8 7 6.6 table 18-2: example pwm frequencies and resolutions (f osc = 8 mhz) pwm frequency 0.31 khz 4.90 khz 19.61 khz 76.92 khz 153.85 khz 200.0 khz timer prescale (1, 4, 64) 64 4 1 1 1 1 pr2 value 0x65 0x65 0x65 0x19 0x0c 0x09 maximum resolution (bits) 8 8 8 6 5 5 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 110 preliminary ? 2011 microchip technology inc. 18.1.9 setup for pwm operation using pwmx pins the following steps should be taken when configuring the module for pwm operation using the pwmx pins: 1. disable the pwmx pin output driver(s) by setting the associated tris bit(s). 2. clear the pwmxcon register. 3. load the pr2 register with the pwm period value. 4. clear the pwmxdch register and bits <7:6> of the pwmxdcl register. 5. configure and start timer2: ? clear the tmr2if interrupt flag bit of the pir1 register. see note below. ? configure the t2ckps bits of the t2con register with the timer2 prescale value. ? enable timer2 by setting the tmr2on bit of the t2con register. 6. enable pwm output pin and wait until timer2 overflows, tmr2if bit of the pir1 register is set. see note below. 7. enable the pwmx pin output driver(s) by clear- ing the associated tris bit(s) and setting the pwmxoe bit of the pwmxcon register. 8. configure the pwm module by loading the pwmxcon register with the appropriate values. note 1: in order to send a complete duty cycle and period on the first pwm output, the above steps must be followed in the order given. if it is not critical to start with a complete pwm signal, then move step 8 to replace step 4. 2: for operation with other peripherals only, disable pwmx pin outputs. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 111 pic10(l)f320/322 18.2 pwm register definitions register 18-1: pwmxcon: pwm control register r/w-0/0 r/w-0/0 r-0/0 r/w-0/0 u-0 u-0 u-0 u-0 pwmxen pwmxoe pwmxout pwmxpol ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 pwmxen: pwm module enable bit 1 = pwm module is enabled 0 = pwm module is disabled bit 6 pwmxoe: pwm module output enable bit 1 = output to pwmx pin is enabled 0 = output to pwmx pin is disabled bit 5 pwmxout: pwm module output value bit bit 4 pwmxpol: pwmx output polarity select bit 1 = pwm output is active low. 0 = pwm output is active high. bit 3-0 unimplemented: read as ? 0 ? www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 112 preliminary ? 2011 microchip technology inc. register 18-2: pwmxdch: pwm duty cycle high bits r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u pwmxdch<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-0 pwmxdch<7:0>: pwm duty cycle most significant bits these bits are the msbs of the pwm duty cycle. the two lsbs are found in the pwmxdcl register. register 18-3: pwmxdcl: pwm duty cycle low bits r/w-x/u r/w-x/u u-0 u-0 u-0 u-0 u-0 u-0 pwmxdcl<7:6> ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-6 pwmxdcl<7:6>: pwm duty cycle least significant bits these bits are the lsbs of the pwm duty cycle. the msbs are found in the pwmxdch register. bit 5-0 unimplemented: read as ? 0 ? table 18-3: summary of registers associated with pwm name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page ansela ? ? ? ? ? ansa2 ansa1 ansa0 78 lata ? ? ? ? ? lata2 lata1 lata0 78 porta ? ? ? ? ra3 ra2 ra1 ra0 77 pr2 timer2 module period register 105 pwm1con pwm1en pwm1oe pwm1out pwm1pol ? ? ? ? 111 pwm1dch pwm1dch<7:0> 112 pwm1dcl pwm1dcl<7:6> ? ? ? ? ? ? 112 pwm2con pwm2en pwm2oe pwm2out pwm2pol ? ? ? ? 111 pwm2dch pwm2dch<7:0> 112 pwm2dcl pwm2dcl<7:6> ? ? ? ? ? ? 112 t2con ? toutps<3:0> tmr2on t2ckps<1:0> 106 tmr2 timer2 module register 105 trisa ? ? ? ? ? trisa2 trisa1 trisa0 77 legend: - = unimplemented locations, read as ? 0 ?, u = unchanged, x = unknown. shaded cells are not used by the pwm. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 113 pic10(l)f320/322 19.0 configurable logic cell (clc) the configurable logic cell (clcx) provides program- mable logic that operates outside the speed limitations of software execution. the logic cell selects any combi- nation of the eight input signals and through the use of configurable gates reduces the selected inputs to four logic lines that drive one of eight selectable single-out- put logic functions. input sources are a combination of the following: ? two i/o pins ? internal clocks ? peripherals ? register bits the output can be directed internally to peripherals and to an output pin. refer to figure 19-1 for a simplified diagram showing signal flow through the clcx. possible configurations include: ? combinatorial logic -and -nand - and-or - and-or-invert -or-xor -or-xnor ? latches -s-r - clocked d with set and reset - transparent d with set and reset - clocked j-k with reset figure 19-1: clcx simpli fied block diagram lcxg1 lcxg2 lcxg3 lcxg4 interrupt det logic function input data selection gates clcx lcxoe lcxq lcxpol lcxout dq le q1 lcxmode<2:0> lcx_out clcxin[0] clcxin[1] clcxin[2] clcxin[3] clcxin[4] clcxin[5] clcxin[6] clcxin[7] tris control interrupt det lcxintp lcxintn clcxif sets lcxen see figure 19-2 flag see figure 19-3 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 114 preliminary ? 2011 microchip technology inc. 19.1 clcx setup programming the clcx module is performed by config- uring the four stages in the logic signal flow. the four stages are: ?data selection ? data gating ? logic function selection ? output polarity each stage is setup at run time by writing to the corre- sponding clcx special function registers. this has the added advantage of permitting logic reconfiguration on-the-fly during program execution. 19.1.1 data selection there are eight signals available as inputs to the con- figurable logic. four 8-input multiplexers are used to select the inputs to pass on to the next stage. data inputs are selected with the clcxsel0 and clcxsel1 registers ( register 19-3 and register 19-4 , respectively). data selection is through four multiplexers as indicated on the left side of figure 19-2 . data inputs in the figure are identified by a generic numbered input name. table 19-1 correlates the generic input name to the actual signal for each clc module. the columns labeled lcxd1 through lcxd4 indicate the mux output for the selected data input. d1s through d4s are abbreviations for the mux select input codes: lcxd1s<2:0> through lcxd4s<2:0>, respectively. selecting a data input in a column excludes all other inputs in that column. 19.1.2 data gating outputs from the input multiplexers are directed to the desired logic function input through the data gating stage. each data gate can direct any combination of the four selected inputs. the gate stage is more than just signal direction. the gate can be configured to direct each input signal as inverted or non-inverted data. directed signals are anded together in each gate. the output of each gate can be inverted before going on to the logic function stage. the gating is in essence a 1-to-4 input and/nand/or/ nor gate. when every input is inverted and the output is inverted, the gate is an or of all enabled data inputs. when the inputs and output are not inverted, the gate is an and or all enabled inputs. table 19-2 summarizes the basic logic that can be obtained in gate 1 by using the gate logic select bits. the table shows the logic of four input variables, but each gate can be configured to use less than four. if no inputs are selected, the output will be zero or one, depending on the gate output polarity bit. it is possible (but not recommended) to select both the true and negated values of an input. when this is done, the gate output is zero, regardless of the other inputs, but may emit logic glitches (transient-induced pulses). if the output of the channel must be zero or one, the recommended method is to set all gate bits to zero and use the gate polarity bit to set the desired level. data gating is configured with the logic gate select registers as follows: ? gate 1: clcxgls0 ( register 19-5 ) ? gate 2: clcxgls1 ( register 19-6 ) ? gate 3: clcxgls2 ( register 19-7 ) ? gate 4: clcxgls3 ( register 19-8 ) register number suffixes are different than the gate numbers because other variations of this module have multiple gate selections in the same register. data gating is indicated in the right side of figure 19-2 . only one gate is shown in detail. the remaining three gates are configured identically with the exception that the data enables correspond to the enables for that gate. note: data selections are undefined at power-up. table 19-1: clcx data input selection data input lcxd1 d1s lcxd2 d2s lcxd3 d3s lcxd4 d4s clc 1 clcxin[0] 000 000 000 000 clcx clcxin[1] 001 001 001 001 clcxin1 clcxin[2] 010 010 010 010 clcxin2 clcxin[3] 011 011 011 011 pwm1 clcxin[4] 100 100 100 100 pwm2 clcxin[5] 101 101 101 101 ncox clcxin[6] 110 110 110 110 f osc clcxin[7] 111 111 111 111 lfintosc note: data gating is undefined at power-up. table 19-2: data gating logic clcxgls0 lcxgypol gate logic 0x55 1 and 0x55 0 nand 0xaa 1 nor 0xaa 0 or 0x00 0 logic 0 0x00 1 logic 1 www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 115 pic10(l)f320/322 19.1.3 logic function there are eight available logic functions including: ? and-or ?or-xor ?and ? s-r latch ? d flip-flop with set and reset ? d flip-flop with reset ? j-k flip-flop with reset ? transparent latch with set and reset logic functions are shown in figure 19-3 . each logic function has four inputs and one output. the four inputs are the four data gate outputs of the previous stage. the output is fed to the inversion stage and from there to other peripherals, an output pin, and back to the clcx itself. 19.1.4 output polarity the last stage in the configurable logic cell is the output polarity. setting the lcxpol bit of the clcxcon reg- ister inverts the output signal from the logic stage. changing the polarity while the interrupts are enabled will cause an interrupt for the resulting output transition. 19.1.5 clcx setup steps the following steps should be followed when setting up the clcx: ? disable clcx by clearing the lcxen bit. ? select desired inputs using clcxsel0 and clcxsel1 registers (see table 19-1 ). ? clear any associated ansel bits. ? set all tris bits associated with inputs. ? clear all tris bits associated with outputs. ? enable the chosen inputs through the four gates using clcxgls0, clcxgls1, clcxgls2, and clcxgls3 registers. ? select the gate output polarities with the lcxpoly bits of the clcxpol register. ? select the desired logic function with the lcxmode<2:0> bits of the clcxcon register. ? select the desired polarity of the logic output with the lcxpol bit of the clcxpol register. (this step may be combined with the previous gate out- put polarity step). ? if driving the clcx pin, set the lcxoe bit of the clcxcon register and also clear the tris bit corresponding to that output. ? if interrupts are desired, configure the following bits: - set the lcxintp bit in the clcxcon register for rising event. - set the lcxintn bit in the clcxcon register or falling event. - set the clcxie bit of the associated pie registers. - set the gie and peie bits of the intcon register. ? enable the clcx by setting the lcxen bit of the clcxcon register. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 116 preliminary ? 2011 microchip technology inc. 19.2 clcx interrupts an interrupt will be generated upon a change in the output value of the clcx when the appropriate interrupt enables are set. a rising edge detector and a falling edge detector are present in each clc for this purpose. theclcxif bit of the associated pir registers will be set when either edge detector is triggered and its asso- ciated enable bit is set. the lcxintp enables rising edge interrupts and the lcxintn bit enables falling edge interrupts. both are located in the clcxcon reg- ister. to fully enable the interrupt, set the following bits: ? lcxon bit of the clcxcon register ? clcxie bit of the associated pie registers ? lcxintp bit of the clcxcon register (for a rising edge detection) ? lcxintn bit of the clcxcon register (for a falling edge detection) ? peie and gie bits of the intcon register the clcxif bit of the associated pir registers must be cleared in software as part of the interrupt service. if another edge is detected while this flag is being cleared, the flag will still be set at the end of the sequence. 19.3 effects of a reset the clcxcon register is cleared to zero as the result of a reset. all other selection and gating values remain unchanged. 19.4 operation during sleep the selection, gating, and logic functions are not affected by sleep. operation will continue provided that the source signals are also not affected by sleep. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 117 pic10(l)f320/322 figure 19-2: input data selection and gating lcxg1 lcxg1pol data gate 1 lcxd1g1t lcxg2 lcxg3 lcxg4 data gate 2 data gate 3 data gate 4 lcxd1g1n lcxd2g1t lcxd2g1n lcxd3g1t lcxd3g1n lcxd4g1t lcxd4g1n lcxd1s<2:0> lcxd2s<2:0> lcxd3s<2:0> lcxd4s<2:0> clcxin[0] clcxin[1] clcxin[2] clcxin[3] clcxin[4] clcxin[5] clcxin[6] clcxin[7] 000 111 000 111 000 111 000 111 clcxin[0] clcxin[1] clcxin[2] clcxin[3] clcxin[4] clcxin[5] clcxin[6] clcxin[7] clcxin[0] clcxin[1] clcxin[2] clcxin[3] clcxin[4] clcxin[5] clcxin[6] clcxin[7] clcxin[0] clcxin[1] clcxin[2] clcxin[3] clcxin[4] clcxin[5] clcxin[6] clcxin[7] data selection note: all controls are undefined at power-up. lcxd1t lcxd1n lcxd2t lcxd2n lcxd3t lcxd3n lcxd4t lcxd4n (same as data gate 1) (same as data gate 1) (same as data gate 1) www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 118 preliminary ? 2011 microchip technology inc. figure 19-3: programm able logic functions lcxg1 lcxg2 lcxg3 lcxg4 lcxq lcxg1 lcxg2 lcxg3 lcxg4 lcxq lcxg1 lcxg2 lcxg3 lcxg4 lcxq s r q lcxg1 lcxg2 lcxg3 lcxg4 lcxq dq lcxg1 lcxg2 lcxg3 lcxg4 lcxq s r jq lcxg2 lcxg3 lcxg4 lcxq r lcxg1 k dq lcxg1 lcxg2 lcxg3 lcxg4 lcxq s r dq lcxg1 lcxg3 lcxq r lcxg4 lcxg2 lcxmode<2:0>= 000 lcxmode<2:0>= 010 lcxmode<2:0>= 001 lcxmode<2:0>= 011 lcxmode<2:0>= 100 lcxmode<2:0>= 110 lcxmode<2:0>= 101 lcxmode<2:0>= 111 le and - or or - xor 4-input and s-r latch 1-input d flip-flop with s and r 2-input d flip-flop with r 1-input transparent latch with s and r j-k flip-flop with r www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 119 pic10(l)f320/322 19.5 clc control registers register 19-1: clcxcon: configurable logic cell control register r/w-0/0 r/w-0/0 r-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 lcxen lcxoe lcxout lcxintp lcxintn lcxmode<2:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other reset ?1? = bit is set ?0? = bit is cleared bit 7 lcxen: configurable logic cell enable bit 1 = configurable logic cell is enabled and mixing input signals 0 = configurable logic cell is disabled and has logic zero output bit 6 lcxoe: configurable logic cell output enable bit 1 = configurable logic cell port pin output enabled 0 = configurable logic cell port pin output disabled bit 5 lcxout: configurable logic cell data output bit read-only: logic cell output data, after lcxpol; sampled from lcx_out wire. bit 4 lcxintp: configurable logic cell positive edge going interrupt enable bit 1 = clcxif will be set when a rising edge occurs on lcx_out 0 = clcxif will not be set bit 3 lcxintn: configurable logic cell negative edge going interrupt enable bit 1 = clcxif will be set when a falling edge occurs on lcx_out 0 = clcxif will not be set bit 2-0 lcxmode<2:0>: configurable logic cell functional mode bits 111 = cell is 1-input transparent latch with s and r 110 = cell is j-k flip-flop with r 101 = cell is 2-input d flip-flop with r 100 = cell is 1-input d flip-flop with s and r 011 = cell is s-r latch 010 = cell is 4-input and 001 =cell is or-xor 000 = cell is and-or www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 120 preliminary ? 2011 microchip technology inc. register 19-2: clcxpol: signal polarity control register r/w-x/u u-0 u-0 u-0 r/w-x/u r/w-x/u r/w-x/u r/w-x/u lcxpol ? ? ? lcxg4pol lcxg3pol lcxg2pol lcxg1pol bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other reset ?1? = bit is set ?0? = bit is cleared bit 7 lcxpol: lcout polarity control bit 1 = the output of the logic cell is inverted 0 = the output of the logic cell is not inverted bit 6-4 unimplemented: read as ? 0 ? bit 3 lcxg4pol: gate 4 output polarity control bit 1 = the output of gate 4 is inverted when applied to the logic cell 0 = the output of gate 4 is not inverted bit 2 lcxg3pol: gate 3 output polarity control bit 1 = the output of gate 3 is inverted when applied to the logic cell 0 = the output of gate 3 is not inverted bit 1 lcxg2pol: gate 2 output polarity control bit 1 = the output of gate 2 is inverted when applied to the logic cell 0 = the output of gate 2 is not inverted bit 0 lcxg1pol: gate 1 output polarity control bit 1 = the output of gate 1 is inverted when applied to the logic cell 0 = the output of gate 1 is not inverted www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 121 pic10(l)f320/322 register 19-3: clcxsel0: multiplexer data 1 and 2 select register u-0 r/w-x/u r/w-x/u r/w-x/u u-0 r/w-x/u r/w-x/u r/w-x/u ? lcxd2s<2:0> ? lcxd1s<2:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 unimplemented: read as ? 0 ? bit 6-4 lcxd2s<2:0>: input data 2 selection control bits (1) 111 = clcxin[7] is selected for lcxd2. 110 = clcxin[6] is selected for lcxd2. 101 = clcxin[5] is selected for lcxd2. 100 = clcxin[4] is selected for lcxd2. 011 = clcxin[3] is selected for lcxd2. 010 = clcxin[2] is selected for lcxd2. 001 = clcxin[1] is selected for lcxd2. 000 = clcxin[0] is selected for lcxd2. bit 3 unimplemented: read as ? 0 ? bit 2-0 lcxd1s<2:0>: input data 1 selection control bits (1) 111 = clcxin[7] is selected for lcxd1. 110 = clcxin[6] is selected for lcxd1. 101 = clcxin[5] is selected for lcxd1. 100 = clcxin[4] is selected for lcxd1. 011 = clcxin[3] is selected for lcxd1. 010 = clcxin[2] is selected for lcxd1. 001 = clcxin[1] is selected for lcxd1. 000 = clcxin[0] is selected for lcxd1. note 1: see table 19-1 for signal names associated with inputs. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 122 preliminary ? 2011 microchip technology inc. register 19-4: clcxsel1: multiplexer data 3 and 4 select register u-0 r/w-x/u r/w-x/u r/w-x/u u-0 r/w-x/u r/w-x/u r/w-x/u ? lcxd4s<2:0> ? lcxd3s<2:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 unimplemented: read as ? 0 ? bit 6-4 lcxd4s<2:0>: input data 4 selection control bits (1) 111 = clcxin[7] is selected for lcxd4. 110 = clcxin[6] is selected for lcxd4. 101 = clcxin[5] is selected for lcxd4 100 = clcxin[4] is selected for lcxd4. 011 = clcxin[3] is selected for lcxd4. 010 = clcxin[2] is selected for lcxd4. 001 = clcxin[1] is selected for lcxd4. 000 = clcxin[0] is selected for lcxd4. bit 3 unimplemented: read as ? 0 ? bit 2-0 lcxd3s<2:0>: input data 3 selection control bits (1) 111 = clcxin[7] is selected for lcxd3. 110 = clcxin[6] is selected for lcxd3. 101 = clcxin[5] is selected for lcxd3. 100 = clcxin[4] is selected for lcxd3. 011 = clcxin[3] is selected for lcxd3. 010 = clcxin[2] is selected for lcxd3. 001 = clcxin[1] is selected for lcxd3. 000 = clcxin[0] is selected for lcxd3. note 1: see table 19-1 for signal names associated with inputs. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 123 pic10(l)f320/322 register 19-5: clcxgls0: gate 1 logic select register r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u lcxg1d4t lcxg1d4n lcxg1d3t lcxg1d3n lcxg1d2t lcxg1d2n lcxg1d1t lcxg1d1n bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 lcxg1d4t: gate 1 data 4 true (non-inverted) bit 1 = lcxd4t is gated into lcxg1 0 = lcxd4t is not gated into lcxg1 bit 6 lcxg1d4n: gate 1 data 4 negated (inverted) bit 1 = lcxd4n is gated into lcxg1 0 = lcxd4n is not gated into lcxg1 bit 5 lcxg1d3t: gate 1 data 3 true (non-inverted) bit 1 = lcxd3t is gated into lcxg1 0 = lcxd3t is not gated into lcxg1 bit 4 lcxg1d3n: gate 1 data 3 negated (inverted) bit 1 = lcxd3n is gated into lcxg1 0 = lcxd3n is not gated into lcxg1 bit 3 lcxg1d2t: gate 1 data 2 true (non-inverted) bit 1 = lcxd2t is gated into lcxg1 0 = lcxd2t is not gated into lcxg1 bit 2 lcxg1d2n: gate 1 data 2 negated (inverted) bit 1 = lcxd2n is gated into lcxg1 0 = lcxd2n is not gated into lcxg1 bit 1 lcxg1d1t: gate 1 data 1 true (non-inverted) bit 1 = lcxd1t is gated into lcxg1 0 = lcxd1t is not gated into lcxg1 bit 0 lcxg1d1n: gate 1 data 1 negated (inverted) bit 1 = lcxd1n is gated into lcxg1 0 = lcxd1n is not gated into lcxg1 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 124 preliminary ? 2011 microchip technology inc. register 19-6: clcxgls1: gate 2 logic select register r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u lcxg2d4t lcxg2d4n lcxg2d3t lcxg2d3n lcxg2d2t lcxg2d2n lcxg2d1t lcxg2d1n bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 lcxg2d4t: gate 2 data 4 true (non-inverted) bit 1 = lcxd4t is gated into lcxg2 0 = lcxd4t is not gated into lcxg2 bit 6 lcxg2d4n: gate 2 data 4 negated (inverted) bit 1 = lcxd4n is gated into lcxg2 0 = lcxd4n is not gated into lcxg2 bit 5 lcxg2d3t: gate 2 data 3 true (non-inverted) bit 1 = lcxd3t is gated into lcxg2 0 = lcxd3t is not gated into lcxg2 bit 4 lcxg2d3n: gate 2 data 3 negated (inverted) bit 1 = lcxd3n is gated into lcxg2 0 = lcxd3n is not gated into lcxg2 bit 3 lcxg2d2t: gate 2 data 2 true (non-inverted) bit 1 = lcxd2t is gated into lcxg2 0 = lcxd2t is not gated into lcxg2 bit 2 lcxg2d2n: gate 2 data 2 negated (inverted) bit 1 = lcxd2n is gated into lcxg2 0 = lcxd2n is not gated into lcxg2 bit 1 lcxg2d1t: gate 2 data 1 true (non-inverted) bit 1 = lcxd1t is gated into lcxg2 0 = lcxd1t is not gated into lcxg2 bit 0 lcxg2d1n: gate 2 data 1 negated (inverted) bit 1 = lcxd1n is gated into lcxg2 0 = lcxd1n is not gated into lcxg2 www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 125 pic10(l)f320/322 register 19-7: clcxgls2: gate 3 logic select register r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u lcxg3d4t lcxg3d4n lcxg3d3t lcxg3d3n lcxg3d2t lcxg3d2n lcxg3d1t lcxg3d1n bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 lcxg3d4t: gate 3 data 4 true (non-inverted) bit 1 = lcxd4t is gated into lcxg3 0 = lcxd4t is not gated into lcxg3 bit 6 lcxg3d4n: gate 3 data 4 negated (inverted) bit 1 = lcxd4n is gated into lcxg3 0 = lcxd4n is not gated into lcxg3 bit 5 lcxg3d3t: gate 3 data 3 true (non-inverted) bit 1 = lcxd3t is gated into lcxg3 0 = lcxd3t is not gated into lcxg3 bit 4 lcxg3d3n: gate 3 data 3 negated (inverted) bit 1 = lcxd3n is gated into lcxg3 0 = lcxd3n is not gated into lcxg3 bit 3 lcxg3d2t: gate 3 data 2 true (non-inverted) bit 1 = lcxd2t is gated into lcxg3 0 = lcxd2t is not gated into lcxg3 bit 2 lcxg3d2n: gate 3 data 2 negated (inverted) bit 1 = lcxd2n is gated into lcxg3 0 = lcxd2n is not gated into lcxg3 bit 1 lcxg3d1t: gate 3 data 1 true (non-inverted) bit 1 = lcxd1t is gated into lcxg3 0 = lcxd1t is not gated into lcxg3 bit 0 lcxg3d1n: gate 3 data 1 negated (inverted) bit 1 = lcxd1n is gated into lcxg3 0 = lcxd1n is not gated into lcxg3 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 126 preliminary ? 2011 microchip technology inc. register 19-8: clcxgls3: gate 4 logic select register r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u lcxg4d4t lcxg4d4n lcxg4d3t lcxg4d3n lcxg4d2t lcxg4d2n lcxg4d1t lcxg4d1n bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 lcxg4d4t: gate 4 data 4 true (non-inverted) bit 1 = lcxd4t is gated into lcxg4 0 = lcxd4t is not gated into lcxg4 bit 6 lcxg4d4n: gate 4 data 4 negated (inverted) bit 1 = lcxd4n is gated into lcxg4 0 = lcxd4n is not gated into lcxg4 bit 5 lcxg4d3t: gate 4 data 3 true (non-inverted) bit 1 = lcxd3t is gated into lcxg4 0 = lcxd3t is not gated into lcxg4 bit 4 lcxg4d3n: gate 4 data 3 negated (inverted) bit 1 = lcxd3n is gated into lcxg4 0 = lcxd3n is not gated into lcxg4 bit 3 lcxg4d2t: gate 4 data 2 true (non-inverted) bit 1 = lcxd2t is gated into lcxg4 0 = lcxd2t is not gated into lcxg4 bit 2 lcxg4d2n: gate 4 data 2 negated (inverted) bit 1 = lcxd2n is gated into lcxg4 0 = lcxd2n is not gated into lcxg4 bit 1 lcxg4d1t: gate 4 data 1 true (non-inverted) bit 1 = lcxd1t is gated into lcxg4 0 = lcxd1t is not gated into lcxg4 bit 0 lcxg4d1n: gate 4 data 1 negated (inverted) bit 1 = lcxd1n is gated into lcxg4 0 = lcxd1n is not gated into lcxg4 www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 127 pic10(l)f320/322 table 19-3: summary of registers associated with clcx name bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 register on page clc1con lc1en lc1oe lc1out lc1intp lc1intn lc1mode<2:0> 119 clc1gls0 lc1g1d4t lc1g1d4n lc1g1d3t lc1g1d3n lc1g1d2t lc1g1d2n lc1g1d1t lc1g1d1n 123 clc1gls1 lc1g2d4t lc1g2d4n lc1g2d3t lc1g2d3n lc1g2d2t lc1g2d2n lc1g2d1t lc1g2d1n 124 clc1gls2 lc1g3d4t lc1g3d4n lc1g3d3t lc1g3d3n lc1g3d2t lc1g3d2n lc1g3d1t lc1g3d1n 125 clc1gls3 lc1g4d4t lc1g4d4n lc1g4d3t lc1g4d3n lc1g4d2t lc1g4d2n lc1g4d1t lc1g4d1n 126 clc1pol lc1pol ? ? ? lc1g4pol lc1g3pol lc1g2pol lc1g1pol 120 clc1sel0 ? lc1d2s<2:0> ? lc1d1s<2:0> 121 clc1sel1 ? lc1d4s<2:0> ? lc1d3s<2:0> 122 intcon gie peie tmr0ie inte iocie tmr0if intf iocif 46 pie1 ? adie ? nco1ie clc1ie ? tmr2ie ? 47 pir1 ? adif ? nco1if clc1if ? tmr2if ? 48 trisa ? ? ? ? ? trisa2 trisa1 trisa0 77 legend: ? = unimplemented read as ? 0 ?. shaded cells are not used for clc module. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 128 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 129 pic10(l)f320/322 20.0 numerically controlled oscillator (nco) module the numerically controlled oscillator (ncox) module is a timer that uses the overflow from the addition of an increment value to divide the input frequency. the advantage of the addition method over simple counter driven timer is that the resolution of division does not vary with the divider value. the ncox is most useful for applications that requires frequency accuracy and fine resolution at a fixed duty cycle. features of the ncox include: ? 16-bit increment function ? fixed duty cycle (fdc) mode ? pulse frequency (pf) mode ? output pulse width control ? multiple clock input sources ? output polarity control ? interrupt capability figure 20-1 is a simplified block diagram of the ncox module. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 130 preliminary ? 2011 microchip technology inc. figure 20-1: numerically controlled oscillato r (ncox) module simp lified block diagram n xen lc1out hfintosc nco1clk 2 n xcks < 1:0 > note 1: the increment registers are double-buffered to allow for value changes to be made without first disabling the ncox module. they are shown here for reference. the buffers are not user-accessible. (1) f osc 10 00 01 11 increment buffer accumulator ? overflow ncox clock d q q s q q r to n xout bit 16 20 20 interrupt event set ncoxif flag nxpol ncox clock 0 1 nxpfm to clc and cwg modules ripple counter reset n x pws<2:0> 3 16 ncox nxoe tris control www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 131 pic10(l)f320/322 20.1 ncox operation the ncox operates by repeatedly adding a fixed value to an accumulator. additions occur at the input clock rate. the accumulator will overflow with a carry periodically, which is the raw ncox output. this effectively reduces the input clock by the ratio of the addition value to the maximum accumulator value. see equation 20-1 . the ncox output can be further modified by stretching the pulse or toggling a flip-flop. the modified ncox output is then distributed internally to other peripherals and optionally output to a pin. the accumulator overflow also generates an interrupt. the ncox output creates an instantaneous frequency, which may cause uncertainty. this output depends on the ability of the receiving circuit (i.e., cwg or external resonant converter circuitry) to average the instantaneous frequency to reduce uncertainty. 20.1.1 ncox clock sources clock sources available to the ncox include: ?hfintosc ?f osc ?lc1out ? nco1clk pin the ncox clock source is selected by configuring the nxcks<1:0> bits in the ncoxclk register. 20.1.2 accumulator the accumulator is a 20-bit register. read and write access to the accumulator is available through three registers: ? ncoxaccl ? ncoxacch ? ncoxaccu 20.1.3 adder the ncox adder is a full adder, which operates asynchronously to the clock source selected. the addition of the previous result and the increment value replaces the accumulator value on the rising edge of each input clock. 20.1.4 increment registers the increment value is stored in two 8-bit registers making up a 16-bit increment. in order of lsb to msb they are: ? ncoxincl ? ncoxinch both of the registers are readable and writeable. the increment registers are double-buffered to allow for value changes to be made without first disabling the ncox module. the buffer loads are immediate when the module is dis- abled. writing to the ms register first is necessary because then the buffer is loaded synchronously with the ncox operation after the write is executed on the lower increment register. equation 20-1: note: the increment buffer registers are not user- accessible. f overflow nco clock frequency increment value ? 2 n ---------------------------------------------------------------------------------------------------------------- = n = accumulator width in bits www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 132 preliminary ? 2011 microchip technology inc. 20.2 fixed duty cycle (fdc) mode in fixed duty cycle (fdc) mode, every time the accumulator overflows, the output is toggled. this provides a 50% duty cycle, provided that the increment value remains constant. for more information, see figure 20-2 . the fdc mode is selected by clearing the nxpfm bit in the ncoxcon register. 20.3 pulse frequency (pf) mode in pulse frequency (pf) mode, every time the accu- mulator overflows, the output becomes active for one or more clock periods. see section 20.3.1 ?output pulse width control? for more information. once the clock period expires, the output returns to an inactive state. this provides a pulsed output. the output becomes active on the rising clock edge immediately following the overflow event. for more information, see figure 20-2 . the value of the active and inactive states depends on the polarity bit, nxpol in the ncoxcon register. the pf mode is selected by setting the nxpfm bit in the ncoxcon register. 20.3.1 output pulse width control when operating in pf mode, the active state of the out- put can vary in width by multiple clock periods. various pulse widths are selected with the nxpws<2:0> bits in the ncoxclk register. when the selected pulse width is greater than the accumulator overflow time frame, then ncox opera- tion is undefined. 20.4 output polarity control the last stage in the ncox module is the output polar- ity. the nxpol bit in the ncoxcon register selects the output polarity. changing the polarity while the inter- rupts are enabled will cause an interrupt for the result- ing output transition. the ncox output can be used internally by source code or other peripherals. this is done by reading the nxout (read-only) bit of the ncoxcon register. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 133 pic10(l)f320/322 figure 20-2: fdc output mode operation diagram clock source ncox increment value ncox value accumulator 0000h 4000h fc000h 0000h 4000h 8000h 0000h 4000h 8000h c000h 4000h 1 0000h overflow event interrupt ncox output fdc mode ncox output pf mode ncoxpws = 000 ncox output ncoxpws = 001 pf mode fc000h 8000h www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 134 preliminary ? 2011 microchip technology inc. 20.5 interrupts when the accumulator overflows, the ncox interrupt flag bit, ncoxif, of the pir1 register is set. to enable this interrupt event, the following bits must be set: ? nxen bit of the ncoxcon register ? ncoxie bit of the pie1 register ? peie bit of the intcon register ? gie bit of the intcon register the interrupt must be cleared by software by clearing the ncoxif bit in the interrupt service routine. 20.6 effects of a reset all of the ncox registers are cleared to zero as the result of a reset. 20.7 operation in sleep the nco module operates independently from the system clock and will continue to run during sleep, provided that the clock source selected remains active. the hfintosc remains active during sleep when the nco module is enabled and the hfintosc is selected as the clock source, regardless of the system clock source selected. in other words, if the hfintosc is simultaneously selected as the system clock and the nco clock source, when the nco is enabled, the cpu will go idle during sleep, but the nco will continue to operate and the hfintosc will remain active. this will have a direct effect on the sleep mode current. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 135 pic10(l)f320/322 20.8 ncox control registers register 20-2: ncoxclk: ncox input clock control register register 20-1: ncoxcon: ncox control register r/w-0/0 r/w-0/0 r-0/0 r/w-0/0 u-0 u-0 u-0 r/w-0/0 nxen nxoe nxout nxpol ? ? ?nxpfm bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7 nxen: ncox enable bit 1 = ncox module is enabled 0 = ncox module is disabled bit 6 nxoe: ncox output enable bit 1 = ncox output pin is enabled 0 = ncox output pin is disabled bit 5 nxout: ncox output bit 1 = ncox output is high 0 = ncox output is low bit 4 nxpol: ncox polarity bit 1 = ncox output signal is active high 0 = ncox output signal is active low bit 3-1 unimplemented : read as ? 0 ?. bit 0 nxpfm: ncox pulse frequency mode bit 1 = ncox operates in pulse frequency mode 0 = ncox operates in fixed duty cycle mode r/w-0/0 r/w-0/0 r/w-0/0 u-0 u-0 u-0 r/w-0/0 r/w-0/0 nxpws<2:0> ? ? ?nxcks<1:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-5 nxpws<2:0>: ncox output pulse width select bits (1, 2) 111 = 128 ncox clock periods 110 = 64 ncox clock periods 101 = 32 ncox clock periods 100 = 16 ncox clock periods 011 = 8 ncox clock periods 010 = 4 ncox clock periods 001 = 2 ncox clock periods 000 = 1 ncox clock periods bit 4-2 unimplemented: read as ? 0 ? bit 1-0 nxcks<1:0>: ncox clock source select bits 11 = nco1clk 10 = lc1out 01 = fosc 00 = hfintosc (16 mhz) note 1: nxpws applies only when operating in pulse frequency mode. 2: if ncox pulse width is greater than ncox overflow period, operation is undefined. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 136 preliminary ? 2011 microchip technology inc. register 20-3: ncoxaccl: ncox accumulator register ? low byte register 20-4: ncoxacch: ncox accum ulator register ? high byte register 20-5: ncoxaccu: ncox accum ulator register ? upper byte r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ncoxacc<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-0 ncoxacc<7:0>: ncox accumulator, low byte note 1: nxpws applies only when operating in pulse frequency mode. 2: if ncox pulse width is greater than ncox overflow period, operation is undefined. r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ncoxacc<15:8> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-0 ncoxacc<15:8>: ncox accumulator, high byte u-0 u-0 u-0 u-0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ? ? ? ? nco x acc<19:16> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-4 unimplemented: read as ? 0 ? bit 3-0 nco x acc<19:16>: nco x accumulator, upper byte www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 137 pic10(l)f320/322 register 20-6: ncoxincl: ncox increment register ? low byte register 20-7: ncoxinch: ncox increment register ? high byte r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-1/1 ncoxinc<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-0 ncoxinc<7:0>: ncox increment, low byte r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 ncoxinc<15:8> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared bit 7-0 ncoxinc<15:8>: ncox increment, high byte www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 138 preliminary ? 2011 microchip technology inc. table 20-1: summary of register s associated with ncox name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page clc1sel0 ? lc1d2s2 lc1d2s1 lc1d2s0 ? lc1d1s2 lc1d1s1 lc1d1s0 121 clc1sel1 ? lc1d4s2 lc1d4s1 lc1d4s0 ? lc1d3s2 lc1d3s1 lc1d3s0 122 cwg1con1 g1asdlb<1:0> g1asdla<1:0> ? ? g1is<1:0> 150 intcon gie peie tmr0ie inte iocie tmr0if intf iocif 46 nco1acch nco1acch<15:8> 136 nco1accl nco1accl<7:0> 136 nco1accu ? nco1accu<19:16 136 nco1clk n1pws<2:0> ? ? ?n1cks<1:0> 135 nco1con n1en n1oe n1out n1pol ? ? ?n1pfm 135 nco1inch nco1inch<15:8> 137 nco1incl nco1incl<7:0> 137 pie1 ? adie ? nco1ie clc1ie ? tmr2ie ? 47 pir1 ? adif ? nco1if clc1if ? tmr2if ? 48 trisa ? ? ? ? ? trisa2 trisa1 trisa0 77 legend: x = unknown, u = unchanged, ? = unimplemented read as ? 0 ?, q = value depends on condition. shaded cells are not used for adc module. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 139 pic10(l)f320/322 21.0 complementary waveform generator (cwg) module the complementary waveform generator (cwg) pro- duces a complementary waveform with dead-band delay from a selection of input sources. the cwg module has the following features: ? selectable dead-band clock source control ? selectable input sources ? output enable control ? output polarity control ? dead-band control with independent 6-bit rising and falling edge dead-band counters ? auto-shutdown control with: - selectable shutdown sources - auto-restart enable - auto-shutdown pin override control www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 140 preliminary ? 2011 microchip technology inc. figure 21-1: cwg block diagram cwg_clock gxcs input source pwm1out pwm2out n1out cwg1flt (int pin) gxasdflt lc1out gxasdclc1 f osc hfintosc gxis lc1out auto-shutdown source g x pola 2 1 2 q s rq en r gxarsen cwgxdbr g x polb 6 cwgxdbf 0 1 0 1 00 10 11 ? 0 ? ? 1 ? 00 10 11 ? 0 ? ? 1 ? g x asdlb 2 gxasdla 2 cwg x a cwg x b gxasdla = 01 gxasdlb = 01 gxase gxoea gxoeb = en r 6 = trisx trisx x = cwg module number q s rq q d s write gxase data bit shutdown set dominate www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 141 pic10(l)f320/322 figure 21-2: typical cwg operatio n with pwm1 (no auto-shutdown) rising edge d falling edge dead band rising edge dead band falling edge dead band cwg_clock pwm1 cwgxa cwgxb rising edge dead band www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 142 preliminary ? 2011 microchip technology inc. 21.1 fundamental operation the cwg generates a two output complementary waveform from one of four selectable input sources. the off-to-on transition of each output can be delayed from the on-to-off transition of the other output, thereby, creating a time delay immediately where neither output is driven. this is referred to as dead time and is covered in section 21.5 ?dead-band control? . a typical operating waveform, with dead band, generated from a single input signal is shown in figure 21-2 . it may be necessary to guard against the possibility of circuit faults or a feedback event arriving too late or not at all. in this case, the active drive must be terminated before the fault condition causes damage. this is referred to as auto-shutdown and is covered in section 21.9 ?auto-shutdown control? . 21.2 clock source the cwg module allows for up to 2 different clock sources to be selected: ? fosc (system clock) ? hfintosc (16 mhz only) the clock sources are selected using the g1cs0 bit of the cwgxcon0 register ( register 21-1 ). 21.3 selectable input sources the cwg uses four different input sources to gener- ate the complementary waveform: ?pwm1 ?pwm2 ?n1out ?lc1out the input sources are selected using the gxis<1:0> bits in the cwgxcon1 register ( register 21-2 ). 21.4 output control immediately after the cwg module is enabled, the complementary drive is configured with both cwgxa and cwgxb drives cleared. 21.4.1 output enables each cwg output pin has individual output enable control. output enables are selected with the gxoea and gxoeb bits of the cwgxcon0 register. when an output enable control is cleared, the module asserts no control over the pin. when an output enable is set, the override value or active pwm waveform is applied to the pin per the port priority selection. the output pin enables are dependent on the module enable bit, gxen. when gxen is cleared, cwg output enables and cwg drive levels have no effect. 21.4.2 polarity control the polarity of each cwg output can be selected independently. when the output polarity bit is set, the corresponding output is active high. clearing the output polarity bit configures the corresponding output as active low. however, polarity does not affect the override levels. output polarity is selected with the gxpola and gxpolb bits of the cwgxcon0 register. 21.5 dead-band control dead-band control provides for non-overlapping output signals to prevent shoot-through current in power switches. the cwg contains two 6-bit dead-band counters. one dead-band counter is used for the rising edge of the input source control. the other is used for the falling edge of the input source control. dead band is timed by counting cwg clock periods from zero up to the value in the rising or falling dead- band counter registers. see cwgxdbr and cwgxdbf registers ( register 21-4 and register 21-5 , respectively). 21.6 rising edge dead band the rising edge dead band delays the turn-on of the cwgxa output from when the cwgxb output is turned off. the rising edge dead-band time starts when the rising edge of the input source signal goes true. when this happens, the cwgxb output is immediately turned off and the rising edge dead-band delay time starts. when the rising edge dead-band delay time is reached, the cwgxa output is turned on. the cwgxdbr register sets the duration of the dead- band interval on the rising edge of the input source signal. this duration is from 0 to 64 counts of dead band. dead band is always counted off the edge on the input source signal. a count of 0 (zero), indicates that no dead band is present. if the input source signal is not present for enough time for the count to be completed, no output will be seen on the respective output. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 143 pic10(l)f320/322 21.7 falling edge dead band the falling edge dead band delays the turn-on of the cwgxb output from when the cwgxa output is turned off. the falling edge dead-band time starts when the falling edge of the input source goes true. when this happens, the cwgxa output is immediately turned off and the falling edge dead-band delay time starts. when the falling edge dead-band delay time is reached, the cwgxb output is turned on. the cwgxdbf register sets the duration of the dead- band interval on the falling edge of the input source sig- nal. this duration is from 0 to 64 counts of dead band. dead band is always counted off the edge on the input source signal. a count of 0 (zero), indicates that no dead band is present. if the input source signal is not present for enough time for the count to be completed, no output will be seen on the respective output. refer to figure 21-3 and figure 21-4 for examples. 21.8 dead-band uncertainty when the rising and falling edges of the input source triggers the dead-band counters, the input may be asyn- chronous. this will create some uncertainty in the dead- band time delay. the maximum uncertainty is equal to one cwg clock period. refer to equation 21-1 for more detail. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 144 preliminary ? 2011 microchip technology inc. figure 21-3: dead-band operation, cwgxdbr = 01h, cwgxdbf = 02h figure 21-4: dead-band operation, cwgxdbr = 03h, cwgxdbf = 04h, source shorter than dead band input source cwgxa cwgxb cwg_clock source shorter than dead band input source cwgxa cwgxb cwg_clock www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 145 pic10(l)f320/322 equation 21-1: dead-band delay time uncertainty example 21-1: dead-band delay time uncertainty t deadband _ uncertainty 1 fcwg_clock ---------------------------- - = therefore: fcwg_clock 16 mhz = 1 16 mhz ------------------ - = 625ns = t deadband _ uncertainty 1 fcwg_clock ---------------------------- - = www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 146 preliminary ? 2011 microchip technology inc. 21.9 auto-shutdown control auto-shutdown is a method to immediately override the cwg output levels with specific overrides that allow for safe shutdown of the circuit. the shutdown state can be either cleared automatically or held until cleared by software. 21.9.1 shutdown the shutdown state can be entered by either of the fol- lowing two methods: ? software generated ? external input 21.9.1.1 software generated shutdown setting the gxase bit of the cwgxcon2 register will force the cwg into the shutdown state. when auto-restart is disabled, the shutdown state will persist as long as the gxase bit is set. when auto-restart is enabled, the gxase bit will clear automatically and resume operation on the next rising edge event. see figure 21-6 . 21.9.1.2 external input source external shutdown inputs provide the fastest way to safely suspend cwg operation in the event of a fault condition. when any of the selected shutdown inputs goes high, the cwg outputs will immediately go to the selected override levels without software delay. any combination of two input sources can be selected to cause a shutdown condition. the two sources are: ?lc1out ?cwg1flt shutdown inputs are selected using the gxasds0 and gxasds1 bits of the cwgxcon2 register. ( register 21-3 ). 21.10 operation during sleep the cwg module operates independently from the system clock and will continue to run during sleep, provided that the clock and input sources selected remain active. the hfintosc remains active during sleep, provided that the cwg module is enabled, the input source is active, and the hfintosc is selected as the clock source, regardless of the system clock source selected. in other words, if the hfintosc is simultaneously selected as the system clock and the cwg clock source, when the cwg is enabled and the input source is active, the cpu will go idle during sleep, but the cwg will continue to operate and the hfintosc will remain active. this will have a direct effect on the sleep mode current. note: shutdown inputs are level sensitive, not edge sensitive. the shutdown state can- not be cleared, except by disabling auto-shutdown, as long as the shutdown input level persists. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 147 pic10(l)f320/322 21.11 configuring the cwg the following steps illustrate how to properly configure the cwg to ensure a synchronous start: 1. ensure that the tris control bits corresponding to cwgxa and cwgxb are set so that both are configured as inputs. 2. clear the gxen bit, if not already cleared. 3. set desired dead-band times with the cwgxdbr and cwgxdbf registers. 4. setup the following controls in cwgxcon2 auto-shutdown register: ? select desired shutdown source. ? select both output overrides to the desired levels (this is necessary even if not using auto-shutdown because start-up will be from a shutdown state). ? set the gxase bit and clear the gxarsen bit. 5. select the desired input source using the cwgxcon1 register. 6. configure the following controls in cwgxcon0 register: ? select desired clock source. ? select the desired output polarities. ? set the output enables for the outputs to be used. 7. set the gxen bit. 8. clear tris control bits corresponding to cwgxa and cwgxb to be used to configure those pins as outputs. 9. if auto-restart is to be used, set the gxarsen bit and the gxase bit will be cleared automati- cally. otherwise, clear the gxase bit to start the cwg. 21.11.1 pin override levels the levels driven to the output pins, while the shutdown input is true, are controlled by the gxasdla and gxasdlb bits of the cwgxcon2 register ( register 21-3 ). gxasdla controls the cwg1a override level and gxasdlb controls the cwg1b override level. the control bit logic level corresponds to the output logic drive level while in the shutdown state. the polarity control does not apply to the override level. 21.11.2 auto-shutdown restart after an auto-shutdown event has occurred, there are two ways to have resume operation: ? software controlled ? auto-restart the restart method is selected with the gxarsen bit of the cwgxcon2 register. waveforms of software controlled and automatic restarts are shown in figure 21-5 and figure 21-6 . 21.11.2.1 software controlled restart when the gxarsen bit of the cwgxcon2 register is cleared, the cwg must be restarted after an auto-shut- down event by software. the cwg will resume operation on the first rising edge event after the gxase bit is cleared. clearing the shut- down state requires all selected shutdown inputs to be low, otherwise the gxase bit will remain set. 21.11.2.2 auto-restart when the gxarsen bit of the cwgxcon2 register is set, the cwg will restart from the auto-shutdown state automatically. after the shutdown event clears, the gxase bit will clear automatically and the cwg will resume operation on the first rising edge event. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 148 preliminary ? 2011 microchip technology inc. figure 21-5: shutdown functionality, auto-restart disabled (gxarsen = 0 ) figure 21-6: shutdown functionality, auto-restart enabled (gxarsen = 1 ) shutdown g x ase cleared by software output resumes no shutdown cwg input g x ase cwg1a source shutdown source shutdown event ceases tri-state (no pulse) cwg1b tri-state (no pulse) shutdown tri-state (no pulse) g x ase auto-cleared by hardware output resumes no shutdown cwg input g x ase cwg1a source shutdown source shutdown event ceases cwg1b tri-state (no pulse) www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 149 pic10(l)f320/322 21.12 cwg control registers register 21-1: cwgxcon0: cwg control register 0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 r/w-0/0 u-0 u-0 r/w-0/0 gxen gxoeb gxoea gxpolb gxpola ? ?gxcs0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7 gxen: cwgx enable bit 1 = module is enabled 0 = module is disabled bit 6 gxoeb: cwgxb output enable bit 1 = cwgxb is available on appropriate i/o pin 0 = cwgxb is not available on appropriate i/o pin bit 5 gxoea: cwgxa output enable bit 1 = cwgxa is available on appropriate i/o pin 0 = cwgxa is not available on appropriate i/o pin bit 4 gxpolb: cwgxb output polarity bit 1 = output is inverted polarity 0 = output is normal polarity bit 3 gxpola: cwgxa output polarity bit 1 = output is inverted polarity 0 = output is normal polarity bit 2-1 unimplemented : read as ? 0 ? bit 0 gxcs0: cwgx clock source select bit 1 =hfintosc 0 =f osc www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 150 preliminary ? 2011 microchip technology inc. register 21-2: cwgxcon1: cwg control register 1 r/w-x/u r/w-x/u r/w-x/u r/w-x/u u-0 u-0 r/w-0/0 r/w-0/0 gxasdlb<1:0> gxasdla<1:0> ? ? gxis<1:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7-6 gxasdlb<1:0>: cwgx shutdown state for cwgxb when an auto shutdown event is present (gxase = 1 ): 11 = cwgxb pin is driven to ? 1 ?, regardless of the setting of the gxpolb bit. 10 = cwgxb pin is driven to ? 0 ?, regardless of the setting of the gxpolb bit. 01 = cwgxb pin is tri-stated 00 = cwgxb pin is driven to its inactive state after the selected dead-band interval. gxpolb still will control the polarity of the output. bit 5-4 gxasdla<1:0>: cwgx shutdown state for cwgxa when an auto shutdown event is present (gxase = 1 ): 00 = cwgxa pin is driven to its inactive state after the selected dead-band interval. gxpola still will control the polarity of the output. 01 = cwgxa pin is tri-stated 10 = cwgxa pin is driven to ? 0 ?, regardless of the setting of the gxpola bit. 11 = cwgxa pin is driven to ? 1 ?, regardless of the setting of the gxpola bit. bit 3-2 unimplemented: read as ? 0 ? bit 1-0 gxis<1:0>: cwgx dead-band source select bits 11 =lc1out 10 =n1out 01 =pwm2out 00 =pwm1out www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 151 pic10(l)f320/322 register 21-3: cwgxcon2: cwg control register 2 r/w-0/0 r/w-0/0 u-0 u-0 u-0 u-0 r/w-0/0 r/w-0/0 gxase g x arsen ? ? ? ? gxasdclc1 gxasdflt bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7 gxase: auto-shutdown event status bit 1 = an auto-shutdown event has occurred 0 = no auto-shutdown event has occurred bit 6 gxarsen: auto-restart enable bit 1 = auto-restart is enabled 0 = auto-restart is disabled bit 5-2 unimplemented: read as ? 0 ? bit 1 gxasdclc1: cwg auto-shutdown source enable bit 1 1 = shutdown when lc1out is high 0 = lc1out has no effect on shutdown bit 0 gxasdflt: cwg auto-shutdown source enable bit 0 1 = shutdown when c wg1flt input is low 0 =c wg1flt input has no effect on shutdown www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 152 preliminary ? 2011 microchip technology inc. register 21-4: cwg x dbr: complementary waveform generator (cwg x) rising dead-band count register register 21-5: cwg x dbf: complementary waveform generator (cwg x) falling dead-band count register u-0 u-0 r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u ? ? cwg x dbr<5:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7-6 unimplemented: read as ? 0 ? bit 5-0 cwgxdbr<5:0>: complementary waveform generator (cwgx) rising counts bits 11 1111 = 63-64 counts of dead band 11 1110 = 62-63 counts of dead band ?? ?? ? 00 0010 = 2-3 counts of dead band 00 0001 = 1-2 counts of dead band 00 0000 = 0 counts of dead band u-0 u-0 r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u r/w-x/u ? ? cwgxdbf<5:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? u = bit is unchanged x = bit is unknown -n/n = value at por and bor/value at all other resets ?1? = bit is set ?0? = bit is cleared q = value depends on condition bit 7-6 unimplemented: read as ? 0 ? bit 5-0 cwgxdbf<5:0>: complementary waveform generator (cwgx) falling counts bits 11 1111 = 63-64 counts of dead band 11 1110 = 62-63 counts of dead band ?? ?? ? 00 0010 = 2-3 counts of dead band 00 0001 = 1-2 counts of dead band 00 0000 = 0 counts of dead band. dead-band generation is bypassed. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 153 pic10(l)f320/322 table 21-1: summary of registers associated with cwg name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 register on page ansela ? ? ? ? ? ansa2 ansa1 ansa0 78 cwg1con0 g1en g1oeb g1oea g1polb g1pola ? ?g1cs0 150 cwg1con1 g1asdlb<1:0> g1asdla<1:0> ? ? g1is<1:0> 151 cwg1con2 g1ase g 1 arsen ? ? ? ? gxasdclc1 gxasdflt 152 cwg1dbf ? ? cwg1dbf<5:0> 153 cwg1dbr ? ? cwg1dbr<5:0> 153 lata ? ? ? ? ? lata2 lata1 lata0 78 trisa ? ? ? ? ? trisa2 trisa1 trisa0 77 legend: x = unknown, u = unchanged, ? = unimplemented locations read as ? 0 ?. shaded cells are not used by cwg. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 154 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 155 pic10(l)f320/322 22.0 in-circuit serial programming? (icsp?) icsp? programming allows customers to manufacture circuit boards with unprogrammed devices. programming can be done after the assembly process allowing the device to be programmed with the most recent firmware or a custom firmware. five pins are needed for icsp? programming: ? icspclk ? icspdat ?mclr /v pp ?v dd ?v ss in program/verify mode the program memory, user ids and the configuration words are programmed through serial communications. the icspdat pin is a bidirectional i/o used for transferring the serial data and the icspclk pin is the clock input. for more information on icsp? refer to the ? pic16(l)f178x memory programming specification ? (ds41457). 22.1 high-voltage programming entry mode the device is placed into high-voltage programming entry mode by holding the icspclk and icspdat pins low then raising the voltage on mclr /v pp to v ihh . some programmers produce v pp greater than v ihh (9.0v), an external circuit is required to limit the v pp voltage. see figure 22-1 for example circuit. figure 22-1: vpp limiter example circuit v ref v pp v dd v ss icsp_data icsp_clock nc rj11-6pin rj11-6pin r1 270 ohm to m p l a b ? icd 2 to tar g e t b o ar d 1 2 3 4 5 61 2 3 4 5 6 r2 r3 10k 1% 24k 1% u1 lm431bcmx a 2 3 6 7 8 a a a k nc nc 1 4 5 note: the mplab ? icd 2 produces a v pp voltage greater than the maximum v pp specification of the pic10(l)f320/322. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 156 preliminary ? 2011 microchip technology inc. 22.2 low-voltage programming entry mode the low-voltage programming entry mode allows the pic10(l)f320/322 devices to be programmed using v dd only, without high voltage. when the lvp bit of configuration word is set to ? 1 ?, the low-voltage icsp programming entry is enabled. to disable the low-voltage icsp mode, the lvp bit must be programmed to ? 0 ?. entry into the low-voltage programming entry mode requires the following steps: 1. mclr is brought to v il . 2. a 32-bit key sequence is presented on icspdat, while clocking icspclk. once the key sequence is complete, mclr must be held at v il for as long as program/verify mode is to be maintained. if low-voltage programming is enabled (lvp = 1 ), the mclr reset function is automatically enabled and cannot be disabled. see section 5.3 ?low-power brown-out reset (lpbor)? for more information. the lvp bit can only be reprogrammed to ? 0 ? by using the high-voltage programming mode. 22.3 common programming interfaces connection to a target device is typically done through an icsp? header. a commonly found connector on development tools is the rj-11 in the 6p6c (6 pin, 6 connector) configuration. see figure 22-2 . figure 22-2: icd rj-11 style connector interface another connector often found in use with the pickit? programmers is a standard 6-pin header with 0.1 inch spacing. refer to figure 22-3 . figure 22-3: pickit? st yle connector interface 1 2 3 4 5 6 target bottom side pc board v pp /mclr v ss icspclk v dd icspdat nc pin description* 1 = v pp /mclr 2 = v dd target 3 = v ss (ground) 4 = icspdat 5 = icspclk 6 = no connect 1 2 3 4 5 6 * the 6-pin header (0.100" spacing) accepts 0.025" square pins. pin description* 1 = v pp /mclr 2 = v dd target 3 = v ss (ground) 4 = icspdat 5 = icspclk 6 = no connect pin 1 indicator www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 157 pic10(l)f320/322 for additional interface recommendations, refer to your specific device programmer manual prior to pcb design. it is recommended that isolation devices be used to separate the programming pins from other circuitry. the type of isolation is highly dependent on the specific application and may include devices such as resistors, diodes, or even jumpers. see figure 22-4 for more information. figure 22-4: typical connect ion for icsp? programming v dd v pp v ss external device to be data clock v dd mclr /v pp v ss icspdat icspclk * * * to normal connections * isolation devices (as required). programming signals programmed v dd www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 158 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 159 pic10(l)f320/322 23.0 instruction set summary the pic10(l)f320/322 instruction set is highly orthog- onal and is comprised of three basic categories: ? byte-oriented operations ? bit-oriented operations ? literal and control operations each pic16 instruction is a 14-bit word divided into an opcode, which specifies the instruction type and one or more operands, which further specify the operation of the instruction. the formats for each of the categories is presented in figure 23-1 , while the various opcode fields are summarized in tab l e 2 3- 1 . table 23-2 lists the instructions recognized by the mpasm tm assembler. for byte-oriented instructions, ?f? represents a file register designator and ?d? represents a destination designator. the file register designator specifies which file register is to be used by the instruction. the destination designator specifies where the result of the operation is to be placed. if ?d? is zero, the result is placed in the w register. if ?d? is one, the result is placed in the file register specified in the instruction. for bit-oriented instructions, ?b? represents a bit field designator, which selects the bit affected by the operation, while ?f? represents the address of the file in which the bit is located. for literal and control operations, ?k? represents an 8-bit or 11-bit constant, or literal value. one instruction cycle consists of four oscillator periods; for an oscillator frequency of 4 mhz, this gives a normal instruction execution time of 1 ? s. all instructions are executed within a single instruction cycle, unless a conditional test is true, or the program counter is changed as a result of an instruction. when this occurs, the execution takes two instruction cycles, with the second cycle executed as a nop . all instruction examples use the format ? 0xhh ? to represent a hexadecimal number, where ? h ? signifies a hexadecimal digit. 23.1 read-modify-write operations any instruction that specifies a file register as part of the instruction performs a read-modify-write (rmw) operation. the register is read, the data is modified, and the result is stored according to either the instruc- tion or the destination designator ?d?. a read operation is performed on a register even if the instruction writes to that register. for example, a clrf porta instruction will read porta, clear all the data bits, then write the result back to porta. this example would have the unintended consequence of clearing the condition that set the iocif flag. table 23-1: opcode field descriptions figure 23-1: general format for instructions field description f register file address (0x00 to 0x7f) w working register (accumulator) b bit address within an 8-bit file register k literal field, constant data or label x don?t care location (= 0 or 1 ). the assembler will generate code with x = 0 . it is the recommended form of use for compatibility with all microchip software tools. d destination select; d = 0 : store result in w , d = 1 : store result in file register f. default is d = 1. pc program counter to time-out bit c carry bit dc digit carry bit z zero bit pd power-down bit byte-oriented file register operations 13 8 7 6 0 d = 0 for destination w opcode d f (file #) d = 1 for destination f f = 7-bit file register address bit-oriented file register operations 13 10 9 7 6 0 opcode b (bit #) f (file #) b = 3-bit bit address f = 7-bit file register address literal and control operations 13 8 7 0 opcode k (literal) k = 8-bit immediate value 13 11 10 0 opcode k (literal) k = 11-bit immediate value general call and goto instructions only www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 160 preliminary ? 2011 microchip technology inc. table 23-2: pic10(l)f320/322 instruction set mnemonic, operands description cycles 14-bit opcode status affected notes msb lsb byte-oriented file register operations addwf andwf clrf clrw comf decf decfsz incf incfsz iorwf movf movwf nop rlf rrf subwf swapf xorwf f, d f, d f ? f, d f, d f, d f, d f, d f, d f, d f ? f, d f, d f, d f, d f, d add w and f and w with f clear f clear w complement f decrement f decrement f, skip if 0 increment f increment f, skip if 0 inclusive or w with f move f move w to f no operation rotate left f through carry rotate right f through carry subtract w from f swap nibbles in f exclusive or w with f 1 1 1 1 1 1 1 (2) 1 1 (2) 1 1 1 1 1 1 1 1 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0111 0101 0001 0001 1001 0011 1011 1010 1111 0100 1000 0000 0000 1101 1100 0010 1110 0110 dfff dfff lfff 0xxx dfff dfff dfff dfff dfff dfff dfff lfff 0xx0 dfff dfff dfff dfff dfff ffff ffff ffff xxxx ffff ffff ffff ffff ffff ffff ffff ffff 0000 ffff ffff ffff ffff ffff c, dc, z z z z z z z z z c c c, dc, z z 1, 2 1, 2 2 1, 2 1, 2 1, 2, 3 1, 2 1, 2, 3 1, 2 1, 2 1, 2 1, 2 1, 2 1, 2 1, 2 bit-oriented file register operations bcf bsf btfsc btfss f, b f, b f, b f, b bit clear f bit set f bit test f, skip if clear bit test f, skip if set 1 1 1 (2) 1 (2) 01 01 01 01 00bb 01bb 10bb 11bb bfff bfff bfff bfff ffff ffff ffff ffff 1, 2 1, 2 3 3 literal and control operations addlw andlw call clrwdt goto iorlw movlw retfie retlw return sleep sublw xorlw k k k ? k k k ? k ? ? k k add literal and w and literal with w call subroutine clear watchdog timer go to address inclusive or literal with w move literal to w return from interrupt return with literal in w return from subroutine go into standby mode subtract w from literal exclusive or literal with w 1 1 2 1 2 1 1 2 2 2 1 1 1 11 11 10 00 10 11 11 00 11 00 00 11 11 111x 1001 0kkk 0000 1kkk 1000 00xx 0000 01xx 0000 0000 110x 1010 kkkk kkkk kkkk 0110 kkkk kkkk kkkk 0000 kkkk 0000 0110 kkkk kkkk kkkk kkkk kkkk 0100 kkkk kkkk kkkk 1001 kkkk 1000 0011 kkkk kkkk c, dc, z z to , pd z to , pd c, dc, z z note 1: when an i/o register is modified as a function of itself (e.g., movf porta, 1 ), the value used will be that value present on the pins themselves. for example, if the data latch is ? 1 ? for a pin configured as input and is driven low by an external device, the data will be written back with a ? 0 ?. 2: if this instruction is executed on the tm r0 register (and where applicable, d = 1 ), the prescaler will be cleared if assigned to the timer0 module. 3: if the program counter (pc) is modified, or a conditional test is true, the instruction requires two cycles. the second cycle is executed as a nop . www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 161 pic10(l)f320/322 23.2 instruction descriptions addlw add literal and w syntax: [ label ] addlw k operands: 0 ? k ? 255 operation: (w) + k ? (w) status affected: c, dc, z description: the contents of the w register are added to the eight-bit literal ?k? and the result is placed in the w register. addwf add w and f syntax: [ label ] addwf f,d operands: 0 ? f ? 127 d ??? 0 , 1 ? operation: (w) + (f) ? (destination) status affected: c, dc, z description: add the contents of the w register with register ?f?. if ?d? is ? 0 ?, the result is stored in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?. andlw and literal with w syntax: [ label ] andlw k operands: 0 ? k ? 255 operation: (w) .and. (k) ? (w) status affected: z description: the contents of w register are and?ed with the eight-bit literal ?k?. the result is placed in the w register. andwf and w with f syntax: [ label ] andwf f,d operands: 0 ? f ? 127 d ??? 0 , 1 ? operation: (w) .and. (f) ? (destination) status affected: z description: and the w register with register ?f?. if ?d? is ? 0 ?, the result is stored in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?. bcf bit clear f syntax: [ label ] bcf f,b operands: 0 ? f ? 127 0 ? b ? 7 operation: 0 ? (f) status affected: none description: bit ?b? in register ?f? is cleared. bsf bit set f syntax: [ label ] bsf f,b operands: 0 ? f ? 127 0 ? b ? 7 operation: 1 ? (f) status affected: none description: bit ?b? in register ?f? is set. btfsc bit test f, skip if clear syntax: [ label ] btfsc f,b operands: 0 ? f ? 127 0 ? b ? 7 operation: skip if (f) = 0 status affected: none description: if bit ?b? in register ?f? is ? 1 ?, the next instruction is executed. if bit ?b? in register ?f? is ? 0 ?, the next instruction is discarded, and a nop is executed instead, making this a two-cycle instruction. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 162 preliminary ? 2011 microchip technology inc. btfss bit test f, skip if set syntax: [ label ] btfss f,b operands: 0 ? f ? 127 0 ? b < 7 operation: skip if (f) = 1 status affected: none description: if bit ?b? in register ?f? is ? 0 ?, the next instruction is executed. if bit ?b? is ? 1 ?, then the next instruction is discarded and a nop is executed instead, making this a two-cycle instruction. call call subroutine syntax: [ label ] call k operands: 0 ? k ? 2047 operation: (pc)+ 1 ? tos, k ? pc<10:0>, (pclath<4:3>) ? pc<12:11> status affected: none description: call subroutine. first, return address (pc + 1) is pushed onto the stack. the eleven-bit immediate address is loaded into pc bits <10:0>. the upper bits of the pc are loaded from pclath. call is a two-cycle instruction. clrf clear f syntax: [ label ] clrf f operands: 0 ? f ? 127 operation: 00h ? (f) 1 ? z status affected: z description: the contents of register ?f? are cleared and the z bit is set. clrw clear w syntax: [ label ] clrw operands: none operation: 00h ? (w) 1 ? z status affected: z description: w register is cleared. zero bit (z) is set. clrwdt clear watchdog timer syntax: [ label ] clrwdt operands: none operation: 00h ? wdt 0 ? wdt prescaler, 1 ? to 1 ? pd status affected: to , pd description: clrwdt instruction resets the watchdog timer. it also resets the prescaler of the wdt. status bits to and pd are set. comf complement f syntax: [ label ] comf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f ) ? (destination) status affected: z description: the contents of register ?f? are complemented. if ?d? is ? 0 ?, the result is stored in w. if ?d? is ? 1 ?, the result is stored back in register ?f?. decf decrement f syntax: [ label ] decf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f) - 1 ? (destination) status affected: z description: decrement register ?f?. if ?d? is ? 0 ?, the result is stored in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 163 pic10(l)f320/322 decfsz decrement f, skip if 0 syntax: [ label ] decfsz f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f) - 1 ? (destination); skip if result = 0 status affected: none description: the contents of register ?f? are decremented. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed back in register ?f?. if the result is ? 1 ?, the next instruction is executed. if the result is ? 0 ?, then a nop is executed instead, making it a two-cycle instruction. goto unconditional branch syntax: [ label ] goto k operands: 0 ? k ? 2047 operation: k ? pc<10:0> pclath<4:3> ? pc<12:11> status affected: none description: goto is an unconditional branch. the eleven-bit immediate value is loaded into pc bits <10:0>. the upper bits of pc are loaded from pclath<4:3>. goto is a two-cycle instruction. incf increment f syntax: [ label ] incf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f) + 1 ? (destination) status affected: z description: the contents of register ?f? are incremented. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed back in register ?f?. incfsz increment f, skip if 0 syntax: [ label ] incfsz f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f) + 1 ? (destination), skip if result = 0 status affected: none description: the contents of register ?f? are incremented. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed back in register ?f?. if the result is ? 1 ?, the next instruction is executed. if the result is ? 0 ?, a nop is executed instead, making it a two-cycle instruction. iorlw inclusive or literal with w syntax: [ label ] iorlw k operands: 0 ? k ? 255 operation: (w) .or. k ? (w) status affected: z description: the contents of the w register are or?ed with the eight-bit literal ?k?. the result is placed in the w register. iorwf inclusive or w with f syntax: [ label ] iorwf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (w) .or. (f) ? (destination) status affected: z description: inclusive or the w register with register ?f?. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed back in register ?f?. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 164 preliminary ? 2011 microchip technology inc. movf move f syntax: [ label ] movf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f) ? (dest) status affected: z description: the contents of register ?f? is moved to a destination dependent upon the status of ?d?. if d = 0 , destination is w register. if d = 1 , the destination is file register ?f? itself. d = 1 is useful to test a file register since status flag z is affected. words: 1 cycles: 1 example: movf fsr, 0 after instruction w= value in fsr register z= 1 movlw move literal to w syntax: [ label ] movlw k operands: 0 ? k ? 255 operation: k ? (w) status affected: none description: the eight-bit literal ?k? is loaded into w register. the ?don?t cares? will assemble as ? 0 ?s. words: 1 cycles: 1 example: movlw 0x5a after instruction w= 0x5a movwf move w to f syntax: [ label ] movwf f operands: 0 ? f ? 127 operation: (w) ? (f) status affected: none description: move data from w register to register ?f?. words: 1 cycles: 1 example: movw f option_reg before instruction option_reg = 0xff w = 0x4f after instruction option_reg = 0x4f w = 0x4f nop no operation syntax: [ label ] nop operands: none operation: no operation status affected: none description: no operation. words: 1 cycles: 1 example: nop www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 165 pic10(l)f320/322 retfie return from interrupt syntax: [ label ] retfie operands: none operation: tos ? pc, 1 ? gie status affected: none description: return from interrupt. stack is poped and top-of-stack (tos) is loaded in the pc. interrupts are enabled by setting global interrupt enable bit, gie (intcon<7>). this is a two-cycle instruction. words: 1 cycles: 2 example: retfie after interrupt pc = tos gie = 1 retlw return with literal in w syntax: [ label ] retlw k operands: 0 ? k ? 255 operation: k ? (w); tos ? pc status affected: none description: the w register is loaded with the eight-bit literal ?k?. the program counter is loaded from the top of the stack (the return address). this is a two-cycle instruction. words: 1 cycles: 2 example: table done call table;w contains ;table offset ;value goto done ? ? addwf pc ;w = offset retlw k1 ;begin table retlw k2 ; ? ? ? retlw kn ;end of table before instruction w = 0x07 after instruction w = value of k8 return return from subroutine syntax: [ label ] return operands: none operation: tos ? pc status affected: none description: return from subroutine. the stack is poped and the top of the stack (tos) is loaded into the program counter. this is a two-cycle instruction. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 166 preliminary ? 2011 microchip technology inc. rlf rotate left f through carry syntax: [ label ] rlf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: see description below status affected: c description: the contents of register ?f? are rotated one bit to the left through the carry flag. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?. words: 1 cycles: 1 example: rlf reg1,0 before instruction reg1 = 1110 0110 c=0 after instruction reg1 = 1110 0110 w = 1100 1100 c=1 rrf rotate right f through carry syntax: [ label ] rrf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: see description below status affected: c description: the contents of register ?f? are rotated one bit to the right through the carry flag. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed back in register ?f?. register f c register f c sleep enter sleep mode syntax: [ label ] sleep operands: none operation: 00h ? wdt, 0 ? wdt prescaler, 1 ? to , 0 ? pd status affected: to , pd description: the power-down status bit, pd is cleared. time-out status bit, to is set. watchdog timer and its prescaler are cleared. the processor is put into sleep mode with the oscillator stopped. sublw subtract w from literal syntax: [ label ] sublw k operands: 0 ?? k ?? 255 operation: k - (w) ??? w) status affected: c, dc, z description: the w register is subtracted (2?s complement method) from the eight-bit literal ?k?. the result is placed in the w register. result condition c = 0 w ? k c = 1 w ? k dc = 0 w<3:0> ? k<3:0> dc = 1 w<3:0> ? k<3:0> www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 167 pic10(l)f320/322 subwf subtract w from f syntax: [ label ] subwf f,d operands: 0 ?? f ?? 127 d ? [ 0 , 1 ] operation: (f) - (w) ??? destination) status affected: c, dc, z description: subtract (2?s complement method) w register from register ?f?. if ?d? is ? 0 ?, the result is stored in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?. swapf swap nibbles in f syntax: [ label ] swapf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (f<3:0>) ? (destination<7:4>), (f<7:4>) ? (destination<3:0>) status affected: none description: the upper and lower nibbles of register ?f? are exchanged. if ?d? is ? 0 ?, the result is placed in the w register. if ?d? is ? 1 ?, the result is placed in register ?f?. xorlw exclusive or literal with w syntax: [ label ] xorlw k operands: 0 ?? k ?? 255 operation: (w) .xor. k ??? w) status affected: z description: the contents of the w register are xor?ed with the eight-bit literal ?k?. the result is placed in the w register. c = 0 w ? f c = 1 w ? f dc = 0 w<3:0> ? f<3:0> dc = 1 w<3:0> ? f<3:0> xorwf exclusive or w with f syntax: [ label ] xorwf f,d operands: 0 ? f ? 127 d ? [ 0 , 1 ] operation: (w) .xor. (f) ??? destination) status affected: z description: exclusive or the contents of the w register with register ?f?. if ?d? is ? 0 ?, the result is stored in the w register. if ?d? is ? 1 ?, the result is stored back in register ?f?. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 168 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 169 pic10(l)f320/322 24.0 electrical specifications absolute maximum ratings (?) ambient temperature under bias................................................................................................. ...... -40c to +125c storage temperature ............................................................................................................ ............ -65c to +150c voltage on v dd with respect to v ss , pic10f320/322 ........................................................................ -0.3v to +6.5v voltage on v dd with respect to v ss , pic10lf320/322 ...................................................................... -0.3v to +4.0v voltage on mclr with respect to vss ................................................................................................. -0.3v to +9.0v voltage on all other pins with respect to v ss ........................................................................... -0.3v to (v dd + 0.3v) total power dissipation (1) ............................................................................................................................... 800 mw maximum current out of v ss pin, -40c ? t a ? +85c for industrial............................................................... 200 ma maximum current out of v ss pin, -40c ? t a ? +125c for extended ............................................................ 120 ma maximum current into v dd pin, -40c ? t a ? +85c for industrial.................................................................. 200 ma maximum current into v dd pin, -40c ? t a ? +125c for extended ............................................................... 120 ma clamp current, i k (v pin < 0 or v pin > v dd ) ??????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????? 20 ma maximum output current sunk by any i/o pin..................................................................................... ............... 25 ma maximum output current sourced by any i/o pin .................................................................................. ............ 25 ma note 1: power dissipation is calculated as follows: p dis = v dd x {i dd ? ? i oh } + ? {(v dd ? v oh ) x i oh } + ? (v o l x i ol ). ? notice: stresses above those listed under ?absolute maximum ratings? may cause permanent damage to the device. this is a stress rating only and functional operation of the device at those or any other conditions above those indicated in the operation listings of this specification is not implied. exposure above maximum rating condi- tions for extended periods may affect device reliability. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 170 preliminary ? 2011 microchip technology inc. figure 24-1: pic10f320/322 voltage frequency graph, -40c ? t a ?? +125c figure 24-2: pic10lf320/322 vo ltage frequency graph, -40c ? t a ?? +125c 0 2.5 frequency (mhz) v dd (v) note 1: the shaded region indicates the permissible combinations of voltage and frequency. 2: refer to table 24-1 for each oscillator mode?s supported frequencies. 420 10 16 5.5 2.3 1.8 0 2.5 frequency (mhz) v dd (v) note 1: the shaded region indicates the permissible combinations of voltage and frequency. 2: refer to table 24-1 for each oscillator mode?s supported frequencies. 420 10 16 3.6 www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 171 pic10(l)f320/322 24.1 dc characteristics: pic10(l)f320/322-i/e (industrial, extended) pic10lf320/322 standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended pic10f320/322 standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended param. no. sym. characteristic min. typ? max. units conditions d001 v dd supply voltage pic10lf320/322 1.8 2.5 ? ? 3.6 3.6 v v f osc ? 16 mhz: f osc ? 20 mhz d001 pic10f320/322 2.3 2.5 ? ? 5.5 5.5 v v f osc ? 16 mhz: f osc ? 20 mhz d002* v dr ram data retention voltage (1) pic10lf320/322 1.5 ? ? v device in sleep mode d002* pic10f320/322 1.7 ? ? v device in sleep mode v por * power-on reset release voltage ?1.6? v v porr * power-on reset rearm voltage pic10lf320/322 ? 0.8 ? v device in sleep mode pic10f320/322 ? 1.7 ? v device in sleep mode d003 v adfvr fixed voltage reference voltage for adc, initial accuracy -7 -8 -7 -8 -7 -8 6 6 6 6 6 6 % 1.024v, v dd ? 2.5v, 85c 1.024v, v dd ? 2.5v, 125c 2.048v, v dd ? 2.5v, 85c 2.048v, v dd ? 2.5v, 125c 4.096v, v dd ? 4.75v, 85c 4.096v, v dd ? 4.75v, 125c d003c* tcv fvr temperature coefficient, fixed voltage reference ? -130 ? ppm/c d003d* ? v fvr / ? v in line regulation, fixed voltage reference ? 0.270 ? %/v d004* s vdd v dd rise rate to ensure internal power-on reset signal 0.05 ? ? v/ms see section 5.1 ?power-on reset (por)? for details. * these parameters are characterized but not tested. ? data in ?typ? column is at 3.3v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: this is the limit to which v dd can be lowered in sleep mode without losing ram data. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 172 preliminary ? 2011 microchip technology inc. figure 24-3: por and por rearm with slow rising v dd v dd v por v porr v ss v ss npor t por (3) por rearm note 1: when npor is low, the device is held in reset. 2: t por 1 ? s typical. 3: t vlow 2.7 ? s typical. t vlow (2) www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 173 pic10(l)f320/322 24.2 dc characteristics: pic10(l)f320/322-i/e (industrial, extended) pic10lf320/322 standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended pic10f320/322 standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended param no. device characteristics min. typ? max. units conditions v dd note supply current (i dd ) (1, 2) d009 ldo regulator ? 350 ? ? a ? ec or intosc (8-16 mh z ) ? 5 ? ? a ? sleep with power-save mode (requires fvr and bor to be disabled) d013 ? 140 ? ? a1.8f osc = 500 khz ec mode ? 317 ? ? a3.0 d013 ? 156 ? ? a 2.3 f osc = 500 khz ec mode ? 336 ? ? a 3.0 ? 384 ? ? a 5.0 d014 ? 225 ? ? a1.8f osc = 8 mhz ec mode ? 475 ? ? a3.0 d014 ? 250 ? ? a 2.3 f osc = 8 mhz ec mode ? 500 ? ? a 3.0 ? 600 ? ? a 5.0 d015 ? 3.4 ? ma 3.0 f osc = 20 mhz ec mode ?4.1 ? ma 3.6 d015 ? 3.6 ? ma 3.0 f osc = 20 mhz ec mode ? 3.9 ? ma 5.0 d016 ? 7 ? ? a1.8f osc = 32 khz lfintosc mode, 85c ?10 ? ? a3.0 d016 ? 21 ? ? a 2.3 f osc = 32 khz lfintosc mode, 85c ? 27 ? ? a 3.0 ? 28 ? ? a 5.0 d016a ? 8 ? ? a1.8f osc = 32 khz lfintosc mode, 125c ?11 ? ? a3.0 note 1: the test conditions for all i dd measurements in active operation mode ar e: clkin = external square wave, from rail-to-rail; all i/o pins tri-stated, pulled to v dd ; mclr = v dd ; wdt disabled. 2: the supply current is mainly a function of the operating voltage and frequency. other factors, such as i/o pin loading and switching rate, oscillator type, internal code execution pattern and temperature, also have an impact on the current consumption. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 174 preliminary ? 2011 microchip technology inc. d017 supply current (i dd ) (1, 2) ? 130 ? ? a1.8f osc = 500 khz hfintosc mode ? 190 ? ? a3.0 d017 ? 150 ? ? a 2.3 f osc = 500 khz hfintosc mode ? 210 ? ? a 3.0 ? 270 ? ? a 5.0 d018 ? 800 ? ? a1.8f osc = 8 mhz hfintosc mode ? 1300 ? ? a3.0 d018 ? 0.85 ? ma 2.3 f osc = 8 mhz hfintosc mode ? 1.4 ? ma 3.0 ? 1.6 ? ma 5.0 d019 ? 1.25 ? ma 1.8 f osc = 16 mhz hfintosc mode ?2.0 ? ma 3.0 d019 ? 1.4 ? ma 2.3 f osc = 16 mhz hfintosc mode ? 2.2 ? ma 3.0 ? 2.4 ? ma 5.0 24.2 dc characteristics: pic10(l)f320/322-i/e (industrial, extended) (continued) pic10lf320/322 standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended pic10f320/322 standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended param no. device characteristics min. typ? max. units conditions v dd note note 1: the test conditions for all i dd measurements in active operation mode ar e: clkin = external square wave, from rail-to-rail; all i/o pins tri-stated, pulled to v dd ; mclr = v dd ; wdt disabled. 2: the supply current is mainly a function of the operating voltage and frequency. other factors, such as i/o pin loading and switching rate, oscillator type, internal code execution pattern and temperature, also have an impact on the current consumption. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 175 pic10(l)f320/322 24.3 dc characteristics: pic10(l)f320/322-i/e (power-down) pic10lf320/322 standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended pic10f320/322 standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended param no. device characteristics min. typ? max. +85c max. +125c units conditions v dd note power-down base current (i pd ) (2) d023 ? 0.06 ? ? ? a 1.8 wdt, bor, and fvr disabled, all peripherals inactive ?0.08 ? ? ? a3.0 d023 ? 15 ? ? ? a 2.3 wdt, bor, and fvr disabled, all peripherals inactive ? 18 ? ? ? a 3.0 ? 19 ? ? ? a 5.0 d024 ? 0.5 ? ? ? a 1.8 lpwdt current (note 1) ?0.8 ? ? ? a3.0 d024 ? 16 ? ? ? a 2.3 lpwdt current (note 1) ? 19 ? ? ? a 3.0 ? 20 ? ? ? a 5.0 d025 ? 8.5 ? ? ? a 1.8 fvr current ?8.5 ? ? ? a3.0 d025 ? 32 ? ? ? a 2.3 fvr current ? 39 ? ? ? a 3.0 ? 70 ? ? ? a 5.0 d026 ? 7.5 ? ? ? a 3.0 bor current (note 1) d026 ? 34 ? ? ? a 3.0 bor current (note 1) ? 67 ? ? ? a 5.0 d028 ? 0.1 ? ? ? a 1.8 a/d current (note 1, note 3) , no conversion in progress ?0.1 ? ? ? a3.0 d028 ? 16 ? ? ? a 2.3 a/d current (note 1, note 3) , no conversion in progress ? 21 ? ? ? a 3.0 ? 25 ? ? ? a 5.0 d029 ? 250 ? ? ? a 1.8 a/d current (note 1, note 3) , conversion in progress ?250 ? ? ? a3.0 d029 ? 280 ? ? ? a 2.3 a/d current (note 1, note 3) , conversion in progress ? 280 ? ? ? a 3.0 ? 280 ? ? ? a 5.0 * these parameters are characterized but not tested. ? data in ?typ? column is at 3.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. legend: tbd = to be determined note 1: the peripheral current is the sum of the base i dd or i pd and the additional current consumed when this peripheral is enabled. the peripheral ? current can be determined by subtracting the base i dd or i pd current from this limit. max values should be used when calculating total current consumption. 2: the power-down current in sleep mode does not depend on the oscillator type. power-down current is measured with the part in sleep mode, with all i/o pins in high-impedance state and tied to v dd . 3: a/d oscillator source is f rc . www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 176 preliminary ? 2011 microchip technology inc. 24.4 dc characteristics: pic10(l)f320/322-i/e dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial -40c ? t a ? +125c for extended param no. sym. characteristic min. typ? max. units conditions v il input low voltage i/o port: d032 with ttl buffer ? ? 0.8 v 4.5v ? v dd ? 5.5v d032a ? ? 0.15 v dd v1.8v ? v dd ? 4.5v d033 with schmitt trigger buffer ? ? 0.2 v dd v2.0v ? v dd ? 5.5v d034 mclr ??0.2v dd v v ih input high voltage i/o ports: d040 with ttl buffer 2.0 ? ? v 4.5v ? v dd ?? 5.5v d040a 0.25 v dd + 0.8 ??v1.8v ? v dd ? 4.5v d041 with schmitt trigger buffer 0.8 v dd ??v2.0v ? v dd ? 5.5v d042 mclr 0.8 v dd ??v i il input leakage current (2) d060 i/o ports ? 5 5 125 1000 na na v ss ? v pin ? v dd , pin at high-impedance @ 85c 125c d061 mclr ? 50 200nav ss ? v pin ? v dd @ 85c i pur weak pull-up current d070* 25 25 100 140 200 300 ? a v dd = 3.3v, v pin = v ss v dd = 5.0v, v pin = v ss v ol output low voltage d080 i/o ports ??0.6v i ol = 8ma, v dd = 5v i ol = 6ma, v dd = 3.3v i ol = 1.8ma, v dd = 1.8v v oh output high voltage d090 i/o ports v dd - 0.7 ? ? v i oh = 3.5ma, v dd = 5v i oh = 3ma, v dd = 3.3v i oh = 1ma, v dd = 1.8v * these parameters are characterized but not tested. ? data in ?typ? column is at 3.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: negative current is defined as current sourced by the pin. 2: the leakage current on the mclr pin is strongly dependent on the applied voltage level. the specified levels represent normal operating conditions. higher leakage current may be measured at different input voltages. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 177 pic10(l)f320/322 24.5 memory programming requirements dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. sym. characteristic min. typ? max. units conditions program memory programming specifications d110 v ihh voltage on mclr /v pp pin 8.0 ? 9.0 v (note 2, note 3) d111 i ddp supply current during programming ? ? 10 ma d112 v dd for bulk erase 2.7 ? v dd max. v d113 v pew v dd for write or row erase v dd min. ?v dd max. v d114 i pppgm current on mclr /v pp during erase/write ??1.0ma d115 i ddpgm current on v dd during erase/write ? 5.0 ma program flash memory d121 e p cell endurance 10k ? ? e/w -40 ? c to +85 ? c ( note 1 ) d122 v pr v dd for read v dd min. ?v dd max. v d123 t iw self-timed write cycle time ? 2 2.5 ms d124 t retd characteristic retention 40 ? ? year provided no other specifications are violated ? data in ?typ? column is at 3.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: self-write and block erase. 2: required only if single-supply programming is disabled. 3: the mplab icd 2 does not support variable v pp output. circuitry to limit the icd 2 v pp voltage must be placed between the icd 2 and target system when programming or debugging with the icd 2. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 178 preliminary ? 2011 microchip technology inc. 24.6 thermal considerations standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. sym. characteristic typ. units conditions th01 ? ja thermal resistance junction to ambient 60 ? c/w 6-pin sot-23 package 80 ? c/w 8-pin pdip package 90 ? c/w 8-pin dfn package th02 ? jc thermal resistance junction to case 31.4 ? c/w 6-pin sot-23 package 24 ? c/w 8-pin pdip package 24 ? c/w 8-pin dfn package th03 t jmax maximum junction temperature 150 ? c th04 pd power dissipation ? w pd = p internal + p i / o th05 p internal internal power dissipation ? w p internal = i dd x v dd (1) th06 p i / o i/o power dissipation ? w p i / o = ? (i ol * v ol ) + ? (i oh * (v dd - v oh )) th07 p der derated power ? w p der = pd max (t j - t a )/ ? ja (2) note 1: i dd is current to run the chip alone without driving any load on the output pins. 2: t a = ambient temperature 3: t j = junction temperature www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 179 pic10(l)f320/322 24.7 timing parameter symbology the timing parameter symbols have been created with one of the following formats: figure 24-4: load conditions 1. tpps2pps 2. tpps t f frequency t time lowercase letters (pp) and their meanings: pp cc ccp1 osc clkin ck clkr rd rd cs cs rw rd or wr di sdi sc sck do sdo ss ss dt data in t0 t0cki io i/o port t1 t1cki mc mclr wr wr uppercase letters and their meanings: s ffall pperiod hhigh rrise i invalid (high-impedance) v valid l low z high-impedance vss cl legend: c l = 50 pf for all pins load condition pin www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 180 preliminary ? 2011 microchip technology inc. 24.8 ac characteristics: pic10(l)f320/322-i/e figure 24-5: clock timing table 24-1: clock oscillator timing requirements table 24-2: oscillator parameters standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. sym. characteristic min. typ? max. units conditions os01 f osc external clkin frequency (1) dc ? 20 mhz ec mode os02 t osc external clkin period (1) 31.25 ? ? ns ec oscillator mode os03 t cy instruction cycle time (1) 200 t cy dc ns t cy = 4/f osc * these parameters are characterized but not tested. ? data in ?typ? column is at 3.0v, 25c unless otherwise st ated. these parameters are for design guidance only and are not tested. note 1: instruction cycle period (t cy ) equals four times the input oscillator time base period. all specified values are based on characterization data for that particular oscillator type under standard operating conditions with the device executing code. exceeding these specified limits may result in an unstable oscillator operation and/or higher than expected current con- sumption. all devices are tested to operate at ?min? values with an external clock applied to clkin pin. when an external clock input is used, the ?max? cycle time limit is ?dc? (no clock) for all devices. standard operating conditions (unless otherwise stated) operating temperature -40c ?? t a ?? +125c param no. sym. characteristic freq. tolerance min. typ? max. units conditions os08 hf osc internal calibrated hfintosc frequency (1) 2% 3% ? ? 16.0 16.0 ? ? mhz mhz 0c ? t a ? +60c, v dd ?? 2.5v 60c ?? t a ?? 85c, v dd ?? 2.5v 5% ? 16.0 ? mhz -40c ? t a ? +125c os09 lf osc internal lfintosc frequency ? ? 31 ? khz -40c ? t a ? +125c os10* t iosc st hfintosc wake-up from sleep start-up time ??58 ? s * these parameters are characterized but not tested. ? data in ?typ? column is at 3.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: to ensure these oscillator frequency tolerances, v dd and v ss must be capacitively decoupled as close to the device as possible. 0.1 ? f and 0.01 ? f values in parallel are recommended. clkin clkr q4 q1 q2 q3 q4 q1 os02 os03 (clkroe = 1 ) www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 181 pic10(l)f320/322 figure 24-6: clkr and i/o timing table 24-3: clkr and i/o timing parameters standard operating conditions (unless otherwise stated) operating temperature -40c ?? t a ?? +125c param no. sym. characteristic min. typ? max. units conditions os11 tosh2ckl f osc ? to clkr ? (1) ??70nsv dd = 3.3-5.0v os12 tosh2ckh f osc ? to clkr ? (1) ??72nsv dd = 3.3-5.0v os13 tckl2iov clkr ? to port out valid (1) ??20ns os14 tiov2ckh port input valid before clkr ? (1) t osc + 200 ns ? ? ns os15 tosh2iov fosc ? (q1 cycle) to port out valid ? 50 70* ns v dd = 3.3-5.0v os16 tosh2ioi fosc ? (q2 cycle) to port input invalid (i/o in hold time) 50 ? ? ns v dd = 3.3-5.0v os17 tiov2osh port input valid to fosc ?? (q2 cycle) (i/o in setup time) 20 ? ? ns os18 tior port output rise time ? ? 40 15 72 32 ns v dd = 1.8v v dd = 3.3-5.0v os19 tiof port output fall time ? ? 28 15 55 30 ns v dd = 1.8v v dd = 3.3-5.0v os20* tinp int pin input high or low time 25 ? ? ns os21* tioc interrupt-on-change new input level time 25 ? ? ns * these parameters are characterized but not tested. ? data in ?typ? column is at 3.0v, 25 ? c unless otherwise stated. note 1: measurements are taken in ec mode where clkr output is 4 x t osc . f osc clkr i/o pin (input) i/o pin (output) q4 q1 q2 q3 os11 os19 os13 os15 os18, os19 os20 os21 os17 os16 os14 os12 os18 old value new value write fetch read execute cycle www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 182 preliminary ? 2011 microchip technology inc. figure 24-7: reset, watchdog timer, and power-up timer timing figure 24-8: brown-out rese t timing and characteristics v dd mclr internal por pwrt time-out internal reset (1) watchdog timer 33 30 31 34 i/o pins 34 note 1: asserted low. reset (1) v bor v dd (device in brown-out reset) (device not in brown-out reset) 33 (1) note 1: 64 ms delay only if pwrte bit in the configuration word register is programmed to ? 0 ?. reset (due to bor) v bor and v hyst 37 www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 183 pic10(l)f320/322 table 24-4: reset, watchdog timer, power-up timer and brown-out reset parameters figure 24-9: timer0 and timer1 external clock timings table 24-5: timer0 external clock requirements standard operating conditions (unless otherwise stated) operating temperature -40c ?? t a ?? +125c param no. sym. characteristic min. typ? max. units conditions 30 t mc lmclr pulse width (low) 2 5 ? ? ? ? ? s ? s v dd = 3.3-5v, -40c to +85c v dd = 3.3-5v 31 t wdtlp low-power watchdog timer time-out period 10 16 27 ms v dd = 3.3v-5v 1:16 prescaler used 33* t pwrt power-up timer period, pwrte = 0 40 64 140 ms 34* t ioz i/o high-impedance from mclr low or watchdog timer reset ??2.0 ? s 35 v bor brown-out reset voltage tbd 2.38 1.80 2.7 2.4 1.9 tbd 2.73 2.11 v v v borv = 2.7v borv = 2.4v (pic10f320/322) borv = 1.9v (pic10lf320/322) 36* v hyst brown-out reset hysteresis 0 25 50 mv -40c to +85c 37* t bordc brown-out reset dc response time 1 3 5 ? sv dd ? v bor legend: tbd = to be determined * these parameters are characterized but not tested. ? data in ?typ? column is at 3.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. standard operating conditions (unless otherwise stated) operating temperature -40c ?? t a ?? +125c param no. sym. characteristic min. typ? max. units conditions 40* t t 0h t0cki high pulse width no prescaler 0.5 t cy + 20 ? ? ns with prescaler 10 ? ? ns 41* t t 0l t0cki low pulse width no prescaler 0.5 t cy + 20 ? ? ns with prescaler 10 ? ? ns 42* t t 0p t0cki period greater of: 20 or t cy + 40 n ? ? ns n = prescale value (2, 4, ..., 256) * these parameters are characterized but not tested. ? data in ?typ? column is at 3.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. t0cki 40 41 42 tmr0 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 184 preliminary ? 2011 microchip technology inc. table 24-6: pic10(l)f320/322 a/d converter (adc) characteristics : table 24-7: pic10(l)f320/322 a/d conversion requirements standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. sym. characteristic min. typ? max. units conditions ad01 n r resolution ? ? 8 bit ad02 e il integral error ? ? 1.7 lsb v ref = 3.0v ad03 e dl differential error ? ? 1 lsb no missing codes v ref = 3.0v ad04 e off offset error ? ? 2.5 lsb v ref = 3.0v ad05 e gn gain error ? ? 2.0 lsb v ref = 3.0v ad06 v ref reference voltage (3) 1.8 ? v dd vv ref = (v ref + minus v ref -) ( note 5 ) ad07 v ain full-scale range v ss ?v ref v ad08 z ain recommended impedance of analog voltage source ?? 10 k ? can go higher if external 0.01 ? f capacitor is present on input pin. * these parameters are characterized but not tested. ? data in ?typ? column is at 3.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: total absolute error includes integral, differential, offset and gain errors. 2: the a/d conversion result never decreases with an increase in the input voltage and has no missing codes. 3: adc v ref is from external v ref , v dd pin or fvr, whichever is selected as reference input. 4: when adc is off, it will not consume any current other than leakage current. the power-down current specification includes any such leakage from the adc module. 5: fvr voltage selected must be 2.048v or 4.096v. standard operating conditions (unless otherwise stated) operating temperature -40c ? t a ? +125c param no. sym. characteristic min. typ? max. units conditions ad130* t ad a/d clock period 1.0 ? 9.0 ? st osc -based a/d internal frc oscillator period 1.0 1.6 6.0 ? s adcs<1:0> = 11 (adrc mode) ad131 t cnv conversion time (not including acquisition time) (1) ?9.5?t ad set go/done bit to conversion complete ad132* t acq acquisition time ? 5.0 ? ? s * these parameters are characterized but not tested. ? data in ?typ? column is at 3.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the adres register may be read on the following t cy cycle. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 185 pic10(l)f320/322 figure 24-10: pic10(l)f320/322 a/d conversion timing (normal mode) figure 24-11: pic10(l)f320/322 a/d conversion timing (sleep mode) ad131 ad130 bsf adcon, go q4 a/d clk a/d data adres adif go sample old_data sampling stopped done new_data 765 3210 note 1: if the a/d clock source is selected as frc, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. 1 tcy 4 ad134 ( t osc /2 (1) ) 1 tcy ad132 ad132 ad131 ad130 bsf adcon, go q4 a/d clk a/d data adres adif go sample old_data sampling stopped done new_data 7 5 3210 note 1: if the a/d clock source is selected as frc, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. ad134 4 6 1 tcy ( t osc /2 + t cy (1) ) 1 tcy www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 186 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 187 pic10(l)f320/322 25.0 dc and ac characteristics graphs and charts graphs and charts are not available at this time. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 188 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 189 pic10(l)f320/322 26.0 development support the pic ? microcontrollers and dspic ? digital signal controllers are supported with a full range of software and hardware development tools: ? integrated development environment - mplab ? ide software ? compilers/assemblers/linkers - mplab c compiler for various device families - hi-tech c for various device families - mpasm tm assembler -mplink tm object linker/ mplib tm object librarian - mplab assembler/linker/librarian for various device families ? simulators - mplab sim software simulator ?emulators - mplab real ice? in-circuit emulator ? in-circuit debuggers - mplab icd 3 - pickit? 3 debug express ? device programmers - pickit? 2 programmer - mplab pm3 device programmer ? low-cost demonstration/development boards, evaluation kits, and starter kits 26.1 mplab integrated development environment software the mplab ide software brings an ease of software development previously unseen in the 8/16/32-bit microcontroller market. the mplab ide is a windows ? operating system-based application that contains: ? a single graphical interface to all debugging tools - simulator - programmer (sold separately) - in-circuit emulator (sold separately) - in-circuit debugger (sold separately) ? a full-featured editor with color-coded context ? a multiple project manager ? customizable data windows with direct edit of contents ? high-level source code debugging ? mouse over variable inspection ? drag and drop variables from source to watch windows ? extensive on-line help ? integration of select third party tools, such as iar c compilers the mplab ide allows you to: ? edit your source files (either c or assembly) ? one-touch compile or assemble, and download to emulator and simulator tools (automatically updates all project information) ? debug using: - source files (c or assembly) - mixed c and assembly - machine code mplab ide supports multiple debugging tools in a single development paradigm, from the cost-effective simulators, through low-cost in-circuit debuggers, to full-featured emulators. this eliminates the learning curve when upgrading to tools with increased flexibility and power. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 190 preliminary ? 2011 microchip technology inc. 26.2 mplab c compilers for various device families the mplab c compiler code development systems are complete ansi c compilers for microchip?s pic18, pic24 and pic32 families of microcontrollers and the dspic30 and dspic33 families of digital signal control- lers. these compilers provide powerful integration capabilities, superior code optimization and ease of use. for easy source level debugging, the compilers provide symbol information that is optimized to the mplab ide debugger. 26.3 hi-tech c for various device families the hi-tech c compiler code development systems are complete ansi c compilers for microchip?s pic family of microcontrollers and the dspic family of digital signal controllers. these compilers provide powerful integration capabilities, omniscient code generation and ease of use. for easy source level debugging, the compilers provide symbol information that is optimized to the mplab ide debugger. the compilers include a macro assembler, linker, pre- processor, and one-step driver, and can run on multiple platforms. 26.4 mpasm assembler the mpasm assembler is a full-featured, universal macro assembler for pic10/12/16/18 mcus. the mpasm assembler generates relocatable object files for the mplink object linker, intel ? standard hex files, map files to detail memory usage and symbol reference, absolute lst files that contain source lines and generated machine code and coff files for debugging. 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 26.5 mplink object linker/ mplib object librarian the mplink object linker combines relocatable objects created by the mpasm assembler and the mplab c18 c compiler. it can link relocatable objects from precompiled libraries, using directives from a linker script. the mplib object librarian manages the creation and modification of library files of precompiled code. when a routine from a library is called from a 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 object linker/library features include: ? efficient linking of single libraries instead of many smaller files ? enhanced code maintainability by grouping related modules together ? flexible creation of libraries with easy module listing, replacement, deletion and extraction 26.6 mplab assembler, linker and librarian for various device families mplab assembler produces relocatable machine code from symbolic assembly language for pic24, pic32 and dspic devices. mplab c compiler uses the assembler to produce its object file. the assembler generates relocatable object files that can then be archived or linked with other relocatable object files and archives to create an executable file. notable features of the assembler include: ? support for the entire device instruction set ? support for fixed-point and floating-point data ? command line interface ? rich directive set ? flexible macro language ? mplab ide compatibility www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 191 pic10(l)f320/322 26.7 mplab sim software simulator the mplab sim software simulator allows code development in a pc-hosted environment by simulat- ing the pic mcus and dspic ? dscs on an instruction level. on any given instruction, the data areas can be examined or modified and stimuli can be applied from a comprehensive stimulus controller. registers can be logged to files for further run-time analysis. the trace buffer and logic analyzer display extend the power of the simulator to record and track program execution, actions on i/o, most peripherals and internal registers. the mplab sim software simulator fully supports symbolic debugging using the mplab c compilers, and the mpasm and mplab assemblers. the soft- ware simulator offers the flexibility to develop and debug code outside of the hardware laboratory envi- ronment, making it an excellent, economical software development tool. 26.8 mplab real ice in-circuit emulator system mplab real ice in-circuit emulator system is microchip?s next generation high-speed emulator for microchip flash dsc and mcu devices. it debugs and programs pic ? flash mcus and dspic ? flash dscs with the easy-to-use, powerful graphical user interface of the mplab integrated development environment (ide), included with each kit. the emulator is connected to the design engineer?s pc using a high-speed usb 2.0 interface and is connected to the target with either a connector compatible with in- circuit debugger systems (rj11) or with the new high- speed, noise tolerant, low-voltage differential signal (lvds) interconnection (cat5). the emulator is field upgradable through future firmware downloads in mplab ide. in upcoming releases of mplab ide, new devices will be supported, and new features will be added. mplab real ice offers significant advantages over competitive emulators including low-cost, full-speed emulation, run-time variable watches, trace analysis, complex breakpoints, a ruggedized probe interface and long (up to three meters) interconnection cables. 26.9 mplab icd 3 in-circuit debugger system mplab icd 3 in-circuit debugger system is micro- chip's most cost effective high-speed hardware debugger/programmer for microchip flash digital sig- nal controller (dsc) and microcontroller (mcu) devices. it debugs and programs pic ? flash microcon- trollers and dspic ? dscs with the powerful, yet easy- to-use graphical user interface of mplab integrated development environment (ide). the mplab icd 3 in-circuit debugger probe is con- nected to the design engineer's pc using a high-speed usb 2.0 interface and is connected to the target with a connector compatible with the mplab icd 2 or mplab real ice systems (rj-11). mplab icd 3 supports all mplab icd 2 headers. 26.10 pickit 3 in-circuit debugger/ programmer and pickit 3 debug express the mplab pickit 3 allows debugging and program- ming of pic ? and dspic ? flash microcontrollers at a most affordable price point using the powerful graphical user interface of the mplab integrated development environment (ide). the mplab pickit 3 is connected to the design engineer's pc using a full speed usb interface and can be connected to the target via an microchip debug (rj-11) connector (compatible with mplab icd 3 and mplab real ice). the connector uses two device i/o pins and the reset line to imple- ment in-circuit debugging and in-circuit serial pro- gramming?. the pickit 3 debug express include the pickit 3, demo board and microcontroller, hookup cables and cdrom with user?s guide, lessons, tutorial, compiler and mplab ide software. www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 192 preliminary ? 2011 microchip technology inc. 26.11 pickit 2 development programmer/debugger and pickit 2 debug express the pickit? 2 development programmer/debugger is a low-cost development tool with an easy to use inter- face for programming and debugging microchip?s flash families of microcontrollers. the full featured windows ? programming interface supports baseline (pic10f, pic12f5xx, pic16f5xx), midrange (pic12f6xx, pic16f), pic18f, pic24, dspic30, dspic33, and pic32 families of 8-bit, 16-bit, and 32-bit microcontrollers, and many microchip serial eeprom products. with microchip?s powerful mplab integrated development environment (ide) the pickit? 2 enables in-circuit debugging on most pic ? microcon- trollers. in-circuit-debugging runs, halts and single steps the program while the pic microcontroller is embedded in the application. when halted at a break- point, the file registers can be examined and modified. the pickit 2 debug express include the pickit 2, demo board and microcontroller, hookup cables and cdrom with user?s guide, lessons, tutorial, compiler and mplab ide software. 26.12 mplab pm3 device programmer the mplab pm3 device programmer is a universal, ce compliant device programmer with programmable voltage verification at v ddmin and v ddmax for maximum reliability. it features a large lcd display (128 x 64) for menus and error messages and a modu- lar, detachable socket assembly to support various package types. the icsp? cable assembly is included as a standard item. in stand-alone mode, the mplab pm3 device programmer can read, verify and program pic devices without a pc connection. it can also set code protection in this mode. the mplab pm3 connects to the host pc via an rs-232 or usb cable. the mplab pm3 has high-speed communications and optimized algorithms for quick programming of large memory devices and incorporates an mmc card for file storage and data applications. 26.13 demonstration/development boards, evaluation kits, and starter kits a wide variety of demonstration, development and evaluation boards for various pic mcus and dspic dscs allows quick application development on fully func- tional systems. most boards include prototyping areas for adding custom circuitry and provide application firmware and source code for examination and modification. the boards support a variety of features, including leds, temperature sensors, switches, speakers, rs-232 interfaces, lcd displays, potentiometers and additional eeprom memory. the demonstration and development boards can be used in teaching environments, for prototyping custom circuits and for learning about various microcontroller applications. in addition to the picdem? and dspicdem? demon- stration/development board series of circuits, microchip has a line of evaluation kits and demonstration software for analog filter design, k ee l oq ? security ics, can, irda ? , powersmart battery management, seeval ? evaluation system, sigma-delta adc, flow rate sensing, plus many more. also available are starter kits that contain everything needed to experience the specified device. this usually includes a single application and debug capability, all on one board. check the microchip web page ( www.microchip.com ) for the complete list of demonstration, development and evaluation kits. www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 193 pic10(l)f320/322 27.0 packaging information 27.1 package marking information legend: xx...x customer-specific information y year code (last digit of calendar year) yy year code (last 2 digits of calendar year) ww week code (week of january 1 is week ?01?) nnn alphanumeric traceability code pb-free jedec designator for matte tin (sn) * this package is pb-free. the pb-free jedec designator ( ) can be found on the outer packaging for this package. note : in the event the full microchip part number cannot be marked on one line, it will be carried over to the next line, thus limiting the number of available characters for customer-specific information. 3 e 3 e 6-lead sot-23 example xxnn 8-lead pdip (300 mil) example xxxxxxxx xxxxxnnn yyww 8-lead dfn (2x3x0.9 mm) example 10f320 1110 3 e i/p 07q la11 baa 110 20 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 194 preliminary ? 2011 microchip technology inc. table 27-1: 8-lead 2x3 dfn (mc) top marking table 27-2: 6-lead sot-23 (ot) package top marking part number marking PIC10F322(t)-i/mc baa PIC10F322(t)-e/mc bab pic10f320(t)-i/mc bac pic10f320(t)-e/mc bad pic10lf322(t)-i/mc baf pic10lf322(t)-e/mc bag pic10lf320(t)-i/mc bah pic10lf320(t)-e/mc baj part number marking PIC10F322(t)-i/ot la PIC10F322(t)-e/ot lb pic10f320(t)-i/ot lc pic10f320(t)-e/ot ld pic10lf322(t)-i/ot le pic10lf322(t)-e/ot lf pic10lf320(t)-i/ot lg pic10lf320(t)-e/ot lh www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 195 pic10(l)f320/322 27.2 package details the following sections give the technical details of the packages. 
 

       
 !"!

#$!
!% 

# $ 
 
!% 

# $ 
  
#&!   !   
!#
   "'( )*+ )  
 
#&#,$
--#
$##
     .
# 
#$ # /! - 0   # 
  1/ %#

#!# ## +22---
  
2 / 3# 44" "  
4# 5 56 7 5$8 
%1 5 9 1#  ()* 6$# !4!1#  )* 6, : #   ; ( 
!!1/ /  < ;  #!
%%   ; ( 6, =!# "  ;  
!!1/=!# "  ; < 6, 4#   ;  .
#4# 4  ; 9 .
# # 4 ( ; < .
# > ; > 4! /  < ; 9 4!=!# 8  ; ( b e 4 n e1 pin 1 id by laser mark d 1 2 3 e e1 a a1 a2 c l l1 
   

  - *<) www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 196 preliminary ? 2011 microchip technology inc. note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 197 pic10(l)f320/322 
  
!  "##
$% !      1, $!&%#$ , 08$#$ #8
#!-# #  # !   ?%#*  #  #   
 !"!

#$!
!% 

# $ 
 
!% 

# $ 
  
#&!@   !   
!#
   "'( )*+)  
 
#&#,$
--#
$##
     .
# 
#$ # /! - 0   # 
  1/ %#

#!# ## +22---
  
2 / 3# 5*:"  
4# 5 56 7 5$8 
%1 5 < 1#  )*
#
#1  ; ;  
!!1/ /  (  ( ) #
#1  ( ; ; 
$! #

$! =!# "   ( 
!!1/=!# "  ( < 6, 4#  < 9(   #
#1 4 (  ( 4! /  <  ( 3  4!=!# 8  9  4
- 4!=!# 8  <  6, 
- ? ) ; ;  n e1 note 1 d 12 3 a a1 a2 l b1 b e e eb c 
   

  - *<) www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 198 preliminary ? 2011 microchip technology inc. 
  
&
 ' ()*+",,#-.$% &     1, $!&%#$ , 08$#$ #8
#!-# #  # !   1/ ,


&
!#8 #!   1/  - $#!   
!#
   "'( )*+ )  
 
#&#,$
--#
$##
   ".+ %  
0$ $-#
$##
 0%
%
#
 $
 
   .
# 
#$ # /! - 0   # 
  1/ %#

#!# ## +22---
  
2 / 3# 44" "  
4# 5 56 7 5$8 
%1 5 < 1#  ()* 6, : #  <   #!
%%    ( *
## /  ". 6, 4#  )* 6, =!# " )* "&
!1!4#   ; (( "&
!1!=!# " ( ; ( *
##=!# 8  (  *
##4# 4   ( *
###
"&
!1! a  ; ; d n e note 1 1 2 exposed pad note 1 2 1 d2 k l e2 n e b a3 a1 a note 2 bottom view top view 
   

  - ** www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 199 pic10(l)f320/322 note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 200 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 201 pic10(l)f320/322 appendix a: data sheet revision history revision a original release (7/2011). www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 202 preliminary ? 2011 microchip technology inc. notes: www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 203 pic10(l)f320/322 index a a/d specifications............................................................ 184 absolute maximum ratings (pic10(l)f320/322) ............. 169 ac characteristics industrial and extended (pic10(l)f320/322) ........... 180 load conditions ........................................................ 179 adc .................................................................................... 91 acquisition requirements ........................................... 98 associated registers.................................................. 100 block diagram............................................................. 91 calculating acquisition time....................................... 98 channel selection....................................................... 92 configuration............................................................... 92 configuring interrupt ................................................... 95 conversion clock........................................................ 92 conversion procedure ................................................ 95 internal sampling switch (r ss ) impedance................ 98 interrupts..................................................................... 94 operation .................................................................... 94 operation during sleep .............................................. 94 port configuration ....................................................... 92 reference voltage (v ref )........................................... 92 source impedance...................................................... 98 adcon register................................................................. 17 adres register ................................................................. 97 adresh register............................................................... 17 analog-to-digital converter. see adc ansela register ............................................................... 78 assembler mpasm assembler................................................... 190 b block diagrams adc ............................................................................ 91 adc transfer function ............................................... 99 analog input model ..................................................... 99 clock source............................................................... 27 interrupt logic ............................................................. 41 nco .......................................................................... 130 on-chip reset circuit ................................................. 33 pic10(l)f320/322 ........................................................ 8 pwm ......................................................................... 107 timer2....................................................................... 105 tmr0/wdt prescaler............................................... 101 voltage reference ...................................................... 85 borcon register.............................................................. 35 brown-out reset (bor) ...................................................... 35 timing and characteristics ....................................... 182 c c compilers mplab c18 .............................................................. 190 ccp1con register ............................................................ 17 ccpr1h register............................................................... 17 clcxcon register........................................................... 119 clcxgls0 register ......................................................... 123 clcxgls1 register ......................................................... 124 clcxgls2 register ......................................................... 125 clcxgls3 register ......................................................... 126 clcxpol register ........................................................... 120 clcxsel0 register.......................................................... 121 clcxsel1 register.......................................................... 122 clock sources external modes........................................................... 31 ec ...................................................................... 31 code examples indirect addressing..................................................... 19 initializing porta ...................................................... 75 saving status and w registers in ram ..................... 45 writing to flash program memory.............................. 66 complementary waveform generator (cwg).................. 139 config register ............................................................... 22 customer change notification service............................. 207 customer notification service .......................................... 207 customer support............................................................. 207 cwg auto-shutdown control ............................................. 146 clock source ............................................................ 142 output control .......................................................... 142 selectable input sources.......................................... 142 cwgxcon0 register....................................................... 149 cwgxcon1 register....................................................... 150 cwgxcon2 register....................................................... 151 cwgxdbf register.......................................................... 152 cwgxdbr register ......................................................... 152 d data memory ...................................................................... 13 dc and ac characteristics............................................... 187 dc characteristics extended and industrial (pic10(l)f320/322)........... 176 industrial and extended (pic10(l)f320/322)........... 171 development support ....................................................... 189 device configuration .......................................................... 21 code protection.......................................................... 24 configuration word..................................................... 21 user id ................................................................. 24, 25 device overview............................................................. 7, 53 e eecon1 register............................................................... 18 eedatl register ............................................................... 70 effects of reset pwm mode............................................................... 109 electrical specifications (pic10(l)f320/322) ................... 169 errata .................................................................................... 6 f firmware instructions ....................................................... 159 fixed voltage reference (fvr) associated registers.................................................. 86 flash program memory ...................................................... 57 associated registers.................................................. 73 configuration word w/ flash program memory ......... 73 erasing ....................................................................... 61 modifying .................................................................... 67 write verify ................................................................. 69 writing ........................................................................ 63 fsr register ...................................................................... 17 fvrcon (fixed voltage reference control) register....... 86 g general purpose register file ........................................... 13 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 204 preliminary ? 2011 microchip technology inc. i indf register ..................................................................... 17 indirect addressing, indf and fsr registers ..................... 19 instruction format ............................................................. 159 instruction set ................................................................... 159 addlw ..................................................................... 161 addwf ..................................................................... 161 andlw ..................................................................... 161 andwf ..................................................................... 161 movf........................................................................ 164 bcf ........................................................................... 161 bsf ........................................................................... 161 btfsc ...................................................................... 161 btfss ...................................................................... 162 call ......................................................................... 162 clrf......................................................................... 162 clrw ....................................................................... 162 clrwdt................................................................... 162 comf ....................................................................... 162 decf ........................................................................ 162 decfsz.................................................................... 163 goto ....................................................................... 163 incf.......................................................................... 163 incfsz ..................................................................... 163 iorlw ...................................................................... 163 iorwf ...................................................................... 163 movlw .................................................................... 164 movwf .................................................................... 164 nop .......................................................................... 164 retfie ..................................................................... 165 retlw ..................................................................... 165 return ................................................................... 165 rlf ........................................................................... 166 rrf........................................................................... 166 sleep ...................................................................... 166 sublw ..................................................................... 166 subwf ..................................................................... 167 swapf ..................................................................... 167 xorlw ..................................................................... 167 xorwf..................................................................... 167 summary table......................................................... 160 intcon register ................................................................ 46 internal oscillator block intosc specifications.................................................... 180 internal sampling switch (r ss ) impedance ........................ 98 internet address................................................................ 207 interrupt-on-change ........................................................... 81 associated registers .................................................. 84 interrupts ............................................................................. 41 adc ............................................................................ 95 associated registers w/ interrupts ............................... 49 configuration word w/ clock sources ........................ 31 context saving............................................................ 45 intosc specifications ..................................................... 180 iocbp register................................................................... 83 l lata register..................................................................... 78 load conditions ................................................................ 179 m mclr .................................................................................. 36 internal ........................................................................ 36 memory organization........................................................ 139 data ............................................................................ 13 program ...................................................................... 11 microchip internet web site.............................................. 207 mplab asm30 assembler, linker, librarian ................... 190 mplab integrated development environment software.. 189 mplab pm3 device programmer .................................... 192 mplab real ice in-circuit emulator system ................ 191 mplink object linker/mplib object librarian ................ 190 n nco associated registers ................................................. 138 ncoxacch register ....................................................... 136 ncoxaccl register ........................................................ 136 ncoxaccu register ....................................................... 136 ncoxclk register........................................................... 135 ncoxcon register.......................................................... 135 ncoxinch register ......................................................... 137 ncoxincl register ......................................................... 137 numerically controlled oscillator (nco) .......................... 129 o opcode field descriptions............................................. 159 option_reg register.................................................... 103 osccon register.............................................................. 30 oscillator associated registers ........................................... 31, 153 oscillator module ................................................................ 27 ec............................................................................... 27 intosc ...................................................................... 27 reference clock output control................................. 29 oscillator parameters ....................................................... 180 oscillator specifications.................................................... 180 p packaging ......................................................................... 193 marking ............................................................. 193, 195 pdip details ............................................................. 195 pcl and pclath............................................................... 19 stack........................................................................... 19 pcl register ...................................................................... 17 pclath register ............................................................... 17 pcon register ............................................................. 17, 39 pie1 register................................................................ 17, 47 pinout descriptions pic10(l)f320/322 ........................................................ 9 pir1 register ............................................................... 17, 48 pmadr registers............................................................... 57 pmadrh registers ............................................................ 57 pmadrl register .............................................................. 71 pmadrl registers............................................................. 57 pmcon1 register ........................................................ 57, 72 pmcon2 register ........................................................ 57, 73 pmdath register ........................................................ 70, 71 porta ............................................................................... 76 ansela register ....................................................... 76 associated registers .................................................. 80 porta register ......................................................... 17 specifications ........................................................... 181 porta register ................................................................. 77 power-down mode (sleep)................................................. 51 associated registers .................................................. 52 power-on reset .................................................................. 34 power-up time-out sequence ............................................ 36 power-up timer (pwrt) .................................................... 34 specifications ........................................................... 183 www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 205 pic10(l)f320/322 pr2 register....................................................................... 17 prescaler shared wdt/timer0 ................................................. 102 program memory ................................................................ 11 map and stack (pic10(l)f320 ................................... 12 programming, device instructions .................................... 159 pulse width modulation (pwm) ........................................ 107 associated registers w/ pwm ................................... 112 pwm mode duty cycle ........................................................ 108 effects of reset ................................................ 109 example pwm frequencies and resolutions, 20 mhz ................................ 109 example pwm frequencies and resolutions, 8 mhz................................... 109 operation in sleep mode .................................. 109 setup for operation using pwmx pins.............. 110 system clock frequency changes .................. 109 pwm period.............................................................. 108 setup for pwm operation using pwmx pins............ 110 pwmxcon register ......................................................... 111 pwmxdch register ......................................................... 112 pwmxdcl register.......................................................... 112 r reader response ............................................................. 208 read-modify-write operations ......................................... 159 registers adres (adc result) ................................................. 97 ansela (porta analog select)............................... 78 borcon brown-out reset control)........................... 35 clcxcon (clcx control) ........................................ 119 clcxgl1 (gate 2 logic select) ............................... 124 clcxgls0 (gate 1 logic select) ............................. 123 clcxgls2 (gate 3 logic select) ............................. 125 clcxgls3 (gate 4 logic select) ............................. 126 clcxpol (signal polarity control)........................... 120 clcxsel0 (multiplexer data 1 and 2 select)........... 121 clcxsel1 (multiplexer data 3 and 4 select)........... 122 configuration word ..................................................... 22 cwgxcon0 (cwg control 0).................................. 149 cwgxcon1 (cwg control 1).................................. 150 cwgxcon2 (cwg control 1).................................. 151 cwgxdbf (cwgx dead band falling count) ......... 152 cwgxdbr (cwgx dead band rising count) ......... 152 eedatl (eeprom data) .......................................... 70 fvrcon..................................................................... 86 intcon (interrupt control)......................................... 46 iocbp (interrupt-on-change positive edge) .............. 83 lata (data latch porta)......................................... 78 ncoxacch (ncox accumulator high byte) ........... 136 ncoxaccl (ncox accumulator low byte)............. 136 ncoxaccu (ncox accumulator upper byte)......... 136 ncoxclk (ncox clock control) ............................. 135 ncoxcon (ncox control) ...................................... 135 ncoxinch (ncox increment high byte)................. 137 ncoxincl (ncox increment low byte) .................. 137 option_reg (option) ............................................ 103 osccon (oscillator control) ..................................... 30 pcon (power control) ............................................... 39 pie1 (peripheral interrupt enable 1)........................... 47 pir1 (peripheral interrupt register 1) ........................ 48 pmadrl (program memory address)........................ 71 pmcon1 (program memory control 1)...................... 72 pmcon2 (program memory control 2)...................... 73 pmdath (program memory data) ....................... 70, 71 porta ....................................................................... 77 pwmxcon (pwm control) ...................................... 111 pwmxdch (pwm control) ...................................... 112 pwmxdcl (pwm control) ....................................... 112 special function registers......................................... 13 special function, summary........................................ 17 status ..................................................................... 15 t2con ..................................................................... 106 trisa (tri-state porta) .......................................... 77 wdtcon (watchdog timer control) ......................... 55 reset .................................................................................. 33 resets ................................................................................ 33 associated registers.................................................. 39 configuration word w/ clock resets.......................... 39 revision history................................................................ 201 s software simulator (mplab sim) .................................... 191 spbrg register................................................................. 17 special function registers ................................................. 13 special function registers (sfrs)..................................... 17 status register ............................................................... 15 t t2con register ......................................................... 17, 106 temperature indicator module............................................ 89 thermal considerations (pic10(l)f320/322)................... 178 timer0 .............................................................................. 101 associated registers................................................ 103 interrupt .................................................................... 103 operation.................................................................. 101 specifications ........................................................... 183 timer1 .............................................................................. 105 timer2 associated registers ................................................. 106 timers timer2 t2con ............................................................. 106 timing diagrams a/d conversion ........................................................ 185 a/d conversion (sleep mode).................................. 185 brown-out reset (bor)............................................ 182 brown-out reset situations ........................................ 35 clkr and i/o ........................................................... 181 clock timing............................................................. 180 int pin interrupt ......................................................... 44 reset start-up sequence ........................................... 37 timer0 external clock .............................................. 183 wake-up from interrupt............................................... 52 timing parameter symbology .......................................... 179 tmr0 register.................................................................... 17 tmr2 register.................................................................... 17 trisa register................................................................... 77 v v ref . s ee adc reference voltage w wake-up using interrupts ................................................... 52 watchdog timer (wdt)...................................................... 36 associated registers.................................................. 56 configuration word w/ watchdog timer..................... 56 modes......................................................................... 54 specifications ........................................................... 183 wdtcon register ............................................................. 55 write protection .................................................................. 24 www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 206 preliminary ? 2011 microchip technology inc. www address.................................................................. 207 www, on-line support........................................................ 6 www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 207 pic10(l)f320/322 the microchip web site microchip provides online support via our www site at www.microchip.com . this web site is used as a means to make files and information easily available to customers. accessible by using your favorite internet browser, the web site contains the following information: ? product support ? data sheets and errata, application notes and sample programs, design resources, user?s guides and hardware support documents, latest software releases and archived software ? general technical support ? frequently asked questions (faq), technical support requests, online discussion groups, microchip consultant program member listing ? business of microchip ? product selector and ordering guides, latest microchip press releases, listing of seminars and events, listings of microchip sales offices, distributors and factory representatives customer change notification service microchip?s customer notification service helps keep customers current on microchip products. subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest. to register, access the microchip web site at www.microchip.com . under ?support?, click on ?customer change notification? and follow the registration instructions. customer support users of microchip products can receive assistance through several channels: ? distributor or representative ? local sales office ? field application engineer (fae) ? technical support ? development systems information line customers should contact their distributor, representative or field application engineer (fae) for support. local sales offices are also available to help customers. a listing of sales offices and locations is included in the back of this document. technical support is available through the web site at: http://microchip.com/support www.datasheet.co.kr datasheet pdf - http://www..net/
pic10(l)f320/322 ds41585a-page 208 preliminary ? 2011 microchip technology inc. reader response it is our intention to provide you with the best documentation possible to ensure successful use of your microchip product. if you wish to provide your comments on organization, clarity, subject matter, and ways in which our documentation can better serve you, please fax your comments to the technical publications manager at (480) 792-4150. please list the following information, and use this outline to provide us with your comments about this document. to: technical publications manager re: reader response total pages sent ________ from: name company address city / state / zip / country telephone: (_______) _________ - _________ application (optional): would you like a reply? y n device: literature number: questions: fax: (______) _________ - _________ ds41585a pic10(l)f320/322 1. what are the best features of this document? 2. how does this document meet your hardware and software development needs? 3. do you find the organization of this document easy to follow? if not, why? 4. what additions to the document do you think would enhance the structure and subject? 5. what deletions from the document could be made without affecting the overall usefulness? 6. is there any incorrect or misleading information (what and where)? 7. how would you improve this document? www.datasheet.co.kr datasheet pdf - http://www..net/
? 2011 microchip technology inc. preliminary ds41585a-page 209 pic10(l)f320/322 product identification system to order or obtain information, e.g., on pricing or delivery, refer to the factory or the listed sales office . part no. x /xx xxx pattern package temperature range device device: pic10f320, pic10lf320, PIC10F322, pic10lf322 tape and reel option: blank = standard packaging (tube or tray) t = tape and reel (1) temperature range: i= -40 ? c to +85 ? c(industrial) e= -40 ? c to +125 ? c (extended) package: ot = sot-23 p=pdip mc = dfn pattern: qtp, sqtp, code or special requirements (blank otherwise) examples: a) pic10lf320t - i/ot tape and reel, industrial temperature, sot-23 package b) PIC10F322 - i/p industrial temperature pdip package c) pic10f320 - e/mc extended temperature, dfn package note 1: tape and reel identifier only appears in the catalog part number description. this identifier is used for ordering purposes and is not printed on the device package. check with your microchip sales office for package availability with the tape and reel option. [x] (1) tape and reel option - www.datasheet.co.kr datasheet pdf - http://www..net/
ds41585a-page 210 preliminary ? 2011 microchip technology inc. americas corporate office 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7200 fax: 480-792-7277 technical support: http://www.microchip.com/ support web address: www.microchip.com atlanta duluth, ga tel: 678-957-9614 fax: 678-957-1455 boston westborough, ma tel: 774-760-0087 fax: 774-760-0088 chicago itasca, il tel: 630-285-0071 fax: 630-285-0075 cleveland independence, oh tel: 216-447-0464 fax: 216-447-0643 dallas addison, tx tel: 972-818-7423 fax: 972-818-2924 detroit farmington hills, mi tel: 248-538-2250 fax: 248-538-2260 indianapolis noblesville, in tel: 317-773-8323 fax: 317-773-5453 los angeles mission viejo, ca tel: 949-462-9523 fax: 949-462-9608 santa clara santa clara, ca tel: 408-961-6444 fax: 408-961-6445 toronto mississauga, ontario, canada tel: 905-673-0699 fax: 905-673-6509 asia/pacific asia pacific office suites 3707-14, 37th floor tower 6, the gateway harbour city, kowloon hong kong tel: 852-2401-1200 fax: 852-2401-3431 australia - sydney tel: 61-2-9868-6733 fax: 61-2-9868-6755 china - beijing tel: 86-10-8569-7000 fax: 86-10-8528-2104 china - chengdu tel: 86-28-8665-5511 fax: 86-28-8665-7889 china - chongqing tel: 86-23-8980-9588 fax: 86-23-8980-9500 china - hangzhou tel: 86-571-2819-3180 fax: 86-571-2819-3189 china - hong kong sar tel: 852-2401-1200 fax: 852-2401-3431 china - nanjing tel: 86-25-8473-2460 fax: 86-25-8473-2470 china - qingdao tel: 86-532-8502-7355 fax: 86-532-8502-7205 china - shanghai tel: 86-21-5407-5533 fax: 86-21-5407-5066 china - shenyang tel: 86-24-2334-2829 fax: 86-24-2334-2393 china - shenzhen tel: 86-755-8203-2660 fax: 86-755-8203-1760 china - wuhan tel: 86-27-5980-5300 fax: 86-27-5980-5118 china - xian tel: 86-29-8833-7252 fax: 86-29-8833-7256 china - xiamen tel: 86-592-2388138 fax: 86-592-2388130 china - zhuhai tel: 86-756-3210040 fax: 86-756-3210049 asia/pacific india - bangalore tel: 91-80-3090-4444 fax: 91-80-3090-4123 india - new delhi tel: 91-11-4160-8631 fax: 91-11-4160-8632 india - pune tel: 91-20-2566-1512 fax: 91-20-2566-1513 japan - yokohama tel: 81-45-471- 6166 fax: 81-45-471-6122 korea - daegu tel: 82-53-744-4301 fax: 82-53-744-4302 korea - seoul tel: 82-2-554-7200 fax: 82-2-558-5932 or 82-2-558-5934 malaysia - kuala lumpur tel: 60-3-6201-9857 fax: 60-3-6201-9859 malaysia - penang tel: 60-4-227-8870 fax: 60-4-227-4068 philippines - manila tel: 63-2-634-9065 fax: 63-2-634-9069 singapore tel: 65-6334-8870 fax: 65-6334-8850 taiwan - hsin chu tel: 886-3-6578-300 fax: 886-3-6578-370 taiwan - kaohsiung tel: 886-7-213-7830 fax: 886-7-330-9305 taiwan - taipei tel: 886-2-2500-6610 fax: 886-2-2508-0102 thailand - bangkok tel: 66-2-694-1351 fax: 66-2-694-1350 europe austria - wels tel: 43-7242-2244-39 fax: 43-7242-2244-393 denmark - copenhagen tel: 45-4450-2828 fax: 45-4485-2829 france - paris tel: 33-1-69-53-63-20 fax: 33-1-69-30-90-79 germany - munich tel: 49-89-627-144-0 fax: 49-89-627-144-44 italy - milan tel: 39-0331-742611 fax: 39-0331-466781 netherlands - drunen tel: 31-416-690399 fax: 31-416-690340 spain - madrid tel: 34-91-708-08-90 fax: 34-91-708-08-91 uk - wokingham tel: 44-118-921-5869 fax: 44-118-921-5820 worldwide sales and service 05/02/11 www.datasheet.co.kr datasheet pdf - http://www..net/


▲Up To Search▲   

 
Price & Availability of PIC10F322

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X