Part Number Hot Search : 
TVV030 2SJ479 MC7815A 015C2 34262P CMZ5351B 91ER1KLF AX168
Product Description
Full Text Search
 

To Download PIC24FJ128GC010 Datasheet File

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


  Datasheet File OCR Text:
  ? 2012-2013 microchip technology inc. ds30009312b-page 1 PIC24FJ128GC010 family advanced analog features ? 12-bit, up to 50-channel, high-speed, pipelined analog-to-digital (a/d) converter: - conversion rates up to 10 msps - compatibility features for low conversion rates - flexible operating modes with auto-accumulate, threshold detect and channel scan using sample lists - conversion available during sleep and idle ? 16-bit sigma-delta analog-to-digital (a/d) converter: - programmable data rate with dithering option and adjustable oversampling ratios - two differential channels - configurable input gain stage ? two 10-bit digital-to-analog converters (dac): - fast settling time supports 1 msps update rate ? two rail-to-rail, input/output, general purpose operational amplifiers: - 2.5 mhz gain bandwidth product (typical) - flexible input multiplexing options - optional comparator mode ? three rail-to-rail, enhanced analog comparators with programmable input/output configuration ? three on-chip programmable voltage references ? charge time measurement unit (ctmu): - used for capacitive touch sensing, up to 50 channels - time measurement down to 100 ps resolution - operation in sleep mode extreme low-power features ? multiple power management options for extreme power reduction: -v bat allows for lowest power consumption on backup battery (with or without rtcc) - deep sleep allows near total power-down, with the ability to wake-up on internal or external triggers - full ram and state retention in select deep sleep and v bat modes - sleep and idle modes selectively shut down peripherals and/or core for substantial power reduction and fast wake-up - doze mode allows cpu to run at a lower clock speed than peripherals ? alternate clock modes allow on-the-fly switching to a lower clock speed for selective power reduction ? extreme low-power current consumption for deep sleep: - wdt: 270 na @ 3.3v, typical - rtcc: 350 na @ 32 khz, 3.3v, typical - deep sleep current, 75 na, 3.3v, typical device memory pins analog peripherals digital peripherals lcd controller (pixels) usb otg deep sleep w/v bat program flash (bytes) data ram (bytes) 12-bit hs a/d (ch) 16-bit ?? a/d (diff ch) 10-bit dac op amps comparators ctmu (ch) input capture output compare/pwm i 2 c? spi uart w/irda ? epmp/psp 16-bit timers PIC24FJ128GC010 128k 8k 100 50 2 2 2 3 50 9 9 2 2 4 y 5 472 y y pic24fj128gc006 128k 8k 64 30 2 2 2 3 30 9 9 2 2 4 y 5 248 y y pic24fj64gc010 64k 8k 100 50 2 2 2 3 50 9 9 2 2 4 y 5 472 y y pic24fj64gc006 64k 8k 64 30 2 2 2 3 30 9 9 2 2 4 y 5 248 y y 16-bit flash microcontrollers with 12-bit pipeline a/d, sigma-delta a/d, usb on-the-go and xlp technology
PIC24FJ128GC010 family ds30009312b-page 2 ? 2012-2013 microchip technology inc. universal serial bus features ? usb v2.0 on-the-go (otg) compliant ? usb device mode operation from frc oscillator ? no crystal oscillator required ? dual role capable ? can act as either host or peripheral ? low-speed (1.5 mb/s) and full-speed (12 mb/s) usb operation in host mode ? full-speed usb operation in device mode ? low jitter pll for usb ? supports up to 32 endpoints (16 bidirectional): - usb module can use any ram location on the device as usb endpoint buffers ? on-chip usb transceiver with interface for off-chip usb transceiver ? supports control, interrupt, isochronous and bulk transfers ? on-chip pull-up and pull-down resistors peripheral features ? lcd display controller: - up to 59 segments by 8 commons - internal charge pump and low-power, internal resistor biasing - operation in sleep mode ? up to five external interrupt sources ? peripheral pin select (pps); allows independent i/o mapping of many peripherals ? five 16-bit timers/counters with prescaler: - can be paired as 32-bit timers/counters ? six-channel dma supports all peripheral modules: - minimizes cpu overhead, increases data throughput and lowers power consumption ? nine input capture modules, each with a dedicated 16-bit timer ? nine output compare/pwm modules, each with a dedicated 16-bit timer ? enhanced parallel master/slave port (epmp/epsp) ? hardware real-time clock/calendar (rtcc): - run, sleep, deep sleep and v bat modes ? two 3-wire/4-wire spi modules (support 4 frame modes) with 8-level fifo buffer ?two i 2 c? modules support multi-master/slave mode and 7-bit/10-bit addressing ? four uart modules: - support rs-485, rs-232 and lin/j2602 - on-chip hardware encoder/decoder for irda ? - auto-wake-up on auto-baud detect (abd) - 4-level deep fifo buffer ? programmable, 32-bit cyclic redundancy check (crc) generator ? digital signal modulator (dsm) provides on-chip fsk and psk modulation for a digital signal stream ? high-current sink/source (18 ma/18 ma) on all i/o pins ? configurable open-drain outputs on digital i/o pins ? 5.5v tolerant inputs on select pins high-performance cpu ? modified harvard architecture ? up to 16 mips operation @ 32 mhz ? c compiler optimized instruction set architecture (isa) ? 8 mhz internal oscillator: - 96 mhz pll option for usb clocking - multiple clock divide options - run-time self-calibration capability for maintaining better than 0.20% accuracy - fast start-up ? 17-bit x 17-bit single-cycle hardware fractional/integer multiplier ? 32-bit by 16-bit hardware divider ? 16 x 16-bit working register array ? two address generation units (agus) for separate read and write addressing of data memory special microcontroller features ? supply voltage range of 2.0v to 3.6v ? two on-chip voltage regulators (1.8v and 1.2v) for regular and extreme low-power operation ? 20,000 erase/write cycle endurance flash program memory, typical ? flash data retention: 20 years minimum ? self-programmable under software control ? programmable reference clock output ? in-circuit serial programming? (icsp?) and in-circuit emulation (ice) via 2 pins ? jtag boundary scan support ? fail-safe clock monitor operation: - detects clock failure and switches to on-chip, low-power rc oscillator ? power-on reset (por), power-up timer (pwrt) and oscillator start-up timer (ost) ? separate brown-out reset (bor) and deep sleep brown-out reset (dsbor) circuits ? programmable high/low-voltage detect (hlvd) ? flexible watchdog timer (wdt) with its own rc oscillator for reliable operation ? standard and ultra low-power watchdog timers for reliable operation in standard and deep sleep modes
? 2012-2013 microchip technology inc. ds30009312b-page 3 PIC24FJ128GC010 family pin diagrams legend: shaded pins indicate pins tolerant to up to +5.5 vdc. see table 1 for a complete description of pin functions. note 1: it is recommended to connect the metal pad on the bottom of the 64-pin qfn package to v ss . 64-pin tqfp (10 mm x 10 mm) 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 48 47 22 44 24 25 26 27 28 29 30 31 32 1 46 45 23 43 42 41 40 39 63 62 61 59 60 58 57 56 54 55 53 52 51 49 50 38 37 34 36 35 33 17 19 20 21 18 64 v dd v ss rg9 mclr rg8 rg7 rg6 re7 re6 re5 rb5 rb4 rb3 rb2 rb1 rb0 osci/rc12 osco/rc15 v ss rd8 rd9 rd10 rd11 rd0 rc13 rc14 v dd d+/rg2 d-/rg3 v usb3v3 v bus /rf7 rf3 sv dd ch1- ch1+ ch0- ch0+ sv ss av ss av dd rb7 rb6 rb12 rb13 rb14 rb15 rf4 rf5 rd7 v cap v bat rf0 rf1 re0 re1 re2 re3 re4 rd6 rd5 rd4 rd3 rd2 rd1 pic24fjxxxgc006 64-pin qfn (9 mm x 9 mm) (1)
PIC24FJ128GC010 family ds30009312b-page 4 ? 2012-2013 microchip technology inc. table 1: complete pin function de scriptions for 64-pin devices pin function pin function 1 cted4/pmd5/lcdbias2/cn63/re5 33 an30/seg12/ rp16 /usbid/pma12/cn71/rf3 2 pmd6/lcdbias1/cn64/re6 34 v bus /cn83/rf7 3 pmd7/lcdbias0/cn65/re7 35 v usb3v3 4 bgbuf2/an17/oa1pb/c1ind/seg0/ rp21 /t5ck/pma5/cn8/ rg6 36 d-/cn73/rg3 5v lcap1 /an18/oa1ne/c1inc/ rp26 /pma4/cn9/rg7 37 d+/cn72/rg2 6v lcap2 /an19/oa1nd/c2ind/ rp19 /pma3/cn10/rg8 38 v dd 7mclr 39 osci/clki/cn23/rc12 8 an49/oa1pa/c2inc/seg1/dac1/ rp27 /pma2/cn11/rg9 40 osco/clko/cn22/rc15 9v ss 41 v ss 10 v dd 42 an40/seg13/ rp2 /rtcc/dmln/octrig1/pma13/cn53/rd8 11 pgec3/an5/oa1out/c1ina/seg2/ rp18 /cn7/rb5 43 an24/seg14/ rp4 /sda1/dpln/pmack2/cn54/rd9 12 pged3/an4/oa2nc/c1inb/seg3/ rp28 /usboen/cn6/rb4 44 an41/c3ind/seg15/scl1/pma15/cs2/cn55/rd10 13 an3/oa2out/c2ina/seg4/vpio/cn5/rb3 45 tms/an42/oa2pa/c3inc/seg16/ rp12 /pma14/cs1/cn56/ rd11 14 an2/oa2nc/ctcmp/c2inb/seg5/ rp13 /t4ck/vmio/cted13/ pma7/cn4/rb2 46 an43/oa2na/seg17/ rp11 /v cmpst3 /dmh/int0/cn49/rd0 15 pgec1/cv ref -/av ref -/an1/oa2pb/seg6/ rp1 /cted12/cn3/ rb1 47 sosci/rc13 16 pged1/cv ref +/av ref +/dv ref +/bgbuf1/an0/seg7/ rp0 / pma6/cn2/rb0 48 sosco/ rpi37 /sclki/rc14 17 pgec2/an6/oa1pd/ rp6 /lcdbias3/cn24/rb6 49 an35/seg20/ rp24 /cn50/rd1 18 pged2/an7/com6/seg30/ rp7 /cn25/rb7 50 an25/oa2nb/seg21/ rp23 /dph/pmack1/cn51/rd2 19 av dd 51 an44/oa2pe/seg22/ rp22 /pmbe0/cn52/rd3 20 av ss 52 an47/oa1pe/seg23/ rp25 /pmwr/cn13/rd4 21 sv ss 53 an48/oa1nb/seg24/ rp20 /pmrd/cn14/rd5 22 ch0+ 54 an34/oa1pc/c3inb/seg25/cn15/rd6 23 ch0- 55 an20/c3ina/seg26/cn16/rd7 24 ch1+/sv ref +56v cap 25 ch1-/ch1se/sv ref -57v bat 26 sv dd 58 com7/seg27/v cmpst1 /cn68/rf0 27 tck/an12/com5/seg18/t1ck/cted2/pma11/cn30/rb12 59 com4/seg47/v cmpst2 /cn69/rf1 28 tdi/an13/oa2pd/seg19/dac2/cted1/pma10/cn31/rb13 60 com3/pmd0/cn58/re0 29 tdo/an14/oa2ne/seg8/ rp14 /cted5/ctpls/pma1/cn32/ rb14 61 com2/pmd1/cn59/re1 30 an15/seg9/ rp29 /t2ck/refo/cted6/pma0/cn12/rb15 62 com1/pmd2/cn60/re2 31 an11/oa2nd/seg10/ rp10 /sda2/t3ck/pma9/cn17/rf4 63 com0/cted9/pmd3/cn61/re3 32 cv ref /an10/oa2pc/seg11/ rp17 /scl2/pma8/cn18/rf5 64 hlvdin/seg62/cted8/pmd4/cn62/re4 legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions.
? 2012-2013 microchip technology inc. ds30009312b-page 5 PIC24FJ128GC010 family pin diagrams (continued) legend: shaded pins indicate pins tolerant to up to +5.5 vdc. see ta b l e 2 for a complete description of pin functions. 100-pin tqfp (12 mm x 12 mm) pic24fjxxxgc010 92 94 93 91 90 89 88 87 86 85 84 83 82 81 80 79 78 20 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 65 64 63 62 61 60 59 26 56 45 44 43 42 41 40 39 28 29 30 31 32 33 34 35 36 37 38 17 18 19 21 22 95 1 76 77 72 71 70 69 68 67 66 75 74 73 58 57 24 23 25 96 98 97 99 27 46 47 48 49 50 55 54 53 52 51 100 rd5 rd4 rd13 rd12 rd3 rd2 rd1 ra7 ra6 re2 rg13 rg12 rg14 re1 re0 rg0 re4 re3 rf0 v cap rc13 rd0 rd10 rd9 rd8 rd11 ra15 ra14 osco/rc15 osci/rc12 v dd d+/rg2 v usb3v3 v bus /rf7 rf8 d-/rg3 rf2 rf3 v ss rc14 ra10 ra9 av dd av ss sv ss ch0+ ch0- ch1+ sv dd rf12 rf13 v ss v dd rd15 rd14 rb6 rb7 rf5 rf4 re5 re6 re7 rc1 rc2 rc3 rc4 rg6 v dd ra0 re8 re9 rb5 rb4 rb3 rb2 rg7 rg8 rb1 rb0 rg15 v dd rg9 mclr rb12 rb13 rb14 rb15 rg1 rf1 rd7 rd6 ra5 ra3 ra2 v ss ch1- v ss v bat ra4 ra1
PIC24FJ128GC010 family ds30009312b-page 6 ? 2012-2013 microchip technology inc. table 2: complete pin function de scriptions for 100-pin devices pin function pin function 1 an33/seg50/cted3/cn82/rg15 41 an12/com5/seg18/t1ck/cted2/pma11/cn30/rb12 2v dd 42 an13/oa2pd/seg19/dac2/cted1/pma10/cn31/rb13 3 cted4/pmd5/lcdbias2/cn63/re5 43 an14/oa2ne/seg8/ rp14 /cted5/ctpls/pma1/cn32/rb14 4 pmd6/lcdbias1/cn64/re6 44 an15/seg9/ rp29 /t2ck/refo/cted6/pma0/cn12/rb15 5 pmd7/lcdbias0/cn65/re7 45 v ss 6 an8/oa1nb/seg32/ rpi38 /cn45/rc1 46 v dd 7 seg51/ rpi39 /cn46/rc2 47 an28/seg38/ rpi43 /cn20/rd14 8 an9/seg33/ rpi40 /cn47/rc3 48 an29/seg39/ rp5 /cn21/rd15 9 an16/seg52/ rpi41 /pmcs2/cn48/rc4 49 an11/oa2nd/seg10/ rp10 /sda2 ( 3 ) /t3ck/pma9/cn17/rf4 10 bgbuf2/an17/oa1pb/c1ind/seg0/ rp21 /t5ck/pma5/cn8/ rg6 50 cv ref /an10/oa2pc/seg11/ rp17 /scl2 ( 3 ) /pma8/cn18/rf5 11 v lcap1 /an18/oa1ne/c1inc/ rp26 /pma4/cn9/rg7 51 an30/seg12/ rp16 /usbid/pma12/cn71/rf3 12 v lcap2 /an19/oa1nc/c2ind/ rp19 /pma3/cn10/rg8 52 an31/seg40/ rp30 /cn70/rf2 13 mclr 53 an32/seg41/ rp15 /cn74/rf8 14 an49/oa1pa/c2inc/seg1/dac1/ rp27 /pma2/cn11/rg9 54 v bus /cn83/rf7 15 v ss 55 v usb3v3 16 v dd 56 d-/cn73/rg3 17 tms/seg48/cted0/cn33/ra0 57 d+/cn72/rg2 18 seg34/ rpi33 /pmcs1/cn66/re8 58 seg55/scl2/cn35/ra2 19 an21/seg35/ rpi34 /pma19/cn67/re9 59 seg56/sda2/pma20/cn36/ra3 20 pgec3/an5/oa1out/c1ina/seg2/ rp18 /cn7/rb5 60 tdi/an36/seg29/pma21/cn37/ra4 21 pged3/an4/oa1na/c1inb/seg3/ rp28 /usboen/cn6/rb4 61 tdo/an37/seg28/cn38/ra5 22 an3/oa2out/c2ina/seg4/vpio/cn5/rb3 62 v dd 23 an2/oa2nc/ctcmp/c2inb/seg5/ rp13 /t4ck/vmio/cted13/ cn4/rb2 63 osci/clki/cn23/rc12 24 pgec1/cv ref -/av ref -/an1/oa2pb/seg6/ rp1 /cted12/cn3/ rb1 64 osco/clko/cn22/rc15 25 pged1/cv ref +/av ref +/dv ref +/bgbuf1/an0/seg7/ rp0 /cn2/ rb0 65 v ss 26 pgec2/an6/oa1pd/ rp6 /lcdbias3/cn24/rb6 66 an38/seg42/ rpi36 /scl1/octrig2/pma22/cn43/ra14 27 pged2/an7/com6/seg30/ rp7 /cn25/rb7 67 an39/seg43/ rpi35 /sda1/pmbe1/cn44/ra15 28 cv ref - ( 1 ) /av ref - ( 2 ) /seg36/pma7/cn41/ra9 68 an40/seg13/ rp2 /rtcc/dmln/octrig1/pma13/cn53/rd8 29 cv ref + ( 1 ) /av ref + ( 2 ) /seg37/pma6/cn42/ra10 69 an24/seg14/ rp4 /dpln/pmack2/cn54/rd9 30 av dd 70 an41/c3ind/seg15/pma15/cs2/cn55/rd10 31 av ss 71 an42/oa2pa/c3inc/seg16/ rp12 /pma14/cs1/cn56/rd11 32 sv ss 72 an43/oa2na/seg17/ rp11 /v cmpst3 /dmh/int0/cn49/rd0 33 ch0+ 73 sosci/rc13 34 ch0- 74 sosco/sclki/ rpi37 /rc14 35 ch1+/sv ref +75v ss 36 ch1-/ch1se/sv ref - 76 an35/seg20/ rp24 /cn50/rd1 37 sv dd 77 an25/oa2nb/seg21/ rp23 /dph/pmack1/cn51/rd2 38 tck/an26/seg31/cn34/ra1 78 an44/oa2pe/seg22/ rp22 /pmbe0/cn52/rd3 39 an27/seg53/ rp31 /cn76/rf13 79 an45/seg44/ rpi42 /pmd12/cn57/rd12 40 seg54/ rpi32 /cted7/pma18/cn75/rf12 80 an46/seg45/pmd13/cn19/rd13 legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions. note 1: alternate pin assignments for the external comparator voltage references as determined by the altcvref configuration bit. 2: alternate pin assignments for the external a/d voltage references as determined by the altadref configuration bit. 3: alternate pin assignments for i2c2 as determined by the i2c2sel configuration bit.
? 2012-2013 microchip technology inc. ds30009312b-page 7 PIC24FJ128GC010 family 81 an47/oa1pe/seg23/ rp25 /pmwr/cn13/rd4 91 an23/seg57/cn39/ra6 82 an48/oa1nb/seg24/ rp20 /pmrd/cn14/rd5 92 an22/seg58/pma17/cn40/ra7 83 an34/oa1pc/c3inb/seg25/pmd14/cn15/rd6 93 com3/pmd0/cn58/re0 84 an20/c3ina/seg26/pmd15/cn16/rd7 94 com2/pmd1/cn59/re1 85 v cap 95 seg59/cted11/pma16/cn81/rg14 86 v bat 96 seg60/cn79/rg12 87 com7/seg27/v cmpst1 /pmd11/cn68/rf0 97 seg61/cted10/cn80/rg13 88 com4/seg47/v cmpst2 /pmd10/cn69/rf1 98 com1/pmd2/cn60/re2 89 seg46/pmd9/cn78/rg1 99 com0/cted9/pmd3/cn61/re3 90 seg49/pmd8/cn77/rg0 100 hlvdin/seg62/cted8/pmd4/cn62/re4 table 2: complete pin funct ion descriptions for 100- pin devices (continued) pin function pin function legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions. note 1: alternate pin assignments for the external comparator voltage references as determined by the altcvref configuration bit. 2: alternate pin assignments for the external a/d voltage references as determined by the altadref configuration bit. 3: alternate pin assignments for i2c2 as determined by the i2c2sel configuration bit.
PIC24FJ128GC010 family ds30009312b-page 8 ? 2012-2013 microchip technology inc. pin diagrams (continued) 1 3 5 7 8 9 10 11 a re4 re3 re0 rg0 rf1 v bat n/c rd12 rd1 b n/c re2 re1 ra7 rf0 v cap rd5 rd3 v ss rc14 c re6 v dd rg14 n/c rd7 rd4 n/c rc13 rd11 d re7 re5 n/c n/c n/c rd6 rd13 rd0 n/c rd10 e rc4 rg6 n/c rg1 n/c ra15 rd8 ra14 f mclr rg8 rg9 rg7 v ss n/c n/c v dd osci/ v ss osco/ g re8 re9 ra0 n/c v dd v dd v ss n/c ra5 ra3 ra4 h n/c n/c ch0- n/c n/c v usb3v3 d+/rg2 ra2 j av dd sv dd ra1 rb12 n/c n/c rf8 d-/rg3 k ra10 ch1+ rf12 rb14 v dd l ra9 av ss ch1- rb13 rb15 rf4 rf5 24 6 v bus / rg13 rd2 rg15 rg12 ra6 rc1 rc3 rc2 rd9 rc12 rc15 rb4 rb3 rb2 sv ss rd15 rf3 rf2 ch0+ rf13 rd14 rb5 rb1 rb0 rb6 rb7 121-pin bga (10 mm x 10 mm, top view) legend: shaded balls indicate pins tolerant to up to +5.5 vdc. see table 3 for complete pinout descriptions. rf7
? 2012-2013 microchip technology inc. ds30009312b-page 9 PIC24FJ128GC010 family table 3: complete pin function de scriptions for 121-pin devices pinfunctionpinfunction a1 hlvdin/seg62/cted8/pmd4/cn62/re4 e1 an16/seg52/ rpi41 /pmcs2/cn48/rc4 a2 com0/cted9/pmd3/cn61/re3 e2 an9/oa1nc/seg33/ rpi40 /cn47/rc3 a3 seg61/cted10/cn80/rg13 e3 bg buf2/an17/oa1pb/c1ind/seg0/ rp21 /t5ck/pma5/ cn8/rg6 a4 com3/pmd0/cn58/re0 e4 seg51/ rpi39 /cn46/rc2 a5 seg49/pmd8/cn77/rg0 e5 n/c a6 com4/seg47/v cmpst2 /pmd10/cn69/rf1 e6 seg46/pmd9/cn78/rg1 a7 v bat e7 n/c a8 n/c e8 an39/seg43/ rpi35 /sda1/pmbe1/cn44/ra15 a9 an45/seg44/ rpi42 /pmd12/cn57/rd12 e9 an40/seg13/ rp2 /rtcc/dmln/octrig1/pma13/cn53/ rd8 a10 an25/oa2nb/seg21/ rp23 /dph/pmack1/cn51/rd2 e10 an24/seg14/ rp4 /dpln/pmack2/cn54/rd9 a11 an35/seg20/ rp24 /cn50/rd1 e11 an38/seg42/ rpi36 /scl1/octrig2/pma22/cn43/ra14 b1 n/c f1 mclr b2 an33/seg50/cted3/cn82/rg15 f2 v lcap2 /an19/oa1nd/c2ind/ rp19 /pma3/cn10/rg8 b3 com1/pmd2/cn60/re2 f3 an49/c2inc/seg1/dac1/ rp27 /pma2/cn11/rg9 b4 com2/pmd1/cn59/re1 f4 v lcap1 /an18/oa1ne/c1inc/ rp26 /pma4/cn9/rg7 b5 an22/seg58/pma17/cn40/ra7 f5 v ss b6 com7/seg27/v cmpst1 /pmd11/cn68/rf0 f6 n/c b7 v cap f7 n/c b8 an48/oa1nb/seg24/ rp20 /pmrd/cn14/rd5 f8 v dd b9 an44/oa2pe/seg22/ rp22 /pmbe0/cn52/rd3 f9 osci/clki/cn23/rc12 b10 v ss f10 v ss b11 sosco/sclki/ rpi37 /rc14 f11 osco/clko/cn22/rc15 c1 pmd6/lcdbias1/cn64/re6 g1 seg34/ rpi33 /pmcs1/cn66/re8 c2 v dd g2 an21/seg35/ rpi34 /pma19/cn67/re9 c3 seg60/cn79/rg12 g3 tms/seg48/cted0/cn33/ra0 c4 seg59/cted11/pma16/cn81/rg14 g4 n/c c5 an23/seg57/cn39/ra6 g5 v dd c6 n/c g6 v dd c7 an20/c3ina/seg26/pmd15/cn16/rd7 g7 v ss c8 an47/oa1pe/seg23/ rp25 /pmwr/cn13/rd4 g8 n/c c9 n/c g9 tdo/an37/seg28/cn38/ra5 c10 sosci/rc13 g10 seg56/sda2/pma20/cn36/ra3 c11 an42/oa2pa/c3inc/seg16/ rp12 /pma14/cs1/cn56/rd11 g11 tdi/an36/seg29/pma21/cn37/ra4 d1 an8/oa1nb/seg32/ rpi38 /cn45/rc1 h1 pgec3/an5/oa1out/c1ina/seg2/ rp18 /cn7/rb5 d2 pmd7/lcdbias0/cn65/re7 h2 pged3/an4/oa1na/c1inb/seg3/ rp28 /usboen/cn6/rb4 d3 cted4/pmd5/lcdbias2/cn63/re5 h3 n/c d4 n/c h4 n/c d5 n/c h5 ch0- d6 n/c h6 n/c d7 an34/oa1pc/c3inb/seg25/pmd14/cn15/rd6 h7 n/c d8 an46/seg45/pmd13/cn19/rd13 h8 v bus /cn83/rf7 d9 an43/oa2na/seg17/ rp11 /v cmpst3 /dmh/int0/cn49/rd0 h9 v usb3v3 d10 n/c h10 d+/cn72/rg2 d11 an41/c3ind/seg15/pma15/cs2/cn55/rd10 h11 seg55/scl2/cn35/ra2 legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions. note 1: alternate pin assignments for the external comparator voltage references as determined by the altcvref configuration bit. 2: alternate pin assignments for the external a/d voltage references as determined by the altadref configuration bit. 3: alternate pin assignments for i2c2 as determined by the i2c2sel configuration bit.
PIC24FJ128GC010 family ds30009312b-page 10 ? 2012-2013 microchip technology inc. j1 an3/oa2out/c2ina/seg4/vpio/cn5/rb3 k7 an14/oa2ne/seg8/ rp14 /cted5/ctpls/pma1/cn32/rb14 j2 an2/oa2nc/ctcmp/c2inb/seg5/ rp13 /t4ck/vmio/ cted13/cn4/rb2 k8 v dd j3 pged2/an7/com6/seg30/ rp7 /cn25/rb7 k9 an29/seg39/ rp5 /cn21/rd15 j4 av dd k10 an30/seg12/ rp16 /usbid/pma12/cn71/rf3 j5 sv dd k11 an31/seg40/ rp30 /cn70/rf2 j6 tck/an26/seg31/cn34/ra1 l1 pgec2/an6/oa1pd/ rp6 /lcdbias3/cn24/rb6 j7 an12/com5/seg18/t1ck/cted2/pma11/cn30/rb12 l2 cv ref - ( 1 ) /av ref - ( 2 ) /seg36/pma7/cn41/ra9 j8 n/c l3 av ss j9 n/c l4 ch0+ j10 an32/seg41/ rp15 /cn74/rf8 l5 ch1-/ch1se/sv ref - j11 d-/cn73/rg3 l6 an27/seg53/ rp31 /cn76/rf13 k1 pgec1/cv ref -/av ref -/an1/oa2pb/seg6/ rp1 /cted12/ cn3/rb1 l7 an13/oa2pd/seg19/dac2/cted1/pma10/cn31/rb13 k2 pged1/cv ref +/av ref +/dv ref +/bgbuf1/an0/seg7/ rp0 / cn2/rb0 l8 an15/seg9/ rp29 /t2ck/refo/cted6/pma0/cn12/rb15 k3 cv ref + ( 1 ) /av ref + ( 2 ) /seg37/pma6/cn42/ra10 l9 an28/seg38/ rpi43 /cn20/rd14 k4 sv ss l10 an11/oa2nd/seg10/ rp10 /sda2 ( 3 ) /t3ck/pma9/cn17/rf4 k5 ch1+/sv ref +l11cv ref /an10/oa2pc/seg11/ rp17 /scl2 ( 3 ) /pma8/cn18/rf5 k6 seg54/ rpi32 /cted7/pma18/cn75/rf12 table 3: complete pin funct ion descriptions for 121- pin devices (continued) pinfunctionpinfunction legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions. note 1: alternate pin assignments for the external comparator voltage references as determined by the altcvref configuration bit. 2: alternate pin assignments for the external a/d voltage references as determined by the altadref configuration bit. 3: alternate pin assignments for i2c2 as determined by the i2c2sel configuration bit.
? 2012-2013 microchip technology inc. ds30009312b-page 11 PIC24FJ128GC010 family table of contents 1.0 device overview ............................................................................................................. ........................................................... 13 2.0 guidelines for getting started with 16-bit microcontrollers................................................................. ....................................... 33 3.0 cpu ........................................................................................................................ ................................................................... 39 4.0 memory organization ......................................................................................................... ........................................................ 45 5.0 direct memory access controller (dma) ....................................................................................... ............................................ 83 6.0 flash program memory........................................................................................................ ...................................................... 91 7.0 resets ...................................................................................................................... .................................................................. 97 8.0 interrupt controller ........................................................................................................ ........................................................... 103 9.0 oscillator configuration ..................................... ............................................................... ........................................................ 159 10.0 power-saving features...................................................................................................... ...................................................... 171 11.0 i/o ports .................................................................................................................. ................................................................. 183 12.0 timer1 ..................................................................................................................... ................................................................. 215 13.0 timer2/3 and timer4/5 ..................................................................................................... ....................................................... 217 14.0 input capture with dedicated timers ........................................................................................ ............................................... 223 15.0 output compare with dedicated timers ....................................................................................... ........................................... 227 16.0 serial peripheral interface (spi).......................................................................................... ..................................................... 237 17.0 inter-integrated circuit? (i 2 c?)............................................................................................................................ .................. 249 18.0 universal asynchronous receiver transmitter (uart) ......................................................................... .................................. 257 19.0 universal serial bus with on-the-go support (usb otg) ...................................................................... ............................... 265 20.0 data signal modulator...................................................................................................... ........................................................ 299 21.0 enhanced parallel master port (epmp) ....................................................................................... ............................................ 303 22.0 liquid crystal display (lcd) controller.................................................................................... ................................................ 315 23.0 real-time clock and calendar (rtcc) ....................................................................................... ........................................... 323 24.0 32-bit programmable cyclic redundancy che ck (crc) generator ................................................................ ........................ 335 25.0 overview of advanced analog features ....................................................................................... ........................................... 341 26.0 12-bit high-speed, pipeline a/d converter .................................................................................. ........................................... 347 27.0 16-bit sigma-delta analog-to-digital (a/d) converter ....................................................................... ...................................... 369 28.0 10-bit digital-to-analog converter (dac)................................................................................... .............................................. 375 29.0 dual operational amplifier module.......................................................................................... ................................................. 377 30.0 triple comparator module................................................................................................... ..................................................... 381 31.0 comparator voltage reference............................................................................................... ................................................. 387 32.0 charge time measurement unit (ctmu) ........................................................................................ ........................................ 389 33.0 high/low-voltage detect (hlvd)............................................................................................. ................................................ 397 34.0 special features ........................................................................................................... ........................................................... 399 35.0 development support........................................................................................................ ....................................................... 413 36.0 instruction set summary .................................................................................................... ...................................................... 417 37.0 electrical characteristics ................................................................................................. ......................................................... 425 38.0 packaging information...................................................................................................... ........................................................ 447 appendix a: revision history................................................................................................... .......................................................... 459 index .......................................................................................................................... ........................................................................ 461 the microchip web site ......................................................................................................... ............................................................ 467 customer change notification service ........................................................................................... ................................................... 467 customer support............................................................................................................... ............................................................... 467 reader response ................................................................................................................ .............................................................. 468 product identification system .................................................................................................. .......................................................... 469
PIC24FJ128GC010 family ds30009312b-page 12 ? 2012-2013 microchip technology inc. to our valued customers it is our intention to provide our valued customers with the best 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 regar ding 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 particul ar 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 spec ify which device, revision 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.
? 2012-2013 microchip technology inc. ds30009312b-page 13 PIC24FJ128GC010 family 1.0 device overview this document contains device-specific information for the following devices: the PIC24FJ128GC010 family expands the capabilities of the pic24f family by adding a complete selection of advanced analog peripherals to its existing digital fea- tures. this combination, along with its ultra low-power features, direct memory access (dma) for peripherals, usb on-the-go (otg) and a built-in lcd controller and driver, makes this family the new standard for mixed-signal pic ? microcontrollers in one economical and power-saving package. 1.1 core features 1.1.1 16-bit architecture central to all pic24f devices is the 16-bit modified harvard architecture, first introduced with microchip?s dspic ? digital signal controllers (dscs). the pic24f cpu core offers a wide range of enhancements, such as: ? 16-bit data and 24-bit address paths with the ability to move information between data and memory spaces ? linear addressing of up to 12 mbytes (program space) and 32 kbytes (data) ? a 16-element working register array with built-in software stack support ? a 17 x 17 hardware multiplier with support for integer math ? hardware support for 32 by 16-bit division ? an instruction set that supports multiple addressing modes and is optimized for high-level languages, such as ?c? ? operational performance up to 16 mips 1.1.2 xlp power-saving technology the PIC24FJ128GC010 family of devices introduces a greatly expanded range of power-saving operating modes for the ultimate in power conservation. the new modes include: ? retention sleep, with essential circuits being powered from a separate low-voltage regulator ? retention deep sleep, a lower power mode that maintains data ram for fast start-up ? deep sleep without rtcc, for the lowest possible power consumption under software control ?v bat mode (with or without rtcc), to continue limited operation from a backup battery when v dd is removed many of these new low-power modes also support the continuous operation of the low-power, on-chip real-time clock/calendar (rtcc), making it possible for an application to keep time while the device is otherwise asleep. aside from these new features, PIC24FJ128GC010 family devices also include all of the legacy power-saving features of previous pic24f microcontrollers, such as: ? on-the-fly clock switching, allowing the selection of a lower power clock during run time ? doze mode operation, for maintaining peripheral clock speed while slowing the cpu clock ? instruction-based power-saving modes, for quick invocation of idle and the many sleep modes. 1.1.3 oscillator options and features all of the devices in the PIC24FJ128GC010 family offer five different oscillator options, allowing users a range of choices in developing application hardware. these include: ? two crystal modes ? two external clock modes ? a phase lock loop (pll) frequency multiplier, which allows clock speeds of up to 32 mhz ? a fast internal oscillator (frc) ? nominal 8 mhz output, with multiple frequency divider options and automatic frequency self-calibration during run time ? a separate low-power internal rc oscillator (lprc) ? 31 khz nominal, for low-power, timing-insensitive applications. the internal oscillator block also provides a stable reference source for the fail-safe clock monitor (fscm). this option constantly monitors the main clock source against a reference signal provided by the inter- nal oscillator and enables the controller to switch to the internal oscillator, allowing for continued low-speed operation or a safe application shutdown. 1.1.4 easy migration regardless of the memory size, all devices share the same rich set of peripherals, allowing for a smooth migration path as applications grow and evolve. this extends the ability of applications to grow from the relatively simple, to the powerful and complex, while still selecting a microchip device. ? pic24fj64gc006 ? pic24fj128gc006 ? pic24fj64gc010 ? PIC24FJ128GC010
PIC24FJ128GC010 family ds30009312b-page 14 ? 2012-2013 microchip technology inc. 1.2 advanced analog features the centerpiece of the PIC24FJ128GC010 family is the advanced analog block. this feature set provides appli- cation developers with all the tools they need for single chip applications that demand high analog performance. included in the advanced analog block are: ? a new 12-bit, pipelined a/d converter (a/d) module. a major departure from previous pic24f a/d converters, this module offers up to 50 single-ended input channels (or up to 25 differ- ential channel pairs) and conversion rates of up to ten million samples per second. it also provides a wider range of new features that allow the con- verter to assess and make decisions on incoming data without cpu intervention. ? a dual differential channel, sigma-delta a/d con- verter, for applications requiring high-precision conversions (up to 16-bit resolution). the sigma-delta converter also offers programmable gain on each channel pair, and user-configurable data rate, between 976 samples per second and 62.5 ksps. ? two independent, 10-bit digital-to-analog converters (dacs), each capable of conversion rates up to one million samples per second. ? a comparator module with three analog compara- tors that are configurable for a wide range of operations. the comparators also have their own independent, configurable voltage reference. ? a dual operational amplifier module with multiple input options, selectable power modes, and rail-to-rail operation on the inputs and outputs. each of the op amps can also be configured to function as a comparator, complete with interrupt generation. ? a dedicated, integrated band gap voltage refer- ence for all analog modules, providing a range of on-chip reference voltages and two buffered reference outputs. ? flexible multiplexing options for the entire analog block, allowing for the convenient sharing of signals between the analog modules. 1.3 dma controller PIC24FJ128GC010 family devices also add a direct memory access (dma) controller to the existing pic24f architecture. the dma acts in concert with the cpu, allowing data to move between data memory and peripherals without the intervention of the cpu, increasing data throughput, and decreasing execution time overhead. six independently programmable chan- nels make it possible to service multiple peripherals at virtually the same time, with each channel peripheral performing a different operation. many types of data transfer operations are supported. 1.4 usb on-the-go (otg) usb on-the-go provides on-chip functionality as a target device compatible with the usb 2.0 standard, as well as limited stand-alone functionality as a usb embedded host. by implementing usb host negotia- tion protocol (hnp), the module can also dynamically switch between device and host operation, allowing for a much wider range of versatile usb-enabled applications on a microcontroller platform. PIC24FJ128GC010 family devices also incorporate an integrated usb transceiver and precision oscillator, minimizing the required complexity of implementing a complete usb device, embedded host, dual role or on-the-go application. 1.5 lcd controller with the PIC24FJ128GC010 family of devices, microchip introduces its versatile liquid crystal display (lcd) controller and driver to the pic24f family. the on-chip lcd driver includes many features that make the integration of displays in low-power applications easier. these include an integrated voltage regulator with charge pump and an integrated internal resistor ladder that allows contrast control in software, and display operation above device v dd .
? 2012-2013 microchip technology inc. ds30009312b-page 15 PIC24FJ128GC010 family 1.6 other special features ? peripheral pin select (pps): the peripheral pin select feature allows most digital peripherals to be mapped over a fixed set of digital i/o pins. users may independently map the input and/or output of any one of the many digital peripherals to any one of the i/o pins. ? communications: the PIC24FJ128GC010 family incorporates several different serial communication peripherals to handle a range of application requirements. there are two indepen- dent i 2 c? modules that support both master and slave modes of operation. devices also have, through the pps feature, four independent uarts with built-in irda ? encoders/decoders and two spi modules. ? ctmu interface: in addition to their other analog features, members of the PIC24FJ128GC010 family include the ctmu interface module. this provides a convenient method for precision time measurement and pulse generation, and can serve as an interface for capacitive sensors. ? enhanced parallel master/parallel slave port: this module allows rapid and transparent access to the microcontroller data bus, and enables the cpu to directly address external data memory. the parallel port can function in master or slave mode, accommodating data widths of 4, 8 or 16 bits, and address widths of up to 23 bits in master modes. ? real-time clock and calendar (rtcc): this module implements a full-featured clock and calendar with alarm functions in hardware, freeing up timer resources and program memory space for use of the core application. ? data signal modulator (dsm): the data signal modulator (dsm) allows the user to mix a digital data stream (the ?modulator signal?) with a carrier signal to produce a modulated output. 1.7 details on individual family members devices in the PIC24FJ128GC010 family are available in 64-pin and 100/121-pin packages. the general block diagram for all devices is shown in figure 1-1 . the devices are differentiated from each other in six ways: 1. flash program memory (64 kbytes for pic24fj64gc0xx devices and 128 kbytes for pic24fj128gc0xx devices). 2. available i/o pins and ports (53 pins on 6 ports for 64-pin devices and 85 pins on 7 ports for 100/121-pin devices). 3. available interrupt-on-change notification (icn) inputs (52 on 64-pin devices and 82 on 100/121-pin devices). 4. available remappable pins (29 pins on 64-pin devices and 44 pins on 100/121-pin devices). 5. maximum available drivable lcd pixels (196 for 64-pin devices and 472 on 100/121-pin devices.) 6. analog input channels for the pipeline a/d converter (29 channels for 64-pin devices and 50 channels for 100/121-pin devices). all other features for devices in this family are identical. these are summarized in ta b l e 1 - 1 and tab l e 1 - 2 . a list of pin features available on the PIC24FJ128GC010 family devices, sorted by function, is shown in tab le 1 - 3 . note that this table shows the pin location of individual peripheral features and not how they are multiplexed on the same pin. this information is provided in the pinout diagrams in the beginning of the data sheet. multiplexed features are sorted by the priority given to a feature, with the highest priority peripheral being listed first.
PIC24FJ128GC010 family ds30009312b-page 16 ? 2012-2013 microchip technology inc. table 1-1: device features for the PIC24FJ128GC010 family: 64-pin features pic24fj64gc006 pic24fj128gc006 operating frequency dc ? 32 mhz program memory (bytes) 64k 128k program memory (instructions) 22,016 44,032 data memory (bytes) 8k interrupt sources (soft vectors/ nmi traps) 65 (61/4) i/o ports ports b, c, d, e, f, g total i/o pins 53 remappable pins 30 (29 i/o, 1 input only) timers: total number (16-bit) 5 ( 1 ) 32-bit (from paired 16-bit timers) 2 input capture w/timer channels 9 ( 1 ) output compare/pwm channels 9 ( 1 ) input change notification interrupt 52 serial communications: uart 4 ( 1 ) spi (3-wire/4-wire) 2 ( 1 ) i 2 c? 2 digital signal modulator yes parallel communications (epmp/psp) yes jtag boundary scan yes 12-bit pipeline analog-to-digital converter (a/d) (input channels) 29 sigma-delta analog-to-digital converter (a/d) (differential channels) 2 digital-to-analog converter (dac) 2 operational amplifiers 2 analog comparators 3 ctmu interface yes lcd controller (available pixels) 196 (28 seg x 7 com) resets (and delays) core por, v dd por, v bat por, bor, reset instruction, mclr , wdt, illegal opcode, repeat instruction, hardware traps, configuration word mismatch (ost, pll lock) instruction set 76 base instructions, multiple addressing mode variations packages 64-pin tqfp and qfn note 1: peripherals are accessible through remappable pins.
? 2012-2013 microchip technology inc. ds30009312b-page 17 PIC24FJ128GC010 family table 1-2: device features for the pic 24fj128gc010 family: 100/121-pin devices features pic24fj64gc010 PIC24FJ128GC010 operating frequency dc ? 32 mhz program memory (bytes) 64k 128k program memory (instructions) 22,016 44,032 data memory (bytes) 8k interrupt sources (soft vectors/ nmi traps) 66 (62/4) i/o ports ports a, b, c, d, e, f, g to t a l i / o p i n s 8 5 remappable pins 44 (32 i/o, 12 input only) timers: total number (16-bit) 5 ( 1 ) 32-bit (from paired 16-bit timers) 2 input capture w/timer channels 9 ( 1 ) output compare/pwm channels 9 ( 1 ) input change notification interrupt 82 serial communications: uart 4 ( 1 ) spi (3-wire/4-wire) 2 ( 1 ) i 2 c? 2 digital signal modulator yes parallel communications (epmp/psp) yes jtag boundary scan yes 12-bit pipeline analog-to-digital converter (a/d) (input channels) 50 sigma-delta analog-to-digital converter (a/d) (differential channels) 2 digital-to-analog converter (dac) 2 operational amplifiers 2 analog comparators 3 ctmu interface yes lcd controller (available pixels) 472 (59 seg x 8 com) resets (and delays) core por, v dd por, v bat por, bor, reset instruction, mclr , wdt, illegal opcode, repeat instruction, hardware traps, configuration word mismatch (ost, pll lock) instruction set 76 base instructions, multiple addressing mode variations packages 100-pin tqfp and 121-pin bga note 1: peripherals are accessible through remappable pins.
PIC24FJ128GC010 family ds30009312b-page 18 ? 2012-2013 microchip technology inc. figure 1-1: PIC24FJ128GC010 fa mily general block diagram instruction decode and control 16 pch 16 program counter 23 24 data bus inst register 16 divide support inst latch 16 16 16 8 interrupt controller eds and stack control logic repeat control logic data latch data ram address latch address latch extended data data latch 16 address bus literal 23 control signals 16 16 16 x 16 w reg array multiplier 17x17 osci/clki osco/clko v dd , v ss timing generation mclr power-up timer oscillator start-up timer power-on reset watchdog timer hlvd & bor precision references band gap frc/lprc oscillators regulators voltage v cap porta (1) portc (1) (12 i/o) (8 i/o) portb (16 i/o) note 1: not all i/o pins or features are implemented on all device pinout configurations. see ta b l e 1 - 3 for specific implementations by pin count . 2: these peripheral i/os are only accessible through remappable pins. portd (1) (16 i/o) comparators (2) timers timer1 ic a/d 12-bit oc/pwm spi epmp/psp 1-9 (2) icns (1) uart refo porte (1) portg (1) (10 i/o) (12 i/o) portf (1) (10 i/o) 1/2 (2) 1/2 1/2/3/4 (2) 1-9 (2) ctmu lcd driver space program memory/ dma controller data dma data bus 16 ta b l e d a t a access control v bat pipeline a/d ??? 2/3 & 4/5 (2) rtcc dsm dacs op amps usb otg bgbuf1 bgbuf2 10-bit 16-bit read agu write agu i 2 c ? pcl ea mux 16-bit alu
? 2012-2013 microchip technology inc. ds30009312b-page 19 PIC24FJ128GC010 family table 1-3: PIC24FJ128GC010 fa mily pinout description pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga an0 16 25 k2 i ana 12-bit pipeline a/d converter inputs. an1 15 24 k1 i ana an2 14 23 j2 i ana an3 13 22 j1 i ana an4 12 21 h2 i ana an5 11 20 h1 i ana an6 17 26 l1 i ana an7 18 27 j3 i ana an8 ? 6 d1 i ana an9 ? 8 e2 i ana an10 32 50 l11 i ana an11 31 49 l10 i ana an12 27 41 j7 i ana an13 28 42 l7 i ana an14 29 43 k7 i ana an15 30 44 l8 i ana an16 ? 9 e1 i ana an17 4 10 e3 i ana an18 5 11 f4 i ana an19 6 12 f2 i ana an20 55 84 c7 i ana an21 ? 19 g2 i ana an22 ? 92 b5 i ana an23 ? 91 c5 i ana an24 43 69 e10 i ana an25 50 77 a10 i ana an26 ? 38 j6 i ana an27 ? 39 l6 i ana an28 ? 47 l9 i ana an29 ? 48 k9 i ana an30 33 51 k10 i ana an31 ? 52 k11 i ana an32 ? 53 j10 i ana an33 ? 1 b2 i ana an34 54 83 d7 i ana an35 49 76 a11 i ana an36 ? 60 g11 i ana an37 ? 61 g9 i ana an38 ? 66 e11 i ana an39 ? 67 e8 i ana an40 42 68 e9 i ana legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
PIC24FJ128GC010 family ds30009312b-page 20 ? 2012-2013 microchip technology inc. an41 44 70 d11 i ana 12-bit pipeline a/d converter inputs. an42 45 71 c11 i ana an43 46 72 d9 i ana an44 51 78 b9 i ana an45 ? 79 a9 i ana an46 ? 80 d8 i ana an47 52 81 c8 i ana an48 53 82 b8 i ana an49 8 14 f3 i ana av dd 19 30 j4 p ? positive supply for analog modules. av ref + 16 25, 29 k2, k3 i ana pipeline a/d reference voltage (high) input. av ref - 15 24, 28 k1, l2 i ana pipeline a/d reference voltage (low) input. avss 20 31 l3 p ? ground reference for analog modules. bgbuf1 16 25 k2 o ? buffered band gap reference 1 voltage output. bgbuf2 4 10 e3 o ? buffered band gap reference 2 voltage output. c1ina 11 20 h1 i ana comparator 1 input a. c1inb 12 21 h2 i ana comparator 1 input b. c1inc 5 11 f4 i ana comparator 1 input c. c1ind 4 10 e3 i ana comparator 1 input d. c2ina 13 22 j1 i ana comparator 2 input a. c2inb 14 23 j2 i ana comparator 2 input b. c2inc 8 14 f3 i ana comparator 2 input c. c2ind 6 12 f2 i ana comparator 2 input d. c3ina 55 84 c7 i ana comparator 3 input a. c3inb 54 83 d7 i ana comparator 3 input b. c3inc 45 71 c11 i ana comparator 3 input c. c3ind 44 70 d11 i ana comparator 3 input d. ch0+ 22 33 l4 i ana sigma-delta a/d converter channel 0 non-inverting analog input. ch0- 23 34 h5 i ana sigma-delta a/d converter channel 0 inverting analog input. ch1+ 24 35 k5 i ana sigma-delta a/d converter channel 1 non-inverting analog input. ch1- 25 36 l5 i ana sigma-delta a/d converter channel 1 inverting analog input. clki 39 63 f9 i ana main clock input connection. clko 40 64 f11 o ? system clock output. table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
? 2012-2013 microchip technology inc. ds30009312b-page 21 PIC24FJ128GC010 family cn2 16 25 k2 i st interrupt-on-change inputs. cn3 15 24 k1 i st cn4 14 23 j2 i st cn5 13 22 j1 i st cn6 12 21 h2 i st cn7 11 20 h1 i st cn8 4 10 e3 i st cn9 5 11 f4 i st cn10 6 12 f2 i st cn11 8 14 f3 i st cn12 30 44 l8 i st cn13 52 81 c8 i st cn14 53 82 b8 i st cn15 54 83 d7 i st cn16 55 84 c7 i st cn17 31 49 l10 i st cn18 32 50 l11 i st cn19 ? 80 d8 i st cn20 ? 47 l9 i st cn21 ? 48 k9 i st cn22 40 64 f11 i st cn23 39 63 f9 i st cn24 17 26 l1 i st cn25 18 27 j3 i st cn30 27 41 j7 i st cn31 28 42 l7 i st cn32 29 43 k7 i st cn33 ? 17 g3 i st cn34 ? 38 j6 i st cn35 ? 58 h11 i st cn36 ? 59 g10 i st cn37 ? 60 g11 i st cn38 ? 61 g9 i st cn39 ? 91 c5 i st cn40 ? 92 b5 i st cn41 ? 28 l2 i st cn42 ? 29 k3 i st cn43 ? 66 e11 i st cn44 ? 67 e8 i st cn45 ? 6 d1 i st cn46 ? 7 e4 i st cn47 ? 8 l11 i st cn48 ? 9 e1 i st cn49 46 72 d9 i st table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
PIC24FJ128GC010 family ds30009312b-page 22 ? 2012-2013 microchip technology inc. cn50 49 76 a11 i st interrupt-on-change inputs. cn51 50 77 a10 i st cn52 51 78 b9 i st cn53 42 68 e9 i st cn54 43 69 e10 i st cn55 44 70 d11 i st cn56 45 71 c11 i st cn57 ? 79 a9 i st cn58 60 93 a4 i st cn59 61 94 b4 i st cn60 62 98 b3 i st cn61 63 99 a2 i st cn62 64 100 a1 i st cn63 1 3 d3 i st cn64 2 4 c1 i st cn65 3 5 d2 i st cn66 ? 18 g1 i st cn67 ? 19 g2 i st cn68 58 87 b6 i st cn69 59 88 a6 i st cn70 ? 52 k11 i st cn71 33 51 k10 i st cn72 37 57 h10 i st cn73 36 56 j11 i st cn74 ? 53 j10 i st cn75 ? 40 k6 i st cn76 ? 39 l6 i st cn77 ? 90 a5 i st cn78 ? 89 e6 i st cn79 ? 96 c3 i st cn80 ? 97 a3 i st cn81 ? 95 c4 i st cn82 ? 1 b2 i st cn83 34 54 h8 i st com0 63 99 a2 o ? lcd driver common outputs. com1 62 98 b3 o ? com2 61 94 b4 o ? com3 60 93 a4 o ? com4 59 88 a6 o ? com5 27 41 j7 o ? com6 18 27 j3 o ? com7 58 87 b6 o ? table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
? 2012-2013 microchip technology inc. ds30009312b-page 23 PIC24FJ128GC010 family cs1 45 71 c11 i/o st/ttl parallel master port chip select 1 strobe (shared with pma14). cs2 44 70 d11 o ? parallel master port chip select 2 strobe (shared with pma15). ctcmp 14 23 j2 i ana ctmu comparator 2 input (pulse mode). cted0 ? 17 g3 i ana ctmu external edge inputs. cted1 28 42 l7 i ana cted2 27 41 j7 i ana cted3 ? 1 b2 i ana cted4 1 3 d3 i ana cted5 29 43 k7 i ana cted6 30 44 l8 i ana cted7 ? 40 k6 i ana cted8 64 100 a1 i ana cted9 63 99 a2 i ana cted10 ? 97 a3 i ana cted11 ? 95 c4 i ana cted12 15 24 k1 i ana cted13 14 23 j2 i ana ctpls 29 43 k7 o ? ctmu pulse output. cv ref 32 50 l11 o ? comparator voltage reference output. cv ref + 16 25, 29 k2, k3 i ana comparator reference voltage (high) input. cv ref - 15 24, 28 k1, l2 i ana comparator reference voltage (low) input. d+ 37 57 h10 i/o ? usb differential plus line (internal transceiver). d- 36 56 j11 i/o ? usb differential minus line (internal transceiver). dac1 8 14 f3 o ? dac converter 1 analog output. dac2 28 42 l7 o ? dac converter 2 analog output. dmh 46 72 d9 o ? d- external pull-up control output. dmln 42 68 e9 o ? d- external pull-down control output. dph 50 77 a10 o ? d+ external pull-up control output. dpln 43 69 e10 o ? d+ external pull-down control output. dv ref + 16 25 k2 i ana dac positive reference input. int0 46 72 d9 i st external interrupt input 0. lcdbias0 3 5 d2 i ana bias inputs for lcd driver charge pump. lcdbias1 2 4 c1 i ana lcdbias2 1 3 d3 i ana lcdbias3 17 26 l1 i ana hlvdin 64 100 a1 i ana high/low-voltage detect input. mclr 7 13 f1 i st master clear (device reset) input. this line is brought low to cause a reset. octrig1 42 68 e9 i st output compare external trigger 1 input. octrig2 ? 66 e11 i st output compare external trigger 2 input. table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
PIC24FJ128GC010 family ds30009312b-page 24 ? 2012-2013 microchip technology inc. oa1na 12 21 h2 i ana op amp 1 negative (inverting) inputs. oa1nb 53 82 b8 i ana oa1nc ? 8 e2 i ana oa1nd 6 12 f2 i ana oa1ne 5 11 f4 i ana oa1out 11 20 h1 o ? op amp 1 (analog) output (digital output in comparator mode). oa1pa 8 14 f3 i ana op amp 1 positive (non-inverting) inputs. oa1pb 4 10 e3 i ana oa1pc 54 83 d7 i ana oa1pd 17 26 l1 i ana oa1pe 52 81 c8 i ana oa2na 46 72 d9 i ana op amp 2 negative (inverting) inputs. oa2nb 50 77 a10 i ana oa2nc 14 23 j2 i ana oa2nd 31 49 l10 i ana oa2ne 29 43 k7 i ana oa2out 13 22 j1 o ? op amp 2 (analog) output (digital output in comparator mode). oa2pa 45 71 c11 i ana op amp 2 positive (non-inverting) inputs. oa2pb 15 24 k1 i ana oa2pc 32 50 l11 i ana oa2pd 28 42 l7 i ana oa2pe 51 78 b9 i ana osci 39 63 f9 i ana main oscillator input connection. osco 40 64 f11 o ? main oscillator output connection. pgec1 15 24 k1 i/o st in-circuit debugger/emulator/icsp? programming clock. pgec2 17 26 l1 i/o st pgec3 11 20 h1 i/o st pged1 16 25 k2 i/o st in-circuit debugger/emulator/icsp programming data. pged2 18 27 j3 i/o st pged3 12 21 h2 i/o st pma0 30 44 l8 i/o st parallel master port address bit 0 input (buffered slave modes) and output (master modes). pma1 29 43 k7 i/o st parallel master port address bit 1 input (buffered slave modes) and output (master modes). pma2 8 14 f3 o ? parallel master port address (bits<22:2>). pma3 6 12 f2 o ? pma4 5 11 f4 o ? pma5 4 10 e3 o ? pma6 16 29 k3 o ? pma7 14 28 l2 o ? table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
? 2012-2013 microchip technology inc. ds30009312b-page 25 PIC24FJ128GC010 family pma8 32 50 l11 o ? parallel master port address (bits<22:2>). pma9 31 49 l10 o ? pma10 28 42 l7 o ? pma11 27 41 j7 o ? pma12 33 51 k10 o ? pma13 42 68 e9 o ? pma14 45 71 c11 o ? pma15 44 70 d11 o ? pma16 ? 95 c4 o ? pma17 ? 92 b5 o ? pma18 ? 40 k6 o ? pma19 ? 19 g2 o ? pma20 ? 59 g10 o ? pma21 ? 60 g11 o ? pma22 ? 66 e11 o ? pmack1 50 77 a10 i st/ttl parallel master port acknowledge input 1. pmack2 43 69 e10 i st/ttl parallel master port acknowledge input 2. pmbe0 51 78 b9 o ? parallel master port byte enable 0 strobe. pmbe1 ? 67 e8 o ? parallel master port byte enable 1 strobe. pmcs1 ? 18 g1 i/o st/ttl parallel master port chip select 1 strobe. pmcs2 ? 9 k10 o ? parallel master port chip select 2 strobe. pmd0 60 93 a4 i/o st/ttl parallel master port data (demultiplexed master mode) or address/data (multiplexed master modes). pmd1 61 94 b4 i/o st/ttl pmd2 62 98 b3 i/o st/ttl pmd3 63 99 a2 i/o st/ttl pmd4 64 100 a1 i/o st/ttl pmd5 1 3 d3 i/o st/ttl pmd6 2 4 c1 i/o st/ttl pmd7 3 5 d2 i/o st/ttl pmd8 ? 90 a5 i/o st/ttl pmd9 ? 89 e6 i/o st/ttl pmd10 ? 88 a6 i/o st/ttl pmd11 ? 87 b6 i/o st/ttl pmd12 ? 79 a9 i/o st/ttl pmd13 ? 80 d8 i/o st/ttl pmd14 ? 83 d7 i/o st/ttl pmd15 ? 84 c7 i/o st/ttl pmrd 53 82 b8 o ? parallel master port read strobe. pmwr 52 81 c8 o ? parallel master port write strobe. table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
PIC24FJ128GC010 family ds30009312b-page 26 ? 2012-2013 microchip technology inc. ra0 ? 17 g3 i/o st porta digital i/o. ra1 ? 38 j6 i/o st ra2 ? 58 h11 i/o st ra3 ? 59 g10 i/o st ra4 ? 60 g11 i/o st ra5 ? 61 g9 i/o st ra6 ? 91 c5 i/o st ra7 ? 92 b5 i/o st ra9 ? 28 l2 i/o st ra10 ? 29 k3 i/o st ra14 ? 66 e11 i/o st ra15 ? 67 e8 i/o st rb0 16 25 k2 i/o st portb digital i/o. rb1 15 24 k1 i/o st rb2 14 23 j2 i/o st rb3 13 22 j1 i/o st rb4 12 21 h2 i/o st rb5 11 20 h1 i/o st rb6 17 26 l1 i/o st rb7 18 27 j3 i/o st rb12 27 41 j7 i/o st rb13 28 42 l7 i/o st rb14 29 43 k7 i/o st rb15 30 44 l8 i/o st rc1 ? 6 d1 i/o st portc digital i/o. rc2 ? 7 e4 i/o st rc3 ? 8 e2 i/o st rc4 ? 9 e1 i/o st rc12 39 63 f9 i/o st rc13 47 73 c10 i st rc14 48 74 b11 i st rc15 40 64 f11 i/o st table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
? 2012-2013 microchip technology inc. ds30009312b-page 27 PIC24FJ128GC010 family rd0 46 72 d9 i/o st portd digital i/o. rd1 49 76 a11 i/o st rd2 50 77 a10 i/o st rd3 51 78 b9 i/o st rd4 52 81 c8 i/o st rd5 53 82 b8 i/o st rd6 54 83 d7 i/o st rd7 55 84 c7 i/o st rd8 42 68 e9 i/o st rd9 43 69 e10 i/o st rd10 44 70 d11 i/o st rd11 45 71 c11 i/o st rd12 ? 79 a9 i/o st rd13 ? 80 d8 i/o st rd14 ? 47 l9 i/o st rd15 ? 48 k9 i/o st re0 60 93 a4 i/o st porte digital i/o. re1 61 94 b4 i/o st re2 62 98 b3 i/o st re3 63 99 a2 i/o st re4 64 100 a1 i/o st re5 1 3 d3 i/o st re6 2 4 c1 i/o st re7 3 5 d2 i/o st re8 ? 18 g1 i/o st re9 ? 19 g2 i/o st refo 30 44 l8 o ? reference clock output. rf0 58 87 b6 i/o st portf digital i/o. rf1 59 88 a6 i/o st rf2 ? 52 k11 i/o st rf3 33 51 k10 i/o st rf4 31 49 l10 i/o st rf5 32 50 l11 i/o st rf7 34 54 h8 i/o st rf8 ? 53 j10 i/o st rf12 ? 40 k6 i/o st rf13 ? 39 l6 i/o st table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
PIC24FJ128GC010 family ds30009312b-page 28 ? 2012-2013 microchip technology inc. rg0 ? 90 a5 i/o st portg digital i/o. rg1 ? 89 e6 i/o st rg2 37 57 h10 i/o st rg3 36 56 j11 i/o st rg6 4 10 e3 i/o st rg7 5 11 f4 i/o st rg8 6 12 f2 i/o st rg9 8 14 f3 i/o st rg12 ? 96 c3 i/o st rg13 ? 97 a3 i/o st rg14 ? 95 c4 i/o st rg15 ? 1 b2 i/o st rp0 16 25 k2 i/o st remappable peripheral (input or output). rp1 15 24 k1 i/o st rp2 42 68 e9 i/o st rp4 43 69 e10 i/o st rp5 ? 48 k9 i/o st rp6 17 26 l1 i/o st rp7 18 27 j3 i/o st rp10 31 49 l10 i/o st rp11 46 72 d9 i/o st rp12 45 71 c11 i/o st rp13 14 23 j2 i/o st rp14 29 43 k7 i/o st rp15 ? 53 j10 i/o st rp16 33 51 k10 i/o st rp17 32 50 l11 i/o st rp18 11 20 h1 i/o st rp19 6 12 f2 i/o st rp20 53 82 b8 i/o st rp21 4 10 e3 i/o st rp22 51 78 b9 i/o st rp23 50 77 a10 i/o st rp24 49 76 a11 i/o st rp25 52 81 c8 i/o st rp26 5 11f4i/ost rp27 8 14 f3 i/o st rp28 12 21 h2 i/o st rp29 30 44 l8 i/o st rp30 ? 52 k11 i/o st rp31 ? 39 l6 i/o st table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
? 2012-2013 microchip technology inc. ds30009312b-page 29 PIC24FJ128GC010 family rpi32 ? 40 k6 i st remappable peripheral (input only). rpi33 ? 18 g1 i st rpi34 ? 19 g2 i st rpi35 ? 67 e8 i st rpi36 ? 66 e11 i st rpi37 48 74 b11 i st rpi38 ? 6 d1 i st rpi39 ? 7 e4 i st rpi40 ? 8 e2 i st rpi41 ? 9 e1 i st rpi42 ? 79 a9 i st rpi43 ? 47 l9 i st rtcc 42 68 e9 o ? real-time clock alarm/seconds pulse output. scl1 44 66 e11 i/o i 2 c i2c1 synchronous serial clock input/output. scl2 32 50, 58 h11, l11 i/o i 2 c i2c2 synchronous serial clock input/output. sclki 48 74 b11 i st secondary oscillator digital clock input. sda1 43 67 e8 i/o i 2 c i2c1 data input/output. sda2 31 49, 59 g10, l10 i/o i 2 c i2c2 data input/output. seg0 4 10 e3 o ? lcd driver segment outputs. seg1 8 14 f3 o ? seg2 11 20 h1 o ? seg3 12 21 h2 o ? seg4 13 22 j1 o ? seg5 14 23 j2 o ? seg6 15 24 k1 o ? seg7 16 25 k2 o ? seg8 29 43 k7 o ? seg9 30 44 l8 o ? seg10 31 49 l10 o ? seg11 32 50 l11 o ? seg12 33 51 k10 o ? seg13 42 68 e9 o ? seg14 43 69 e10 o ? seg15 44 70 d11 o ? seg16 45 71 c11 o ? seg17 46 72 d9 o ? seg18 27 41 j7 o ? seg19 28 42 l7 o ? seg20 49 76 a11 o ? table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
PIC24FJ128GC010 family ds30009312b-page 30 ? 2012-2013 microchip technology inc. seg21 50 77 a10 o ? lcd driver segment outputs. seg22 51 78 b9 o ? seg23 52 81 c8 o ? seg24 53 82 b8 o ? seg25 54 83 d7 o ? seg26 55 84 c7 o ? seg27 58 87 b6 o ? seg28 ? 61 g9 o ? seg29 ? 60 g11 o ? seg30 18 27 j3 o ? seg31 ? 38 j6 o ? seg32 ? 6 d1 o ? seg33 ? 8 e2 o ? seg34 ? 18 g1 o ? seg35 ? 19 g2 o ? seg36 ? 28 l2 o ? seg37 ? 29 k3 o ? seg38 ? 47 l9 o ? seg39 ? 48 k9 o ? seg40 ? 52 k11 o ? seg41 ? 53 j10 o ? seg42 ? 66 e11 o ? seg43 ? 67 e8 o ? seg44 ? 79 a9 o ? seg45 ? 80 d8 o ? seg46 ? 89 e6 o ? seg47 59 88 a6 o ? seg48 ? 17 g3 o ? seg49 ? 90 a5 o ? seg50 ? 1 b2 o ? seg51 ? 7 e4 o ? seg52 ? 9 e1 o ? seg53 ? 39 l6 o ? seg54 ? 40 k6 o ? seg55 ? 58 h11 o ? seg56 ? 59 g10 o ? seg57 ? 91 c5 o ? seg58 ? 92 b5 o ? seg59 ? 95 c4 o ? seg60 ? 96 c3 o ? seg61 ? 97 a3 o ? seg62 64 100 a1 o ? table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
? 2012-2013 microchip technology inc. ds30009312b-page 31 PIC24FJ128GC010 family sosci 47 73 c10 i ana secondary oscillator input. sosco 48 74 b11 o ana secondary oscillator output. sv dd 26 37 j5 p ? positive supply for sigma-delta a/d converter. sv ref + 24 35 k5 i ana sigma-delta a/d converter voltage reference (high). sv ref - 25 36 l5 i ana sigma-delta a/d converter voltage reference (low). svss 21 32 k4 p ? ground reference for sigma-delta a/d converter. t1ck 27 41 j7 i st external timer1 clock input. t2ck 30 44 l8 i st external timer2 clock input. t3ck 31 49 l10 i st external timer3 clock input. t4ck 14 23 j2 i st external timer4 clock input. t5ck 4 10 e3 i st external timer5 clock input. tck 27 38 j6 i st jtag test clock/programming clock input. tdi 28 60 g11 i st jtag test data/programming data input. tdo 29 61 g9 o ? jtag test data output. tms 45 17 g3 i st jtag test mode select input. usbid 33 51 k10 i st usb otg id (otg mode only). usboe 12 21 h2 o ? usb output enable control (for external transceiver). v bat 57 86 a7 p ? backup battery (b+) input. v bus 34 54 h8 p ? usb v bus connection (5v nominal). v cap 56 85 b7 p ? external filter capacitor connection. v cmpst1 58 87 b6 i st usb v bus external comparator input 1. v cmpst2 59 88 a6 i st usb v bus external comparator input 2. v cmpst3 46 72 d9 i st usb v bus external comparator input 3. v dd 10, 38 2, 16, 46,62 c2,g5, k8, f8 p ? positive supply for peripheral digital logic and i/o pins. v lcap1 5 11 f4 p ana lcd drive charge pump capacitor pins. v lcap2 612f2pana vmio 14 23 j2 i/o st usb differential minus input/output (external transceiver). vpio 13 22 j1 i/o st usb differential plus input/output (external transceiver). v ss 9, 41 15, 45, 65, 75 f5, g7, f10, b10 p ? ground reference for logic and i/o pins. v usb3v3 35 55 h9 p ? usb transceiver power input voltage (3.3v nominal) table 1-3: PIC24FJ128GC010 family pinout description (continued) pin function pin number/grid locator i/o input buffer description 64-pin tqfp/qfn 100-pin tqfp 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c? = i 2 c/smbus input buffer
PIC24FJ128GC010 family ds30009312b-page 32 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 33 PIC24FJ128GC010 family 2.0 guidelines for getting started with 16-bit microcontrollers 2.1 basic connection requirements getting started with the PIC24FJ128GC010 family family of 16-bit microcontrollers requires attention to a minimal set of device pin connections before proceeding with development. the following pins must always be connected: ?all v dd and v ss pins (see section 2.2 ?power supply pins? ) ? all analog power pins (av dd , sv dd , av ss and sv ss ), regardless of whether or not the analog device features are used (see section 2.2 ?power supply pins? ) ? the usb transceiver supply, v usb3v3 , regardless of whether or not the usb module is used (see section 2.2 ?power supply pins? ) ?mclr pin (see section 2.3 ?master clear (mclr) pin? ) ?v cap pin (see section 2.4 ?voltage regulator pin (v cap )? ) these pins must also be connected if they are being used in the end application: ? pgecx/pgedx pins used for in-circuit serial programming? (icsp?) and debugging purposes (see section 2.5 ?icsp pins? ) ? osci and osco pins when an external oscillator source is used (see section 2.6 ?external oscillator pins? ) additionally, the following pins may be required: ? any voltage reference pins used when external voltage reference for analog modules is implemented (av ref +/av ref -, cv ref +/cv ref -, dv ref + and sv ref +/sv ref -) the minimum mandatory connections are shown in figure 2-1 . figure 2-1: recommended minimum connections note: all analog power supply and return pins must always be connected, regardless of whether any of the analog modules are being used. pic24fjxxxx v dd v ss v usb3v3 v ss v ss v dd av dd av ss sv dd sv ss c1 (4) r1 v dd mclr v cap r2 c7 c2 (2) c3 (3) c4 (2) c5 (2) c6 (2) key (all values are recommendations): c1 through c6: 0.1 ? f, 20v ceramic c7: 10 ? f, 6.3v or greater, tantalum or ceramic r1: 10 k ? r2: 100 ? to 470 ? note 1: see section 2.4 ?voltage regulator pin (v cap )? for details on selecting the proper capacitor for v cap . 2: the example shown is for a pic24f device with five power and ground pairs (including analog and usb). other devices may have more or less pairs; adjust the number of decoupling capacitors appropriately. 3: see section 19.1 ?hardware configura- tion? for details on connecting the pins for usb operation. 4: c1 is optional, see section 2.3 ?master clear (mclr) pin? and section 2.5 ?icsp pins? for more information. (1)
PIC24FJ128GC010 family ds30009312b-page 34 ? 2012-2013 microchip technology inc. 2.2 power supply pins 2.2.1 decoupling capacitors the use of decoupling capacitors on every pair of power supply pins is required. this includes digital supply (v dd and v ss ) and all analog supplies (av dd , sv dd , av ss and sv ss ). consider the following criteria when using decoupling capacitors: ? value and type of capacitor: a 0.1 ? f (100 nf), 10-20v capacitor is recommended. the capacitor should be a low-esr device with a resonance frequency in the range of 200 mhz and higher. ceramic capacitors are recommended. ? placement on the printed circuit board: the decoupling capacitors should be placed as close to the pins as possible. it is recommended to place the capacitors on the same side of the board as the device. if space is constricted, the capacitor can be placed on another layer on the pcb using a via; however, ensure that the trace length from the pin to the capacitor is no greater than 0.25 inch (6 mm). ? handling high-frequency noise: if the board is experiencing high-frequency noise (upward of tens of mhz), add a second ceramic type capaci- tor in parallel to the above described decoupling capacitor. the value of the second capacitor can be in the range of 0.01 ? f to 0.001 ? f. place this second capacitor next to each primary decoupling capacitor. in high-speed circuit designs, consider implementing a pair of capacitances as close to the power and ground pins as possible (e.g., 0.1 ? f in parallel with 0.001 ? f). ? maximizing performance: on the board layout from the power supply circuit, run the power and return traces to the decoupling capacitors first, and then to the device pins. this ensures that the decoupling capacitors are first in the power chain. equally important is to keep the trace length between the capacitor and the power pins to a minimum, thereby reducing pcb trace inductance. 2.2.2 bulk capacitors on boards with power traces running longer than six inches in length, it is suggested to use a tank capacitor for integrated circuits including microcontrollers to supply a local power source. the value of the tank capacitor should be determined based on the trace resistance that connects the power supply source to the device, and the maximum current drawn by the device in the application. in other words, select the tank capacitor so that it meets the acceptable voltage sag at the device. typical values range from 4.7 ? f to 47 ? f. 2.3 master clear (mclr ) pin the mclr pin provides two specific device functions: device reset, and device programming and debugging. if programming and debugging are not required in the end application, a direct connection to v dd may be all that is required. the addition of other components, to help increase the application?s resistance to spurious resets from voltage sags, may be beneficial. a typical configuration is shown in figure 2-1 . other circuit designs may be implemented, depending on the application?s requirements. during programming and debugging, the resistance and capacitance that can be added to the pin must be considered. device programmers and debuggers drive the mclr pin. consequently, specific voltage levels (v ih and v il ) and fast signal transitions must not be adversely affected. therefore, specific values of r1 and c1 will need to be adjusted based on the application and pcb requirements. for example, it is recommended that the capacitor, c1, be isolated from the mclr pin during programming and debugging operations by using a jumper ( figure 2-2 ). the jumper is replaced for normal run-time operations. any components associated with the mclr pin should be placed within 0.25 inch (6 mm) of the pin. figure 2-2: example of mclr pin connections note 1: r1 ? 10 k ? is recommended. a suggested starting value is 10 k ? . ensure that the mclr pin v ih and v il specifications are met. 2: r2 ? 470 ? will limit any current flowing into mclr from the external capacitor, c, in the event of mclr pin breakdown, due to electrostatic discharge (esd) or electrical overstress (eos). ensure that the mclr pin v ih and v il specifications are met. c1 r2 r1 v dd mclr pic24fxxxx jp
? 2012-2013 microchip technology inc. ds30009312b-page 35 PIC24FJ128GC010 family 2.4 voltage regulator pin (v cap ) a low-esr (< 5 ? ) capacitor is required on the v cap pin to stabilize the output voltage of the on-chip voltage regulator. the v cap pin must not be connected to v dd and must use a capacitor of 10 f connected to ground. the type can be ceramic or tantalum. suitable examples of capacitors are shown in table 2-1 . capacitors with equivalent specification can be used. the placement of this capacitor should be close to v cap . it is recommended that the trace length not exceed 0.25 inch (6 mm). refer to section 37.0 ?electrical characteristics? for additional information. designers may use figure 2-3 to evaluate esr equivalence of candidate devices. refer to section 34.2 ?on-chip voltage regulator? for details on connecting and using the on-chip regulator. figure 2-3: frequency vs. esr performance for suggested v cap . 10 1 0.1 0.01 0.001 0.01 0.1 1 10 100 1000 10,000 frequency (mhz) esr ( ? ) note: typical data measurement at 25c, 0v dc bias. table 2-1: suitable capacitor equivalents make part # nominal capacitance base tolerance rated voltage temp. range tdk c3216x7r1c106k 10 f 10% 16v -55 to +125oc tdk c3216x5r1c106k 10 f 10% 16v -55 to +85oc panasonic ecj-3yx1c106k 10 f 10% 16v -55 to +125oc panasonic ecj-4yb1c106k 10 f 10% 16v -55 to +85oc murata grm32dr71c106ka01l 10 f 10% 16v -55 to +125oc murata grm31cr61c106kc31l 10 f 10% 16v -55 to +85oc
PIC24FJ128GC010 family ds30009312b-page 36 ? 2012-2013 microchip technology inc. 2.4.1 considerations for ceramic capacitors in recent years, large value, low-voltage, surface-mount ceramic capacitors have become very cost effective in sizes up to a few tens of microfarad. the low-esr, small physical size and other properties make ceramic capacitors very attractive in many types of applications. ceramic capacitors are suitable for use with the inter- nal voltage regulator of this microcontroller. however, some care is needed in selecting the capacitor to ensure that it maintains sufficient capacitance over the intended operating range of the application. typical low-cost, 10 ? f ceramic capacitors are available in x5r, x7r and y5v dielectric ratings (other types are also available, but are less common). the initial toler- ance specifications for these types of capacitors are often specified as 10% to 20% (x5r and x7r), or -20%/+80% (y5v). however, the effective capacitance that these capacitors provide in an application circuit will also vary based on additional factors, such as the applied dc bias voltage and the temperature. the total in-circuit tolerance is, therefore, much wider than the initial tolerance specification. the x5r and x7r capacitors typically exhibit satisfac- tory temperature stability (ex: 15% over a wide temperature range, but consult the manufacturer?s data sheets for exact specifications). however, y5v capaci- tors typically have extreme temperature tolerance specifications of +22%/-82%. due to the extreme temperature tolerance, a 10 ? f nominal rated y5v type capacitor may not deliver enough total capacitance to meet minimum internal voltage regulator stability and transient response requirements. therefore, y5v capacitors are not recommended for use with the internal regulator if the application must operate over a wide temperature range. in addition to temperature tolerance, the effective capacitance of large value ceramic capacitors can vary substantially, based on the amount of dc voltage applied to the capacitor. this effect can be very signifi- cant, but is often overlooked or is not always documented. typical dc bias voltage vs. capacitance graph for x7r type capacitors is shown in figure 2-4 . figure 2-4: dc bias voltage vs. capacitance characteristics when selecting a ceramic capacitor to be used with the internal voltage regulator, it is suggested to select a high-voltage rating, so that the operating voltage is a small percentage of the maximum rated capacitor volt- age. for example, choose a ceramic capacitor rated at 16v for the 2.5v or 1.8v core voltage. suggested capacitors are shown in table 2-1 . 2.5 icsp pins the pgecx and pgedx pins are used for in-circuit serial programming (icsp) and debugging purposes. it is recommended to keep the trace length between the icsp connector and the icsp pins on the device as short as possible. if the icsp connector is expected to experience an esd event, a series resistor is recom- mended, with the value in the range of a few tens of ohms, not to exceed 100 ? . pull-up resistors, series diodes and capacitors on the pgecx and pgedx pins are not recommended as they will interfere with the programmer/debugger communi- cations to the device. if such discrete components are an application requirement, they should be removed from the circuit during programming and debugging. alternatively, refer to the ac/dc characteristics and timing requirements information in the respective device flash programming specification for information on capacitive loading limits and pin voltage input high (v ih ) and voltage input low (v il ) requirements. for device emulation, ensure that the ?communication channel select? (i.e., pgecx/pgedx pins), programmed into the device, matches the physical connections for the icsp to the microchip debugger/emulator tool. the mclr connection from the icsp header should con- nect directly to the mclr pin on the device. a capacitor to ground (c1 in figure 2-2 ) is optional, but if used, may interfere with icsp operation if the value exceeds 0.01 ? f. in most cases, this capacitor is not required. for more information on available microchip development tools connection requirements, refer to section 35.0 ?development support? . -80 -70 -60 -50 -40 -30 -20 -10 0 10 5 1011121314151617 dc bias voltage (vdc) capacitance change (%) 01234 6789 16v capacitor 10v capacitor 6.3v capacitor
? 2012-2013 microchip technology inc. ds30009312b-page 37 PIC24FJ128GC010 family 2.6 external oscillator pins many microcontrollers have options for at least two oscillators: a high-frequency primary oscillator and a low-frequency secondary oscillator (refer to section 9.0 ?oscillator configuration? for details). the oscillator circuit should be placed on the same side of the board as the device. place the oscillator circuit close to the respective oscillator pins with no more than 0.5 inch (12 mm) between the circuit components and the pins. the load capacitors should be placed next to the oscillator itself, on the same side of the board. use a grounded copper pour around the oscillator circuit to isolate it from surrounding circuits. the grounded copper pour should be routed directly to the mcu ground. do not run any signal traces or power traces inside the ground pour. also, if using a two-sided board, avoid any traces on the other side of the board where the crystal is placed. layout suggestions are shown in figure 2-5 . in-line packages may be handled with a single-sided layout that completely encompasses the oscillator pins. with fine-pitch packages, it is not always possible to com- pletely surround the pins and components. a suitable solution is to tie the broken guard sections to a mirrored ground layer. in all cases, the guard trace(s) must be returned to ground. in planning the application?s routing and i/o assign- ments, ensure that adjacent port pins, and other signals in close proximity to the oscillator, are benign (i.e., free of high frequencies, short rise and fall times and other similar noise). for additional information and design guidance on oscillator circuits, please refer to these microchip application notes, available at the corporate web site ( www.microchip.com ): ? an826, ?crystal oscillator basics and crystal selection for rfpic? and picmicro ? devices? ? an849, ?basic picmicro ? oscillator design? ? an943, ?practical picmicro ? oscillator analysis and design? ? an949, ?making your oscillator work? figure 2-5: suggested placement of the oscillator circuit gnd ` ` ` osci osco sosco sosc i copper pour primary oscillator crystal secondary crystal device pins primary oscillator c1 c2 sec oscillator: c1 sec oscillator: c2 (tied to ground) gnd osco osci bottom layer copper pour oscillator crystal top layer copper pour c2 c1 device pins (tied to ground) (tied to ground) single-sided and in-line layouts: fine-pitch (dual-sided) layouts: oscillator
PIC24FJ128GC010 family ds30009312b-page 38 ? 2012-2013 microchip technology inc. 2.7 configuration of analog and digital pins during icsp operations if an icsp compliant emulator is selected as a debug- ger, it automatically initializes all of the a/d input pins (anx) as ?digital? pins. depending on the particular device, this is done by setting all bits in the adnpcfg register(s), or clearing all bit in the ansx registers. all pic24f devices will have either one or more adnpcfg registers or several ansx registers (one for each port); no device will have both. refer to section 11.2 ?configuring analog port pins (ansx)? for more specific information. the bits in these registers that correspond to the a/d pins that initialized the emulator must not be changed by the user application firmware; otherwise, communication errors will result between the debugger and the device. if your application needs to use certain a/d pins as analog input pins during the debug session, the user application must modify the appropriate bits during initialization of the a/d module, as follows: ? for devices with an adnpcfg register, clear the bits corresponding to the pin(s) to be configured as analog. do not change any other bits, particu- larly those corresponding to the pgecx/pgedx pair, at any time. ? for devices with ansx registers, set the bits corresponding to the pin(s) to be configured as analog. do not change any other bits, particularly those corresponding to the pgecx/pgedx pair, at any time. when a microchip debugger/emulator is used as a programmer, the user application firmware must correctly configure the adnpcfg or ansx registers. automatic initialization of this register is only done during debugger operation. failure to correctly configure the register(s) will result in all a/d pins being recognized as analog input pins, resulting in the port value being read as a logic ? 0 ?, which may affect user application functionality. 2.8 sigma-delta a/d connections the sigma-delta a/d converter has input and power connections that are independent from the rest of the microcontroller. these connections are required to use the converter, and are in addition to the connection and layout connections provided in section 2.1 ?basic connection requirements? and section 2.2 ?power supply pins? . 2.8.1 voltage and ground connections to minimize noise interference, the sigma-delta a/d converter has independent voltage pins. converter cir- cuits are supplied through the sv dd pin. independent ground return is provided through the svss pin. as with the microcontroller?s v dd /v ss and av dd /av ss pins, bypass capacitors are required on sv dd and sv ss . requirements for these capacitors are identical to those for the v dd /v ss and a vdd /av ss pins. it is recommended that designs using the sigma-delta a/d converter incorporate a separate ground return path for analog circuits. the analog and digital grounds may be tied to a single point at the power source. ana- log pins that require grounding should be tied to this analog return. sv ss can be tied to the digital ground, along with v ss and av ss . 2.8.2 analog inputs the analog signals to be converted are connected to the pins of ch0 and/or ch1. each channel has inverting and non-inverting inputs (chn- and chn+, respectively), and is fully differential. if not used for conversion, ch1+ and ch1- can be used to supply an external voltage reference to the con- verter. if an external reference is not used and ch1 is not needed as a conversion input, both pins should be connected to the analog ground return. 2.9 unused i/os unused i/o pins should be configured as outputs and driven to a logic low state. alternatively, connect a 1 k ? to 10 k ? resistor to v ss on unused pins and drive the output to logic low.
? 2012-2013 microchip technology inc. ds30009312b-page 39 PIC24FJ128GC010 family 3.0 cpu the pic24f cpu has a 16-bit (data) modified, harvard architecture with an enhanced instruction set and a 24-bit instruction word with a variable length opcode field. the program counter (pc) is 23 bits wide and addresses up to 4m instructions of user program memory space. a single-cycle instruction prefetch mechanism is used to help maintain throughput and provides predictable execution. all instructions execute in a single cycle, with the exception of instructions that change the program flow, the double-word move ( mov.d ) instruction and the table instructions. overhead-free program loop constructs are supported using the repeat instructions, which are interruptible at any point. pic24f devices have sixteen, 16-bit working registers in the programmer?s model. each of the working registers can act as a data, address or address offset register. the 16 th working register (w15) operates as a software stack pointer for interrupts and calls. the lower 32 kbytes of the data space can be accessed linearly. the upper 32 kbytes of the data space are referred to as extended data space to which the extended data ram, epmp memory space or program memory can be mapped. the instruction set architecture (isa) has been significantly enhanced beyond that of the pic18, but maintains an acceptable level of backward compatibil- ity. all pic18 instructions and addressing modes are supported, either directly, or through simple macros. many of the isa enhancements have been driven by compiler efficiency needs. the core supports inherent (no operand), relative, literal and memory direct addressing modes, along with three groups of addressing modes. all modes sup- port register direct and various register indirect modes. each group offers up to seven addressing modes. instructions are associated with predefined addressing modes, depending upon their functional requirements. for most instructions, the core is capable of executing a data (or program data) memory read, a working reg- ister (data) read, a data memory write and a program (instruction) memory read per instruction cycle. as a result, three parameter instructions can be supported, allowing trinary operations (that is, a + b = c) to be executed in a single cycle. a high-speed, 17-bit x 17-bit multiplier has been included to significantly enhance the core arithmetic capability and throughput. the multiplier supports signed, unsigned and mixed mode, 16-bit x 16-bit or 8-bit x 8-bit, integer multiplication. all multiply instructions execute in a single cycle. the 16-bit alu has been enhanced with integer divide assist hardware that supports an iterative non-restoring divide algorithm. it operates in conjunction with the repeat instruction looping mechanism and a selection of iterative divide instructions to support 32-bit (or 16-bit), divided by 16-bit, integer signed and unsigned division. all divide operations require 19 cycles to complete but are interruptible at any cycle boundary. the pic24f has a vectored exception scheme with up to 8 sources of non-maskable traps and up to 118 interrupt sources. each interrupt source can be assigned to one of seven priority levels. a block diagram of the cpu is shown in figure 3-1 . 3.1 programmer?s model the programmer?s model for the pic24f is shown in figure 3-2 . all registers in the programmer?s model are memory mapped and can be manipulated directly by instructions. a description of each register is provided in ta b l e 3 - 1 . all registers associated with the programmer?s model are memory mapped. note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?cpu with extended data space (eds)? (ds39732). the information in this data sheet supersedes the information in the frm.
PIC24FJ128GC010 family ds30009312b-page 40 ? 2012-2013 microchip technology inc. figure 3-1: pic24f cp u core block diagram table 3-1: cpu core registers register(s) name description w0 through w15 working register array pc 23-bit program counter sr alu status register splim stack pointer limit value register tblpag table memory page address register rcount repeat loop counter register corcon cpu control register disicnt disable interrupt count register dsrpag data space read page register dswpag data space write page register instruction decode and control 16 program counter 16-bit alu 23 23 24 23 data bus instruction reg 16 16 x 16 w register array divide support 16 ragu wagu 16 16 8 interrupt controller stack control logic loop control logic data latch data ram address latch control signals to various blocks program memory/ data latch address bus 16 literal data 16 16 hardware multiplier 16 to peripheral modules address latch up to 0x7fff extended data space eds and table data access control block rom latch pcl pch ea mux
? 2012-2013 microchip technology inc. ds30009312b-page 41 PIC24FJ128GC010 family figure 3-2: programmer?s model ?? ? ? ? ? ? tblpag 22 0 7 0 0 15 program counter table memory page alu status register (sr) working/address registers w0 (wreg) w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 frame pointer stack pointer ra 0 rcount 15 0 repeat loop counter splim stack pointer limit srl 0 0 15 0 cpu control register (corcon) srh w14 w15 ipl 210 pc divider working registers multiplier registers 15 0 value register address register register data space read page register data space write page register disable interrupt count register 13 0 disicnt 90 dsrpag 80 dswpag ipl3 ???????????? ??? registers or bits are shadowed for push.s and pop.s instructions. dc n ov z c
PIC24FJ128GC010 family ds30009312b-page 42 ? 2012-2013 microchip technology inc. 3.2 cpu control registers register 3-1: sr: alu status register u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 ? ? ? ? ? ? ?dc bit 15 bit 8 r/w-0 ( 1 ) r/w-0 ( 1 ) r/w-0 ( 1 ) r-0 r/w-0 r/w-0 r/w-0, r/w-0 ipl2 ( 2 ) ipl1 ( 2 ) ipl0 ( 2 ) ra n ov z c bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-9 unimplemented: read as ? 0 ? bit 8 dc: alu half carry/borrow bit 1 = a carry out from the 4 th low-order bit (for byte-sized data) or 8 th low-order bit (for word-sized data) of the result occurred 0 = no carry out from the 4 th or 8 th low-order bit of the result has occurred bit 7-5 ipl<2:0>: cpu interrupt priority level (ipl) status bits ( 1 , 2 ) 111 = cpu interrupt priority level is 7 (15); user interrupts are disabled 110 = cpu interrupt priority level is 6 (14) 101 = cpu interrupt priority level is 5 (13) 100 = cpu interrupt priority level is 4 (12) 011 = cpu interrupt priority level is 3 (11) 010 = cpu interrupt priority level is 2 (10) 001 = cpu interrupt priority level is 1 (9) 000 = cpu interrupt priority level is 0 (8) bit 4 ra: repeat loop active bit 1 = repeat loop is in progress 0 = repeat loop is not in progress bit 3 n: alu negative bit 1 = result was negative 0 = result was not negative (zero or positive) bit 2 ov: alu overflow bit 1 = overflow occurred for signed (2?s complement) arithmetic in this arithmetic operation 0 = no overflow has occurred bit 1 z: alu zero bit 1 = an operation, which affects the z bit, has set it at some time in the past 0 = the most recent operation, which affects the z bit, has cleared it (i.e., a non-zero result) bit 0 c: alu carry/borrow bit 1 = a carry out from the most significant bit (msb) of the result occurred 0 = no carry out from the most significant bit of the result occurred note 1: the iplx status bits are read-only when nstdis (intcon1<15>) = 1 . 2: the iplx status bits are concatenated with the ipl3 (corcon<3>) bit to form the cpu interrupt priority level (ipl). the value in parentheses indicates the ipl when ipl3 = 1 .
? 2012-2013 microchip technology inc. ds30009312b-page 43 PIC24FJ128GC010 family register 3-2: corcon: cp u core control register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 r/c-0 r-1 u-0 u-0 ? ? ? ?ipl3 ( 1 ) r ? ? bit 7 bit 0 legend: c = clearable bit r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-4 unimplemented: read as ? 0 ? bit 3 ipl3: cpu interrupt priority level status bit ( 1 ) 1 = cpu interrupt priority level is greater than 7 0 = cpu interrupt priority level is 7 or less bit 2 reserved: read as ? 1 ? bit 1-0 unimplemented: read as ? 0 ? note 1: the ipl3 bit is concatenated with the ipl<2:0> bits (sr<7:5>) to form the cpu interrupt priority level; see register 3-1 for bit description.
PIC24FJ128GC010 family ds30009312b-page 44 ? 2012-2013 microchip technology inc. 3.3 arithmetic logic unit (alu) the pic24f alu is 16 bits wide and is capable of addi- tion, subtraction, bit shifts and logic operations. unless otherwise mentioned, arithmetic operations are 2?s complement in nature. depending on the operation, the alu may affect the values of the carry (c), zero (z), negative (n), overflow (ov) and digit carry (dc) status bits in the sr register. the c and dc status bits operate as borrow and digit borrow bits, respectively, for subtraction operations. the alu can perform 8-bit or 16-bit operations, depending on the mode of the instruction that is used. data for the alu operation can come from the w register array, or data memory, depending on the addressing mode of the instruction. likewise, output data from the alu can be written to the w register array or a data memory location. the pic24f cpu incorporates hardware support for both multiplication and division. this includes a dedicated hardware multiplier and support hardware for 16-bit divisor division. 3.3.1 multiplier the alu contains a high-speed, 17-bit x 17-bit multiplier. it supports unsigned, signed or mixed sign operation in several multiplication modes: 1. 16-bit x 16-bit signed 2. 16-bit x 16-bit unsigned 3. 16-bit signed x 5-bit (literal) unsigned 4. 16-bit unsigned x 16-bit unsigned 5. 16-bit unsigned x 5-bit (literal) unsigned 6. 16-bit unsigned x 16-bit signed 7. 8-bit unsigned x 8-bit unsigned 3.3.2 divider the divide block supports signed and unsigned integer divide operations with the following data sizes: 1. 32-bit signed/16-bit signed divide 2. 32-bit unsigned/16-bit unsigned divide 3. 16-bit signed/16-bit signed divide 4. 16-bit unsigned/16-bit unsigned divide the quotient for all divide instructions ends up in w0 and the remainder in w1. sixteen-bit signed and unsigned div instructions can specify any w register for both the 16-bit divisor (wn), and any w register (aligned) pair (w(m + 1):wm) for the 32-bit dividend. the divide algorithm takes one cycle per bit of divisor, so both 32-bit/16-bit and 16-bit/16-bit instructions take the same number of cycles to execute. 3.3.3 multibit shift support the pic24f alu supports both single bit and single-cycle, multibit arithmetic and logic shifts. multibit shifts are implemented using a shifter block, capable of performing up to a 15-bit arithmetic right shift, or up to a 15-bit left shift, in a single cycle. all multibit shift instructions only support register direct addressing for both the operand source and result destination. a full summary of instructions that use the shift operation is provided in table 3-2 . table 3-2: instructions that use the si ngle bit and multibit shift operation instruction description asr arithmetic shift right source register by one or more bits. sl shift left source register by one or more bits. lsr logical shift right source register by one or more bits.
? 2012-2013 microchip technology inc. ds30009312b-page 45 PIC24FJ128GC010 family 4.0 memory organization as harvard architecture devices, pic24f micro- controllers feature separate program and data memory spaces and buses. this architecture also allows direct access of program memory from the data space (ds) during code execution. 4.1 program memory space the program address memory space of the PIC24FJ128GC010 family devices is 4m instructions. the space is addressable by a 24-bit value derived from either the 23-bit program counter (pc) during pro- gram execution, or from table operation or data space remapping, as described in section 4.3 ?interfacing program and data memory spaces? . user access to the program memory space is restricted to the lower half of the address range (000000h to 7fffffh). the exception is the use of tblrd/tblwt operations, which use tblpag<7> to permit access to the configuration bits and device id sections of the configuration memory space. memory maps for the PIC24FJ128GC010 family of devices are shown in figure 4-1 . figure 4-1: program space memory map for PIC24FJ128GC010 family devices 000000h 0000feh 000002h 000100h f8000eh f80010h fefffeh fffffeh 000004h 000200h 0001feh 000104h configuration memory space user memory space note: memory areas are not shown to scale. ff0000h f7fffeh f80000h 800000h 7ffffeh reset address device config. registers user flash program memory (22k instructions) devid (2) goto instruction reserved alternate vector table reserved interrupt vector table pic24fj64gc0xx reserved unimplemented read ? 0 ? 015800h 0157feh 00ac00h 00abfeh reset address devid (2) goto instruction reserved alternate vector table reserved interrupt vector table pic24f128gc0xx flash config. words device config. registers reserved unimplemented read ? 0 ? user flash program memory (44k instructions) flash config. words
PIC24FJ128GC010 family ds30009312b-page 46 ? 2012-2013 microchip technology inc. 4.1.1 program memory organization the program memory space is organized in word-addressable blocks. although it is treated as 24 bits wide, it is more appropriate to think of each address of the program memory as a lower and upper word, with the upper byte of the upper word being unimplemented. the lower word always has an even address, while the upper word has an odd address ( figure 4-2 ). program memory addresses are always word-aligned on the lower word and addresses are incremented or decremented by two during code execution. this arrangement also provides compatibility with data memory space addressing and makes it possible to access data in the program memory space. 4.1.2 hard memory vectors all pic24f devices reserve the addresses between 000000h and 000200h for hard-coded program execu- tion vectors. a hardware reset vector is provided to redirect code execution from the default value of the pc on device reset to the actual start of code. a goto instruction is programmed by the user at 000000h with the actual address for the start of code at 000002h. pic24f devices also have two interrupt vector tables (ivts), located from 000004h to 0000ffh and 000100h to 0001ffh. these vector tables allow each of the many device interrupt sources to be handled by sepa- rate isrs. a more detailed discussion of the interrupt vector tables is provided in section 8.1 ?interrupt vector table? . 4.1.3 flash configuration words in PIC24FJ128GC010 family devices, the top four words of on-chip program memory are reserved for configura- tion information. on device reset, the configuration information is copied into the appropriate configuration register. the addresses of the flash configuration word for devices in the PIC24FJ128GC010 family are shown in table 4-1 . their location in the memory map is shown with the other memory vectors in figure 4-1 . the configuration words in program memory are a compact format. the actual configuration bits are mapped in several different regi sters in the configuration memory space. their order in the flash configuration words does not reflect a corresponding arrangement in the configuration space. additional details on the device configuration words are provided in section 34.0 ?special features? . table 4-1: flash configuration words for PIC24FJ128GC010 family devices figure 4-2: program memory organization device program memory (words) configuration word addresses pic24fj64gc0xx 22,016 00abf8h:00abfeh pic24fj128gc0xx 44,032 0157f8h:0157feh 0 8 16 pc address 0x000000 0x000002 0x000004 0x000006 23 00000000 00000000 00000000 00000000 program memory ?phantom? byte (read as ? 0 ?) least significant word most significant word instruction width 0x000001 0x000003 0x000005 0x000007 msw address (lsw address)
? 2012-2013 microchip technology inc. ds30009312b-page 47 PIC24FJ128GC010 family 4.2 data memory space the pic24f core has a 16-bit wide data memory space, addressable as a single linear range. the data space (ds) is accessed using two address generation units (agus), one each for read and write operations. the data space memory map is shown in figure 4-3 . the 16-bit wide data addresses in the data memory space point to bytes within the data space. this gives a ds address range of 64 kbytes or 32k words. the lower half (0000h to 7fffh) is used for implemented (on-chip) memory addresses. the upper half of data memory address space (8000h to ffffh) is used as a window into the extended data space (eds). this allows the microcontroller to directly access a greater range of data beyond the standard 16-bit address range. eds is discussed in detail in section 4.2.5 ?extended data space (eds)? . the lower half of ds is compatible with previous pic24f microcontrollers without eds. all PIC24FJ128GC010 family devices implement 8 kbytes of data ram in the lower half of the ds, from 0800h to 27ffh. 4.2.1 data space width the data memory space is organized in byte-addressable, 16-bit wide blocks. data is aligned in data memory and registers as 16-bit words, but all data space effective addresses (eas) resolve to bytes. the least significant bytes (lsbs) of each word have even addresses, while the most significant bytes (msbs) have odd addresses. figure 4-3: data space memory map fo r PIC24FJ128GC010 family devices note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ? pic24f family reference manual ?, section 45. ?data memory with extended data space (eds) ? (ds39733). the information in this data sheet supersedes the information in the frm. note: memory areas are not shown to scale. 0000h 07feh fffeh lsb address lsb msb msb address 0001h 07ffh 1fffh ffffh 8001h 8000h 7fffh 0801h 0800h 2001h near 1ffeh sfr 2000h 7ffeh eds window space data space upper 32 kbytes data space 2800h 2801h lower 32 kbytes data space 8 kbytes data ram sfr space eds page 0x1 (32 kbytes) eds page 0x2 (32 kbytes) eds page 0x3 eds page 0x4 eds page 0x1ff eds page 0x200 eds page 0x2ff eds page 0x300 eds page 0x3ff epmp memory space program space visibility area to access lower word of program memory program space visibility area to access upper word of program memory 27feh 27ffh unimplemented
PIC24FJ128GC010 family ds30009312b-page 48 ? 2012-2013 microchip technology inc. 4.2.2 data memory organization and alignment to maintain backward compatibility with pic ? mcus and improve data space memory usage efficiency, the pic24f instruction set supports both word and byte operations. as a consequence of byte accessibility, all ea calculations are internally scaled to step through word-aligned memory. for example, the core recognizes that post-modified register indirect addressing mode [ws++] will result in a value of ws + 1 for byte operations and ws + 2 for word operations. data byte reads will read the complete word, which contains the byte, using the lsb of any ea to deter- mine which byte to select. the selected byte is placed onto the lsb of the data path. that is, data memory and registers are organized as two parallel, byte-wide entities with shared (word) address decode but separate write lines. data byte writes only write to the corresponding side of the array or register which matches the byte address. all word accesses must be aligned to an even address. misaligned word data fetches are not supported, so care must be taken when mixing byte and word operations or translating from 8-bit mcu code. if a misaligned read or write is attempted, an address error trap will be generated. if the error occurred on a read, the instruction underway is completed; if it occurred on a write, the instruction will be executed but the write will not occur. in either case, a trap is then executed, allow- ing the system and/or user to examine the machine state prior to execution of the address fault. all byte loads into any w register are loaded into the lsb. the most significant byte (msb) is not modified. a sign-extend ( se ) instruction is provided to allow users to translate 8-bit signed data to 16-bit signed values. alternatively, for 16-bit unsigned data, users can clear the msb of any w register by executing a zero-extend ( ze ) instruction on the appropriate address. although most instructions are capable of operating on word or byte data sizes, it should be noted that some instructions operate only on words. 4.2.3 near data space the 8-kbyte area between 0000h and 1fffh is referred to as the near data space. locations in this space are directly addressable via a 13-bit absolute address field within all memory direct instructions. the remainder of the data space is addressable indirectly. additionally, the whole data space is addressable using mov instructions, which support memory direct addressing with a 16-bit address field. 4.2.4 special function register (sfr) space the first 2 kbytes of the near data space, from 0000h to 07ffh, are primarily occupied with special function registers (sfrs). these are used by the pic24f core and peripheral modules for controlling the operation of the device. sfrs are distributed among the modules that they con- trol and are generally grouped together by module. much of the sfr space contains unused addresses; these are read as ? 0 ?. a diagram of the sfr space, showing where the sfrs are actually implemented, is shown in tab le 4 - 2 . each implemented area indicates a 32-byte region where at least one address is imple- mented as an sfr. a complete list of implemented sfrs, including their addresses, is shown in tables 4-3 through 4-39 . table 4-2: implemented regions of sfr data space sfr space address xx00 xx20 xx40 xx60 xx80 xxa0 xxc0 xxe0 000h core icn interrupts 100h timers ? capture compare ? 200h i 2 c? urt spi/urt ( 1 ) spi ? ? ?urt i/o 300h a/d dma ? 400h a/d dac ? ? ?usbs/dana ? 500h a/d ?lcd ? 600h epmp rtc/cmp ( 2 ) crc ? avr pps ? 700h ? ? system nvm/pmd ctm ? ? ? ? legend: ? = no implemented sfrs in this block; urt = uart; s/d = sigma-delta a/d; avr = analog reference note 1: this region includes registers for the op amp module. 2: this region includes registers for the digital signal modulator (dsm) module.
? 2012-2013 microchip technology inc. ds30009312b-page 49 PIC24FJ128GC010 family table 4-3: cpu core registers map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets wreg0 0000 working register 0 0000 wreg1 0002 working register 1 0000 wreg2 0004 working register 2 0000 wreg3 0006 working register 3 0000 wreg4 0008 working register 4 0000 wreg5 000a working register 5 0000 wreg6 000c working register 6 0000 wreg7 000e working register 7 0000 wreg8 0010 working register 8 0000 wreg9 0012 working register 9 0000 wreg10 0014 working register 10 0000 wreg11 0016 working register 11 0000 wreg12 0018 working register 12 0000 wreg13 001a working register 13 0000 wreg14 001c working register 14 0000 wreg15 001e working register 15 0800 splim 0020 stack pointer limit value register xxxx pcl 002e program counter low word register 0000 pch 0030 ? ? ? ? ? ? ? ? program counter register high byte 0000 dsrpag 0032 ? ? ? ? ? ? extended data space read page address register 0000 dswpag 0034 ? ? ? ? ? ? ? extended data space write page address register 0000 rcount 0036 repeat loop counter register xxxx sr 0042 ? ? ? ? ? ? ? dc ipl2 ipl1 ipl0 ra n ov z c 0000 corcon 0044 ? ? ? ? ? ? ? ? ? ? ? ?ipl3 r ? ? 0004 disicnt 0052 ? ? disable interrupts counter register xxxx tblpag 0054 ? ? ? ? ? ? ? ? table memory page address register 0000 legend: ? = unimplemented, read as ? 0 ?; r = reserved, do not modify. reset values are shown in hexadecimal.
PIC24FJ128GC010 family ds30009312b-page 50 ? 2012-2013 microchip technology inc. table 4-4: icn register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets cnpd1 0056 cn15pde cn14pde cn13pde cn12pde cn11pde cn10pde cn9pde cn8pde cn7pde cn6pde cn5pde cn4pde cn3pde cn2pde ? ? 0000 cnpd2 0058 cn31pde cn30pde ? ? ? ? cn25pde cn24pde cn23pde cn22pde cn21pde ( 1 ) cn20pde ( 1 ) cn19pde ( 1 ) cn18pde cn17pde cn16pde 0000 cnpd3 005a cn47pde ( 1 ) cn46pde ( 1 ) cn45pde ( 1 ) cn44pde ( 1 ) cn43pde ( 1 ) cn42pde ( 1 ) cn41pde ( 1 ) cn40pde ( 1 ) cn39pde ( 1 ) cn38pde ( 1 ) cn37pde ( 1 ) cn36pde ( 1 ) cn35pde ( 1 ) cn34pde ( 1 ) cn33pde ( 1 ) cn32pde 0000 cnpd4 005c cn63pde cn62pde cn61pde cn60pde cn59pde cn58pde cn57pde ( 1 ) cn56pde cn55pde cn54pde cn53pde cn52pde cn51pde cn50pde cn49pde cn48pde ( 1 ) 0000 cnpd5 005e cn79pde ( 1 ) cn78pde ( 1 ) cn77pde ( 1 ) cn76pde ( 1 ) cn75pde ( 1 ) cn74pde ( 1 ) cn73pde cn72pde cn71pde cn70pde ( 1 ) cn69pde cn68pde cn67pde ( 1 ) cn66pde ( 1 ) cn65pde cn64pde 0000 cnpd6 0060 ? ? ? ? ? ? ? ? ? ? ? ? cn83pde cn82pde ( 1 ) cn81pde ( 1 ) cn80pde ( 1 ) 0000 cnen1 0062 cn15ie cn14ie cn13ie cn12ie cn11ie cn10ie cn9ie cn8ie cn7ie cn6ie cn5ie cn4ie cn3ie cn2ie ? ? 0000 cnen2 0064 cn31ie cn30ie ? ? ? ? cn25ie cn24ie cn23ie cn22ie cn21ie ( 1 ) cn20ie ( 1 ) cn19ie ( 1 ) cn18ie cn17ie cn16ie 0000 cnen3 0066 cn47ie ( 1 ) cn46ie ( 1 ) cn45ie ( 1 ) cn44ie ( 1 ) cn43ie ( 1 ) cn42ie ( 1 ) cn41ie ( 1 ) cn40ie ( 1 ) cn39ie ( 1 ) cn38ie ( 1 ) cn37ie ( 1 ) cn36ie ( 1 ) cn35ie ( 1 ) cn34ie ( 1 ) cn33ie ( 1 ) cn32ie 0000 cnen4 0068 cn63ie cn62ie cn61ie cn60ie cn59ie cn58ie cn57ie ( 1 ) cn56ie cn55ie cn54ie cn53ie cn52ie cn51ie cn50ie cn49ie cn48ie ( 1 ) 0000 cnen5 006a cn79ie ( 1 ) cn78ie ( 1 ) cn77ie ( 1 ) cn76ie ( 1 ) cn75ie ( 1 ) cn74ie ( 1 ) cn73ie cn72ie cn71ie cn70ie ( 1 ) cn69ie cn68ie cn67ie ( 1 ) cn66ie ( 1 ) cn65ie cn64ie 0000 cnen6 006c ? ? ? ? ? ? ? ? ? ? ? ? cn83ie cn82ie ( 1 ) cn81ie ( 1 ) cn80ie ( 1 ) 0000 cnpu1 006e cn15pue cn14pue cn13pue cn12pue cn11pue cn10pue cn9pue cn8pue cn7pue cn6pue cn5pue cn4pue cn3pue cn2pue ? ? 0000 cnpu2 0070 cn31pue cn30pue ? ? ? ? cn25pue cn24pue cn23pue cn22pue cn21pue ( 1 ) cn20pue ( 1 ) cn19pue ( 1 ) cn18pue cn17pue cn16pue 0000 cnpu3 0072 cn47pue ( 1 ) cn46pue ( 1 ) cn45pue ( 1 ) cn44pue ( 1 ) cn43pue ( 1 ) cn42pue ( 1 ) cn41pue ( 1 ) cn40pue ( 1 ) cn39pue ( 1 ) cn38pue ( 1 ) cn37pue ( 1 ) cn36pue ( 1 ) cn35pue ( 1 ) cn34pue ( 1 ) cn33pue ( 1 ) cn32pue 0000 cnpu4 0074 cn63pue cn62pue cn61pue cn60pue cn59pue cn58pue cn57pue ( 1 ) cn56pue cn55pue cn54pue cn53pue cn52pue cn51pue cn50pue cn49pue cn48pue ( 1 ) 0000 cnpu5 0076 cn79pue ( 1 ) cn78pue ( 1 ) cn77pue ( 1 ) cn76pue ( 1 ) cn75pue ( 1 ) cn74pue ( 1 ) cn73pue cn72pue cn71pue cn70pue ( 1 ) cn69pue cn68pue cn67pue ( 1 ) cn66pue ( 1 ) cn65pue cn64pue 0000 cnpu6 0078 ? ? ? ? ? ? ? ? ? ? ? ? cn83pue cn82pue ( 1 ) cn81pue ( 1 ) cn80pue ( 1 ) 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. note 1: these bits are unimplemented in 64-pin devices, read as ? 0 ?.
? 2012-2013 microchip technology inc. ds30009312b-page 51 PIC24FJ128GC010 family table 4-5: interrupt controller register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets intcon1 0080 nstdis ? ? ? ? ? ? ? ? ? ? matherr addrerr stkerr oscfail ? 0000 intcon2 0082 altivt disi ? ? ? ? ? ? ? ? ? int4ep int3ep int2ep int1ep int0ep 0000 ifs0 0084 ? dma1if ad1if u1txif u1rxif spi1if spf1if t3if t2if oc2if ic2if dma0if t1if oc1if ic1if int0if 0000 ifs1 0086 u2txif u2rxif int2if t5if t4if oc4if oc3if dma2if ic8if ic7if ? int1if cnif cmif mi2c1if si2c1if 0000 ifs2 0088 ? dma4if pmpif oc8if oc7if oc6if oc5if ic6if ic5if ic4if ic3if dma3if ? ? spi2if spf2if 0000 ifs3 008a ?rtcifdma5if ? ? ? ? ? ? int4if int3if ? ? mi2c2if si2c2if ? 0000 ifs4 008c dac2if dac1if ctmuif ? ? ? ?hlvdif ? ? ? ? crcif u2erif u1erif ? 0000 ifs5 008e ? ?ic9ifoc9if ? ? u4txif u4rxif u4erif usb1if ? ? u3txif u3rxif u3erif ? 0000 ifs6 0090 ? ? ? ? ? fstif sda1if amp2if amp1if ? ? lcdif ? ? ? ? 0000 ifs7 0092 ? ? ? ? ? ? ? ? ? ?jtagif ? ? ? ? ? 0000 iec0 0094 ? dma1ie ad1ie u1txie u1rxie spi1ie spf1ie t3ie t2ie oc2ie ic2ie dma0ie t1ie oc1ie ic1ie int0ie 0000 iec1 0096 u2txie u2rxie int2ie t5ie t4ie oc4ie oc3ie dma2ie ic8ie ic7ie ? int1ie cnie cmie mi2c1ie si2c1ie 0000 iec2 0098 ? dma4ie pmpie oc8ie oc7ie oc6ie oc5ie ic6ie ic5ie ic4ie ic3ie dma3ie ? ? spi2ie spf2ie 0000 iec3 009a ?rtciedma5ie ? ? ? ? ? ? int4ie int3ie ? ? mi2c2ie si2c2ie ? 0000 iec4 009c dac2ie dac1ie ctmuie ? ? ? ?hlvdie ? ? ? ? crcie u2erie u1erie ? 0000 iec5 009e ? ?ic9ieoc9ie ? ? u4txie u4rxie u4erie usb1ie ? ? u3txie u3rxie u3erie ? 0000 iec6 00a0 ? ? ? ? ? fstie sda1ie amp2ie amp1ie ? ? lcdie ? ? ? ? 0000 iec7 00a2 ? ? ? ? ? ? ? ? ? ?jtagie ? ? ? ? ? 0000 ipc0 00a4 ? t1ip2 t1ip1 t1ip0 ? oc1ip2 oc1ip1 oc1ip0 ? ic1ip2 ic1ip1 ic1ip0 ? int0ip2 int0ip1 int0ip0 4444 ipc1 00a6 ? t2ip2 t2ip1 t2ip0 ? oc2ip2 oc2ip1 oc2ip0 ? ic2ip2 ic2ip1 ic2ip0 ? dma0ip2 dma0ip1 dma0ip0 4444 ipc2 00a8 ? u1rxip2 u1rxip1 u1rxip0 ? spi1ip2 spi1ip1 spi1ip0 ? spf1ip2 spf1ip1 spf1ip0 ? t3ip2 t3ip1 t3ip0 4444 ipc3 00aa ? ? ? ? ? dma1ip2 dma1ip1 dma1ip0 ? ad1ip2 ad1ip1 ad1ip0 ? u1txip2 u1txip1 u1txip0 0444 ipc4 00ac ? cnip2 cnip1 cnip0 ? cmip2 cmip1 cmip0 ? mi2c1ip2 mi2c1ip1 mi2c1ip0 ? si2c1ip2 si2c1ip1 si2c1ip0 4444 ipc5 00ae ? ic8ip2 ic8ip1 ic8ip0 ? ic7ip2 ic7ip1 ic7ip0 ? ? ? ? ? int1ip2 int1ip1 int1ip0 4404 ipc6 00b0 ? t4ip2 t4ip1 t4ip0 ? oc4ip2 oc4ip1 oc4ip0 ? oc3ip2 oc3ip1 oc3ip0 ? dma2ip2 dma2ip1 dma2ip0 4444 ipc7 00b2 ? u2txip2 u2txip1 u2txip0 ? u2rxip2 u2rxip1 u2rxip0 ? int2ip2 int2ip1 int2ip0 ? t5ip2 t5ip1 t5ip0 4444 ipc8 00b4 ? ? ? ? ? ? ? ? ? spi2ip2 spi2ip1 spi2ip0 ? spf2ip2 spf2ip1 spf2ip0 0044 ipc9 00b6 ? ic5ip2 ic5ip1 ic5ip0 ? ic4ip2 ic4ip1 ic4ip0 ? ic3ip2 ic3ip1 ic3ip0 ? dma3ip2 dma3ip1 dma3ip0 4444 ipc10 00b8 ? oc7ip2 oc7ip1 oc7ip0 ? oc6ip2 oc6ip1 oc6ip0 ? oc5ip2 oc5ip1 oc5ip0 ? ic6ip2 ic6ip1 ic6ip0 4444 ipc11 00ba ? ? ? ? ? dma4ip2 dma4ip1 dma4ip0 ? pmpip2 pmpip1 pmpip0 ? oc8ip2 oc8ip1 oc8ip0 0444 ipc12 00bc ? ? ? ? ? mi2c2ip2 mi2c2 ip1 mi2c2ip0 ? si2c2ip2 si2c2ip1 si2c2ip0 ? ? ? ? 0440 ipc13 00be ? ? ? ? ? int4ip2 int4ip1 int4ip0 ? int3ip2 int3ip1 int3ip0 ? ? ? ? 0440 ipc15 00c2 ? ? ? ? ? rtcip2 rtcip1 rtcip0 ? dma5ip2 dma5ip1 dma5ip0 ? ? ? ? 0440 legend: ? = unimplemented, read as ? 0 ?, r = reserved, maintain as ? 0 ?. reset values are shown in hexadecimal.
PIC24FJ128GC010 family ds30009312b-page 52 ? 2012-2013 microchip technology inc. ipc16 00c4 ? crcip2 crcip1 crcip0 ? u2erip2 u2erip1 u2erip0 ? u1erip2 u1erip1 u1erip0 ? ? ? ? 4440 ipc18 00c8 ? ? ? ? ? ? ? ? ? ? ? ? ? hlvdip2 hlvdip1 hlvdip0 0004 ipc19 00ca ? dac2ip2 dac2ip1 dac2ip0 ? dac1ip2 dac1ip1 dac1ip0 ? ctmuip2 ctmuip1 ctmuip0 ? ? ? ? 4440 ipc20 00cc ? u3txip2 u3txip1 u3txip0 ? u3rxip2 u3rxip1 u3rxip0 ? u3erip2 u3erip1 u3erip0 ? ? ? ? 4440 ipc21 00ce ? u4erip2 u4erip1 u4erip0 ? usb1ip2 usb1ip1 usb1ip0 ? ? ? ? ? ? ? ? 4400 ipc22 00d0 ? ? ? ? ? ? ? ? ? u4txip2 u4txip1 u4txip0 ? u4rxip2 u4rxip1 u4rxip0 0044 ipc23 00d2 ? ? ? ? ? ? ? ? ? ic9ip2 ic9ip1 ic9ip0 ? oc9ip2 oc9ip1 oc9ip0 0044 ipc25 00d6 ? amp1ip2 amp1ip1 amp1ip0 ? ? ? ? ? ? ? ? ? lcdip2 lcdip1 lcdip0 4004 ipc26 00d8 ? ? ? ? ? fstip2 fstip1 fstip0 ? sda1ip2 sda1ip1 sda1ip0 ? amp2ip2 amp2ip1 amp2ip0 0444 ipc29 00de ? ? ? ? ? ? ? ? ? jtagip2 jtagip1 jtagip0 ? ? ? ? 0040 inttreg 00e0 cpuirq rvhold ? ilr3 ilr2 ilr1 ilr0 ? vecnum6 vecnum5 vecnum4 vecnum3 vecnum2 vecnum1 vecnum0 0000 table 4-5: interrupt controller register map (continued) file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets legend: ? = unimplemented, read as ? 0 ?, r = reserved, maintain as ? 0 ?. reset values are shown in hexadecimal. table 4-6: timer register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets tmr1 0100 timer1 register 0000 pr1 0102 timer1 period register ffff t1con 0104 ton ?tsidl ? ? ? tiecs1 tiecs0 ? tgate tckps1 tckps0 ?tsynctcs ? 0000 tmr2 0106 timer2 register 0000 tmr3hld 0108 timer3 holding register (for 32-bit timer operations only) 0000 tmr3 010a timer3 register 0000 pr2 010c timer2 period register ffff pr3 010e timer3 period register ffff t2con 0110 ton ?tsidl ? ? ? tiecs1 tiecs0 ? tgate tckps1 tckps0 t32 ?tcs ? 0000 t3con 0112 ton ?tsidl ? ? ? tiecs1 tiecs0 ? tgate tckps1 tckps0 ? ?tcs ? 0000 tmr4 0114 timer4 register 0000 tmr5hld 0116 timer5 holding register (for 32-bit operations only) 0000 tmr5 0118 timer5 register 0000 pr4 011a timer4 period register ffff pr5 011c timer5 period register ffff t4con 011e ton ?tsidl ? ? ? tiecs1 tiecs0 ? tgate tckps1 tckps0 t45 ?tcs ? 0000 t5con 0120 ton ?tsidl ? ? ? tiecs1 tiecs0 ? tgate tckps1 tckps0 ? ?tcs ? 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal.
? 2012-2013 microchip technology inc. ds30009312b-page 53 PIC24FJ128GC010 family table 4-7: input capture register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets ic1con1 0140 ? ? icsidl ictsel2 ictsel1 ictsel0 ? ? ? ici1 ici0 icov icbne icm2 icm1 icm0 0000 ic1con2 0142 ? ? ? ? ? ? ? ic32 ictrig trigstat ? syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000d ic1buf 0144 input capture 1 buffer register 0000 ic1tmr 0146 timer value 1 register xxxx ic2con1 0148 ? ? icsidl ictsel2 ictsel1 ictsel0 ? ? ? ici1 ici0 icov icbne icm2 icm1 icm0 0000 ic2con2 014a ? ? ? ? ? ? ? ic32 ictrig trigstat ? syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000d ic2buf 014c input capture 2 buffer register 0000 ic2tmr 014e timer value 2 register xxxx ic3con1 0150 ? ? icsidl ictsel2 ictsel1 ictsel0 ? ? ? ici1 ici0 icov icbne icm2 icm1 icm0 0000 ic3con2 0152 ? ? ? ? ? ? ? ic32 ictrig trigstat ? syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000d ic3buf 0154 input capture 3 buffer register 0000 ic3tmr 0156 timer value 3 register xxxx ic4con1 0158 ? ? icsidl ictsel2 ictsel1 ictsel0 ? ? ? ici1 ici0 icov icbne icm2 icm1 icm0 0000 ic4con2 015a ? ? ? ? ? ? ? ic32 ictrig trigstat ? syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000d ic4buf 015c input capture 4 buffer register 0000 ic4tmr 015e timer value 4 register xxxx ic5con1 0160 ? ? icsidl ictsel2 ictsel1 ictsel0 ? ? ? ici1 ici0 icov icbne icm2 icm1 icm0 0000 ic5con2 0162 ? ? ? ? ? ? ? ic32 ictrig trigstat ? syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000d ic5buf 0164 input capture 5 buffer register 0000 ic5tmr 0166 timer value 5 register xxxx ic6con1 0168 ? ? icsidl ictsel2 ictsel1 ictsel0 ? ? ? ici1 ici0 icov icbne icm2 icm1 icm0 0000 ic6con2 016a ? ? ? ? ? ? ? ic32 ictrig trigstat ? syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000d ic6buf 016c input capture 6 buffer register 0000 ic6tmr 016e timer value 6 register xxxx ic7con1 0170 ? ? icsidl ictsel2 ictsel1 ictsel0 ? ? ? ici1 ici0 icov icbne icm2 icm1 icm0 0000 ic7con2 0172 ? ? ? ? ? ? ? ic32 ictrig trigstat ? syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000d ic7buf 0174 input capture 7 buffer register 0000 ic7tmr 0176 timer value 7 register xxxx ic8con1 0178 ? ? icsidl ictsel2 ictsel1 ictsel0 ? ? ? ici1 ici0 icov icbne icm2 icm1 icm0 0000 ic8con2 018a ? ? ? ? ? ? ? ic32 ictrig trigstat ? syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000d ic8buf 018c input capture 8 buffer register 0000 ic8tmr 018e timer value 8 register xxxx ic9con1 0180 ? ? icsidl ictsel2 ictsel1 ictsel0 ? ? ? ici1 ici0 icov icbne icm2 icm1 icm0 0000 ic9con2 0182 ? ? ? ? ? ? ? ic32 ictrig trigstat ? syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000d ic9buf 0184 input capture 9 buffer register 0000 ic9tmr 0186 timer value 9 register xxxx legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal.
PIC24FJ128GC010 family ds30009312b-page 54 ? 2012-2013 microchip technology inc. table 4-8: output compare register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets oc1con1 0190 ? ? ocsidl octsel2 octsel1 octsel0 enflt2 enflt1 enflt0 ocflt2 ocflt1 ocflt0 trigmode ocm2 ocm1 ocm0 0000 oc1con2 0192 fltmd fltout flttrien ocinv ? dcb1 dcb0 oc32 octrig trigstat octris syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000c oc1rs 0194 output compare 1 secondary register 0000 oc1r 0196 output compare 1 register 0000 oc1tmr 0198 timer value 1 register xxxx oc2con1 019a ? ? ocsidl octsel2 octsel1 octsel0 enflt2 enflt1 enflt0 ocflt2 ocflt1 ocflt0 trigmode ocm2 ocm1 ocm0 0000 oc2con2 019c fltmd fltout flttrien ocinv ? dcb1 dcb0 oc32 octrig trigstat octris syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000c oc2rs 019e output compare 2 secondary register 0000 oc2r 01a0 output compare 2 register 0000 oc2tmr 01a2 timer value 2 register xxxx oc3con1 01a4 ? ? ocsidl octsel2 octsel1 octsel0 enflt2 enflt1 enflt0 ocflt2 ocflt1 ocflt0 trigmode ocm2 ocm1 ocm0 0000 oc3con2 01a6 fltmd fltout flttrien ocinv ? dcb1 dcb0 oc32 octrig trigstat octris syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000c oc3rs 01a8 output compare 3 secondary register 0000 oc3r 01aa output compare 3 register 0000 oc3tmr 01ac timer value 3 register xxxx oc4con1 01ae ? ? ocsidl octsel2 octsel1 octsel0 enflt2 enflt1 enflt0 ocflt2 ocflt1 ocflt0 trigmode ocm2 ocm1 ocm0 0000 oc4con2 01b0 fltmd fltout flttrien ocinv ? dcb1 dcb0 oc32 octrig trigstat octris syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000c oc4rs 01b2 output compare 4 secondary register 0000 oc4r 01b4 output compare 4 register 0000 oc4tmr 01b6 timer value 4 register xxxx oc5con1 01b8 ? ? ocsidl octsel2 octsel1 octsel0 enflt2 enflt1 enflt0 ocflt1 ocflt1 ocflt0 trigmode ocm2 ocm1 ocm0 0000 oc5con2 01ba fltmd fltout flttrien ocinv ? dcb1 dcb0 oc32 octrig trigstat octris syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000c oc5rs 01bc output compare 5 secondary register 0000 oc5r 01be output compare 5 register 0000 oc5tmr 01c0 timer value 5 register xxxx oc6con1 01c2 ? ? ocsidl octsel2 octsel1 octsel0 enflt2 enflt1 enflt0 ocflt2 ocflt1 ocflt0 trigmode ocm2 ocm1 ocm0 0000 oc6con2 01c4 fltmd fltout flttrien ocinv ? dcb1 dcb0 oc32 octrig trigstat octris syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000c oc6rs 01c6 output compare 6 secondary register 0000 oc6r 01c8 output compare 6 register 0000 oc6tmr 01ca timer value 6 register xxxx legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal.
? 2012-2013 microchip technology inc. ds30009312b-page 55 PIC24FJ128GC010 family oc7con1 01cc ? ? ocsidl octsel2 octsel1 octsel0 enflt2 enflt1 enflt0 ocflt2 ocflt1 ocflt0 trigmode ocm2 ocm1 ocm0 0000 oc7con2 01ce fltmd fltout flttrien ocinv ? dcb1 dcb0 oc32 octrig trigstat octris syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000c oc7rs 01d0 output compare 7 secondary register 0000 oc7r 01d2 output compare 7 register 0000 oc7tmr 01d4 timer value 7 register xxxx oc8con1 01d6 ? ? ocsidl octsel2 octsel1 octsel0 enflt2 enflt1 enflt0 ocflt2 ocflt1 ocflt0 trigmode ocm2 ocm1 ocm0 0000 oc8con2 01d8 fltmd fltout flttrien ocinv ? dcb1 dcb0 oc32 octrig trigstat octris syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000c oc8rs 01da output compare 8 secondary register 0000 oc8r 01dc output compare 8 register 0000 oc8tmr 01de timer value 8 register xxxx oc9con1 01e0 ? ? ocsidl octsel2 octsel1 octsel0 enflt2 enflt1 enflt0 ocflt2 ocflt1 ocflt0 trigmode ocm2 ocm1 ocm0 0000 oc9con2 01e2 fltmd fltout flttrien ocinv ? dcb1 dcb0 oc32 octrig trigstat octris syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 000c oc9rs 01e4 output compare 9 secondary register 0000 oc9r 01e6 output compare 9 register 0000 oc9tmr 01e8 timer value 9 register xxxx table 4-8: output compare register map (continued) file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. table 4-9: i 2 c? register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets i2c1rcv 0200 ? ? ? ? ? ? ? ? receive register 0000 i2c1trn 0202 ? ? ? ? ? ? ? ? transmit register 00ff i2c1brg 0204 ? ? ? ? ? ? ? baud rate generator register 0000 i2c1con 0206 i2cen ? i2csidl sclrel ipmien a10m disslw smen gcen stren ackdt acken rcen pen rsen sen 1000 i2c1stat 0208 ackstat trstat ? ? ? bcl gcstat add10 iwcol i2cov dac p s r/w rbf tbf 0000 i2c1add 020a ? ? ? ? ? ? address register 0000 i2c1msk 020c ? ? ? ? ? ? address mask register 0000 i2c2rcv 0210 ? ? ? ? ? ? ? ? receive register 0000 i2c2trn 0212 ? ? ? ? ? ? ? ? transmit register 00ff i2c2brg 0214 ? ? ? ? ? ? ? baud rate generator register 0000 i2c2con 0216 i2cen ? i2csidl sclrel ipmien a10m disslw smen gcen stren ackdt acken rcen pen rsen sen 1000 i2c2stat 0218 ackstat trstat ? ? ? bcl gcstat add10 iwcol i2cov dac p s r/w rbf tbf 0000 i2c2add 021a ? ? ? ? ? ? address register 0000 i2c2msk 021c ? ? ? ? ? ? address mask register 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal.
PIC24FJ128GC010 family ds30009312b-page 56 ? 2012-2013 microchip technology inc. table 4-10: uart register maps file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets u1mode 0220 uarten ? usidl iren rtsmd ? uen1 uen0 wake lpback abaud rxinv brgh pdsel1 pdsel0 stsel 0000 u1sta 0222 utxisel1 utxinv utxisel0 ? utxbrk utxen utxbf trmt urxisel1 urxisel0 adden ridle perr ferr oerr urxda 0110 u1txreg 0224 ? ? ? ? ? ? ? transmit register xxxx u1rxreg 0226 ? ? ? ? ? ? ? receive register 0000 u1brg 0228 baud rate generator prescaler register 0000 u2mode 0230 uarten ? usidl iren rtsmd ? uen1 uen0 wake lpback abaud rxinv brgh pdsel1 pdsel0 stsel 0000 u2sta 0232 utxisel1 utxinv utxisel0 ? utxbrk utxen utxbf trmt urxisel1 urxisel0 adden ridle perr ferr oerr urxda 0110 u2txreg 0234 ? ? ? ? ? ? ? transmit register xxxx u2rxreg 0236 ? ? ? ? ? ? ? receive register 0000 u2brg 0238 baud rate generator prescaler register 0000 u3mode 0250 uarten ? usidl iren rtsmd ? uen1 uen0 wake lpback abaud rxinv brgh pdsel1 pdsel0 stsel 0000 u3sta 0252 utxisel1 utxinv utxisel0 ? utxbrk utxen utxbf trmt urxisel1 urxisel0 adden ridle perr ferr oerr urxda 0110 u3txreg 0254 ? ? ? ? ? ? ? transmit register xxxx u3rxreg 0256 ? ? ? ? ? ? ? receive register 0000 u3brg 0258 baud rate generator prescaler register 0000 u4mode 02b0 uarten ? usidl iren rtsmd ? uen1 uen0 wake lpback abaud rxinv brgh pdsel1 pdsel0 stsel 0000 u4sta 02b2 utxisel1 utxinv utxisel0 ? utxbrk utxen utxbf trmt urxisel1 urxisel0 adden ridle perr ferr oerr urxda 0110 u4txreg 02b4 ? ? ? ? ? ? ? transmit register xxxx u4rxreg 02b6 ? ? ? ? ? ? ? receive register 0000 u4brg 02b8 baud rate generator prescaler register 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. table 4-11: spi register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets spi1stat 0240 spien ? spisidl ? ? spibec2 spibec1 spibec0 srmpt spirov srxmpt sisel2 sisel1 sisel0 spitbf spirbf 0000 spi1con1 0242 ? ? ? dissck dissdo mode16 smp cke ssen ckp msten spre2 spre1 spre0 ppre1 ppre0 0000 spi1con2 0244 frmen spifsd spifpol ? ? ? ? ? ? ? ? ? ? ? spife spiben 0000 spi1buf 0248 transmit and receive buffer 0000 spi2stat 0260 spien ? spisidl ? ? spibec2 spibec1 spibec0 srmpt spirov srxmpt sisel2 sisel1 sisel0 spitbf spirbf 0000 spi2con1 0262 ? ? ? dissck dissdo mode16 smp cke ssen ckp msten spre2 spre1 spre0 ppre1 ppre0 0000 spi2con2 0264 frmen spifsd spifpol ? ? ? ? ? ? ? ? ? ? ? spife spiben 0000 spi2buf 0268 transmit and receive buffer 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal.
? 2012-2013 microchip technology inc. ds30009312b-page 57 PIC24FJ128GC010 family table 4-12: op amp register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 b it 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets amp1con 024a ampen ? ampsidl ampslp intpol1 intpol0 cmout cmpsel spdsel ampoe ninsel2 ninsel1 ninsel0 pinsel2 pinsel1 pinsel0 0000 amp2con 024c ampen ? ampsidl ampslp intpol1 intpol0 cmout cmpsel spdsel ampoe ninsel2 ninsel1 ninsel0 pinsel2 pinsel1 pinsel0 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. table 4-13: porta register map ( 1 ) file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit2 bit 1 bit 0 all resets trisa 02c0 trisa15 trisa14 ? ? ? trisa10 trisa9 ? trisa7 trisa6 trisa5 trisa4 trisa3 trisa2 trisa1 trisa0 c6ff porta 02c2 ra15 ra14 ? ? ?ra10ra9 ? ra7 ra6 ra5 ra4 ra3 ra2 ra1 ra0 xxxx lata 02c4 lata15 lata14 ? ? ? lata10 lata9 ? lata7 lata6 lata5 lata4 lata3 lata2 lata1 lata0 xxxx odca 02c6 oda15 oda14 ? ? ?oda10oda9 ? oda7 oda6 oda5 oda4 oda3 oda2 oda1 oda0 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. reset values shown are for 100/121-pin devices. note 1: porta and all associated bits are unimplemented in 64-pin devices. table 4-14: portb register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets trisb 02c8 trisb15 trisb14 trisb13 trisb12 ? ? ? ? trisb7 trisb6 trisb5 trisb4 trisb3 trisb2 trisb1 trisb0 f0ff portb 02ca rb15 rb14 rb13 rb12 ? ? ? ? rb7 rb6 rb5 rb4 rb3 rb2 rb1 rb0 xxxx latb 02cc latb15 latb14 latb13 latb12 ? ? ? ? latb7 latb6 latb5 latb4 latb3 latb2 latb1 latb0 xxxx odcb 02ce odb15 odb14 odb13 odb12 ? ? ? ? odb7 odb6 odb5 odb4 odb3 odb2 odb1 odb0 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal.
PIC24FJ128GC010 family ds30009312b-page 58 ? 2012-2013 microchip technology inc. table 4-15: portc register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 ( 1 ) bit 3 ( 1 ) bit 2 ( 1 ) bit 1 ( 1 ) bit 0 all resets trisc 02d0 trisc15 ? ?trisc12 ? ? ? ? ? ? ? trisc4 trisc3 trisc2 trisc1 ? 901e portc 02d2 rc15 ( 2 , 3 ) rc14 ( 4 ) rc13 ( 4 ) rc12 ( 2 ) ? ? ? ? ? ? ? rc4 rc3 rc2 rc1 ? xxxx latc 02d4 latc15 ? ?latc12 ? ? ? ? ? ? ? latc4 latc3 latc2 latc1 ? xxxx odcc 02d6 odc15 ? ? odc12 ? ? ? ? ? ? ? odc4 odc3 odc2 odc1 ? 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. reset values shown are for 100/121-pin devices. note 1: these bits are unimplemented in 64-pin devices, read as ? 0 ?. 2: rc12 and rc15 are only available when the primary oscillator is disabled or when ec mode is selected (poscmd<1:0> configuration bits = 11 or 00 ); otherwise read as ? 0 ?. 3: rc15 is only available when the poscmd<1:0> configuration bits = 11 or 00 and the osciofn configuration bit = 1 . 4: rc13 and rc14 are input ports only and cannot be used as output ports. table 4-16: portd register map file name addr bit 15 ( 1 ) bit 14 ( 1 ) bit 13 ( 1 ) bit 12 ( 1 ) bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets trisd 02d8 trisd15 trisd14 trisd13 trisd12 trisd11 trisd10 trisd 9 trisd8 trisd7 trisd6 trisd5 trisd4 trisd3 trisd2 trisd1 trisd0 ffff portd 02da rd15 rd14 rd13 rd12 rd11 rd10 rd9 rd8 rd7 rd6 rd5 rd4 rd3 rd2 rd1 rd0 xxxx latd 02dc latd15 latd14 latd13 latd12 latd11 latd10 latd9 latd8 latd7 latd6 latd5 latd4 latd3 latd2 latd1 latd0 xxxx odcd 02de odd15 odd14 odd13 odd12 odd11 odd10 odd9 odd8 odd7 odd6 odd5 odd4 odd3 odd2 odd1 odd0 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. reset values shown are for 100/121-pin devices. note 1: these bits are unimplemented in 64-pin devices, read as ? 0 ?. table 4-17: porte register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 ( 1 ) bit 8 ( 1 ) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets trise 02e0 ? ? ? ? ? ? trise9 trise8 trise7 trise6 trise5 trise4 trise3 trise2 trise1 trise0 03ff porte 02e2 ? ? ? ? ? ? re9 re8 re7 re6 re5 re4 re3 re2 re1 re0 xxxx late 02e4 ? ? ? ? ? ? late9 late8 late7 late6 late5 late4 late3 late2 late1 late0 xxxx odce 02e6 ? ? ? ? ? ? ode9 ode8 ode7 ode6 ode5 ode4 ode3 ode2 ode1 ode0 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. reset values shown are for 100/121-pin devices. note 1: these bits are unimplemented in 64-pin devices, read as ? 0 ?.
? 2012-2013 microchip technology inc. ds30009312b-page 59 PIC24FJ128GC010 family ? table 4-18: portf register map file name addr bit 15 bit 14 bit 13 ( 1 ) bit 12 ( 1 ) bit 11 bit 10 bit 9 bit 8 ( 1 ) bit 7 ( 1 ) bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets trisf 02e8 ? ?trisf13trisf12 ? ? ? trisf8 trisf7 ? trisf5 trisf4 trisf3 t risf2 trisf1 trisf0 31bf portf 02ea ? ? rf13 rf12 ? ? ?rf8rf7 ? rf5 rf4 rf3 rf2 rf1 rf0 xxxx latf 02ec ? ? latf13 latf12 ? ? ?latf8latf7 ? latf5 latf4 latf3 latf2 latf1 latf0 xxxx odcf 02ee ? ?odf13odf12 ? ? ?odf8odf7 ? odf5 odf4 odf3 odf2 odf1 odf0 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. reset values shown are for 100/121-pin devices. note 1: these bits are unimplemented in 64-pin devices, read as ? 0 ?. table 4-19: portg register map file name addr bit 15 ( 1 ) bit 14 ( 1 ) bit 13 ( 1 ) bit 12 ( 1 ) bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 ( 1 ) bit 0 ( 1 ) all resets trisg 02f0 trisg15 trisg14 trisg13 trisg12 ? ? trisg9 trisg8 trisg7 trisg6 ? ? trisg3 trisg2 trisg1 trisg0 f3cf portg 02f2 rg15 rg14 rg13 rg12 ? ? rg9 rg8 rg7 rg6 ? ? rg3 rg2 rg1 rg0 xxxx latg 02f4latg15latg14latg13latg12 ? ?latg9latg8latg7latg6 ? ?latg3latg2latg1latg0 xxxx odcg 02f6 odg15 odg14 odg13 odg12 ? ? odg9 odg8 odg7 odg6 ? ? odg3 odg2 odg1 odg0 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. reset values shown are for 100/121-pin devices. note 1: these bits are unimplemented in 64-pin devices, read as ? 0 ?. table 4-20: pad configuratio n register map (padcfg1) file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets padcfg1 02fc ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?pmpttl 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. table 4-21: ctmu register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets ctmucon1 035a ctmuen ? ctmusidl tgen edgen edgseqen idissen cttrig ? ? ? ? ? ? ? ? 0000 ctmucon2 035c edg1mod edg1pol edg1sel3 edg1sel2 edg1sel1 edg1sel0 edg 2stat edg1stat edg2mod edg2pol edg2sel3 edg2sel2 edg2sel1 edg2sel0 ? ? 0000 ctmuicon 035e itrim5 itrim4 itrim3 itrim2 itrim1 itrim0 irng1 irng0 ? ? ? ? ? ? ? ? 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal.
PIC24FJ128GC010 family ds30009312b-page 60 ? 2012-2013 microchip technology inc. table 4-22: dac register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets dac1con 0440 dacen ? dacsidl dacslp dacfm ? ?dactrig ? dactsel4 dactsel3 dactsel2 dactsel1 dactsel0 dacref1 dacref0 0000 dac1dat 0442 dac1 input value register 0000 dac2con 0444 dacen ? dacsidl dacslp dacfm ? ?dactrig ? dactsel4 dactsel3 dactsel2 dactsel1 dactsel0 dacref1 dacref0 0000 dac2dat 0446 dac2 input value register 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. table 4-23: sigma-delta a/d register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets sd1con1 04d0 sdon ? sdsidl sdrst filtdis sdgain2 sdgain1 sdgain0 dither1 dither0 ?voscal ? sdrefn sdrefp pwrlvl 0000 sd1con2 04d2 chop1 chop0 sdint1 sdint0 ? ?sdwm1sdwm0 ? ? ? rndres1 rndres0 ? ? sdrdy 0000 sd1con3 04d4 sddiv2 sddiv1 sddiv0 sdosr2 sdosr1 sdosr0 sdcs1 sdcs0 ? ? ? ? ? sdch2 sdch1 sdch0 0000 sd1resh 04d6 sigma-delta a/d result register (bits<31-16>) 0000 sd1resl 04d8 sigma-delta a/d result register (bits<15-0>) 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. table 4-24: analog configuration register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets ancfg 04de ? ? ? ? ? ? ? ? ? ? ? ? ? ? vbg2en ? 0000 ansa 04e0 ansa15 ( 1 ) ansa14 ( 1 ) ? ? ? ansa10 ( 1 ) ansa9 ( 1 ) ? ansa7 ( 1 ) ansa6 ( 1 ) ansa5 ( 1 ) ansa4 ( 1 ) ? ?ansa1 ( 1 ) ? c6f2 ansb 04e2 ansb15 ansb14 ansb13 ansb12 ? ? ? ? ansb7 ansb6 ansb5 ansb4 ansb3 ansb2 ansb1 ansb0 f0ff ansc 04e4 ? ? ? ? ? ? ? ? ? ? ? ansc4 ( 1 ) ansc3 ( 1 ) ? ansc1 ( 1 ) ? 001a ansd 04e6 ansd15 ( 1 ) ansd14 ( 1 ) ansd13 ( 1 ) ansd12 ( 1 ) ansd11 ansd10 ansd9 ansd8 ansd7 ansd6 ansd5 ansd4 ansd3 ansd2 ? ansd0 fffd anse 04e8 ? ? ? ? ? ? anse9 ( 1 ) ? anse7 anse6 anse5 anse4 ? ? ? ? 02f0 ansf 04ea ? ? ansf13 ( 1 ) ? ? ? ?ansf8 ( 1 ) ansf7 ? ansf5 ansf4 ansf3 ansf2 ( 1 ) ?ansf0 21bd ansg 04ec ansg15 ( 1 ) ? ? ? ? ? ansg9 ansg8 ansg7 ansg6 ? ? ? ? ? ? 83c0 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. note 1: these bits are unimplemented in 64-pin devices, read as ? 0 ?.
? 2012-2013 microchip technology inc. ds30009312b-page 61 PIC24FJ128GC010 family table 4-25: 12-bit pipeline a/d converter register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets adcon1 0500 adon ? adsidl adslp form3 form2 form1 form0 pumpen adcal ? ? ? ? ?pwrlvl 0000 adcon2 0502 pvcfg1 pvcfg0 ?nvcfg0 ?buforg r r r r ? ? ? ?rfpump r 0300 adcon3 0504 adrc ? ? ? slen3 slen2 slen1 slen0 adcs7 adcs6 adcs5 adcs4 adcs3 adcs2 adcs1 adcs0 0000 adtmrpr 0506 a/d trigger timer period value 0000 adstath 050a ? ? ? ? ? ? ? ? ? ? ? ? ? pumpst adready adbusy 0000 adstatl 0508 ? ? ? ? ? ? ?slov ? ? r accif sl3if sl2if sl1if sl0if 0000 adl0conh 051e asen slint1 slint0 wm1 wm0 cm2 cm1 cm0 ctmen r mulchen samc4 samc3 samc2 samc1 samc0 0000 adl0conl 051c slen samp slenclr sltsrc4 sltsrc3 sltsrc2 sltsrc1 sltsrc0 thsrc ? ? slsize4 slsize3 slsize2 slsize1 slsize0 0000 adl1conh 053a asen slint1 slint0 wm1 wm0 cm2 cm1 cm0 ctmen r mulchen samc4 samc3 samc2 samc1 samc0 0000 adl1conl 0538 slen samp slenclr sltsrc4 sltsrc3 sltsrc2 sltsrc1 sltsrc0 thsrc ? ? slsize4 slsize3 slsize2 slsize1 slsize0 0000 adl2conh 0556 asen slint1 slint0 wm1 wm0 cm2 cm1 cm0 ctmen r mulchen samc4 samc3 samc2 samc1 samc0 0000 adl2conl 0554 slen samp slenclr sltsrc4 sltsrc3 sltsrc2 sltsrc1 sltsrc0 thsrc ? ? slsize4 slsize3 slsize2 slsize1 slsize0 0000 adl3conh 0402 asen slint1 slint0 wm1 wm0 cm2 cm1 cm0 ctmen r mulchen samc4 samc3 samc2 samc1 samc0 0000 adl3conl 0400 slen samp slenclr sltsrc4 sltsrc3 sltsrc2 sltsrc1 sltsrc0 thsrc ? ? slsize4 slsize3 slsize2 slsize1 slsize0 0000 adl0ptr 0520 ? adnext6 adnext5 adnext4 adnext3 adnext2 adnext1 adnext0 ? ? ? ? ? ? ? ? 0000 adl1ptr 053c ? adnext6 adnext5 adnext4 adnext3 adnext2 adnext1 adnext0 ? ? ? ? ? ? ? ? 0000 adl2ptr 0558 ? adnext6 adnext5 adnext4 adnext3 adnext2 adnext1 adnext0 ? ? ? ? ? ? ? ? 0000 adl3ptr 0404 ? adnext6 adnext5 adnext4 adnext3 adnext2 adnext1 adnext0 ? ? ? ? ? ? ? ? 0000 adl0stat 0522 adtact lbusy ? ? ? ? ? ?adtdly ?adlif ? ? ? ? ? 0000 adl1stat 053e adtact lbusy ? ? ? ? ? ?adtdly ?adlif ? ? ? ? ? 0000 adl2stat 055a adtact lbusy ? ? ? ? ? ?adtdly ?adlif ? ? ? ? ? 0000 adl3stat 0406 adtact lbusy ? ? ? ? ? ?adtdly ?adlif ? ? ? ? ? 0000 legend: ? = unimplemented, read as ? 0 ?, r = reserved. reset values are shown in hexadecimal.
PIC24FJ128GC010 family ds30009312b-page 62 ? 2012-2013 microchip technology inc. adtbl0 0300 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl1 0302 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl2 0304 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl3 0306 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl4 0308 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl5 030a uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl6 030c uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl7 030e uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl8 0310 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl9 0312 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl10 0314 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl11 0316 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl12 0318 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl13 031a uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl14 031c uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl15 031e uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl16 0320 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl17 0322 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl18 0324 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl19 0326 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl20 0328 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl21 032a uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl22 032c uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl23 032e uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl24 0330 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl25 0332 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl26 0334 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl27 0336 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl28 0338 uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl29 033a uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl30 033c uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 adtbl31 033e uctmu diff ? ? ? ? ? ? ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 0000 table 4-25: 12-bit pipeline a/d converter register map (continued) file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets legend: ? = unimplemented, read as ? 0 ?, r = reserved. reset values are shown in hexadecimal.
? 2012-2013 microchip technology inc. ds30009312b-page 63 PIC24FJ128GC010 family adres0 0340 a/d result register 0 0000 adres1 0342 a/d result register 1 0000 adres2 0344 a/d result register 2 0000 adres3 0346 a/d result register 3 0000 adres4 0348 a/d result register 4 0000 adres5 034a a/d result register 5 0000 adres6 034c a/d result register 6 0000 adres7 034e a/d result register 7 0000 adres8 0350 a/d result register 8 0000 adres9 0352 a/d result register 9 0000 adres10 0354 a/d result register 10 0000 adres11 0356 a/d result register 11 0000 adres12 0358 a/d result register 12 0000 adres13 035a a/d result register 13 0000 adres14 035c a/d result register 14 0000 adres15 035e a/d result register 15 0000 adres16 0360 a/d result register 16 0000 adres17 0362 a/d result register 17 0000 adres18 0364 a/d result register 18 0000 adres19 0366 a/d result register 19 0000 adres20 0368 a/d result register 20 0000 adres21 036a a/d result register 21 0000 adres22 036c a/d result register 22 0000 adres23 036e a/d result register 23 0000 adres24 0370 a/d result register 24 0000 adres25 0372 a/d result register 25 0000 adres26 0374 a/d result register 26 0000 adres27 0376 a/d result register 27 0000 adres28 0378 a/d result register 28 0000 adres29 037a a/d result register 29 0000 adres30 037c a/d result register 30 0000 adres31 037e a/d result register 31 0000 table 4-25: 12-bit pipeline a/d converter register map (continued) file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets legend: ? = unimplemented, read as ? 0 ?, r = reserved. reset values are shown in hexadecimal.
PIC24FJ128GC010 family ds30009312b-page 64 ? 2012-2013 microchip technology inc. acconh 050e ? ? ? ? ? ? ? ?acenacie ? ? ? ? ? ? 0000 acconl 050c ? ? tblsel5 tblsel4 tblsel3 tblsel2 tblsel1 tblsel0 count7 count6 count5 count4 count3 count2 count1 count0 0000 acresh 0512 a/d accumulation high result register (bits<31-16>) 0000 acresl 0510 a/d accumulation low result register (bits<15-0>) 0000 adchith 0516 chh31 chh30 chh29 chh28 chh27 chh26 chh25 chh24 chh23 chh22 chh21 chh20 chh19 chh18 chh17 chh16 0000 adchitl 0514 chh15 chh14 chh13 chh12 chh11 chh10 chh9 chh8 chh7 chh6 chh5 chh4 chh3 chh2 chh1 chh0 0000 adth0h 0526 th15 th14 th13 th12 th11 th10 th9 th8 th7 th6 th5 th4 th3 th2 th1 th0 0000 adth0l 0524 th15 th14 th13 th12 th11 th10 th9 th8 th7 th6 th5 th4 th3 th2 th1 th0 0000 adth1h 0542 th15 th14 th13 th12 th11 th10 th9 th8 th7 th6 th5 th4 th3 th2 th1 th0 0000 adth1l 0540 th15 th14 th13 th12 th11 th10 th9 th8 th7 th6 th5 th4 th3 th2 th1 th0 0000 adth2h 055e th15 th14 th13 th12 th11 th10 th9 th8 th7 th6 th5 th4 th3 th2 th1 th0 0000 adth2l 055c th15 th14 th13 th12 th11 th10 th9 th8 th7 th6 th5 th4 th3 th2 th1 th0 0000 adth3h 040a th15 th14 th13 th12 th11 th10 th9 th8 th7 th6 th5 th4 th3 th2 th1 th0 0000 adth3l 0408 th15 th14 th13 th12 th11 th10 th9 th8 th7 th6 th5 th4 th3 th2 th1 th0 0000 adl0msel3 052e ? ? ? ? ? ? ? ? ? ? ? ? ? ? msel49 msel48 0000 adl0msel2 052c msel47 msel46 msel45 msel44 msel43 msel42 msel41 msel40 msel39 msel38 msel37 msel36 msel35 msel34 msel33 msel32 0000 adl0msel1 052a msel31 msel30 msel29 msel28 msel27 msel26 msel25 msel24 msel23 msel22 msel21 msel20 msel19 msel18 msel17 msel16 0000 adl0msel0 0528 msel15 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0000 adl1msel3 054a ? ? ? ? ? ? ? ? ? ? ? ? ? ? msel49 msel48 0000 adl1msel2 0548 msel47 msel46 msel45 msel44 msel43 msel42 msel41 msel40 msel39 msel38 msel37 msel36 msel35 msel34 msel33 msel32 0000 adl1msel1 0546 msel31 msel30 msel29 msel28 msel27 msel26 msel25 msel24 msel23 msel22 msel21 msel20 msel19 msel18 msel17 msel16 0000 adl1msel0 0544 msel15 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0000 adl2msel3 0566 ? ? ? ? ? ? ? ? ? ? ? ? ? ? msel49 msel48 0000 adl2msel2 0564 msel47 msel46 msel45 msel44 msel43 msel42 msel41 msel40 msel39 msel38 msel37 msel36 msel35 msel34 msel33 msel32 0000 adl2msel1 0562 msel31 msel30 msel29 msel28 msel27 msel26 msel25 msel24 msel23 msel22 msel21 msel20 msel19 msel18 msel17 msel16 0000 adl2msel0 0560 msel15 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0000 adl3msel3 0412 ? ? ? ? ? ? ? ? ? ? ? ? ? ? msel49 msel48 0000 adl3msel2 0410 msel47 msel46 msel45 msel44 msel43 msel42 msel41 msel40 msel39 msel38 msel37 msel36 msel35 msel34 msel33 msel32 0000 adl3msel1 040e msel31 msel30 msel29 msel28 msel27 msel26 msel25 msel24 msel23 msel22 msel21 msel20 msel19 msel18 msel17 msel16 0000 adl3msel0 040c msel15 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0000 table 4-25: 12-bit pipeline a/d converter register map (continued) file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets legend: ? = unimplemented, read as ? 0 ?, r = reserved. reset values are shown in hexadecimal.
? 2012-2013 microchip technology inc. ds30009312b-page 65 PIC24FJ128GC010 family table 4-26: dma register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets dmacon 0380 dmaen ? ? ? ? ? ? ? ? ? ? ? ? ? ? prssel 0000 dmabuf 0382 dma transfer data buffer 0000 dmal 0384 dma high address limit 0000 dmah 0386 dma low address limit 0000 dmach0 0388 ? ? ? ? ? nullw reload chreq samode1 samode0 damode1 damode0 trmode1 trmode0 size chen 0000 dmaint0 038a dbufwf ? chsel5 chsel4 chsel3 chsel2 chsel1 chsel0 highif lowif doneif halfif ovrunif ? ? halfen 0000 dmasrc0 038c dma channel 0 source address 0000 dmadst0 038e dma channel 0 destination address 0000 dmacnt0 0390 dma channel 0 transaction count 0001 dmach1 0392 ? ? ? ? ? nullw reload chreq samode1 samode0 damode1 damode0 trmode1 trmode0 size chen 0000 dmaint1 0394 dbufwf ? chsel5 chsel4 chsel3 chsel2 chsel1 chsel0 highif lowif doneif halfif ovrunif ? ? halfen 0000 dmasrc1 0396 dma channel 1 source address 0000 dmadst1 0398 dma channel 1 destination address 0000 dmacnt1 039a dma channel 1 transaction count 0001 dmach2 039c ? ? ? ? ? nullw reload chreq samode1 samode0 damode1 damode0 trmode1 trmode0 size chen 0000 dmaint2 039e dbufwf ? chsel5 chsel4 chsel3 chsel2 chsel1 chsel0 highif lowif doneif halfif ovrunif ? ? halfen 0000 dmasrc2 03a0 dma channel 2 source address 0000 dmadst2 03a2 dma channel 2 destination address 0000 dmacnt2 03a4 dma channel 2 transaction count 0001 dmach3 03a6 ? ? ? ? ? nullw reload chreq samode1 samode0 damode1 damode0 trmode1 trmode0 size chen 0000 dmaint3 03a8 dbufwf ? chsel5 chsel4 chsel3 chsel2 chsel1 chsel0 highif lowif doneif halfif ovrunif ? ? halfen 0000 dmasrc3 03aa dma channel 3 source address 0000 dmadst3 03ac dma channel 3 destination address 0000 dmacnt3 03ae dma channel 3 transaction count 0001 dmach4 03b0 ? ? ? ? ? nullw reload chreq samode1 samode0 damode1 damode0 trmode1 trmode0 size chen 0000 dmaint4 03b2 dbufwf ? chsel5 chsel4 chsel3 chsel2 chsel1 chsel0 highif lowif doneif halfif ovrunif ? ? halfen 0000 dmasrc4 03b4 dma channel 4 source address 0000 dmadst4 03b6 dma channel 4 destination address 0000 dmacnt4 03b8 dma channel 4 transaction count 0001 dmach5 03ba ? ? ? ? ? nullw reload chreq samode1 samode0 damode1 damode0 trmode1 trmode0 size chen 0000 dmaint5 03bc dbufwf ? chsel5 chsel4 chsel3 chsel2 chsel1 chsel0 highif lowif doneif halfif ovrunif ? ? halfen 0000 dmasrc5 03be dma channel 5 source address 0000 dmadst5 03c0 dma channel 5 destination address 0000 dmacnt5 03c2 dma channel 5 transaction count 0001 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal.
PIC24FJ128GC010 family ds30009312b-page 66 ? 2012-2013 microchip technology inc. table 4-27: usb otg register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets u1otgir 0480 ? ? ? ? ? ? ? ? idif t1msecif lstateif actvif sesvdif sesendif ? vbusvdif 0000 u1otgie 0482 ? ? ? ? ? ? ? ? idie t1msecie lstateie actvie sesvdie sesendie ? vbusvdie 0000 u1otgstat 0484 ? ? ? ? ? ? ? ?id ?lstate ? sesvd sesend ? vbusvd 0000 u1otgcon 0486 ? ? ? ? ? ? ? ? dppulup dmpulup dppuldwn dmpuldwn rotgen r vbusdis 0000 u1pwrc 0488 ? ? ? ? ? ? ? ?uactpnd ? ?uslpgrd ? ? ususpnd usbpwr 00x0 u1ir 048a ( 1 ) ? ? ? ? ? ? ? ?stallif ? resumeif idleif trnif sofif uerrif urstif 0000 ? ? ? ? ? ? ? ? stallif attachif ( 1 ) resumeif idleif trnif sofif uerrif detachif ( 1 ) 0000 u1ie 048c ( 1 ) ? ? ? ? ? ? ? ? stallie ? resumeie idleie trnie sofie uerrie urstie 0000 ? ? ? ? ? ? ? ? stallie attachie ( 1 ) resumeie idleie trnie sofie uerrie detachie ( 1 ) 0000 u1eir 048e ( 1 ) ? ? ? ? ? ? ? ?btsef ? dmaef btoef dfn8ef crc16ef crc5ef pidef 0000 ? ? ? ? ? ? ? ?btsef ? dmaef btoef dfn8ef crc16ef eofef ( 1 ) pidef 0000 u1eie 0490 ( 1 ) ? ? ? ? ? ? ? ? btsee ? dmaee btoee dfn8ee crc16ee crc5ee pidee 0000 ? ? ? ? ? ? ? ? btsee ? dmaee btoee dfn8ee crc16ee eofee ( 1 ) pidee 0000 u1stat 0492 ? ? ? ? ? ? ? ? endpt3 endpt2 endpt1 endpt0 dir ppbi ? ? 0000 u1con 0494 ( 1 ) ? ? ? ? ? ? ? ? ?se0pktdis ? hosten resume ppbrst usben 0000 ? ? ? ? ? ? ? ?jstate ( 1 ) se0 tokbusy usbrst hosten resume ppbrst sofen ( 1 ) 0000 u1addr 0496 ? ? ? ? ? ? ? ? lspden ( 1 ) usb device address (addr) register 0000 u1bdtp1 0498 ? ? ? ? ? ? ? ? buffer descriptor table base address register ? 0000 u1frml 049a ? ? ? ? ? ? ? ? frame count register low byte 0000 u1frmh 049c ? ? ? ? ? ? ? ? frame count register high byte 0000 u1tok ( 2 ) 049e ? ? ? ? ? ? ? ? pid3 pid2 pid1 pid0 ep3 ep2 ep1 ep0 0000 u1sof ( 2 ) 04a0 ? ? ? ? ? ? ? ? start-of-frame count register 0000 u1cnfg1 04a6 ? ? ? ? ? ? ? ?uteyeuoemon ? usbsidl ? ?ppb1ppb0 0000 u1cnfg2 04a8 ? ? ? ? ? ? ? ? ? ? uvcmpsel puvbus exti2cen ? uvcmpdis utrdis 0000 u1ep0 04aa ? ? ? ? ? ? ? ? lspd ( 1 ) retrydis ( 1 ) ? epcondis eprxen eptxen epstall ephshk 0000 u1ep1 04ac ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep2 04ae ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep3 04b0 ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep4 04b2 ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep5 04b4 ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep6 04b6 ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep7 04b8 ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep8 04ba ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep9 04bc ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep10 04be ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 legend: ? = unimplemented, read as ? 0 ?, r = reserved. reset values are shown in hexadecimal. note 1: alternate register or bit definitions when the module is operating in host mode. 2: this register is available in host mode only.
? 2012-2013 microchip technology inc. ds30009312b-page 67 PIC24FJ128GC010 family u1ep11 04c0 ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep12 04c2 ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep13 04c4 ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep14 04c6 ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 u1ep15 04c8 ? ? ? ? ? ? ? ? ? ? ? epcondis eprxen eptxen epstall ephshk 0000 table 4-27: usb otg register map (continued) file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets legend: ? = unimplemented, read as ? 0 ?, r = reserved. reset values are shown in hexadecimal. note 1: alternate register or bit definitions when the module is operating in host mode. 2: this register is available in host mode only. table 4-28: lcd controller register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets lcdreg 0580 cpen ? ? ? ? ? ? ? ? ? bias2 bias1 bias0 mode13 cksel1 cksel0 0000 lcdref 0582 lcdire ? lcdcst2 lcdcst1 lcdcst0 vlcd3pe vlcd2pe vlcd1pe lrlap1 lrlap0 lrlbp1 lrlbp0 ? lrlat2 lrlat1 lrlat0 0000 lcdcon 0584 lcden ? lcdsidl ? ? ? ? ? ? slpen werr cs1 cs0 lmux2 lmux1 lmux0 0000 lcdps 0586 ? ? ? ? ? ? ? ? wft biasmd lcda wa lp3 lp2 lp1 lp0 0000 lcdse0 0588 se15 se14 se13 se12 se11 se10 se09 se08 se07 se06 se05 se04 se03 se02 se01 se00 0000 lcdse1 058a se31 ( 1 ) se30 se29 ( 1 ) se28 ( 11 ) se27 se26 se25 se24 se23 se22 se21 se20 se019 se18 se17 se16 0000 lcdse2 058c se47 se46 ( 1 ) se45 ( 1 ) se44 ( 1 ) se43 ( 1 ) se42 ( 1 ) se41 ( 1 ) se40 ( 1 ) se39 ( 1 ) se38 ( 1 ) se37 ( 1 ) se36 ( 1 ) se35 ( 1 ) se34 ( 1 ) se33 ( 1 ) se32 ( 1 ) 0000 lcdse3 058e ? se62 se61 ( 1 ) se60 ( 1 ) se59 ( 1 ) se58 ( 1 ) se57 ( 1 ) se56 ( 1 ) se55 ( 1 ) se54 ( 1 ) se53 ( 1 ) se52 ( 1 ) se51 ( 1 ) se50 ( 1 ) se49 ( 1 ) se48 ( 1 ) 0000 lcddata0 0590 s15c0 s14c0 s13c0 s12c0 s11c0 s10c0 s09c0 s08c0 s07c0 s06c0 s05c0 s04c0 s03c0 s02c0 s01c0 s00c0 0000 lcddata1 0592 s31c0 ( 1 ) s30c0 s29c0 ( 1 ) s28c0 ( 1 ) s27c0 s26c0 s25c0 s24c0 s23c0 s22c0 s21c0 s20c0 s19c0 s18c0 s17c0 s16c0 0000 lcddata2 0594 s47c0 s46c0 ( 1 ) s45c0 ( 1 ) s44c0 ( 1 ) s43c0 ( 1 ) s42c0 ( 1 ) s41c0 ( 1 ) s40c0 ( 1 ) s39c0 ( 1 ) s38c0 ( 1 ) s37c0 ( 1 ) s36c0 ( 1 ) s35c0 ( 1 ) s34c0 ( 1 ) s33c0 ( 1 ) s32c0 ( 1 ) 0000 lcddata3 0596 ? s62c0 s61c0 ( 1 ) s60c0 ( 1 ) s59c0 ( 1 ) s58c0 ( 1 ) s57c0 ( 1 ) s56c0 ( 1 ) s55c0 ( 1 ) s54c0 ( 1 ) s53c0 ( 1 ) s52c0 ( 1 ) s51c0 ( 1 ) s50c0 ( 1 ) s49c0 ( 1 ) s48c0 0000 lcddata4 0598 s15c1 s14c1 s13c1 s12c1 s11c1 s10c1 s09c1 s08c1 s07c1 s06c1 s05c1 s04c1 s03c1 s02c1 s01c1 s00c1 0000 lcddata5 059a s31c1 ( 1 ) s30c1 s29c1 ( 1 ) s28c1 ( 1 ) s27c1 s26c1 s25c1 s24c1 s23c1 s22c1 s21c1 s20c1 s19c1 s18c1 s17c1 s16c1 0000 lcddata6 059c s47c1 s46c1 ( 1 ) s45c1 ( 1 ) s44c1 ( 1 ) s43c1 ( 1 ) s42c1 ( 1 ) s41c1 ( 1 ) s40c1 ( 1 ) s39c1 ( 1 ) s38c1 ( 1 ) s37c1 ( 1 ) s36c1 ( 1 ) s35c1 ( 1 ) s34c1 ( 1 ) s33c1 ( 1 ) s32c1 ( 1 ) 0000 lcddata7 059e ? s62c1 s61c1 ( 1 ) s60c1 ( 1 ) s59c1 ( 1 ) s58c1 ( 1 ) s57c1 ( 1 ) s56c1 ( 1 ) s55c1 ( 1 ) s54c1 ( 1 ) s53c1 ( 1 ) s52c1 ( 1 ) s51c1 ( 1 ) s50c1 ( 1 ) s49c1 ( 1 ) s48c1 0000 lcddata8 05a0 s15c2 s14c2 s13c2 s12c2 s11c2 s10c2 s09c2 s08c2 s07c2 s06c2 s05c2 s04c2 s03c2 s02c2 s01c2 s00c2 0000 lcddata9 05a2 s31c2 ( 1 ) s30c2 s29c2 ( 1 ) s28c2 ( 1 ) s27c2 s26c2 s25c2 s24c2 s23c2 s22c2 s21c2 s20c2 s19c2 s18c2 s17c2 s16c2 0000 lcddata10 05a4 s47c2 s46c2 ( 1 ) s45c2 ( 1 ) s44c2 ( 1 ) s43c2 ( 1 ) s42c2 ( 1 ) s41c2 ( 1 ) s40c2 ( 1 ) s39c2 ( 1 ) s38c2 ( 1 ) s37c2 ( 1 ) s36c2 ( 1 ) s35c2 ( 1 ) s34c2 ( 1 ) s33c2 ( 1 ) s32c2 ( 1 ) 0000 lcddata11 05a6 ? s62c2 s61c2 ( 1 ) s60c2 ( 1 ) s59c2 ( 1 ) s58c2 ( 1 ) s57c2 ( 1 ) s56c2 ( 1 ) s55c2 ( 1 ) s54c2 ( 1 ) s53c2 ( 1 ) s52c2 ( 1 ) s51c2 ( 1 ) s50c2 ( 1 ) s49c2 ( 1 ) s48c2 0000 lcddata12 05a8 s15c3 s14c3 s13c3 s12c3 s11c3 s10c3 s09c3 s08c3 s07c3 s06c3 s05c3 s04c3 s03c3 s02c3 s01c3 s00c3 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. note 1: these bits are unimplemented in 64-pin devices, read as ? 0 ?.
PIC24FJ128GC010 family ds30009312b-page 68 ? 2012-2013 microchip technology inc. lcddata13 05aa s31c3 ( 1 ) s30c3 s29c3 ( 1 ) s28c3 ( 1 ) s27c3 s26c3 s25c3 s24c3 s23c3 s22c3 s21c3 s20c3 s19c3 s18c3 s17c3 s16c3 0000 lcddata14 05ac s47c3 s46c3 ( 1 ) s45c3 ( 1 ) s44c3 ( 1 ) s43c3 ( 1 ) s42c3 ( 1 ) s41c3 ( 1 ) s40c3 ( 1 ) s39c3 ( 1 ) s38c3 ( 1 ) s37c3 ( 1 ) s36c3 ( 1 ) s35c3 ( 1 ) s34c3 ( 1 ) s33c3 ( 1 ) s32c3 ( 1 ) 0000 lcddata15 05ae ? s62c3 s61c3 ( 1 ) s60c3 ( 1 ) s59c3 ( 1 ) s58c3 ( 1 ) s57c3 ( 1 ) s56c3 ( 1 ) s55c3 ( 1 ) s54c3 ( 1 ) s53c3 ( 1 ) s52c3 ( 1 ) s51c3 ( 1 ) s50c3 ( 1 ) s49c3 ( 1 ) s48c3 0000 lcddata16 05b0 s15c4 s14c4 s13c4 s12c4 s11c4 s10c4 s09c4 s08c4 s07c4 s06c4 s05c4 s04c4 s03c4 s02c4 s01c4 s00c4 0000 lcddata17 05b2 s31c4 ( 1 ) s30c4 s29c4 ( 1 ) s28c4 ( 1 ) s27c4 s26c4 s25c4 s24c4 s23c4 s22c4 s21c4 s20c4 s19c4 s18c4 s17c4 s16c4 0000 lcddata18 05b4 s47c4 s46c4 ( 1 ) s45c4 ( 1 ) s44c4 ( 1 ) s43c4 ( 1 ) s42c4 ( 1 ) s41c4 ( 1 ) s40c4 ( 1 ) s39c4 ( 1 ) s38c4 ( 1 ) s37c4 ( 1 ) s36c4 ( 1 ) s35c4 ( 1 ) s34c4 ( 1 ) s33c4 ( 1 ) s32c4 ( 1 ) 0000 lcddata19 05b6 ? s62c4 s61c4 ( 1 ) s60c4 ( 1 ) s59c4 ( 1 ) s58c4 ( 1 ) s57c4 ( 1 ) s56c4 ( 1 ) s55c4 ( 1 ) s54c4 ( 1 ) s53c4 ( 1 ) s52c4 ( 1 ) s51c4 ( 1 ) s50c4 ( 1 ) s49c4 ( 1 ) s48c4 0000 lcddata20 05b8 s15c5 s14c5 s13c5 s12c5 s11c5 s10c5 s09c5 s08c5 s07c5 s06c5 s05c5 s04c5 s03c5 s02c5 s01c5 s00c5 0000 lcddata21 05ba s31c5 ( 1 ) s30c5 s29c5 ( 1 ) s28c5 ( 1 ) s27c5 s26c5 s25c5 s24c5 s23c5 s22c5 s21c5 s20c5 s19c5 s18c5 s17c5 s16c5 0000 lcddata22 05bc s47c5 s46c5 ( 1 ) s45c5 ( 1 ) s44c5 ( 1 ) s43c5 ( 1 ) s42c5 ( 1 ) s41c5 ( 1 ) s40c5 ( 1 ) s39c5 ( 1 ) s38c5 ( 1 ) s37c5 ( 1 ) s36c5 ( 1 ) s35c5 ( 1 ) s34c5 ( 1 ) s33c5 ( 1 ) s32c5 ( 1 ) 0000 lcddata23 05be ? s62c5 s61c5 ( 1 ) s60c5 ( 1 ) s59c5 ( 1 ) s58c5 ( 1 ) s57c5 ( 1 ) s56c5 ( 1 ) s55c5 ( 1 ) s54c5 ( 1 ) s53c5 ( 1 ) s52c5 ( 1 ) s51c5 ( 1 ) s50c5 ( 1 ) s49c5 ( 1 ) s48c5 0000 lcddata24 05c0 s15c6 s14c6 s13c6 s12c6 s11c6 s10c6 s09c6 s08c6 s07c6 s06c6 s05c6 s04c6 s03c6 s02c6 s01c6 s00c6 0000 lcddata25 05c2 s31c6 ( 1 ) s30c6 s29c6 ( 1 ) s28c6 ( 1 ) s27c6 s26c6 s25c6 s24c6 s23c6 s22c6 s21c6 s20c6 s19c6 s18c6 s17c6 s16c6 0000 lcddata26 05c4 s47c6 s46c6 ( 1 ) s45c6 ( 1 ) s44c6 ( 1 ) s43c6 ( 1 ) s42c6 ( 1 ) s41c6 ( 1 ) s40c6 ( 1 ) s39c6 ( 1 ) s38c6 ( 1 ) s37c6 ( 1 ) s36c6 ( 1 ) s35c6 ( 1 ) s34c6 ( 1 ) s33c6 ( 1 ) s32c6 ( 1 ) 0000 lcddata27 05c6 ? s62c6 s61c6 ( 1 ) s60c6 ( 1 ) s59c6 ( 1 ) s58c6 ( 1 ) s57c6 ( 1 ) s56c6 ( 1 ) s55c6 ( 1 ) s54c6 ( 1 ) s53c6 ( 1 ) s52c6 ( 1 ) s51c6 ( 1 ) s50c6 ( 1 ) s49c6 ( 1 ) s48c6 0000 lcddata28 05c8 s15c7 s14c7 s13c7 s12c7 s11c7 s10c7 s09c7 s08c7 s07c7 s06c7 s05c7 s04c7 s03c7 s02c7 s01c7 s00c7 0000 lcddata29 05ca s31c7 ( 1 ) s30c7 s29c7 ( 1 ) s28c7 ( 1 ) s27c7 s26c7 s25c7 s24c7 s23c7 s22c7 s21c7 s20c7 s19c7 s18c7 s17c7 s16c7 0000 lcddata30 05cc s47c7 s46c7 ( 1 ) s45c7 ( 1 ) s44c7 ( 1 ) s43c7 ( 1 ) s42c7 ( 1 ) s41c7 ( 1 ) s40c7 ( 1 ) s39c7 ( 1 ) s38c7 ( 1 ) s37c7 ( 1 ) s36c7 ( 1 ) s35c7 ( 1 ) s34c7 ( 1 ) s33c7 ( 1 ) s32c7 ( 1 ) 0000 lcddata31 05ce ? s62c7 s61c7 ( 1 ) s60c7 ( 1 ) s59c7 ( 1 ) s58c7 ( 1 ) s57c7 ( 1 ) s56c7 ( 1 ) s55c7 ( 1 ) s54c7 ( 1 ) s53c7 ( 1 ) s52c7 ( 1 ) s51c7 ( 1 ) s50c7 ( 1 ) s49c7 ( 1 ) s48c7 0000 table 4-28: lcd controller register map (continued) file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. note 1: these bits are unimplemented in 64-pin devices, read as ? 0 ?.
? 2012-2013 microchip technology inc. ds30009312b-page 69 PIC24FJ128GC010 family table 4-29: parallel master/slave port register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets pmcon1 0600 pmpen ? psidl adrmux1 adrmux0 ? mode1 mode0 csf1 csf0 alp almode ? buskeep irqm1 irqm0 0000 pmcon2 0602 busy ?errortimeout ? ? ? ? raddr23 raddr22 raddr21 raddr20 raddr19 raddr18 raddr17 raddr16 0000 pmcon3 0604 ptwren ptrden ptbe1en ptbe0en ? awaitm1 awaitm0 awaite ? pten22 pten21 pten20 pten19 pten18 pten17 pten16 0000 pmcon4 0606 pten15 pten14 pten13 pten12 pten11 pten10 pt en9 pten8 pten7 pten6 pten5 pten4 pten3 pten2 pten1 pten0 0000 pmcs1cf 0608 csdis csp cspten bep ? wrsp rdsp sm ackp ptsz1 ptsz0 ? ? ? ? ? 0000 pmcs1bs 060a base23 base22 base21 base20 base19 base18 base17 base16 base15 ? ? ? ? ? ? ? 0200 pmcs1md 060c ackm1 ackm0 amwait2 amwait1 amwait0 ? ? ? dwaitb1 dwaitb0 dwaitm3 dwaitm2 dwaitm1 dwaitm0 dwaite1 dwaite0 0000 pmcs2cf 060e csdis csp cspten bep ? wrsp rdsp sm ackp ptsz1 ptsz0 ? ? ? ? ? 0000 pmcs2bs 0610 base23 base22 base21 base20 base19 base18 base17 base16 base15 ? ? ? ? ? ? ? 0600 pmcs2md 0612 ackm1 ackm0 amwait2 amwait1 amwait0 ? ? ? dwaitb1 dwaitb0 dwaitm3 dwaitm2 dwaitm1 dwaitm0 dwaite1 dwaite0 0000 pmdout1 0614 data out register 1<15:8> data out register 1<7:0> xxxx pmdout2 0616 data out register 2<15:8> data out register 2<7:0> xxxx pmdin1 0618 data in register 1<15:8> data in register 1<7:0> xxxx pmdin2 061a data in register 2<15:8> data in register 2<7:0> xxxx pmstat 061c ibf ibov ? ? ib3f ib2f ib1f ib0f obe obuf ? ? ob3e ob2e ob1e ob0e 008f legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. table 4-30: real-time clock and calendar (rtcc) register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets alrmval 0620 alarm value register window based on alrmptr<1:0> xxxx alcfgrpt 0622 alrmen chime amask3 amask2 amask1 amask0 alrmptr1 alrmptr0 arpt7 arpt6 arpt5 arpt4 arpt3 arpt2 arpt1 arpt0 0000 rtcval 0624 rtcc value register window based on rtcptr<1:0> xxxx rcfgcal 0626 rtcen ? rtcwren rtcsync halfsec rtcoe rtcptr1 rtcptr0 cal7 cal6 cal5 cal4 cal3 cal2 cal1 cal0 note 1 rtcpwc 0628 pwcen pwcpol pwcpre pwspre rtclk1 rtclk0 rtcout1 rtcout0 ? ? ? ? ? ? ? ? note 1 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. note 1: the status of the rcfgcal and rtcpwr registers on por is ? 0000 ?, and on other resets, it is unchanged table 4-31: data signal modulator (dsm) register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets mdcon 062a mden ?mdsidl ? ? ? ? ? ? mdoe mdslr mdopol ? ? ?mdbit 0020 mdsrc 062c ? ? ? ? ? ? ? ? sodis ? ? ? ms3 ms2 ms1 ms0 000x mdcar 062e chodis chpol chsync ? ch3 ch2 ch1 ch0 clodis clpol clsync ? cl3 cl2 cl1 cl0 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal.
PIC24FJ128GC010 family ds30009312b-page 70 ? 2012-2013 microchip technology inc. table 4-32: comparators register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets cmstat 0630 cmidl ? ? ? ? c3evt c2evt c1evt ? ? ? ? ? c3out c2out c1out 0000 cvrcon 0632 ? ? ? ? ? cvrefp cvrefm1 cvrefm0 cvren cvroe cvrss cvr4 cvr3 cvr2 cvr1 cvr0 0000 cm1con 0634 con coe cpol ? ? ? cevt cout evpol1 evpol0 ? cref ? ? cch1 cch0 0000 cm2con 0636 con coe cpol ? ? ? cevt cout evpol1 evpol0 ? cref ? ? cch1 cch0 0000 cm3con 0638 con coe cpol ? ? ? cevt cout evpol1 evpol0 ? cref ? ? cch1 cch0 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. table 4-33: crc register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 b it 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets crccon1 0640 crcen ? csidl vword4 vword3 vword2 vword1 vw ord0 crcful crcmpt crcisel crcgo lendian ? ? ? 0040 crccon2 0642 ? ? ? dwidth4 dwidth3 dwidth2 dwidth1 dwidth0 ? ? ? plen4 plen3 plen2 plen1 plen0 0000 crcxorl 0644 x15 x14 x13 x12 x11 x10 x9 x8 x7 x6 x5 x4 x3 x2 x1 ? 0000 crcxorh 0646 x31 x30 x29 x28 x27 x26 x25 x24 x23 x22 x21 x20 x19 x18 x17 x16 0000 crcdatl 0648 crc data input register low 0000 crcdath 064a crc data input register high 0000 crcwdatl 064c crc result register low 0000 crcwdath 064e crc result register high 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. table 4-34: band gap buffer interface register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets bufcon0 0670 bufen ? bufsidl bufslp ? ? ? ? ?bufstby ? ? ? ? bufref1 bufref0 0000 bufcon1 0672 bufen ? bufsidl bufslp ? ? ? ?bufoebufstby ? ? ? ? bufref1 bufref0 0000 bufcon2 0674 bufen ? bufsidl bufslp ? ? ? ?bufoebufstby ? ? ? ? bufref1 bufref0 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal.
? 2012-2013 microchip technology inc. ds30009312b-page 71 PIC24FJ128GC010 family table 4-35: peripheral pin select register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets rpinr0 0680 ? ? int1r5int1r4int1r3int1r2int1r1int1r0 ? ? ? ? ? ? ? ? 003f rpinr1 0682 ? ? int3r5int3r4int3r3int3r2int3r1int3r0 ? ? int2r5 int2r4 int2r3 int2r2 int2r1 int2r0 3f00 rpinr2 0684 ? ? ? ? ? ? ? ? ? ? int4r5 int4r4 int4r3 int4r2 int4r1 int4r0 3f3f rpinr7 068e ? ? ic2r5 ic2r4 ic2r3 ic2r2 ic2r1 ic2r0 ? ? ic1r5 ic1r4 ic1r3 ic1r2 ic1r1 ic1r0 3f3f rpinr8 0690 ? ? ic4r5 ic4r4 ic4r3 ic4r2 ic4r1 ic4r0 ? ? ic3r5 ic3r4 ic3r3 ic3r2 ic3r1 ic3r0 3f3f rpinr9 0692 ? ? ic6r5 ic6r4 ic6r3 ic6r2 ic6r1 ic6r0 ? ? ic5r5 ic5r4 ic5r3 ic5r2 ic5r1 ic5r0 3f3f rpinr10 0694 ? ? ic8r5 ic8r4 ic8r3 ic8r2 ic8r1 ic8r0 ? ? ic7r5 ic7r4 ic7r3 ic7r2 ic7r1 ic7r0 003f rpinr11 0696 ? ? ocfbr5 ocfbr4 ocfbr3 ocfbr2 ocfbr1 ocfbr0 ? ? ocfar5 ocfar4 ocfar3 ocfar2 ocfar1 ocfar0 3f3f rpinr15 06a2 ? ? ic9r5 ic9r4 ic9r3 ic9r2 ic9r1 ic9r0 ? ? ? ? ? ? ? ? 3f00 rpinr17 06a2 ? ? u3rxr5 u3rxr4 u3rxr3 u3rxr2 u3rxr1 u3rxr0 ? ? ? ? ? ? ? ? 3f00 rpinr18 06a4 ? ? u1ctsr5 u1ctsr4 u1ctsr3 u1ctsr2 u1ctsr1 u1ctsr0 ? ? u1rxr5 u1rxr4 u1rxr3 u1rxr2 u1rxr1 u1rxr0 3f3f rpinr19 06a6 ? ? u2ctsr5 u2ctsr4 u2ctsr3 u2ctsr2 u2ctsr1 u2ctsr0 ? ? u2rxr5 u2rxr4 u2rxr3 u2rxr2 u2rxr1 u2rxr0 3f3f rpinr20 06a8 ? ? sck1r5 sck1r4 sck1r3 s ck1r2 sck1r1 sck1r0 ? ? sdi1r5sdi1r4sdi1r3sdi1r2sdi1r1sdi1r0 3f3f rpinr21 06aa ? ? u3ctsr5 u3ctsr4 u3ctsr3 u3ctsr2 u3ctsr1 u3ctsr0 ? ? ss1r5 ss1r4 ss1r3 ss1r2 ss1r1 ss1r0 3f3f rpinr22 06ac ? ? sck2r5 sck2r4 sck2r3 s ck2r2 sck2r1 sck2r0 ? ? sdi2r5sdi2r4sdi2r3sdi2r2sdi2r1sdi2r0 3f3f rpinr23 06ae ? ? tmrckr5 tmrckr4 tmrckr3 tmrckr2 tmrckr1 tmrckr0 ? ? ss2r5 ss2r4 ss2r3 ss2r2 ss2r1 ss2r0 003f rpinr27 06b6 ? ? u4ctsr5 u4ctsr4 u4ctsr3 u4ctsr2 u4ctsr1 u4ctsr0 ? ? u4rxr5 u4rxr4 u4rxr3 u4rxr2 u4rxr1 u4rxr0 3f3f rpinr30 06bc ? ? ? ? ? ? ? ? ? ? mdmir5 mdmir4 mdmir3 mdmir2 mdmir1 mdmir0 003f rpinr31 06be ? ? mdc2r5 mdc2r4 mdc2r3 mdc2r2 mdc2r1 mdc2r0 ? ? mdc1r5 mdc1r4 mdc1r3 mdc1r2 mdc1r1 mdc1r0 3f3f legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. note 1: these bits are unimplemented in 64-pin devices, read as ? 0 ?.
PIC24FJ128GC010 family ds30009312b-page 72 ? 2012-2013 microchip technology inc. rpor0 06c0 ? ? rp1r5 rp1r4 rp1r3 rp1r2 rp1r1 rp1r0 ? ? rp0r5 rp0r4 rp0r3 rp0r2 rp0r1 rp0r0 0000 rpor1 06c2 ? ? rp3r5 rp3r4 rp3r3 rp3r2 rp3r1 rp3r0 ? ? rp2r5 rp2r4 rp2r3 rp2r2 rp2r1 rp2r0 0000 rpor2 06c4 ? ?rp5r5 ( 1 ) rp5r4 ( 1 ) rp5r3 ( 1 ) rp5r2 ( 1 ) rp5r1 ( 1 ) rp5r0 ( 1 ) ? ? rp4r5 rp4r4 rp4r3 rp4r2 rp4r1 rp4r0 0000 rpor3 06c6 ? ? rp7r5 rp7r4 rp7r3 rp7r2 rp7r1 rp7r0 ? ? rp6r5 rp6r4 rp6r3 rp6r2 rp6r1 rp6r0 0000 rpor4 06c8 ? ? rp9r5 rp9r4 rp9r3 rp9r2 rp9r1 rp9r0 ? ? rp8r5 rp8r4 rp8r3 rp8r2 rp8r1 rp8r0 0000 rpor5 06ca ? ? rp11r5 rp11r4 rp11r3 rp11r2 rp11r1 rp11r0 ? ? rp10r5 rp10r4 rp10r3 rp10r2 rp10r1 rp10r0 0000 rpor6 06cc ? ? rp13r5rp13r4rp13r3rp13r2rp13r1rp13r0 ? ? rp12r5 rp12r4 rp12r3 rp12r2 rp12r1 rp12r0 0000 rpor7 06ce ? ?rp15r5 ( 1 ) rp15r4 ( 1 ) rp15r3 ( 1 ) rp15r2 ( 1 ) rp15r1 ( 1 ) rp15r0 ( 1 ) ? ? rp14r5 rp14r4 rp14r3 rp14r2 rp14r1 rp14r0 0000 rpor8 06d0 ? ? rp17r5rp17r4rp17r3rp17r2rp17r1rp17r0 ? ? rp16r5 rp16r4 rp16r3 rp16r2 rp16r1 rp16r0 0000 rpor9 06d2 ? ? rp19r5rp19r4rp19r3rp19r2rp19r1rp19r0 ? ? rp18r5 rp18r4 rp18r3 rp18r2 rp18r1 rp18r0 0000 rpor10 06d4 ? ? rp21r5rp21r4rp21r3rp21r2rp21r1rp21r0 ? ? rp20r5 rp20r4 rp20r3 rp20r2 rp20r1 rp20r0 0000 rpor11 06d6 ? ? rp23r5rp23r4rp23r3rp23r2rp23r1rp23r0 ? ? rp22r5 rp22r4 rp22r3 rp22r2 rp22r1 rp22r0 0000 rpor12 06d8 ? ? rp25r5rp25r4rp25r3rp25r2rp25r1rp25r0 ? ? rp24r5 rp24r4 rp24r3 rp24r2 rp24r1 rp24r0 0000 rpor13 06da ? ? rp27r5rp27r4rp27r3rp27r2rp27r1rp27r0 ? ? rp26r5 rp26r4 rp26r3 rp26r2 rp26r1 rp26r0 0000 rpor14 06dc ? ? rp29r5rp29r4rp29r3rp29r2rp29r1rp29r0 ? ? rp28r5 rp28r4 rp28r3 rp28r2 rp28r1 rp28r0 0000 rpor15 06de ? ?rp31r5 ( 1 ) rp31r4 ( 1 ) rp31r3 ( 1 ) rp31r2 ( 1 ) rp31r1 ( 1 ) rp31r0 ( 1 ) ? ? rp30r5 rp30r4 rp30r3 rp30r2 rp30r1 rp30r0 0000 table 4-35: peripheral pin select register map (continued) file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. note 1: these bits are unimplemented in 64-pin devices, read as ? 0 ?. table 4-36: system control (clock and reset) register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets rcon 0740 trapr iopuwr ? reten ? dpslp cm pmslp extr swr swdten wdto sleep idle bor por note 1 osccon 0742 ? cosc2 cosc1 cosc0 ? nosc2 nosc1 nosc0 clklock iolock lock ?cfposcensoscenoswen note 2 clkdiv 0744 roi doze2 doze1 doze0 dozen rcdiv2 rcdiv1 rcdiv0 cpdiv1 cpdiv0 pllen ? ? ? ? ? 3100 osctun 0748 sten ? stsidl stsrc stlock stlpol stor storpol ? ? tun5 tun4 tun3 tun2 tun1 tun0 0000 refocon 074e roen ? rosslp rosel rodiv3 rodiv2 rodiv1 rodiv0 ? ? ? ? ? ? ? ? 0000 hlvdcon 0756 hlvden ?lsidl ? ? ? ? ? vdir bgvst irvst ? hlvdl3 hlvdl2 hlvdl1 hlvdl0 0000 rcon2 0762 ? ? ? ? ? ? ? ? ? ? ? r vddbor vddpor vbpor vbat note 1 legend: ? = unimplemented, read as ? 0 ?; r = reserved. reset values are shown in hexadecimal. note 1: the reset value of the rcon register is dependent on the type of reset event. see section 7.0 ?resets? for more information. 2: the reset value of the osccon register is dependent on both the type of reset event and the device configuration. see section 9.0 ?oscillator configuration? for more information.
? 2012-2013 microchip technology inc. ds30009312b-page 73 PIC24FJ128GC010 family table 4-37: deep sleep register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets dscon 0758 dsen ? ? ? ? ? ? ? ? ? ? ? ? r dsbor release 0000 ( 1 ) dswake 075a ? ? ? ? ? ? ? dsint0 dsflt ? ? dswdt dsrtcc dsmclr ? ? 0000 ( 1 ) dsgpr0 075c deep sleep semaphore data 0 0000 ( 1 ) dsgpr1 075e deep sleep semaphore data 1 0000 ( 1 ) legend: ? = unimplemented, read as ? 0 ?; r = reserved. reset values are shown in hexadecimal. note 1: these registers are only reset on a v dd por event. table 4-38: nvm register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets nvmcon 0760 wr wren wrerr ? ? ? ? ? ?erase ? ? nvmop3 nvmop2 nvmop1 nvmop0 0000 ( 1 ) nvmkey 0766 ? ? ? ? ? ? ? ? nvmkey register<7:0> 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal. note 1: the reset value shown is for por only. the value on other reset states is dependent on the state of memory write or erase opera tions at the time of reset. table 4-39: pmd register map file name addr bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets pmd1 0770 t5md t4md t3md t2md t1md ? ? ? i2c1md u2md u1md spi2md spi1md ? ? adc1md 0000 pmd2 0772 ic8md ic7md ic6md ic5md ic4md ic3md ic2md ic1md oc8md oc7md oc6md oc5md oc4md oc3md oc2md oc1md 0000 pmd3 0774 ? ? ? ? txmmd cmpmd rtccmd pmpmd crcmd dac1md ? ?u3md ?i2c2md ? 0000 pmd4 0776 ? ? ? ? ? ? ? ? ?upwmmdu4md ? refomd ctmumd hlvdmd usb1md 0000 pmd5 0778 ? ? ? ? ? ? ?ic9md ? ? ? ? ? ? ?oc9md 0000 pmd6 077a ? ? ? ? ? ? ? ? ? lcdmd amp1md dac2md amp2md sda1md ? ? 0000 pmd7 077c ? ? ? ? ? ? ? ? ? ? dma1md dma0md ? ? ? ? 0000 legend: ? = unimplemented, read as ? 0 ?. reset values are shown in hexadecimal.
PIC24FJ128GC010 family ds30009312b-page 74 ? 2012-2013 microchip technology inc. 4.2.5 extended data space (eds) the extended data space (eds) allows pic24f devices to address a much larger range of data than would otherwise be possible with a 16-bit address range. eds includes any additional internal data mem- ory not directly accessible by the lower 32-kbyte data address space and any external memory through the enhanced parallel master port (epmp). in addition, eds also allows read access to the program memory space. this feature is called program space visibility (psv) and is discussed in detail in section 4.3.3 ?reading data from program memory using eds? . figure 4-4 displays the entire eds space. the eds is organized as pages, called eds pages, with one page equal to the size of the eds window (32 kbytes). a par- ticular eds page is selected through the data space read register (dsrpag) or data space write register (dswpag). for psv, only the dsrpag register is used. the combination of the dsrpag register value and the 16-bit wide data address forms a 24-bit effective address (ea). the data addressing range of PIC24FJ128GC010 family devices depends on the version of the enhanced parallel master port (epmp) implemented on a particu- lar device; this is, in turn, is a function of the device pin count. table 4-40 lists the total memory accessible by each of the devices in this family. for more details on accessing external memory using epmp, refer to the ? pic24f family reference manual ?, section 42. ?enhanced parallel master port (epmp)? (ds39730). . figure 4-4: extended data space table 4-40: total accessible data memory family internal ram external ram access using epmp pic24fjxxxgc010 8k up to 16 mbytes pic24fjxxxgc006 8k up to 64k note: accessing page 0 in the eds window will generate an address error trap as page 0 is the base data memory (data locations, 0800h to 7fffh, in the lower data space). 0000h special registers 32-kbyte eds 8000h program memory dsxpag = 001h dsx pag = 1ffh dsrpag = 200h dsrpag = 3ffh function 008000h 00fffeh 000000h 7f8001h fffffeh 007ffeh 7fffffh program space 0800h fffeh eds pages epmp memory space (1) external memory access using epmp (1) ff8000h dsrpag = 2ffh 7f8000h 7ffffeh access program space access program space access dsrpag = 300h 000001h 007fffh program space access note 1: the range of addressable memory available is dependent on the device pin count and epmp implementation. external memory access using epmp (1) internal data memory space (up to 30 kbytes) (lower word) (lower word) (upper word) (upper word) window
? 2012-2013 microchip technology inc. ds30009312b-page 75 PIC24FJ128GC010 family 4.2.5.1 data read from eds in order to read the data from the eds space, first, an address pointer is set up by loading the required eds page number into the dsrpag register and assigning the offset address to one of the w registers. once the above assignment is done, the eds window is enabled by setting bit 15 of the working register, assigned with the offset address; then, the contents of the pointed eds location can be read. figure 4-5 illustrates how the eds space address is generated for read operations. when the most significant bit (msb) of ea is ? 1 ? and dsrpag<9> = 0 , the lower 9 bits of dsrpag are con- catenated to the lower 15 bits of the ea to form a 24-bit eds space address for read operations. example 4-1 shows how to read a byte, word and double-word from eds. figure 4-5: eds address ge neration for read operations example 4-1: eds read code in assembly note: all read operations from eds space have an overhead of one instruction cycle. therefore, a minimum of two instruction cycles is required to complete an eds read. eds reads under the repeat instruction; the first two accesses take three cycles and the subsequent accesses take one cycle. dsrpag reg select wn 98 15 bits 9 bits 24-bit ea wn<0> is byte select 0 = extended sram and epmp 1 0 ; set the eds page from where the data to be read mov #0x0002, w0 mov w0, dsrpag ;page 2 is selected for read mov #0x0800, w1 ;select the location (0x800) to be read bset w1, #15 ;set the msb of the base address, enable eds mode ;read a byte from the selected location mov.b [w1++], w2 ;read low byte mov.b [w1++], w3 ;read high byte ;read a word from the selected location mov [w1], w2 ; ;read double - word from the selected location mov.d [w1], w2 ;two word read, stored in w2 and w3
PIC24FJ128GC010 family ds30009312b-page 76 ? 2012-2013 microchip technology inc. 4.2.5.2 data write into eds in order to write data to eds space, such as in eds reads, an address pointer is set up by loading the required eds page number into the dswpag register and assigning the offset address to one of the w regis- ters. once the above assignment is done, then the eds window is enabled by setting bit 15 of the working register, assigned with the offset address, and the accessed location can be written. figure 4-6 illustrates how the eds space address is generated for write operations. when the msb of ea is ? 1 ?, the lower 9 bits of dswpag are concatenated to the lower 15 bits of ea to form a 24-bit eds address for write operations. example 4-2 shows how to write a byte, word and double-word to eds. the page registers (dsrpag/dswpag) do not update automatically while crossing a page boundary when the rollover happens from 0xffff to 0x8000. while developing code in assembly, care must be taken to update the page registers when an address pointer crosses the page boundary. the ?c? compiler keeps track of the addressing, and increments or decrements the page registers accordingly, while accessing contiguous data memory locations. figure 4-6: eds address gene ration for write operations example 4-2: eds write code in assembly note 1: all write operations to eds are executed in a single cycle. 2: use of read/modify/write operation on any eds location under a repeat instruction is not supported. for example, bclr, bsw, btg, rlc f, rlnc f, rrc f, rrnc f, add f, sub f, subr f, and f, ior f, xor f, asr f, asl f . 3: use the dsrpag register while performing read/modify/write operations. dswpag reg select wn 8 15 bits 9 bits 24-bit ea wn<0> is byte select 1 0 ; set the eds page where the data to be written mov #0x0002, w0 mov w0, dswpag ;page 2 is selected for write mov #0x0800, w1 ;select the location (0x800) to be written bset w1, #15 ;set the msb of the base address, enable eds mode ;write a byte to the selected location mov #0x00a5, w2 mov #0x003c, w3 mov.b w2, [w1++] ;write low byte mov.b w3, [w1++] ;write high byte ;write a word to the selected location mov #0x1234, w2 ; mov w2, [w1] ; ;write a double - word to the selected location mov #0x1122, w2 mov #0x4455, w3 mov.d w2, [w1] ;2 eds writes
? 2012-2013 microchip technology inc. ds30009312b-page 77 PIC24FJ128GC010 family table 4-41: eds memory address with different pages and addresses 4.2.6 software stack apart from its use as a working register, the w15 register in pic24f devices is also used as a software stack pointer (ssp). the pointer always points to the first available free word and grows from lower to higher addresses. it predecrements for stack pops and post- increments for stack pushes, as shown in figure 4-7 . note that for a pc push during any call instruction, the msb of the pc is zero-extended before the push, ensuring that the msb is always clear. the stack pointer limit value register (splim), associ- ated with the stack pointer, sets an upper address boundary for the stack. splim is uninitialized at reset. as is the case for the stack pointer, splim<0> is forced to ? 0 ? as all stack operations must be word-aligned. whenever an ea is generated using w15 as a source or destination pointer, the resulting address is compared with the value in splim. if the contents of the stack pointer (w15) and the splim reg- ister are equal, and a push operation is performed, a stack error trap will not occur. the stack error trap will occur on a subsequent push operation. thus, for example, if it is desirable to cause a stack error trap when the stack grows beyond address, 2000h in ram, initialize the splim with the value, 1ffeh. similarly, a stack pointer underflow (stack error) trap is generated when the stack pointer address is found to be less than 0800h. this prevents the stack from interfering with the sfr space. a write to the splim register should not be immediately followed by an indirect read operation using w15. figure 4-7: call stack frame dsrpag (data space read register) dswpag (data space write register) source/destination address while indirect addressing 24-bit ea pointing to eds comment x ( 1 ) x ( 1 ) 0000h to 1fffh 000000h to 001fffh near data space ( 2 ) 2000h to 7fffh 002000h to 007fffh 001h 001h 8000h to ffffh 008000h to 00fffeh epmp memory space 002h 002h 010000h to 017ffeh 003h ? ? ? ? ? 1ffh 003h ? ? ? ? ? 1ffh 018000h to 0187feh ? ? ? ? ff8000h to fffffeh 000h 000h invalid address address error trap ( 3 ) note 1: if the source/destination address is below 8000h, the dsrpag and dswpag registers are not considered. 2: this data space can also be accessed by direct addressing. 3: when the source/destination address is above 8000h and dsrpag/dswpag are ? 0 ?, an address error trap will occur. note: a pc push during exception processing will concatenate the srl register to the msb of the pc prior to the push. < free word > pc<15:0> 000000000 0 15 w15 ( before call ) w15 ( after call ) stack grows towards higher address 0000h pc<22:16> pop : [--w15] push : [w15++]
PIC24FJ128GC010 family ds30009312b-page 78 ? 2012-2013 microchip technology inc. 4.3 interfacing program and data memory spaces the pic24f architecture uses a 24-bit wide program space and 16-bit wide data space. the architecture is also a modified harvard scheme, meaning that data can also be present in the program space. to use this data successfully, it must be accessed in a way that preserves the alignment of information in both spaces. aside from normal execution, the pic24f architecture provides two methods by which program space can be accessed during operation: ? using table instructions to access individual bytes or words anywhere in the program space ? remapping a portion of the program space into the data space (program space visibility) table instructions allow an application to read or write to small areas of the program memory. this makes the method ideal for accessing data tables that need to be updated from time to time. it also allows access to all bytes of the program word. the remapping method allows an application to access a large block of data on a read-only basis, which is ideal for look-ups from a large table of static data. it can only access the least significant word of the program word. 4.3.1 addressing program space since the address ranges for the data and program spaces are 16 and 24 bits, respectively, a method is needed to create a 23-bit or 24-bit program address from 16-bit data registers. the solution depends on the interface method to be used. for table operations, the 8-bit table memory page address register (tblpag) is used to define a 32k word region within the program space. this is concatenated with a 16-bit ea to arrive at a full 24-bit program space address. in this format, the msbs of tblpag are used to determine if the operation occurs in the user memory (tblpag<7> = 0 ) or the configuration memory (tblpag<7> = 1 ). for remapping operations, the 10-bit extended data space read register (dsrpag) is used to define a 16k word page in the program space. when the most significant bit (msb) of the ea is ? 1 ?, and the msb (bit 9) of dsrpag is ? 1 ?, the lower 8 bits of dsrpag are con- catenated with the lower 15 bits of the ea to form a 23-bit program space address. the dsrpag<8> bit decides whether the lower word (when the bit is ? 0 ?) or the higher word (when the bit is ? 1 ?) of program memory is mapped. unlike table operations, this strictly limits remapping operations to the user memory area. table 4-42 and figure 4-8 show how the program ea is created for table operations, and remapping accesses from the data ea. here, p<23:0> refer to a program space word, whereas d<15:0> refer to a data space word. table 4-42: program space address construction access type access space program space address <23> <22:16> <15> <14:1> <0> instruction access (code execution) user 0 pc<22:1> 0 0xx xxxx xxxx xxxx xxxx xxx0 tblrd/tblwt (byte/word read/write) user tblpag<7:0> data ea<15:0> 0xxx xxxx xxxx xxxx xxxx xxxx configuration tblpag<7:0> data ea<15:0> 1xxx xxxx xxxx xxxx xxxx xxxx program space visibility (block remap/read) user 0 dsrpag<7:0> ( 2 ) data ea<14:0> ( 1 ) 0 xxxx xxxx xxx xxxx xxxx xxxx note 1: data ea<15> is always ? 1 ? in this case, but is not used in calculating the program space address. bit 15 of the address is dsrpag<0>. 2: dsrpag<9> is always ? 1 ? in this case. dsrpag<8> decides whether the lower word or higher word of program memory is read. when dsrpag<8> is ? 0 ?, the lower word is read and when it is ? 1 ?, the higher word is read.
? 2012-2013 microchip technology inc. ds30009312b-page 79 PIC24FJ128GC010 family figure 4-8: data access from program space address generation 0 program counter 23 bits 1 dsrpag<7:0> 8 bits ea 15 bits program counter select tblpag 8 bits ea 16 bits byte select 0 0 1/0 user/configuration table operations (2) program space visibility (1) space select 24 bits 23 bits (remapping) 1/0 1/0 note 1: dsrpag<8> acts as word select. dsrpag<9> should always be ? 1 ? to map program memory to data memory. 2: the instructions, tblrdh/tblwth/tblrdl/tblwtl , decide if the higher or lower word of program memory is accessed. tblrdh/tblwth instructions access the higher word and tblrdl/tblwtl instructions access the lower word. table read operations are per mitted in the configuration memory space. 1-bit
PIC24FJ128GC010 family ds30009312b-page 80 ? 2012-2013 microchip technology inc. 4.3.2 data access from program memory using table instructions the tblrdl and tblwtl instructions offer a direct method of reading or writing the lower word of any address within the program space without going through data space. the tblrdh and tblwth instructions are the only method to read or write the upper 8 bits of a program space word as data. the pc is incremented by two for each successive 24-bit program word. this allows program memory addresses to directly map to data space addresses. program memory can thus be regarded as two, 16-bit word-wide address spaces, residing side by side, each with the same address range. tblrdl and tblwtl access the space which contains the least significant data word, and tblrdh and tblwth access the space which contains the upper data byte. two table instructions are provided to move byte or word-sized (16-bit) data to and from program space. both function as either byte or word operations. 1. tblrdl (table read low): in word mode, it maps the lower word of the program space location (p<15:0>) to a data address (d<15:0>). in byte mode, either the upper or lower byte of the lower program word is mapped to the lower byte of a data address. the upper byte is selected when byte select is ? 1 ?; the lower byte is selected when it is ? 0 ?. 2. tblrdh (table read high): in word mode, it maps the entire upper word of a program address (p<23:16>) to a data address. note that d<15:8>, the ?phantom? byte, will always be ? 0 ?. in byte mode, it maps the upper or lower byte of the program word to d<7:0> of the data address, as above. note that the data will always be ? 0 ? when the upper ?phantom? byte is selected (byte select = 1 ). in a similar fashion, two table instructions, tblwth and tblwtl , are used to write individual bytes or words to a program space address. the details of their operation are described in section 6.0 ?flash program memory? . for all table operations, the area of program memory space to be accessed is determined by the table memory page address register (tblpag). tblpag covers the entire program memory space of the device, including user and configuration spaces. when tblpag<7> = 0 , the table page is located in the user memory space. when tblpag<7> = 1 , the page is located in configuration space. figure 4-9: accessing program memory with table instructions note: only table read operations will execute in the configuration memory space where device ids are located. table write operations are not allowed. 0 8 16 23 00000000 00000000 00000000 00000000 ?phantom? byte tblrdh.b (wn<0> = 0 ) tblrdl.w tblrdl.b (wn<0> = 1 ) tblrdl.b (wn<0> = 0 ) 23 15 0 tblpag 02 000000h 800000h 020000h 030000h program space data ea<15:0> the address for the table operation is determined by the data ea within the page defined by the tblpag register. only read operations are shown; write operations are also valid in the user memory area.
? 2012-2013 microchip technology inc. ds30009312b-page 81 PIC24FJ128GC010 family 4.3.3 reading data from program memory using eds the upper 32 kbytes of data space may optionally be mapped into any 16k word page of the program space. this provides transparent access of stored constant data from the data space without the need to use special instructions (i.e., tblrdl/h ). program space access through the data space occurs when the msb of ea is ? 1 ? and the dsrpag<9> is also ? 1 ?. the lower 8 bits of dsrpag are concatenated to the wn<14:0> bits to form a 23-bit ea to access program memory. the dsrpag<8> decides which word should be addressed; when the bit is ? 0 ?, the lower word and when ? 1 ?, the upper word of the program memory is accessed. the entire program memory is divided into 512 eds pages, from 200h to 3ffh, each consisting of 16k words of data. pages, 200h to 2ffh, correspond to the lower words of the program memory, while 300h to 3ffh correspond to the upper words of the program memory. using this eds technique, the entire program memory can be accessed. previously, the access to the upper word of the program memory was not supported. table 4-43 provides the corresponding 23-bit eds address for program memory with eds page and source addresses. for operations that use psv and are executed outside a repeat loop, the mov and mov.d instructions will require one instruction cycle in addition to the specified execution time. all other instructions will require two instruction cycles in addition to the specified execution time. for operations that use psv, which are executed inside a repeat loop, there will be some instances that require two instruction cycles in addition to the specified execution time of the instruction: ? execution in the first iteration ? execution in the last iteration ? execution prior to exiting the loop due to an interrupt ? execution upon re-entering the loop after an interrupt is serviced any other iteration of the repeat loop will allow the instruction accessing data, using psv, to execute in a single cycle. table 4-43: eds program address with different pages and addresses example 4-3: eds read code from program memory in assembly dsrpag (data space read register) source address while indirect addressing 23-bit ea pointing to eds comment 200h ? ? ? 2ffh 8000h to ffffh 000000h to 007ffeh ? ? ? 7f8000h to 7ffffeh lower words of 4m program instructions; (8 mbytes) for read operations only. 300h ? ? ? 3ffh 000001h to 007fffh ? ? ? 7f8001h to 7fffffh upper words of 4m program instructions (4 mbytes remaining, 4 mbytes are phantom bytes); for read operations only. 000h invalid address address error trap ( 1 ) note 1: when the source/destination address is above 8000h and dsrpag/dswpag are ? 0 ?, an address error trap will occur. ; set the eds page from where the data to be read mov #0x0202, w0 mov w0, dsrpag ;page 0x202, consisting lower words, is selected for read mov #0x000a, w1 ;select the location (0x0a) to be read bset w1, #15 ;set the msb of the base address, enable eds mode ;read a byte from the selected location mov.b [w1++], w2 ;read low byte mov.b [w1++], w3 ;read high byte ;read a word from the selected location mov [w1], w2 ; ;read double - word from the selected location mov.d [w1], w2 ;two word read, stored in w2 and w3
PIC24FJ128GC010 family ds30009312b-page 82 ? 2012-2013 microchip technology inc. figure 4-10: program space visibility operation to access lower word figure 4-11: program space visibili ty operation to access upper word 23 15 0 dsrpag data space program space 0000h 8000h ffffh 202h 000000h 7ffffeh 010000h 017ffeh when dsrpag<9:8> = 10 and ea<15> = 1 eds window the data in the page designated by dsrpag is mapped into the upper half of the data memory space.... data ea<14:0> ...while the lower 15 bits of the ea specify an exact address within the eds area. this corre- sponds exactly to the same lower 15 bits of the actual program space address. 23 15 0 dsrpag data space program space 0000h 8000h ffffh 302h 000000h 7ffffeh 010001h 017fffh when dsrpag<9:8> = 11 and ea<15> = 1 the data in the page designated by dsrpag is mapped into the upper half of the data memory space.... data ea<14:0> ...while the lower 15 bits of the ea specify an exact address within the eds area. this corre- sponds exactly to the same lower 15 bits of the actual program space address. eds window
? 2012-2013 microchip technology inc. ds30009312b-page 83 PIC24FJ128GC010 family 5.0 direct memory access controller (dma) the direct memory access (dma) controller is designed to service high data throughput peripherals operating on the sfr bus, allowing them to access data memory directly and alleviating the need for cpu intensive management. by allowing these data inten- sive peripherals to share their own data path, the main data bus is also deloaded, resulting in additional power savings. the dma controller functions both as a peripheral and a direct extension of the cpu. it is located on the microcontroller data bus, between the cpu and dma controller-enabled peripherals, with direct access to sram. this partitions the sfr bus into two buses, allowing the dma controller access to the dma capable peripherals located on the new dma sfr bus. the controller serves as a master device on the dma sfr bus, controlling data flow from dma capable peripherals. the controller also monitors cpu instruction process- ing directly, allowing it to be aware of when the cpu requires access to peripherals on the dma bus, and automatically relinquishing control to the cpu as needed. this increases the effective bandwidth for handling data without dma operations, causing a processor stall. this makes the controller essentially transparent to the user. the dma controller includes these features: ? six multiple independent and independently programmable channels ? concurrent operation with the cpu (no dma caused wait states) ? dma bus arbitration ? five programmable address modes ? four programmable transfer modes ? four flexible internal data transfer modes ? byte or word support for data transfer ? 16-bit source and destination address register for each channel, dynamically updated and reloadable ? 16-bit transaction count register, dynamically updated and reloadable ? upper and lower address limit registers ? counter half-full level interrupt ? software triggered transfer ? null write mode for symmetric buffer operations a simplified block diagram of the dma controller is shown if figure 5-1 . figure 5-1: dma controller functional block diagram note: this data sheet summarizes the features of the PIC24FJ128GC010 family of devices. it is not intended to be a comprehensive reference source. to complement the information in this data sheet, refer to the ?pic24f family reference manual? , ?direct memory access controller (dma)? (ds39742). the information in this data sheet supersedes the information in the frm. to i/o ports to dma enabled peripherals and peripherals dmach0 dmaint0 dmasrc0 dmadst0 dmacnt0 dmach1 dmaint1 dmasrc1 dmadst1 dmacnt1 dmach2 dmaint2 dmasrc2 dmadst2 dmacnt2 dmachn dmaintn dmasrcn dmadstn dmacntn dmacon dmah dmal dmabuf channel 0 channel 1 channel 4 channel 5 data ram address generation data ram control logic data bus cpu execution monitoring
PIC24FJ128GC010 family ds30009312b-page 84 ? 2012-2013 microchip technology inc. 5.1 summary of dma operations the dma controller is capable of moving data between addresses according to a number of different parame- ters. each of these parameters can be independently configured for any transaction. in addition, any or all of the dma channels can independently perform a differ- ent transaction at the same time. transactions are classified by these parameters: ? source and destination (sfrs and data ram) ? data size (byte or word) ? trigger source ? transfer mode (one-shot, repeated or continuous) ? addressing modes (fixed address or address blocks, with or without address increment/ decrement) in addition, the dma controller provides channel priority arbitration for all channels. 5.1.1 source and destination using the dma controller, data may be moved between any two addresses in the data space. the sfr space (0000h to 07ffh) or the data ram space (0800h to ffffh) can serve as either the source or the destina- tion. data can be moved between these areas in either direction, or between addresses in either area. the four different combinations are shown in figure 5-2 . if it is necessary to protect areas of data ram, the dma controller allows the user to set upper and lower address boundaries for operations in the data space above the sfr space. the boundaries are set by the dmah and dmal limit registers. if a dma channel attempts an operation outside of the address boundaries, the transaction is terminated and an interrupt is generated. 5.1.2 data size the dma controller can handle both 8-bit and 16-bit transactions. size is user-selectable using the size bit (dmachn<1>). by default, each channel is configured for word-size transactions. when byte-size transac- tions are chosen, the lsb of the source and/or destination address determines if the data represents the upper or lower byte of the data ram location. 5.1.3 trigger source the dma controller can use 63 of the device?s interrupt sources to initiate a transaction. the dma trigger sources occur in reverse order of their natural interrupt priority and are shown in ta bl e 5 - 1 . these sources cannot be used as dma triggers: ? input capture 8 and 9 ? output compare 7, 8 and 9 ?usb since the source and destination addresses for any transaction can be programmed independently of the trigger source, the dma controller can use any trigger to perform an operation on any peripheral. this also allows dma channels to be cascaded to perform more complex transfer operations. 5.1.4 transfer mode the dma controller supports four types of data transfers, based on the volume of data to be moved for each trigger. ? one-shot: a single transaction occurs for each trigger. ? continuous: a series of back-to-back transactions occur for each trigger. the number of transactions is determined by the dmacntn transaction counter register. ? repeated one-shot: a single transaction is per- formed repeatedly, once per trigger, until the dma channel is disabled. ? repeated continuous: a series of transactions are performed repeatedly, one cycle per trigger, until the dma channel is disabled. all transfer modes allow the option to have the source and destination addresses, and counter value automat- ically reloaded after the completion of a transaction. repeated mode transfers do this automatically. 5.1.5 addressing modes the dma controller also supports transfers between single addresses or address ranges. the four basic options are: ? fixed-to-fixed: between two constant addresses ? fixed-to-block: from a constant source address to a range of destination addresses ? block-to-fixed: from a range of source addresses to a single, constant destination address ? block-to-block: from a range to source addresses to a range of destination addresses the option to select auto-increment or auto-decrement of source and/or destination addresses is available for block addressing modes. in addition to the four basic modes, the dma controller also supports peripheral indirect addressing (pia) mode, where the source or destination address is gen- erated jointly by the dma controller and a pia capable peripheral. when enabled, the dma channel provides a base source and/or destination address, while the peripheral provides a fixed range, offset address. for PIC24FJ128GC010 family devices, the 12-bit a/d converter module is the only pia capable peripheral. details for its use in pia mode are provided in section 26.0 ?12-bit high-speed, pipeline a/d converter? .
? 2012-2013 microchip technology inc. ds30009312b-page 85 PIC24FJ128GC010 family figure 5-2: types of dma data transfers sfr area data ram dma ram area sfr area data ram dma ram area sfr area data ram sfr area data ram 07ffh 0800h dmasrcn dmadstn dma ram area dmal dmah 07ffh 0800h dmasrcn dmadstn dmal dmah 07ffh 0800h dmasrcn dmadstn dmal dmah 07ffh 0800h dmasrcn dmadstn dmal dmah dma ram area peripheral to memory memory to peripheral peripheral to peripheral memory to memory note: relative sizes of memory areas are not shown to scale.
PIC24FJ128GC010 family ds30009312b-page 86 ? 2012-2013 microchip technology inc. 5.1.6 channel priority each dma channel functions independently of the others, but also competes with the others for access to the data and dma buses. when access collisions occur, the dma controller arbitrates between the channels using a user-selectable priority scheme. two schemes are available: ? round robin: when two or more channels col- lide, the lower numbered channel receives priority on the first collision. on subsequent collisions, the higher numbered channels each receive priority based on their channel number. ? fixed: when two or more channels collide, the lowest numbered channel always receives priority, regardless of past history. 5.2 typical setup to set up a dma channel for a basic data transfer: 1. enable the dma controller (dmaen = 1 ) and select an appropriate channel priority scheme by setting or clearing prssel. 2. program dmah and dmal with appropriate upper and lower address boundaries for data ram operations. 3. select the dma channel to be used and disable its operation (chen = 0 ). 4. program the appropriate source and destination addresses for the transaction into the channel?s dmasrcn and dmadstn registers. for pia mode addressing, use the base address value. 5. program the dmacntn register for the number of triggers per transfer (one-shot or continuous modes) or the number of words (bytes) to be transferred (repeated modes). 6. set or clear the size bit to select the data size. 7. program the trmodex bits to select the data transfer mode. 8. program the samodex and damodex bits to select the addressing mode. 9. enable the dma channel by setting chen. 10. enable the trigger source interrupt. 5.3 peripheral module disable unlike other peripheral modules, the channels of the dma controller cannot be individually powered down using the peripheral module disable (pmd) registers. instead, the channels are controlled as two groups. the dma0md bit (pmd7<4>) selectively controls dmach0 through dmach3. the dma1md bit (pmd7<5>) controls dmach4 and dmach5. setting both bits effectively disables the dma controller. 5.4 registers the dma controller uses a number of registers to con- trol its operation. the number of registers depends on the number of channels implemented for a particular device. there are always four module level registers (one control and three buffer/address): ? dmacon: dma control register ( register 5-1 ) ? dmah and dmal: dma high and low address limit registers ? dmabuf: dma data buffer register each of the dma channels implements five registers (two control and three buffer/address): ? dmachn: dma channel n control register ( register 5-2 ) ? dmaintn: dma channel n interrupt control register ( register 5-3 ) ? dmasrcn: dma data source address pointer for channel n register ? dmadstn: dma data destination source for channel n register ? dmacntn: dma transaction counter for channel n register for PIC24FJ128GC010 family devices, there are a total of 34 dma registers.
? 2012-2013 microchip technology inc. ds30009312b-page 87 PIC24FJ128GC010 family register 5-1: dmacon: dma engine control register r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 dmaen ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 ? ? ? ? ? ? ? prssel bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 dmaen: dma module enable bit 1 = enables module 0 = disables module and terminates all active dma operation(s) bit 14-1 unimplemented: read as ? 0 ? bit 0 prssel: channel priority scheme selection bit 1 = round robin scheme 0 = fixed priority scheme
PIC24FJ128GC010 family ds30009312b-page 88 ? 2012-2013 microchip technology inc. register 5-2: dmachn: dma channel n control register u-0 u-0 u-0 r-0 u-0 r/w-0 r/w-0 r/w-0 ? ? ? r ?nullwreload ( 1 ) chreq ( 3 ) bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 samode1 samode0 damode1 damode0 trmode1 trmode0 size chen bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-13 unimplemented: read as ? 0 ? bit 12 reserved: maintain as ? 0 ? bit 11 unimplemented: read as ? 0 ? bit 10 nullw: null write mode bit 1 = a dummy write is initiated to dmasrcn for every write to dmadstn 0 = no dummy write is initiated bit 9 reload: address and count reload bit ( 1 ) 1 = dmasrcn, dmadstn and dmacntn registers are reloaded to their previous values upon the start of the next operation 0 = dmasrcn, dmadstn and dmacntn are not reloaded on the start of the next operation ( 2 ) bit 8 chreq: dma channel software request bit ( 3 ) 1 = a dma request is initiated by software; automatically cleared upon completion of a dma transfer 0 = no dma request is pending bit 7-6 samode<1:0>: source address mode selection bits 11 = reserved 10 = dmasrcn is decremented based on the size bit after a transfer completion 01 = dmasrcn is incremented based on the size bit after a transfer completion 00 = dmasrcn remains unchanged after a transfer completion bit 5-4 damode<1:0>: destination address mode selection bits 11 = reserved 10 = dmadstn is decremented based on the size bit after a transfer completion 01 = dmadstn is incremented based on the size bit after a transfer completion 00 = dmadstn remains unchanged after a transfer completion bit 3-2 trmode<1:0>: transfer mode selection bits 11 = repeated continuous 10 = continuous 01 = repeated one-shot 00 = one-shot bit 1 size: data size selection bit 1 = byte (8-bit) 0 = word (16-bit) bit 0 chen: dma channel enable bit 1 = the corresponding channel is enabled 0 = the corresponding channel is disabled note 1: only the original dmacntn is required to be stored to recover the original dmasrcn and dmadstn. 2: dmasrcn, dmadstn and dmacntn are always reloaded in repeated mode transfers (dmachn<2> = 1 ), regardless of the state of the reload bit. 3: the number of transfers executed while chreq is set depends on the configuration of trmode<1:0>.
? 2012-2013 microchip technology inc. ds30009312b-page 89 PIC24FJ128GC010 family register 5-3: dmaintn: dma channel n interrupt register r-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 dbufwf ( 1 ) ? chsel5 chsel4 chsel3 chsel2 chsel1 chsel0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 highif ( 1 , 2 ) lowif ( 1 , 2 ) doneif ( 1 ) halfif ( 1 ) ovrunif ( 1 ) ? ?halfen bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 dbufwf: buffered data write flag bit ( 1 ) 1 = the content of the dma buffer has not been written to the location specified in dmadstn or dmasrcn in null write mode 0 = the content of the dma buffer has been written to the location specified in dmadstn or dmasrcn in null write mode bit 14 unimplemented: read as ? 0 ? bit 13-8 chsel<5:0>: dma channel trigger selection bits see tab le 5 - 1 for a complete list. bit 7 highif: dma high address limit interrupt flag bit ( 1 , 2 ) 1 = the dma channel has attempted to access an address higher than dmah or the upper limit of the data ram space 0 = the dma channel has not invoked the high address limit interrupt bit 6 lowif: dma low address limit interrupt flag bit ( 1 , 2 ) 1 = the dma channel has attempted to access the dma sfr address lower than dmal but above the sfr range (07ffh) 0 = the dma channel has not invoked the low address limit interrupt bit 5 doneif: dma complete operation interrupt flag bit ( 1 ) if chen = 1 : 1 = the previous dma session has ended with completion 0 = the current dma session has not yet completed if chen = 0 : 1 = the previous dma session has ended with completion 0 = the previous dma session has ended without completion bit 4 halfif: dma 50% watermark level interrupt flag bit ( 1 ) 1 = dmacntn has reached the halfway point to 0000h 0 = dmacntn has not reached the halfway point bit 3 ovrunif: dma channel overrun flag bit ( 1 ) 1 = the dma channel is triggered while it is still completing the operation based on the previous trigger 0 = the overrun condition has not occurred bit 2-1 unimplemented: read as ? 0 ? bit 0 halfen: halfway completion watermark bit 1 = interrupts are invoked when dmacntn has reached its halfway point and at completion 0 = an interrupt is invoked only at the completion of the transfer note 1: setting these flags in software does not generate an interrupt. 2: testing for address limit violations (dmasrcn or dmadstn is either greater than dmah or less than dmal) is not done before the actual access.
PIC24FJ128GC010 family ds30009312b-page 90 ? 2012-2013 microchip technology inc. table 5-1: dma trigger sources chsel<5:0> trigger (interrupt) chsel<5:0> trigger (interrupt) 000000 (unimplemented) 100000 uart2 transmit 000001 dac2 100001 uart2 receive 000010 lcd 100010 external interrupt 2 000011 uart4 transmit 100011 timer5 000100 uart4 receive 100100 timer4 000101 uart4 error 100101 output compare 4 000110 uart3 transmit 100110 output compare 3 000111 uart3 receive 100111 dma channel 2 001000 uart3 error 101000 dac1 001001 ctmu event 101001 external interrupt 1 001010 hlvd 101010 interrupt-on-change 001011 crc done 101011 comparators event 001100 uart2 error 101100 i2c1 master event 001101 uart1 error 101101 i2c1 slave event 001110 rtcc 101110 dma channel 1 001111 dma channel 5 101111 pipeline a/d converter 010000 external interrupt 4 110000 uart1 transmit 010001 external interrupt 3 110001 uart1 receive 010010 i2c2 master event 110010 spi1 event 010011 i2c2 slave event 110011 spi1 error 010100 dma channel 4 110100 timer3 010101 epmp 110101 timer2 010110 output compare 7 110110 output compare 2 010111 output compare 6 110111 input capture 2 011000 output compare 5 111000 dma channel 0 011001 input capture 6 111001 timer1 011010 input capture 5 111010 output compare 1 011011 input capture 4 111011 input capture 1 011100 input capture 3 111100 external interrupt 0 011101 dma channel 3 111101 op amp 2 011110 spi2 event 111110 op amp 1 011111 spi2 error 111111 sigma-delta a/d converter
? 2012-2013 microchip technology inc. ds30009312b-page 91 PIC24FJ128GC010 family 6.0 flash program memory the PIC24FJ128GC010 family of devices contains internal flash program memory for storing and execut- ing application code. the program memory is readable, writable and erasable. the flash can be programmed in three ways: ? in-circuit serial programming? (icsp?) ? run-time self-programming (rtsp) ? enhanced in-circuit serial programming (enhanced icsp) icsp allows a PIC24FJ128GC010 family device to be serially programmed while in the end application circuit. this is simply done with two lines for the programming clock and programming data (named pgecx and pgedx, respectively), and three other lines for power (v dd ), ground (v ss ) and master clear (mclr ). this allows customers to manufacture boards with unprogrammed devices and then program the microcontroller just before shipping the product. this also allows the most recent firmware or a custom firmware to be programmed. rtsp is accomplished using tblrd (table read) and tblwt (table write) instructions. with rtsp, the user may write program memory data in blocks of 64 instruc- tions (192 bytes) at a time and erase program memory in blocks of 512 instructions (1536 bytes) at a time. 6.1 table instructions and flash programming regardless of the method used, all programming of flash memory is done with the table read and write instructions. these allow direct read and write access to the program memory space from the data memory while the device is in normal operating mode. the 24-bit target address in the program memory is formed using the tblpag<7:0> bits and the effective address (ea) from a w register, specified in the table instruction, as shown in figure 6-1 . the tblrdl and the tblwtl instructions are used to read or write to bits<15:0> of program memory. tblrdl and tblwtl can access program memory in both word and byte modes. the tblrdh and tblwth instructions are used to read or write to bits<23:16> of program memory. tblrdh and tblwth can also access program memory in word or byte mode. figure 6-1: addressing for table registers note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?program memory? (ds39715). the information in this data sheet supersedes the information in the frm. 0 program counter 24 bits program tblpag reg 8 bits working reg ea 16 bits using byte 24-bit ea 0 1 / 0 select table instruction counter using user/configuration space select
PIC24FJ128GC010 family ds30009312b-page 92 ? 2012-2013 microchip technology inc. 6.2 rtsp operation the pic24f flash program memory array is organized into rows of 64 instructions or 192 bytes. rtsp allows the user to erase blocks of eight rows (512 instructions) at a time and to program one row at a time. it is also possible to program single words. the 8-row erase blocks and single row write blocks are edge-aligned, from the beginning of program memory, on boundaries of 1536 bytes and 192 bytes, respectively. when data is written to program memory using tblwt instructions, the data is not written directly to memory. instead, data written using table writes is stored in holding latches until the programming sequence is executed. any number of tblwt instructions can be executed and a write will be successfully performed. however, 64 tblwt instructions are required to write the full row of memory. to ensure that no data is corrupted during a write, any unused address should be programmed with ffffffh. this is because the holding latches reset to an unknown state, so if the addresses are left in the reset state, they may overwrite the locations on rows which were not rewritten. the basic sequence for rtsp programming is to set up a table pointer, then do a series of tblwt instructions to load the buffers. programming is performed by setting the control bits in the nvmcon register. data can be loaded in any order and the holding regis- ters can be written to multiple times before performing a write operation. subsequent writes, however, will wipe out any previous writes. all of the table write operations are single-word writes (2 instruction cycles), because only the buffers are writ- ten. a programming cycle is required for programming each row. 6.3 enhanced in-circuit serial programming enhanced in-circuit serial programming uses an on-board bootloader, known as the program executive (pe), to manage the programming process. using an spi data frame format, the program executive can erase, program and verify program memory. for more information on enhanced icsp, see the device programming specification. 6.4 control registers there are two sfrs used to read and write the program flash memory: nvmcon and nvmkey. the nvmcon register ( register 6-1 ) controls which blocks are to be erased, which memory type is to be programmed and when the programming cycle starts. nvmkey is a write-only register that is used for write protection. to start a pr ogramming or erase sequence, the user must consecutively write 55h and aah to the nvmkey register. refer to section 6.5 ?programming operations? for further details. note: writing to a location multiple times without erasing is not recommended.
? 2012-2013 microchip technology inc. ds30009312b-page 93 PIC24FJ128GC010 family register 6-1: nvmcon: flash memory control register r/s-0, hc ( 1 ) r/w-0 ( 1 ) r-0, hsc ( 1 ) u-0 u-0 u-0 u-0 u-0 wr wren wrerr ? ? ? ? ? bit 15 bit 8 u-0 r/w-0 ( 1 ) u-0 u-0 r/w-0 ( 1 ) r/w-0 ( 1 ) r/w-0 ( 1 ) r/w-0 ( 1 ) ?erase ? ?nvmop3 ( 2 ) nvmop2 ( 2 ) nvmop1 ( 2 ) nvmop0 ( 2 ) bit 7 bit 0 legend: s = settable bit hc = hardware clearable bit 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 hsc = hardware settable/clearable bit bit 15 wr: write control bit ( 1 ) 1 = initiates a flash memory program or erase operation; the operation is self-timed and the bit is cleared by hardware once the operation is complete 0 = program or erase operation is complete and inactive bit 14 wren: write enable bit ( 1 ) 1 = enables flash program/erase operations 0 = inhibits flash program/erase operations bit 13 wrerr: write sequence error flag bit ( 1 ) 1 = an improper program or erase sequence attempt, or termination has occurred (bit is set automatically on any set attempt of the wr bit) 0 = the program or erase operation completed normally bit 12-7 unimplemented: read as ? 0 ? bit 6 erase: erase/program enable bit ( 1 ) 1 = performs the erase operation specified by nvmop<3:0> on the next wr command 0 = performs the program operation specified by nvmop<3:0> on the next wr command bit 5-4 unimplemented: read as ? 0 ? bit 3-0 nvmop<3:0>: nvm operation select bits ( 1 , 2 ) 1111 = memory bulk erase operation (erase = 1 ) or no operation (erase = 0 ) ( 3 ) 0011 = memory word program operation (erase = 0 ) or no operation (erase = 1 ) 0010 = memory page erase operation (erase = 1 ) or no operation (erase = 0 ) 0001 = memory row program operation (erase = 0 ) or no operation (erase = 1 ) note 1: these bits can only be reset on a power-on reset. 2: all other combinations of nvmop<3:0> are unimplemented. 3: available in icsp? mode only; refer to the device programming specification.
PIC24FJ128GC010 family ds30009312b-page 94 ? 2012-2013 microchip technology inc. 6.5 programming operations a complete programming sequence is necessary for programming or erasing the internal flash in rtsp mode. during a programming or erase operation, the processor stalls (waits) until the operation is finished. setting the wr bit (nvmcon<15>) starts the opera- tion and the wr bit is automatically cleared when the operation is finished. 6.5.1 programming algorithm for flash program memory the user can program one row of flash program memory at a time. to do this, it is necessary to erase the 8-row erase block containing the desired row. the general process is: 1. read eight rows of program memory (512 instructions) and store in data ram. 2. update the program data in ram with the desired new data. 3. erase the block (see example 6-1 ): a) set the nvmopx bits (nvmcon<3:0>) to ? 0010 ? to configure for block erase. set the erase (nvmcon<6>) and wren (nvmcon<14>) bits. b) write the starting address of the block to be erased into the tblpag and w registers. c) write 55h to nvmkey. d) write aah to nvmkey. e) set the wr bit (nvmcon<15>). the erase cycle begins and the cpu stalls for the dura- tion of the erase cycle. when the erase is done, the wr bit is cleared automatically. 4. write the first 64 instructions from data ram into the program memory buffers (see example 6-3 ). 5. write the program block to flash memory: a) set the nvmopx bits to ? 0001 ? to configure for row programming. clear the erase bit and set the wren bit. b) write 55h to nvmkey. c) write aah to nvmkey. d) set the wr bit. the programming cycle begins and the cpu stalls for the duration of the write cycle. when the write to flash memory is done, the wr bit is cleared automatically. 6. repeat steps 4 and 5, using the next available 64 instructions from the block in data ram by incrementing the value in tblpag, until all 512 instructions are written back to flash memory. for protection against accidental operations, the write initiate sequence for nvmkey must be used to allow any erase or program operation to proceed. after the programming command has been executed, the user must wait for the programming time until programming is complete. the two instructions following the start of the programming sequence should be nop s, as shown in example 6-4 . example 6-1: erasing a program memo ry block (assembly language code) ; set up nvmcon for block erase operation mov #0x4042, w0 ; mov w0, nvmcon ; initialize nvmcon ; init pointer to row to be erased mov #tblpage(prog_addr), w0 ; mov w0, tblpag ; initialize program memory (pm) page boundary sfr mov #tbloffset(prog_addr), w0 ; initialize in-page ea<15:0> pointer tblwtl w0, [w0] ; set base address of erase block disi #5 ; block all interrupts with priority <7 ; for next 5 instructions mov.b #0x55, w0 mov w0, nvmkey ; write the 0x55 key mov.b #0xaa, w1 ; mov w1, nvmkey ; write the 0xaa key bset nvmcon, #wr ; start the erase sequence nop ; insert two nops after the erase nop ; command is asserted
? 2012-2013 microchip technology inc. ds30009312b-page 95 PIC24FJ128GC010 family example 6-2: erasing a program memo ry block (?c? language code) example 6-3: loading the write buffers example 6-4: initiating a programming sequence // c example using mplab c30 unsigned long progaddr = 0xxxxxxx; // address of row to write unsigned int offset; //set up pointer to the first memory location to be written tblpag = progaddr>>16; // initialize pm page boundary sfr offset = progaddr & 0xffff; // initialize lower word of address __builtin_tblwtl(offset, 0x0000); // set base address of erase block // with dummy latch write nvmcon = 0x4042; // initialize nvmcon asm("disi #5"); // block all interrupts with priority <7 // for next 5 instructions __builtin_write_nvm(); // check function to perform unlock // sequence and set wr ; set up nvmcon for row programming operations mov #0x4001, w0 ; mov w0, nvmcon ; initialize nvmcon ; set up a pointer to the first program memory location to be written ; program memory selected, and writes enabled mov #0x0000, w0 ; mov w0, tblpag ; initialize pm page boundary sfr mov #0x6000, w0 ; an example program memory address ; perform the tblwt instructions to write the latches ; 0th_program_word mov #low_word_0, w2 ; mov #high_byte_0, w3 ; tblwtl w2, [w0] ; write pm low word into program latch tblwth w3, [w0++] ; write pm high byte into program latch ; 1st_program_word mov #low_word_1, w2 ; mov #high_byte_1, w3 ; tblwtl w2, [w0] ; write pm low word into program latch tblwth w3, [w0++] ; write pm high byte into program latch ; 2nd_program_word mov #low_word_2, w2 ; mov #high_byte_2, w3 ; tblwtl w2, [w0] ; write pm low word into program latch tblwth w3, [w0++] ; write pm high byte into program latch ? ? ? ; 63rd_program_word mov #low_word_63, w2 ; mov #high_byte_63, w3 ; tblwtl w2, [w0] ; write pm low word into program latch tblwth w3, [w0] ; write pm high byte into program latch disi #5 ; block all interrupts with priority <7 ; for next 5 instructions mov.b #0x55, w0 mov w0, nvmkey ; write the 0x55 key mov.b #0xaa, w1 ; mov w1, nvmkey ; write the 0xaa key bset nvmcon, #wr ; start the programming sequence nop ; required delays nop btsc nvmcon, #15 ; and wait for it to be bra $-2 ; completed
PIC24FJ128GC010 family ds30009312b-page 96 ? 2012-2013 microchip technology inc. 6.5.2 programming a single word of flash program memory if a flash location has been erased, it can be pro- grammed using table write instructions to write an instruction word (24-bit) into the write latch. the tblpag register is loaded with the 8 most significant bytes (msbs) of the flash address. the tblwtl and tblwth instructions write the desired data into the write latches and specify the lower 16 bits of the pro- gram memory address to write to. to configure the nvmcon register for a word write, set the nvmopx bits (nvmcon<3:0>) to ? 0011 ?. the write is performed by executing the unlock sequence and setting the wr bit (see example 6-5 ). an equivalent procedure in ?c? compiler, using the mplab ? c30 compiler and built-in hardware functions, is shown in example 6-6 . example 6-5: programming a single word of flash program memory example 6-6: programming a single word of flash program memory (?c? language code) ; setup a pointer to data program memory mov #tblpage(prog_addr), w0 ; mov w0, tblpag ;initialize pm page boundary sfr mov #tbloffset(prog_addr), w0 ;initialize a register with program memory address mov #low_word_n, w2 ; mov #high_byte_n, w3 ; tblwtl w2, [w0] ; write pm low word into program latch tblwth w3, [w0++] ; write pm high byte into program latch ; setup nvmcon for programming one word to data program memory mov #0x4003, w0 ; mov w0, nvmcon ; set nvmop bits to 0011 disi #5 ; disable interrupts while the key sequence is written mov.b #0x55, w0 ; write the key sequence mov w0, nvmkey mov.b #0xaa, w0 mov w0, nvmkey bset nvmcon, #wr ; start the write cycle nop ; required delays nop // c example using mplab c30 unsigned int offset; unsigned long progaddr = 0xxxxxxx; // address of word to program unsigned int progdatal = 0xxxxx; // data to program lower word unsigned char progdatah = 0xxx; // data to program upper byte //set up nvmcon for word programming nvmcon = 0x4003; // initialize nvmcon //set up pointer to the first memory location to be written tblpag = progaddr>>16; // initialize pm page boundary sfr offset = progaddr & 0xffff; // initialize lower word of address //perform tblwt instructions to write latches __builtin_tblwtl(offset, progdatal); // write to address low word __builtin_tblwth(offset, progdatah); // write to upper byte asm(?disi #5?); // block interrupts with priority <7 // for next 5 instructions __builtin_write_nvm(); // c30 function to perform unlock // sequence and set wr
? 2012-2013 microchip technology inc. ds30009312b-page 97 PIC24FJ128GC010 family 7.0 resets the reset module combines all reset sources and controls the device master reset signal, sysrst . the following is a list of device reset sources: ? por: power-on reset ?mclr : pin reset ?swr: reset instruction ? wdt: watchdog timer reset ? bor: brown-out reset ? cm: configuration mismatch reset ? trapr: trap conflict reset ? iopuwr: illegal opcode reset ? uwr: uninitialized w register reset a simplified block diagram of the reset module is shown in figure 7-1 . any active source of reset will make the sysrst signal active. many registers associated with the cpu and peripherals are forced to a known reset state. most registers are unaffected by a reset; their status is unknown on por and unchanged by all other resets. all types of device reset will set a corresponding status bit in the rcon register to indicate the type of reset (see register 7-1 ). in addition, reset events occurring while an extreme power-saving feature is in use (such as v bat ) will set one or more status bits in the rcon2 register ( register 7-2 ). a por will clear all bits, except for the bor and por (rcon<1:0>) bits, which are set. the user may set or clear any bit at any time during code execution. the rcon bits only serve as status bits. setting a particular reset status bit in software will not cause a device reset to occur. the rcon register also has other bits associated with the watchdog timer and device power-saving states. the function of these bits is discussed in other sections of this data sheet. figure 7-1: reset sy stem block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ? pic24f family reference manual ?, ?reset? (ds39712). the information in this data sheet supersedes the information in the frm. note: refer to the specific peripheral or cpu section of this manual for register reset states. note: the status bits in the rcon registers should be cleared after they are read so that the next rcon register values after a device reset will be meaningful. mclr v dd v dd rise detect por sleep or idle brown-out reset boren reset instruction wdt module glitch filter bor trap conflict illegal opcode uninitialized w register sysrst configuration mismatch
PIC24FJ128GC010 family ds30009312b-page 98 ? 2012-2013 microchip technology inc. register 7-1: rcon: re set control register r/w-0 r/w-0 u-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 trapr ( 1 ) iopuwr ( 1 ) ? reten ( 2 ) ? dpslp ( 1 ) cm ( 1 ) pmslp ( 3 ) bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-1 r/w-1 extr ( 1 ) swr ( 1 ) swdten ( 4 ) wdto ( 1 ) sleep ( 1 ) idle ( 1 ) bor ( 1 ) por ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 trapr: trap reset flag bit ( 1 ) 1 = a trap conflict reset has occurred 0 = a trap conflict reset has not occurred bit 14 iopuwr: illegal opcode or uninitialized w access reset flag bit ( 1 ) 1 = an illegal opcode detection, an illegal address mode or uninitialized w register is used as an address pointer and caused a reset 0 = an illegal opcode or uninitialized w reset has not occurred bit 13 unimplemented: read as ? 0 ? bit 12 reten: retention mode enable bit ( 2 ) 1 = retention mode is enabled while device is in sleep modes (1.2v regulator supplies to the core) 0 = retention mode is disabled; normal voltage levels are present bit 11 unimplemented: read as ? 0 ? bit 10 dpslp: deep sleep flag bit ( 1 ) 1 = device has been in deep sleep mode 0 = device has not been in deep sleep mode bit 9 cm: configuration word mismatch reset flag bit ( 1 ) 1 = a configuration word mismatch reset has occurred 0 = a configuration word mismatch reset has not occurred bit 8 pmslp: program memory power during sleep bit ( 3 ) 1 = program memory bias voltage remains powered during sleep 0 = program memory bias voltage is powered down during sleep bit 7 extr: external reset (mclr ) pin bit ( 1 ) 1 = a master clear (pin) reset has occurred 0 = a master clear (pin) reset has not occurred bit 6 swr: software reset (instruction) flag bit ( 1 ) 1 =a reset instruction has been executed 0 =a reset instruction has not been executed note 1: all of the reset status bits may be set or cleared in software. setting one of these bits in software does not cause a device reset. 2: if the lpcfg configuration bit is ? 1 ? (unprogrammed), the retention regulator is disabled and the reten bit has no effect. 3: re-enabling the regulator after it enters standby mode will add a delay, t vreg , when waking up from sleep. applications that do not use the voltage regulator should set this bit to prevent this delay from occurring. 4: if the fwdten configuration bit is ? 1 ? (unprogrammed), the wdt is always enabled , regardless of the swdten bit setting.
? 2012-2013 microchip technology inc. ds30009312b-page 99 PIC24FJ128GC010 family bit 5 swdten: software enable/disable of wdt bit ( 4 ) 1 = wdt is enabled 0 = wdt is disabled bit 4 wdto: watchdog timer time-out flag bit ( 1 ) 1 = wdt time-out has occurred 0 = wdt time-out has not occurred bit 3 sleep: wake from sleep flag bit ( 1 ) 1 = device has been in sleep mode 0 = device has not been in sleep mode bit 2 idle: wake-up from idle flag bit ( 1 ) 1 = device has been in idle mode 0 = device has not been in idle mode bit 1 bor: brown-out reset flag bit ( 1 ) 1 = a brown-out reset has occurred (also set after a power-on reset). 0 = a brown-out reset has not occurred bit 0 por: power-on reset flag bit ( 1 ) 1 = a power-on reset has occurred 0 = a power-on reset has not occurred register 7-1: rcon: reset co ntrol register (continued) note 1: all of the reset status bits may be set or cleared in software. setting one of these bits in software does not cause a device reset. 2: if the lpcfg configuration bit is ? 1 ? (unprogrammed), the retention regulator is disabled and the reten bit has no effect. 3: re-enabling the regulator after it enters standby mode will add a delay, t vreg , when waking up from sleep. applications that do not use the voltage regulator should set this bit to prevent this delay from occurring. 4: if the fwdten configuration bit is ? 1 ? (unprogrammed), the wdt is always enabled , regardless of the swdten bit setting.
PIC24FJ128GC010 family ds30009312b-page 100 ? 2012-2013 microchip technology inc. table 7-1: reset flag bit operation register 7-2: rcon2: reset and system control register 2 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 r-0 r/co-1 r/co-1 r/co-1 r/co-0 ? ? ? r vddbor ( 1 ) vddpor ( 1 , 2 ) vbpor ( 1 , 3 ) vbat ( 1 ) bit 7 bit 0 legend: co = clearable only bit r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-5 unimplemented: read as ? 0 ? bit 4 reserved: maintain as ? 0 ? bit 3 vddbor: v dd brown-out reset flag bit ( 1 ) 1 =a v dd brown-out reset has occurred (set by hardware) 0 =a v dd brown-out reset has not occurred bit 2 vddpor: v dd power-on reset flag bit ( 1 , 2 ) 1 =a v dd power-on reset has occurred (set by hardware) 0 =a v dd power-on reset has not occurred bit 1 vbpor: v bat power-on reset flag bit ( 1 , 3 ) 1 =a v bat por has occurred (no battery connected to v bat pin or v bat power is below deep sleep semaphore retention level, set by hardware) 0 =a v bat por has not occurred bit 0 vbat: v bat flag bit ( 1 ) 1 = a por exit has occurred while power was applied to v bat pin (set by hardware) 0 = a por exit from v bat has not occurred note 1: this bit is set in hardware only; it can only be cleared in software. 2: indicates a v dd por. setting the por bit (rcon<0>) indicates a v core por. 3: this bit is set when the device is originally powered up, even if power is present on v bat . flag bit setting event clearing event trapr (rcon<15>) trap conflict event por iopuwr (rcon<14>) illegal opcode or uninitialized w register access por cm (rcon<9>) configuration mismatch reset por extr (rcon<7>) mclr reset por swr (rcon<6>) reset instruction por wdto (rcon<4>) wdt time-out clrwdt, pwrsav instruction, por sleep (rcon<3>) pwrsav #0 instruction por dpslp (rcon<10>) pwrsav #0 instruction while dsen bit set por idle (rcon<2>) pwrsav #1 instruction por bor (rcon<1>) por, bor ? por (rcon<0>) por ? note: all reset flag bits may be set or cleared by the user software.
? 2012-2013 microchip technology inc. ds30009312b-page 101 PIC24FJ128GC010 family 7.1 special function register reset states most of the special function registers (sfrs) associ- ated with the pic24f cpu and peripherals are reset to a particular value at a device reset. the sfrs are grouped by their peripheral or cpu function and their reset values are specified in each section of this manual. the reset value for each sfr does not depend on the type of reset, with the exception of four registers. the reset value for the reset control register, rcon, will depend on the type of device reset. the reset value for the oscillator control register, osccon, will depend on the type of reset and the programmed values of the fnoscx bits in flash configuration word 2 (cw2) (see table 7-2 ). the rcfgcal and nvmcon registers are only affected by a por. 7.2 device reset times the reset times for various types of device reset are summarized in tab l e 7 - 3 . note that the system reset signal, sysrst , is released after the por delay time expires. the time at which the device actually begins to execute code will also depend on the system oscillator delays, which include the oscillator start-up timer (ost) and the pll lock time. the ost and pll lock times occur in parallel with the applicable sysrst delay times. the fail-safe clock monitor (fscm) delay determines the time at which the fscm begins to monitor the system clock source after the sysrst signal is released. 7.3 brown-out reset (bor) PIC24FJ128GC010 family devices implement a bor circuit that provides the user with several configuration and power-saving options. the bor is controlled by the boren (cw3<12>) configuration bit. when bor is enabled, any drop of v dd below the bor threshold results in a device bor. threshold levels are described in section 37.1 ?dc characteristics? (parameter dc17b ). 7.4 clock source selection at reset if clock switching is enabled, the system clock source at device reset is chosen, as shown in table 7-2 . if clock switching is disabled, the system clock source is always selected according to the oscillator configuration bits. refer to the ? pic24f family reference manual ?, section 6.0 ?oscillator? (ds39700) for further details. table 7-2: oscillator selection vs. type of reset (clock switching enabled) reset type clock source determinant por fnosc<2:0> configuration bits (cw2<10:8>) bor mclr cosc<2:0> control bits (osccon<14:12>) wdto swr
PIC24FJ128GC010 family ds30009312b-page 102 ? 2012-2013 microchip technology inc. table 7-3: reset delay times for various device resets 7.4.1 por and long oscillator start-up times the oscillator start-up circuitry and its associated delay timers are not linked to the device reset delays that occur at power-up. some crystal circuits (especially low-frequency crystals) will have a relatively long start-up time. therefore, one or more of the following conditions is possible after sysrst is released: ? the oscillator circuit has not begun to oscillate. ? the oscillator start-up timer has not expired (if a crystal oscillator is used). ? the pll has not achieved a lock (if pll is used). the device will not begin to execute code until a valid clock source has been released to the system. there- fore, the oscillator and pll start-up delays must be considered when the reset delay time must be known. 7.4.2 fail-safe clock monitor (fscm) and device resets if the fscm is enabled, it will begin to monitor the system clock source when sysrst is released. if a valid clock source is not available at this time, the device will automatically switch to the frc oscillator and the user can switch to the desired crystal oscillator in the trap service routine (tsr). reset type clock source sysrst delay system clock delay notes por ec t por + t startup + t rst ? 1 , 2 , 3 ecpll t por + t startup + t rst t lock 1 , 2 , 3 , 5 xt, hs, sosc t por + t startup + t rst t ost 1 , 2 , 3 , 4 xtpll, hspll t por + t startup + t rst t ost + t lock 1 , 2 , 3 , 4 , 5 frc, frcdiv t por + t startup + t rst t frc 1 , 2 , 3 , 6 , 7 frcpll t por + t startup + t rst t frc + t lock 1 , 2 , 3 , 5 , 6 lprc t por + t startup + t rst t lprc 1 , 2 , 3 , 6 bor ec t startup + t rst ? 2 , 3 ecpll t startup + t rst t lock 2 , 3 , 5 xt, hs, sosc t startup + t rst t ost 2 , 3 , 4 xtpll, hspll t startup + t rst t ost + t lock 2 , 3 , 4 , 5 frc, frcdiv t startup + t rst t frc 2 , 3 , 6 , 7 frcpll t startup + t rst t frc + t lock 2 , 3 , 5 , 6 lprc t startup + t rst t lprc 2 , 3 , 6 mclr any clock t rst ? 3 wdt any clock t rst ? 3 software any clock t rst ? 3 illegal opcode any clock t rst ? 3 uninitialized w any clock t rst ? 3 trap conflict any clock t rst ? 3 note 1: t por = power-on reset delay (10 ? s nominal). 2: t startup = t vreg . 3: t rst = internal state reset time (2 ? s nominal). 4: t ost = oscillator start-up timer (ost). a 10-bit counter counts 1024 oscillator periods before releasing the oscillator clock to the system. 5: t lock = pll lock time. 6: t frc and t lprc = rc oscillator start-up times. 7: if two-speed start-up is enabled, regardless of the primary oscillator selected, the device starts with frc, so the system clock delay is just t frc and in such cases, frc start-up time is valid. it switches to the primary oscillator after its respective clock delay.
? 2012-2013 microchip technology inc. ds30009312b-page 103 PIC24FJ128GC010 family 8.0 interrupt controller the pic24f interrupt controller reduces the numerous peripheral interrupt request signals to a single interrupt request signal to the pic24f cpu. it has the following features: ? up to 8 processor exceptions and software traps ? seven user-selectable priority levels ? interrupt vector table (ivt) with up to 118 vectors ? unique vector for each interrupt or exception source ? fixed priority within a specified user priority level ? alternate interrupt vector table (aivt) for debug support ? fixed interrupt entry and return latencies 8.1 interrupt vector table the interrupt vector table (ivt) is shown in figure 8-1 . the ivt resides in program memory, starting at location, 000004h. the ivt contains 126 vectors, consisting of 8 non-maskable trap vectors, plus up to 118 source interrupts. in general, each interrupt source has its own vector. each interrupt vector contains a 24-bit wide address. the value programmed into each interrupt vec- tor location is the starting address of the associated interrupt service routine (isr). interrupt vectors are prioritized in terms of their natural priority; this is linked to their position in the vector table. all other things being equal, lower addresses have a higher natural priority. for example, the interrupt asso- ciated with vector 0 will take priority over interrupts at any other vector address. PIC24FJ128GC010 family devices implement non-maskable traps and unique interrupts. these are summarized in ta b l e 8 - 1 and tab l e 8 - 2 . 8.1.1 alternate interrupt vector ta b l e the alternate interrupt vector table (aivt) is located after the ivt, as shown in figure 8-1 . the altivt (intcon2<15>) control bit provides access to the aivt. if the altivt bit is set, all interrupt and exception processes will use the alternate vectors instead of the default vectors. the alternate vectors are organized in the same manner as the default vectors. the aivt supports emulation and debugging efforts by providing a means to switch between an application, and a support environment, without requiring the inter- rupt vectors to be reprogrammed. this feature also enables switching between applications for evaluation of different software algorithms at run time. if the aivt is not needed, the aivt should be programmed with the same addresses used in the ivt. 8.2 reset sequence a device reset is not a true exception because the interrupt controller is not involved in the reset process. the pic24f devices clear their registers in response to a reset, which forces the pc to zero. the micro- controller then begins program execution at location, 000000h. the user programs a goto instruction at the reset address, which redirects program execution to the appropriate start-up routine. note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive refer- ence source. for more information, refer to the ? pic24f family reference manual ?, ?interrupts? (ds39707). the information in this data sheet supersedes the information in the frm. note: any unimplemented or unused vector locations in the ivt and aivt should be programmed with the address of a default interrupt handler routine that contains a reset instruction.
PIC24FJ128GC010 family ds30009312b-page 104 ? 2012-2013 microchip technology inc. figure 8-1: pic24f interrupt vector table table 8-1: trap vector details vector number ivt address aivt address trap source 0 000004h 000104h reserved 1 000006h 000106h oscillator failure 2 000008h 000108h address error 3 00000ah 00010ah stack error 4 00000ch 00010ch math error 5 00000eh 00010eh reserved 6 000010h 000110h reserved 7 000012h 000112h reserved note 1: see table 8-2 for the interrupt vector list. reset ? goto instruction 000000h reset ? goto address 000002h reserved 000004h oscillator fail trap vector address error trap vector stack error trap vector math error trap vector reserved reserved reserved interrupt vector 0 000014h interrupt vector 1 ? ? ? interrupt vector 52 00007ch interrupt vector 53 00007eh interrupt vector 54 000080h ? ? ? interrupt vector 116 0000fch interrupt vector 117 0000feh reserved 000100h reserved 000102h reserved oscillator fail trap vector address error trap vector stack error trap vector math error trap vector reserved reserved reserved interrupt vector 0 000114h interrupt vector 1 ? ? ? interrupt vector 52 00017ch interrupt vector 53 00017eh interrupt vector 54 000180h ? ? ? interrupt vector 116 interrupt vector 117 0001feh start of code 000200h decreasing natural order priority interrupt vector table (ivt) (1) alternate interrupt vector table (aivt) (1)
? 2012-2013 microchip technology inc. ds30009312b-page 105 PIC24FJ128GC010 family table 8-2: implemented interrupt vectors interrupt source vector number ivt address aivt address interrupt bit locations flag enable priority a/d (12-bit pipeline) 13 00002eh 00012eh ifs0<13> iec0<13> ipc3<6:4> a/d (sigma-delta) 105 0000e6h 0001e6h ifs6<9> iec6<9> ipc26<6:4> comparator event 18 000038h 000138h ifs1<2> iec1<2> ipc4<10:8> crc generator 67 00009ah 00019ah ifs4<3> iec4<3> ipc16<14:12> ctmu event 77 0000aeh 0001aeh ifs4<13> iec4<13> ipc19<6:4> dac1 78 000080h 000180h ifs4<14> iec4<14> ipc19<10:8> dac2 79 000082h 000182h ifs4<15> iec4<15> ipc19<14:12> dma channel 0 4 00001ch 00011ch ifs0<4> iec0<4> ipc1<2:0> dma channel 1 14 000030h 000130h ifs0<14> iec0<14> ipc3<10:8> dma channel 2 24 000044h 000144h ifs1<8> iec1<8> ipc6<2:0> dma channel 3 36 00005ch 00015ch ifs2<4> iec2<4> ipc9<2:0> dma channel 4 46 000070h 000170h ifs2<14> iec2<14> ipc11<10:8> dma channel 5 61 00008eh 00018eh ifs3<13> iec3<13> ipc15<6:4> external interrupt 0 0 000014h 000114h ifs0<0> iec0<0> ipc0<2:0> external interrupt 1 20 00003ch 00013ch ifs1<4> iec1<4> ipc5<2:0> external interrupt 2 29 00004eh 00014eh ifs1<13> iec1<13> ipc7<6:4> external interrupt 3 53 00007eh 00017eh ifs3<5> iec3<5> ipc13<6:4> external interrupt 4 54 000080h 000180h ifs3<6> iec3<6> ipc13<10:8> frc self-tune 106 0000e8h 0001e8h ifs6<10> iec6<10> ipc26<10:8> i2c1 master event 17 000036h 000136h ifs1<1> iec1<1> ipc4<6:4> i2c1 slave event 16 000034h 000134h ifs1<0> iec1<0> ipc4<2:0> i2c2 master event 50 000078h 000178h ifs3<2> iec3<2> ipc12<10:8> i2c2 slave event 49 000076h 000176h ifs3<1> iec3<1> ipc12<6:4> input capture 1 1 000016h 000116h ifs0<1> iec0<1> ipc0<6:4> input capture 2 5 00001eh 00011eh ifs0<5> iec0<5> ipc1<6:4> input capture 3 37 00005eh 00015eh ifs2<5> iec2<5> ipc9<6:4> input capture 4 38 000060h 000160h ifs2<6> iec2<6> ipc9<10:8> input capture 5 39 000062h 000162h ifs2<7> iec2<7> ipc9<14:12> input capture 6 40 000064h 000164h ifs2<8> iec2<8> ipc10<2:0> input capture 7 22 000040h 000140h ifs1<6> iec1<6> ipc5<10:8> input capture 8 23 000042h 000142h ifs1<7> iec1<7> ipc5<14:12> input capture 9 93 0000ceh 0001ceh ifs5<13> iec5<13> ipc23<6:4> jtag 117 0000feh 0001feh ifs7<5> iec7<5> ipc29<6:4> input change notification (icn) 19 00003ah 00013ah ifs1<3> iec1<3> ipc4<14:12> lcd controller 100 0000dch 0001dch ifs6<4> iec6<4> ipc25<2:0> high/low-voltage detect (hlvd) 72 0000a4h 0001a4h ifs4<8> iec4<8> ipc18<2:0> op amp 1 103 0000e2h 0001e2h ifs6<7> iec6<7> ipc25<14:12> op amp 2 104 0000e4h 0001e4h ifs6<8> iec6<8> ipc26<2:0> output compare 1 2 000018h 000118h ifs0<2> iec0<2> ipc0<10:8> output compare 2 6 000020h 000120h ifs0<6> iec0<6> ipc1<10:8> output compare 3 25 000046h 000146h ifs1<9> iec1<9> ipc6<6:4> output compare 4 26 000048h 000148h ifs1<10> iec1<10> ipc6<10:8> output compare 5 41 000066h 000166h ifs2<9> iec2<9> ipc10<6:4> output compare 6 42 000068h 000168h ifs2<10> iec2<10> ipc10<10:8> output compare 7 43 00006ah 00016ah ifs2<11> iec2<11> ipc10<14:12> output compare 8 44 00006ch 00016ch ifs2<12> iec2<12> ipc11<2:0> output compare 9 92 0000cch 0001cch ifs5<12> iec5<12> ipc23<2:0>
PIC24FJ128GC010 family ds30009312b-page 106 ? 2012-2013 microchip technology inc. enhanced parallel master port (epmp) 45 00006eh 00016eh ifs2<13> iec2<13> ipc11<6:4> real-time clock and calendar (rtcc) 62 000090h 000190h ifs3<14> iec3<14> ipc15<10:8> spi1 error 9 000026h 000126h ifs0<9> iec0<9> ipc2<6:4> spi1 event 10 000028h 000128h ifs0<10> iec0<10> ipc2<10:8> spi2 error 32 000054h 000154h ifs2<0> iec2<0> ipc8<2:0> spi2 event 33 000056h 000156h ifs2<1> iec2<1> ipc8<6:4> timer1 3 00001ah 00011ah ifs0<3> iec0<3> ipc0<14:12> timer2 7 000022h 000122h ifs0<7> iec0<7> ipc1<14:12> timer3 8 000024h 000124h ifs0<8> iec0<8> ipc2<2:0> timer4 27 00004ah 00014ah ifs1<11> iec1<11> ipc6<14:12> timer5 28 00004ch 00014ch ifs1<12> iec1<12> ipc7<2:0> uart1 error 65 000096h 000196h ifs4<1> iec4<1> ipc16<6:4> uart1 receiver 11 00002ah 00012ah ifs0<11> iec0<11> ipc2<14:12> uart1 transmitter 12 00002ch 00012ch ifs0<12> iec0<12> ipc3<2:0> uart2 error 66 000098h 000198h ifs4<2> iec4<2> ipc16<10:8> uart2 receiver 30 000050h 000150h ifs1<14> iec1<14> ipc7<10:8> uart2 transmitter 31 000052h 000152h ifs1<15> iec1<15> ipc7<14:12> uart3 error 81 0000b6h 0001b6h ifs5<1> iec5<1> ipc20<6:4> uart3 receiver 82 0000b8h 0001b8h ifs5<2> iec5<2> ipc20<10:8> uart3 transmitter 83 0000bah 0001bah ifs5<3> iec5<3> ipc20<14:12> uart4 error 87 0000c2h 0001c2h ifs5<7> iec5<7> ipc21<14:12> uart4 receiver 88 0000c4h 0001c4h ifs5<8> iec5<8> ipc22<2:0> uart4 transmitter 89 0000c6h 0001c6h ifs5<9> iec5<9> ipc22<6:4> usb 86 0000c0h 0001c0h ifs5<6> iec5<6> ipc21<10:8> table 8-2: implemented interrupt vectors (continued) interrupt source vector number ivt address aivt address interrupt bit locations flag enable priority
? 2012-2013 microchip technology inc. ds30009312b-page 107 PIC24FJ128GC010 family 8.3 interrupt control and status registers the PIC24FJ128GC010 family of devices implements a total of 44 registers for the interrupt controller: ? intcon1 ? intcon2 ? ifs0 through ifs7 ? iec0 through iec7 ? ipc0 through ipc13, icp15, icp16, icp18 through icp23, icp25, icp26 and icp29 ?inttreg global interrupt control functions are controlled from intcon1 and intcon2. intcon1 contains the inter- rupt nesting disable (nstdis) bit, as well as the control and status flags for the processor trap sources. the intcon2 register controls the external interrupt request signal behavior and the use of the alternate interrupt vector table (aivt). the ifsx registers maintain all of the interrupt request flags. each source of interrupt has a status bit, which is set by the respective peripherals or an external signal and is cleared via software. the iecx registers maintain all of the interrupt enable bits. these control bits are used to individually enable interrupts from the peripherals or external signals. the ipcx registers are used to set the interrupt priority level (ipl) for each source of interrupt. each user interrupt source can be assigned to one of eight priority levels. the inttreg register contains the associated interrupt vector number and the new cpu interrupt priority level, which are latched into the vector number (vecnum<6:0>) and the interrupt level (ilr<3:0>) bit fields in the inttreg register. the new interrupt priority level is the priority of the pending interrupt. the interrupt sources are assigned to the ifsx, iecx and ipcx registers in the order of their vector numbers, as shown in tab l e 8 - 2 . for example, the int0 (external interrupt 0) is shown as having a vector number and a natural order priority of 0. thus, the int0if status bit is found in ifs0<0>, the int0ie enable bit in iec0<0> and the int0ip<2:0> priority bits in the first position of ipc0 (ipc0<2:0>). although they are not specifically part of the interrupt control hardware, two of the cpu control registers con- tain bits that control interrupt functionality. the alu status register (sr) contains the ipl<2:0> bits (sr<7:5>). these indicate the current cpu interrupt priority level. the user can change the current cpu priority level by writing to the iplx bits. the corcon register contains the ipl3 bit, which together with the ipl<2:0> bits, indicates the current cpu priority level. ipl3 is a read-only bit so that trap events cannot be masked by the user software. the interrupt controller has the interrupt controller test register, inttreg, which displays the status of the interrupt controller. when an interrupt request occurs, its associated vector number and the new interrupt pri- ority level are latched into inttreg. this information can be used to determine a specific interrupt source if a generic isr is used for multiple vectors (such as when isr remapping is used in bootloader applica- tions) or to check if another interrupt is pending while in an isr. all interrupt registers are described in register 8-1 through register 8-46 in the succeeding pages.
PIC24FJ128GC010 family ds30009312b-page 108 ? 2012-2013 microchip technology inc. register 8-1: sr: alu status register (in cpu) u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 ? ? ? ? ? ? ? dc ( 1 ) bit 15 bit 8 r/w-0 r/w-0 r/w-0 r-0 r/w-0 r/w-0 r/w-0 r/w-0 ipl2 ( 2 , 3 ) ipl1 ( 2 , 3 ) ipl0 ( 2 , 3 ) ra ( 1 ) n ( 1 ) ov ( 1 ) z ( 1 ) c ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-9 unimplemented: read as ? 0 ? bit 7-5 ipl<2:0>: cpu interrupt priority level status bits ( 2 , 3 ) 111 = cpu interrupt priority level is 7 (15); user interrupts are disabled 110 = cpu interrupt priority level is 6 (14) 101 = cpu interrupt priority level is 5 (13) 100 = cpu interrupt priority level is 4 (12) 011 = cpu interrupt priority level is 3 (11) 010 = cpu interrupt priority level is 2 (10) 001 = cpu interrupt priority level is 1 (9) 000 = cpu interrupt priority level is 0 (8) note 1: see register 3-1 for the description of the remaining bits (bits 8, 4, 3, 2, 1 and 0) that are not dedicated to interrupt control functions. 2: the iplx bits are concatenated with the ipl3 (corcon< 3>) bit to form the cpu interrupt priority level. the value in parentheses indicates the interrupt priority level if ipl3 = 1 . 3: the iplx status bits are read-only when nstdis (intcon1<15>) = 1 .
? 2012-2013 microchip technology inc. ds30009312b-page 109 PIC24FJ128GC010 family register 8-2: corcon: cpu control register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 r/c-0 r-1 u-0 u-0 ? ? ? ?ipl3 ( 1 ) r ? ? bit 7 bit 0 legend: r = reserved bit c = clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-4 unimplemented: read as ? 0 ? bit 3 ipl3: cpu interrupt priority level status bit ( 1 ) 1 = cpu interrupt priority level is greater than 7 0 = cpu interrupt priority level is 7 or less bit 2 reserved: read as ? 1 ? bit 1-0 unimplemented: read as ? 0 ? note 1: the ipl3 bit is concatenated with the ipl<2:0> bits (sr<7:5>) to form the cpu interrupt priority level; see register 3-2 for bit description.
PIC24FJ128GC010 family ds30009312b-page 110 ? 2012-2013 microchip technology inc. register 8-3: intcon1: in terrupt control register 1 r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 nstdis ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 ? ? ? matherr addrerr stkerr oscfail ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 nstdis: interrupt nesting disable bit 1 = interrupt nesting is disabled 0 = interrupt nesting is enabled bit 14-5 unimplemented: read as ? 0 ? bit 4 matherr: arithmetic error trap status bit 1 = overflow trap has occurred 0 = overflow trap has not occurred bit 3 addrerr: address error trap status bit 1 = address error trap has occurred 0 = address error trap has not occurred bit 2 stkerr: stack error trap status bit 1 = stack error trap has occurred 0 = stack error trap has not occurred bit 1 oscfail: oscillator failure trap status bit 1 = oscillator failure trap has occurred 0 = oscillator failure trap has not occurred bit 0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 111 PIC24FJ128GC010 family register 8-4: intcon2: in terrupt control register 2 r/w-0 r-0, hsc u-0 u-0 u-0 u-0 u-0 u-0 altivt disi ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? ? int4ep int3ep int2ep int1ep int0ep bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 altivt: enable alternate interrupt vector table bit 1 = uses alternate interrupt vector table 0 = uses standard (default) interrupt vector table bit 14 disi: disi instruction status bit 1 = disi instruction is active 0 = disi instruction is not active bit 13-5 unimplemented: read as ? 0 ? bit 4 int4ep: external interrupt 4 edge detect polarity select bit 1 = interrupt on negative edge 0 = interrupt on positive edge bit 3 int3ep: external interrupt 3 edge detect polarity select bit 1 = interrupt on negative edge 0 = interrupt on positive edge bit 2 int2ep: external interrupt 2 edge detect polarity select bit 1 = interrupt on negative edge 0 = interrupt on positive edge bit 1 int1ep: external interrupt 1 edge detect polarity select bit 1 = interrupt on negative edge 0 = interrupt on positive edge bit 0 int0ep: external interrupt 0 edge detect polarity select bit 1 = interrupt on negative edge 0 = interrupt on positive edge
PIC24FJ128GC010 family ds30009312b-page 112 ? 2012-2013 microchip technology inc. register 8-5: ifs0: interrupt flag status register 0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? dma1if ad1if u1txif u1rxif spi1if spf1if t3if bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0, r/w-0 r/w-0 t2if oc2if ic2if dma0if t1if oc1if ic1if int0if bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14 dma1if: dma channel 1 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 13 ad1if: 12-bit pipeline a/d event interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 12 u1txif: uart1 transmitter interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 11 u1rxif: uart1 receiver interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 10 spi1if: spi1 event interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 9 spf1if: spi1 fault interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 8 t3if: timer3 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 7 t2if: timer2 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 6 oc2if: output compare channel 2 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 5 ic2if: input capture channel 2 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 4 dma0if: dma channel 0 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 3 t1if: timer1 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred
? 2012-2013 microchip technology inc. ds30009312b-page 113 PIC24FJ128GC010 family bit 2 oc1if: output compare channel 1 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 1 ic1if: input capture channel 1 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 0 int0if: external interrupt 0 flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred register 8-5: ifs0: interrupt fla g status register 0 (continued)
PIC24FJ128GC010 family ds30009312b-page 114 ? 2012-2013 microchip technology inc. register 8-6: ifs1: interrupt flag status register 1 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u2txif u2rxif int2if t5if t4if oc4if oc3if dma2if bit 15 bit 8 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ic8if ic7if ? int1if cnif cmif mi2c1if si2c1if bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 u2txif: uart2 transmitter interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 14 u2rxif: uart2 receiver interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 13 int2if: external interrupt 2 flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 12 t5if: timer5 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 11 t4if: timer4 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 10 oc4if: output compare channel 4 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 9 oc3if: output compare channel 3 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 8 dma2if: dma channel 2 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 7 ic8if: input capture channel 8 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 6 ic7if: input capture channel 7 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 5 unimplemented: read as ? 0 ? bit 4 int1if: external interrupt 1 flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 3 cnif: input change notification interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred
? 2012-2013 microchip technology inc. ds30009312b-page 115 PIC24FJ128GC010 family bit 2 cmif: comparator interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 1 mi2c1if: master i2c1 event interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 0 si2c1if: slave i2c1 event interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred register 8-6: ifs1: interrupt fla g status register 1 (continued)
PIC24FJ128GC010 family ds30009312b-page 116 ? 2012-2013 microchip technology inc. register 8-7: ifs2: interrupt flag status register 2 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? dma4if pmpif oc8if oc7if oc6if oc5if ic6if bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 ic5if ic4if ic3if dma3if ? ? spi2if spf2if bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14 dma4if: dma channel 4 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 13 pmpif: parallel master port interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 12 oc8if: output compare channel 8 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 11 oc7if: output compare channel 7 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 10 oc6if: output compare channel 6 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 9 oc5if: output compare channel 5 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 8 ic6if: input capture channel 6 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 7 ic5if: input capture channel 5 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 6 ic4if: input capture channel 4 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 5 ic3if: input capture channel 3 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 4 dma3if: dma channel 3 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 3-2 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 117 PIC24FJ128GC010 family register 8-8: ifs3: interrupt flag status register 3 bit 1 spi2if: spi2 event interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 0 spf2if: spi2 fault interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred u-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 u-0 ? rtcif dma5if ? ? ? ? ? bit 15 bit 8 u-0 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 u-0 ? int4if int3if ? ?mi2c2ifsi2c2if ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14 rtcif: real-time clock/calendar interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 13 dma5if: dma channel 5 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 12-7 unimplemented: read as ? 0 ? bit 6 int4if: external interrupt 4 flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 5 int3if: external interrupt 3 flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 4-3 unimplemented: read as ? 0 ? bit 2 mi2c2if: master i2c2 event interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 1 si2c2if: slave i2c2 event interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 0 unimplemented: read as ? 0 ? register 8-7: ifs2: interrupt fla g status register 2 (continued)
PIC24FJ128GC010 family ds30009312b-page 118 ? 2012-2013 microchip technology inc. register 8-9: ifs4: interrupt flag status register 4 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 r/w-0 dac2if dac1if ctmuif ? ? ? ?hlvdif bit 15 bit 8 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 u-0 ? ? ? ? crcif u2erif u1erif ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 dac2if: dac converter 2 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 14 dac1if: dac converter 1 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 13 ctmuif: ctmu interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 12-9 unimplemented: read as ? 0 ? bit 8 hlvdif: high/low-voltage detect interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 7-4 unimplemented: read as ? 0 ? bit 3 crcif: crc generator interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 2 u2erif: uart2 error interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 1 u1erif: uart1 error interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 119 PIC24FJ128GC010 family register 8-10: ifs5: interrupt flag status register 5 u-0 u-0 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 ? ?ic9ifoc9if ? ? u4txif u4rxif bit 15 bit 8 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 r/w-0 u-0 u4erif usb1if ? ? u3txif u3rxif u3erif ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13 ic9if: input capture channel 9 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 12 oc9if: output compare channel 9 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 11-10 unimplemented: read as ? 0 ? bit 9 u4txif: uart4 transmitter interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 8 u4rxif: uart4 receiver interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 7 u4erif: uart4 error interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 6 usb1if: usb1 (usb otg) interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 5-4 unimplemented: read as ? 0 ? bit 3 u3txif: uart3 transmitter interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 2 u3rxif: uart3 receiver interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 1 u3erif: uart3 error interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 120 ? 2012-2013 microchip technology inc. register 8-11: ifs6: interr upt flag status register 6 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 ? ? ? ? ? fstif sda1if amp2if bit 15 bit 8 r/w-0 u-0 u-0 r/w-0 u-0 u-0 u-0 u-0 amp1if ? ? lcdif ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as ? 0 ? bit 10 fstif: frc self-tune interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 9 sda1if: sigma-delta a/d converter interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 8 amp2if: op amp 2 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 7 amp1if: op amp 1 interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 6-5 unimplemented: read as ? 0 ? bit 4 lcdif: lcd controller interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 3-0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 121 PIC24FJ128GC010 family register 8-12: ifs7: interrupt flag status register 7 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 r/w-0 u-0 u-0 u-0 u-0 u-0 ? ?jtagif ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as ? 0 ? bit 5 jtagif: jtag controller interrupt flag status bit 1 = interrupt request has occurred 0 = interrupt request has not occurred bit 4-0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 122 ? 2012-2013 microchip technology inc. register 8-13: iec0: interrupt enable control register 0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? dma1ie ad1ie u1txie u1rxie spi1ie spf1ie t3ie bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 t2ie oc2ie ic2ie dma0ie t1ie oc1ie ic1ie int0ie bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14 dma1ie: dma channel 1 interrupt flag enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 13 ad1ie: 12-bit pipeline a/d interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 12 u1txie: uart1 transmitter interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 11 u1rxie: uart1 receiver interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 10 spi1ie: spi1 transfer complete interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 9 spf1ie: spi1 fault interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 8 t3ie: timer3 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 7 t2ie: timer2 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 6 oc2ie: output compare channel 2 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 5 ic2ie: input capture channel 2 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 4 dma0ie: dma channel 0 interrupt flag enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 3 t1ie: timer1 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled
? 2012-2013 microchip technology inc. ds30009312b-page 123 PIC24FJ128GC010 family bit 2 oc1ie: output compare channel 1 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 1 ic1ie: input capture channel 1 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 0 int0ie: external interrupt 0 enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled register 8-13: iec0: interrupt enable control register 0 (continued)
PIC24FJ128GC010 family ds30009312b-page 124 ? 2012-2013 microchip technology inc. register 8-14: iec1: interrupt enable control register 1 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u2txie u2rxie int2ie ( 1 ) t5ie t4ie oc4ie oc3ie dma2ie bit 15 bit 8 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ic8ie ic7ie ?int1ie ( 1 ) cnie cmie mi2c1ie si2c1ie bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 u2txie: uart2 transmitter interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 14 u2rxie: uart2 receiver interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 13 int2ie: external interrupt 2 enable bit ( 1 ) 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 12 t5ie: timer5 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 11 t4ie: timer4 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 10 oc4ie: output compare channel 4 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 9 oc3ie: output compare channel 3 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 8 dma2ie: dma channel 2 interrupt flag enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 7 ic8ie: input capture channel 8 interrupt flag enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 6 ic7ie: input capture channel 7 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 5 unimplemented: read as ? 0 ? note 1: if an external interrupt is enabled, the interrupt input must also be configured to an available rpx or rpix pin. see section 11.4 ?peripheral pin select (pps)? for more information.
? 2012-2013 microchip technology inc. ds30009312b-page 125 PIC24FJ128GC010 family bit 4 int1ie: external interrupt 1 enable bit ( 1 ) 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 3 cnie: input change notification interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 2 cmie: comparator interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 1 mi2c1ie: master i2c1 event interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 0 si2c1ie: slave i2c1 event interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled register 8-14: iec1: interrupt enable control register 1 (continued) note 1: if an external interrupt is enabled, the interrupt input must also be configured to an available rpx or rpix pin. see section 11.4 ?peripheral pin select (pps)? for more information.
PIC24FJ128GC010 family ds30009312b-page 126 ? 2012-2013 microchip technology inc. register 8-15: iec2: interrupt enable control register 2 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? dma4ie pmpie oc8ie oc7ie oc6ie oc5ie ic6ie bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 ic5ie ic4ie ic3ie dma3ie ? ? spi2ie spf2ie bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14 dma4ie: dma channel 4 interrupt flag enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 13 pmpie: parallel master port interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 12 oc8ie: output compare channel 8 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 11 oc7ie: output compare channel 7 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 10 oc6ie: output compare channel 6 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 9 oc5ie: output compare channel 5 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 8 ic6ie: input capture channel 6 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 7 ic5ie: input capture channel 5 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 6 ic4ie: input capture channel 4 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 5 ic3ie: input capture channel 3 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 4 dma3if: dma channel 3 interrupt flag enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 3-2 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 127 PIC24FJ128GC010 family register 8-16: iec3: interrupt enable control register 3 bit 1 spi2ie: spi2 event interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 0 spf2ie: spi2 fault interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled u-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 u-0 ? rtcie dma5ie ? ? ? ? ? bit 15 bit 8 u-0 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 u-0 ?int4ie ( 1 ) int3ie ( 1 ) ? ?mi2c2iesi2c2ie ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14 rtcie: real-time clock/calendar interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 13 dma5ie: dma channel 5 interrupt flag enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 12-7 unimplemented: read as ? 0 ? bit 6 int4ie: external interrupt 4 enable bit ( 1 ) 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 5 int3ie: external interrupt 3 enable bit ( 1 ) 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 4-3 unimplemented: read as ? 0 ? bit 2 mi2c2ie: master i2c2 event interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 1 si2c2ie: slave i2c2 event interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 0 unimplemented: read as ? 0 ? note 1: if an external interrupt is enabled, the interrupt input must also be configured to an available rpx or rpix pin. see section 11.4 ?peripheral pin select (pps)? for more information. register 8-15: iec2: interrupt enable control register 2 (continued)
PIC24FJ128GC010 family ds30009312b-page 128 ? 2012-2013 microchip technology inc. register 8-17: iec4: interrupt enable control register 4 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 r/w-0 dac2ie dac1ie ctmuie ? ? ? ?hlvdie bit 15 bit 8 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 u-0 ? ? ? ? crcie u2erie u1erie ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 dac2ie: dac converter 2 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 14 dac1ie: dac converter 1 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 13 ctmuie: ctmu interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 12-9 unimplemented: read as ? 0 ? bit 8 hlvdie: high/low-voltage detect interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 7-4 unimplemented: read as ? 0 ? bit 3 crcie: crc generator interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 2 u2erie: uart2 error interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 1 u1erie: uart1 error interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 129 PIC24FJ128GC010 family register 8-18: iec5: interrupt enable control register 5 u-0 u-0 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 ? ?ic9ieoc9ie ? ? u4txie u4rxie bit 15 bit 8 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 r/w-0 u-0 u4erie usbie ? ? u3txie u3rxie u3erie ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13 ic9ie: input capture channel 9 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 12 oc9ie: output compare channel 9 enable status bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 11-10 unimplemented: read as ? 0 ? bit 9 u4txie: uart4 transmitter interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 8 u4rxie: uart4 receiver interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 7 u4erie: uart4 error interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 6 usbie: usb1 (usb otg) interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 5-4 unimplemented: read as ? 0 ? bit 3 u3txie: uart3 transmitter interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 2 u3rxie: uart3 receiver interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 1 u3erie: uart3 error interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 130 ? 2012-2013 microchip technology inc. register 8-19: iec6: interrupt enable control register 6 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 ? ? ? ? ? fstie sda1ie amp2ie bit 15 bit 8 r/w-0 u-0 u-0 r/w-0 u-0 u-0 u-0 u-0 amp1ie ? ?lcdie ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as ? 0 ? bit 10 fstie: frc self-tune interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 9 sda1ie: sigma-delta a/d converter interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 8 amp2ie: op amp 2 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 7 amp1ie: op amp 1 interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 6-5 unimplemented: read as ? 0 ? bit 4 lcdie: lcd controller interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 3-0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 131 PIC24FJ128GC010 family register 8-20: iec7: interrupt enable control register 7 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 r/w-0 u-0 u-0 u-0 u-0 u-0 ? ?jtagie ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as ? 0 ? bit 5 jtagie: jatg interrupt enable bit 1 = interrupt request is enabled 0 = interrupt request is not enabled bit 4-0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 132 ? 2012-2013 microchip technology inc. register 8-21: ipc0: interrupt pr iority control register 0 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? t1ip2 t1ip1 t1ip0 ? oc1ip2 oc1ip1 oc1ip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? ic1ip2 ic1ip1 ic1ip0 ? int0ip2 int0ip1 int0ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 t1ip<2:0>: timer1 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 oc1ip<2:0>: output compare channel 1 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 ic1ip<2:0>: input capture channel 1 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 int0ip<2:0>: external interrupt 0 priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 133 PIC24FJ128GC010 family register 8-22: ipc1: interrupt pr iority control register 1 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? t2ip2 t2ip1 t2ip0 ? oc2ip2 oc2ip1 oc2ip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? ic2ip2 ic2ip1 ic2ip0 ? dma0ip2 dma0ip1 dma0ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 t2ip<2:0>: timer2 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 oc2ip<2:0>: output compare channel 2 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 ic2ip<2:0>: input capture channel 2 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 dma0ip<2:0>: dma channel 0 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
PIC24FJ128GC010 family ds30009312b-page 134 ? 2012-2013 microchip technology inc. register 8-23: ipc2: interrupt pr iority control register 2 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? u1rxip2 u1rxip1 u1rxip0 ? spi1ip2 spi1ip1 spi1ip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? spf1ip2 spf1ip1 spf1ip0 ? t3ip2 t3ip1 t3ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 u1rxip<2:0>: uart1 receiver interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 spi1ip<2:0>: spi1 event interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 spf1ip<2:0>: spi1 fault interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 t3ip<2:0>: timer3 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 135 PIC24FJ128GC010 family register 8-24: ipc3: interrupt pr iority control register 3 u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-0 r/w-0 ? ? ? ? ? dma1ip2 dma1ip1 dma1ip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? ad1ip2 ad1ip1 ad1ip0 ? u1txip2 u1txip1 u1txip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as ? 0 ? bit 10-8 dma1ip<2:0>: dma channel 1 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 ad1ip<2:0>: 12-bit pipeline a/d interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 u1txip<2:0>: uart1 transmitter interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
PIC24FJ128GC010 family ds30009312b-page 136 ? 2012-2013 microchip technology inc. register 8-25: ipc4: interrupt pr iority control register 4 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? cnip2 cnip1 cnip0 ? cmip2 cmip1 cmip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? mi2c1ip2 mi2c1ip1 mi2c1ip0 ? si2c1ip2 si2c1ip1 si2c1ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 cnip<2:0>: input change notification interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 cmip<2:0>: comparator interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 mi2c1ip<2:0>: master i2c1 event interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 si2c1ip<2:0>: slave i2c1 event interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 137 PIC24FJ128GC010 family register 8-26: ipc5: interrupt pr iority control register 5 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? ic8ip2 ic8ip1 ic8ip0 ? ic7ip2 ic7ip1 ic7ip0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-0 r/w-0 ? ? ? ? ? int1ip2 int1ip1 int1ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 ic8ip<2:0>: input capture channel 8 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 ic7ip<2:0>: input capture channel 7 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7-3 unimplemented: read as ? 0 ? bit 2-0 int1ip<2:0>: external interrupt 1 priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
PIC24FJ128GC010 family ds30009312b-page 138 ? 2012-2013 microchip technology inc. register 8-27: ipc6: interrupt pr iority control register 6 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? t4ip2 t4ip1 t4ip0 ? oc4ip2 oc4ip1 oc4ip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? oc3ip2 oc3ip1 oc3ip0 ? dma2ip2 dma2ip1 dma2ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 t4ip<2:0>: timer4 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 oc4ip<2:0>: output compare channel 4 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 oc3ip<2:0>: output compare channel 3 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 dma2ip<2:0>: dma channel 2 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 139 PIC24FJ128GC010 family register 8-28: ipc7: interrupt pr iority control register 7 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? u2txip2 u2txip1 u2txip0 ? u2rxip2 u2rxip1 u2rxip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? int2ip2 int2ip1 int2ip0 ? t5ip2 t5ip1 t5ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 u2txip<2:0>: uart2 transmitter interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 u2rxip<2:0>: uart2 receiver interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 int2ip<2:0>: external interrupt 2 priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 t5ip<2:0>: timer5 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
PIC24FJ128GC010 family ds30009312b-page 140 ? 2012-2013 microchip technology inc. register 8-29: ipc8: interrupt pr iority control register 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? spi2ip2 spi2ip1 spi2ip0 ? spf2ip2 spf2ip1 spf2ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-7 unimplemented: read as ? 0 ? bit 6-4 spi2ip<2:0>: spi2 event interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 spf2ip<2:0>: spi2 fault interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 141 PIC24FJ128GC010 family register 8-30: ipc9: interrupt pr iority control register 9 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? ic5ip2 ic5ip1 ic5ip0 ? ic4ip2 ic4ip1 ic4ip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? ic3ip2 ic3ip1 ic3ip0 ? dma3ip2 dma3ip1 dma3ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 ic5ip<2:0>: input capture channel 5 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 ic4ip<2:0>: input capture channel 4 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 ic3ip<2:0>: input capture channel 3 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 dma3ip<2:0>: dma channel 3 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
PIC24FJ128GC010 family ds30009312b-page 142 ? 2012-2013 microchip technology inc. register 8-31: ipc10: interrupt priority control register 10 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? oc7ip2 oc7ip1 oc7ip0 ? oc6ip2 oc6ip1 oc6ip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? oc5ip2 oc5ip1 oc5ip0 ? ic6ip2 ic6ip1 ic6ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 oc7ip<2:0>: output compare channel 7 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 oc6ip<2:0>: output compare channel 6 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 oc5ip<2:0>: output compare channel 5 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 ic6ip<2:0>: input capture channel 6 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 143 PIC24FJ128GC010 family register 8-32: ipc11: interrupt priority control register 11 u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-0 r/w-0 ? ? ? ? ? dma4ip2 dma4ip1 dma4ip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? pmpip2 pmpip1 pmpip0 ? oc8ip2 oc8ip1 oc8ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as ? 0 ? bit 10-8 dma4ip<2:0>: dma channel 4 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 pmpip<2:0>: parallel master port interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 oc8ip<2:0>: output compare channel 8 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
PIC24FJ128GC010 family ds30009312b-page 144 ? 2012-2013 microchip technology inc. register 8-33: ipc12: interrupt priority control register 12 u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-0 r/w-0 ? ? ? ? ? mi2c2ip2 mi2c2ip1 mi2c2ip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 u-0 u-0 u-0 ? si2c2ip2 si2c2ip1 si2c2ip0 ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as ? 0 ? bit 10-8 mi2c2ip<2:0>: master i2c2 event interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 si2c2ip<2:0>: slave i2c2 event interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3-0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 145 PIC24FJ128GC010 family register 8-34: ipc13: interrupt priority control register 13 u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-0 r/w-0 ? ? ? ? ? int4ip2 int4ip1 int4ip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 u-0 u-0 u-0 ? int3ip2 int3ip1 int3ip0 ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as ? 0 ? bit 10-8 int4ip<2:0>: external interrupt 4 priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 int3ip<2:0>: external interrupt 3 priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3-0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 146 ? 2012-2013 microchip technology inc. register 8-35: ipc15: interrupt priority control register 15 u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-0 r/w-0 ? ? ? ? ? rtcip2 rtcip1 rtcip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 u-0 u-0 u-0 ? dma5ip2 dma5ip1 dma5ip0 ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as ? 0 ? bit 10-8 rtcip<2:0>: real-time clock and calendar interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 dma5ip<2:0>: dma channel 5 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3-0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 147 PIC24FJ128GC010 family register 8-36: ipc16: interrupt priority control register 16 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? crcip2 crcip1 crcip0 ? u2erip2 u2erip1 u2erip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 u-0 u-0 u-0 ? u1erip2 u1erip1 u1erip0 ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 crcip<2:0>: crc generator error interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 u2erip<2:0>: uart2 error interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 u1erip<2:0>: uart1 error interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3-0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 148 ? 2012-2013 microchip technology inc. register 8-37: ipc18: interrupt priority control register 18 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-0 r/w-0 ? ? ? ? ? hlvdip2 hlvdip1 hlvdip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-3 unimplemented: read as ? 0 ? bit 2-0 hlvdip<2:0>: high/low-voltage detect interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 149 PIC24FJ128GC010 family register 8-38: ipc19: interrupt priority control register 19 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? dac2ip2 dac2ip1 dac2ip0 ? dac1ip2 dac1ip1 dac1ip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 u-0 u-0 u-0 ? ctmuip2 ctmuip1 ctmuip0 ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 dac2ip<2:0>: dac converter 2 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 dac1ip<2:0>: dac converter 1 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 ctmuip<2:0>: ctmu interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3-0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 150 ? 2012-2013 microchip technology inc. register 8-39: ipc20: interrupt priority control register 20 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? u3txip2 u3txip1 u3txip0 ? u3rxip2 u3rxip1 u3rxip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 u-0 u-0 u-0 ? u3erip2 u3erip1 u3erip0 ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 u3txip<2:0>: uart3 transmitter interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 u3rxip<2:0>: uart3 receiver interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 u3erip<2:0>: uart3 error interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3-0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 151 PIC24FJ128GC010 family register 8-40: ipc21: interrupt priority control register 21 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? u4erip2 u4erip1 u4erip0 ? usb1ip2 usb1ip1 usb1ip0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 u4erip<2:0>: uart4 error interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11 unimplemented: read as ? 0 ? bit 10-8 usb1ip<2:0>: usb1 (usb otg) interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7-0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 152 ? 2012-2013 microchip technology inc. register 8-41: ipc22: interrupt priority control register 22 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? u4txip2 u4txip1 u4txip0 ? u4rxip2 u4rxip1 u4rxip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-7 unimplemented: read as ? 0 ? bit 6-4 u4txip<2:0>: uart4 transmitter interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 u4rxip<2:0>: uart4 receiver interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 153 PIC24FJ128GC010 family register 8-42: ipc23: interrupt priority control register 23 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? ic9ip2 ic9ip1 ic9ip0 ? oc9ip2 oc9ip1 oc9ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-7 unimplemented: read as ? 0 ? bit 6-4 ic9ip<2:0>: input capture channel 9 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 oc9ip<2:0>: output compare channel 9 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
PIC24FJ128GC010 family ds30009312b-page 154 ? 2012-2013 microchip technology inc. register 8-43: ipc25: interrupt priority control register 25 u-0 r/w-1 r/w-0 r/w-0 u-0 u-0 u-0 u-0 ? amp1ip2 amp1ip1 amp1ip0 ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-0 r/w-0 ? ? ? ? ? lcdip2 lcdip1 lcdip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 amp1ip<2:0>: op amp 1 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 11-3 unimplemented: read as ? 0 ? bit 2-0 lcdip<2:0>: lcd controller interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 155 PIC24FJ128GC010 family register 8-44: ipc26: interrupt priority control register 26 u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-0 r/w-0 ? ? ? ? ? fstip2 fstip1 fstip0 bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 r/w-1 r/w-0 r/w-0 ? sda1ip2 sda1ip1 sda1ip0 ? amp2ip2 amp2ip1 amp2ip0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as ? 0 ? bit 10-8 fstip<2:0>: frc self-tune interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 7 unimplemented: read as ? 0 ? bit 6-4 sda1ip<2:0>: sigma-delta a/d converter interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3 unimplemented: read as ? 0 ? bit 2-0 amp2ip<2:0>: op amp 2 interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled
PIC24FJ128GC010 family ds30009312b-page 156 ? 2012-2013 microchip technology inc. register 8-45: ipc29: interrupt priority control register 29 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 r/w-1 r/w-0 r/w-0 u-0 u-0 u-0 u-0 ? jtagip2 jtagip1 jtagip0 ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-7 unimplemented: read as ? 0 ? bit 6-4 jtagip<2:0>: jtag interrupt priority bits 111 = interrupt is priority 7 (highest priority interrupt) ? ? ? 001 = interrupt is priority 1 000 = interrupt source is disabled bit 3-0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 157 PIC24FJ128GC010 family register 8-46: inttreg: interrupt controller test register r-0 r-0 r/w-0 u-0 r-0 r-0 r-0 r-0 cpuirq rvhold ? ilr3 ilr2 ilr1 ilr0 bit 15 bit 8 u-0 r-0 r-0 r-0 r-0 r-0 r-0 r-0 ? vecnum6 vecnum5 vecnum4 vecnum3 vecnum2 vecnum1 vecnum0 bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 cpuirq: interrupt request from interrupt controller cpu bit 1 = an interrupt request has occurred but has not yet been acknowledged by the cpu; this happens when the cpu priority is higher than the interrupt priority 0 = no interrupt request is unacknowledged bit 14 reserved: maintain as ? 0 ? bit 13 vhold: vector number capture configuration bit 1 = vecnum<6:0> contain the value of the highest priority pending interrupt 0 = vecnum<6:0> contain the value of the last acknowledged interrupt (i.e., the last interrupt that has occurred with higher priority than the cpu, even if other interrupts are pending) bit 12 unimplemented: read as ? 0 ? bit 11-8 ilr<3:0>: new cpu interrupt priority level bits 1111 = cpu interrupt priority level is 15 ? ? ? 0001 = cpu interrupt priority level is 1 0000 = cpu interrupt priority level is 0 bit 7 unimplemented: read as ? 0 ? bit 6-0 vecnum<6:0>: vector number of pending interrupt or last acknowledged interrupt bits when vhold = 1 : indicates the vector number (from 0 to 118) of the last interrupt to occur. when vhold = 0 : indicates the vector number (from 0 to 118) of the interrupt request currently being handled.
PIC24FJ128GC010 family ds30009312b-page 158 ? 2012-2013 microchip technology inc. 8.4 interrupt setup procedures 8.4.1 initialization to configure an interrupt source: 1. set the nstdis (intcon1<15>) control bit if nested interrupts are not desired. 2. select the user-assigned priority level for the interrupt source by writing the control bits in the appropriate ipcx register. the priority level will depend on the specific application and type of interrupt source. if multiple priority levels are not desired, the ipcx register control bits, for all enabled interrupt sources, may be programmed to the same non-zero value. 3. clear the interrupt flag status bit associated with the peripheral in the associated ifsx register. 4. enable the interrupt source by setting the interrupt enable control bit associated with the source in the appropriate iecx register. 8.4.2 interrupt service routine (isr) the method that is used to declare an interrupt service routine (isr) and initialize the ivt with the correct vec- tor address will depend on the programming language (i.e., ?c? or assembler), and the language development toolsuite that is used to develop the application. in general, the user must clear the interrupt flag in the appropriate ifsx register for the source of the interrupt that the isr handles; otherwise, the isr will be re-entered immediately after exiting the routine. if the isr is coded in assembly language, it must be termi- nated using a retfie instruction to unstack the saved pc value, srl value and old cpu priority level. 8.4.3 trap service routine (tsr) a trap service routine (tsr) is coded like an isr, except that the appropriate trap status flag in the int- con1 register must be cleared to avoid re-entry into the tsr. 8.4.4 interrupt disable all user interrupts can be disabled using the following procedure: 1. push the current sr value onto the software stack using the push instruction. 2. force the cpu to priority level 7 by inclusive oring the value, 0eh, with srl. to enable user interrupts, the pop instruction may be used to restore the previous sr value. note that only user interrupts with a priority level of 7 or less can be disabled. trap sources (levels 8-15) cannot be disabled. the disi instruction provides a convenient way to disable interrupts of priority levels 1-6 for a fixed period of time. level 7 interrupt sources are not disabled by the disi instruction. note: at a device reset, the ipcx registers are initialized, such that all user interrupt sources are assigned to priority level 4.
? 2012-2013 microchip technology inc. ds30009312b-page 159 PIC24FJ128GC010 family 9.0 oscillator configuration the oscillator system for PIC24FJ128GC010 family devices has the following features: ? a total of four external and internal oscillator options as clock sources, providing 11 different clock modes ? an on-chip usb pll block to provide a stable 48 mhz clock for the usb module, as well as a range of frequency options for the system clock ? software-controllable switching between various clock sources ? software-controllable postscaler for selective clocking of cpu for system power savings ? a fail-safe clock monitor (fscm) that detects clock failure and permits safe application recovery or shutdown ? a separate and independently configurable system clock output for synchroni zing external hardware a simplified diagram of the oscillator system is shown in figure 9-1 . figure 9-1: pic24fj128gc0 10 family clock diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?oscillator? (ds39700). PIC24FJ128GC010 family secondary oscillator soscen enable oscillator sosco sosci clock source option for other modules osci osco primary oscillator xt, hs, ec cpu peripherals postscaler rcdiv<10:8> wdt, pwrt 8 mhz frcdiv 31 khz (nominal) lprc oscillator sosc lprc postscaler clock control logic fail-safe clock monitor doze<14:12> frc clko (nominal) xtpll, hspll ecpll,frcpll 8 mhz 4 mhz pll & div plldiv<2:0> cpdiv<1:0> 48 mhz usb clock usb pll reference clock generator refo refocon<15:8> reference from usb d+/d- frc self-tune control frc oscillator
PIC24FJ128GC010 family ds30009312b-page 160 ? 2012-2013 microchip technology inc. 9.1 cpu clocking scheme the system clock source can be provided by one of four sources: ? primary oscillator (posc) on the osci and osco pins ? secondary oscillator (sosc) on the sosci and sosco pins ? fast internal rc (frc) oscillator ? low-power internal rc (lprc) oscillator the primary oscillator and frc sources have the option of using the internal usb pll block, which generates both the usb module clock and a separate system clock from the 96 mhz pll. refer to section 9.6 ?oscillator modes and usb operation? for additional information. the internal frc provides an 8 mhz clock source. it can optionally be reduced by the programmable clock divider to provide a range of system clock frequencies. the selected clock source generates the processor and peripheral clock sources. the processor clock source is divided by two to produce the internal instruc- tion cycle clock, f cy . in this document, the instruction cycle clock is also denoted by f osc /2. the internal instruction cycle clock, f osc /2, can be provided on the osco i/o pin for some operating modes of the primary oscillator. 9.2 initial configuration on por the oscillator source (and operating mode) that is used at a device power-on reset event is selected using con- figuration bit settings. the oscillator configuration bit settings are located in the configuration registers in the program memory (refer to section 34.1 ?configuration bits? for further details). the primary oscillator configuration bits, poscmd<1:0> (configuration word 2<1:0>), and the initial oscillator select configuration bits, fnosc<2:0> (configuration word 2<10:8>), select the oscillator source that is used at a power-on reset. the frc primary oscillator with postscaler (frcdiv) is the default (unprogrammed) selection. the secondary oscillator (sosc), or one of the internal oscillators, may be chosen by programming these bit locations. the configuration bits allow users to choose between the various clock modes, shown in tab l e 9 - 1 . 9.2.1 clock switching mode configuration bits the fcksm<1:0> configuration bits (configuration word 2<7:6>) are used to jointly configure device clock switching and the fail-safe clock monitor (fscm). clock switching is enabled only when fcksm1 is programmed (? 0 ?). the fscm is enabled only when fcksm<1:0> are both programmed (? 00 ?). table 9-1: configuration bit va lues for clock selection oscillator mode oscillator source poscmd<1:0> fnosc<2:0> notes fast rc oscillator with postscaler (frcdiv) internal 11 111 1 , 2 (reserved) internal xx 110 1 low-power rc oscillator (lprc) internal 11 101 1 secondary (timer1) oscillator (sosc) secondary 11 100 1 primary oscillator (xt) with pll module (xtpll) primary 01 011 primary oscillator (ec) with pll module (ecpll) primary 00 011 primary oscillator (hs) primary 10 010 primary oscillator (xt) primary 01 010 primary oscillator (ec) primary 00 010 fast rc oscillator with pll module (frcpll) internal 11 001 1 fast rc oscillator (frc) internal 11 000 1 note 1: osco pin function is determined by the osciofcn configuration bit. 2: this is the default oscillator mode for an unprogrammed (erased) device.
? 2012-2013 microchip technology inc. ds30009312b-page 161 PIC24FJ128GC010 family 9.3 control registers the operation of the oscillator is controlled by three special function registers: ? osccon ?clkdiv ?osctun the osccon register ( register 9-1 ) is the main con- trol register for the oscillator. it controls clock source switching and allows the monitoring of clock sources. osccon is protected by a write lock to prevent inad- vertent clock switches. see section 9.4 ?clock switching operation? for more information. the clkdiv register ( register 9-2 ) controls the features associated with doze mode, as well as the postscaler for the frc oscillator. the osctun register ( register 9-3 ) allows the user to fine-tune the frc oscillator over a range of approxi- mately 1.5%. it also controls the frc self-tuning features, described in section 9.5 ?frc active clock tuning? . register 9-1: osccon: os cillator control register u-0 r-0 r-0 r-0 u-0 r/w-x ( 1 ) r/w-x ( 1 ) r/w-x ( 1 ) ? cosc2 cosc1 cosc0 ? nosc2 nosc1 nosc0 bit 15 bit 8 r/so-0 r/w-0 r-0 ( 3 ) u-0 r/co-0 r/w-0 r/w-0 r/w-0 clklock iolock ( 2 ) lock ? cf poscen soscen oswen bit 7 bit 0 legend: co = clearable only bit so = settable only bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 cosc<2:0>: current oscillator selection bits 111 = fast rc oscillator with postscaler (frcdiv) 110 = reserved 101 = low-power rc oscillator (lprc) 100 = secondary oscillator (sosc) 011 = primary oscillator with pll module (xtpll, hspll, ecpll) 010 = primary oscillator (xt, hs, ec) 001 = fast rc oscillator with postscaler and pll module (frcpll) ( 4 ) 000 = fast rc oscillator (frc) bit 11 unimplemented: read as ? 0 ? bit 10-8 nosc<2:0>: new oscillator selection bits ( 1 ) 111 = fast rc oscillator with postscaler (frcdiv) 110 = reserved 101 = low-power rc oscillator (lprc) 100 = secondary oscillator (sosc) 011 = primary oscillator with pll module (xtpll, hspll, ecpll) 010 = primary oscillator (xt, hs, ec) 001 = fast rc oscillator with postscaler and pll module (frcpll) ( 4 ) 000 = fast rc oscillator (frc) note 1: reset values for these bits are determined by the fnoscx configuration bits. 2: the state of the iolock bit can only be changed once an unlocking sequence has been executed. in addition, if the iol1way configuration bit is ? 1 ?, once the iolock bit is set, it cannot be cleared. 3: this bit also resets to ? 0 ? during any valid clock switch or whenever a non-pll clock mode is selected. 4: the default divisor of the postscaler is 2, which will generate a 4 mhz clock to the pll module.
PIC24FJ128GC010 family ds30009312b-page 162 ? 2012-2013 microchip technology inc. bit 7 clklock: clock selection lock enable bit if fscm is enabled (fcksm1 = 1 ): 1 = clock and pll selections are locked 0 = clock and pll selections are not locked and may be modified by setting the oswen bit if fscm is disabled (fcksm1 = 0 ): clock and pll selections are never locked and may be modified by setting the oswen bit. bit 6 iolock: i/o lock enable bit ( 2 ) 1 = i/o lock is active 0 = i/o lock is not active bit 5 lock: pll lock status bit ( 3 ) 1 = pll module is in lock or pll module start-up timer is satisfied 0 = pll module is out of lock, pll start-up timer is running or pll is disabled bit 4 unimplemented: read as ? 0 ? bit 3 cf: clock fail detect bit 1 = fscm has detected a clock failure 0 = no clock failure has been detected bit 2 poscen: primary oscillator sleep enable bit 1 = primary oscillator continues to operate during sleep mode 0 = primary oscillator is disabled during sleep mode bit 1 soscen: 32 khz secondary oscillator (sosc) enable bit 1 = enables secondary oscillator 0 = disables secondary oscillator bit 0 oswen: oscillator switch enable bit 1 = initiates an oscillator switch to a clock source specified by the nosc<2:0> bits 0 = oscillator switch is complete register 9-1: osccon: oscillato r control register (continued) note 1: reset values for these bits are determined by the fnoscx configuration bits. 2: the state of the iolock bit can only be changed once an unlocking sequence has been executed. in addition, if the iol1way configuration bit is ? 1 ?, once the iolock bit is set, it cannot be cleared. 3: this bit also resets to ? 0 ? during any valid clock switch or whenever a non-pll clock mode is selected. 4: the default divisor of the postscaler is 2, which will generate a 4 mhz clock to the pll module.
? 2012-2013 microchip technology inc. ds30009312b-page 163 PIC24FJ128GC010 family register 9-2: clkdiv: clock divider register r/w-0 r/w-0 r/w-1 r/w-1 r/w-0 r/w-0 r/w-0 r/w-1 roi doze2 doze1 doze0 dozen ( 1 ) rcdiv2 rcdiv1 rcdiv0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 u-0 cpdiv1 cpdiv0 pllen ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 roi: recover on interrupt bit 1 = interrupts clear the dozen bit and reset the cpu peripheral clock ratio to 1:1 0 = interrupts have no effect on the dozen bit bit 14-12 doze<2:0>: cpu peripheral clock ratio select bits 111 = 1:128 110 = 1:64 101 = 1:32 100 = 1:16 011 = 1:8 (default) 010 = 1:4 001 = 1:2 000 = 1:1 bit 11 dozen: doze enable bit ( 1 ) 1 = doze<2:0> bits specify the cpu peripheral clock ratio 0 = cpu peripheral clock ratio is set to 1:1 bit 10-8 rcdiv<2:0>: frc postscaler select bits 111 = 31.25 khz (divide-by-256) 110 = 125 khz (divide-by-64) 101 = 250 khz (divide-by-32) 100 = 500 khz (divide-by-16) 011 = 1 mhz (divide-by-8) 010 = 2 mhz (divide-by-4) 001 = 4 mhz (divide-by-2) (default) 000 = 8 mhz (divide-by-1) bit 7-6 cpdiv<1:0>: system clock select bits (postscaler select from 32 mhz clock branch) 11 = 4 mhz (divide-by-8) ( 2 ) 10 = 8 mhz (divide-by-4) ( 2 ) 01 = 16 mhz (divide-by-2) 00 = 32 mhz (divide-by-1) bit 5 pllen: usb pll enable bit 1 = pll is always active 0 = pll is only active when a pll oscillator mode is selected (osccon<14:12> = 011 or 001 ) bit 4-0 unimplemented: read as ? 0 ? note 1: this bit is automatically cleared when the roi bit is set and an interrupt occurs. 2: this setting is not allowed while the usb module is enabled.
PIC24FJ128GC010 family ds30009312b-page 164 ? 2012-2013 microchip technology inc. register 9-3: osctun: frc oscillator tune register r/w-0 u-0 r/w-0 r/w-0 r-0 r/w-0 r-0 r/w-0 sten ?stsidlstsrc ( 1 ) stlock stlpol stor storpol bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? tun5 ( 2 ) tun4 ( 2 ) tun3 ( 2 ) tun2 ( 2 ) tun1 ( 2 ) tun0 ( 2 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 sten: frc self-tune enable bit 1 = frc self-tuning is enabled; tunx bits are controlled by hardware 0 = frc self-tuning is disabled; application may optionally control tunx bits bit 14 unimplemented: read as ? 0 ? bit 13 stsidl: frc self-tune stop in idle bit 1 = self-tuning stops during idle mode 0 = self-tuning continues during idle mode bit 12 stsrc: frc self-tune reference clock source bit ( 1 ) 1 = frc is tuned to approximately match the usb host clock tolerance 0 = frc is tuned to approximately match the 32.768 khz sosc tolerance bit 11 stlock: frc self-tune lock status bit 1 = frc accuracy is currently within 0.2% of the stsrc reference accuracy 0 = frc accuracy may not be within 0.2% of the stsrc reference accuracy bit 10 stlpol: frc self-tune lock interrupt polarity bit 1 = a self-tune lock interrupt is generated when stlock is ? 0 ? 0 = a self-tune lock interrupt is generated when stlock is ? 1 ? bit 9 stor: frc self-tune out of range status bit 1 = stsrc reference clock error is beyond the range of tun<5:0>; no tuning is performed 0 = stsrc reference clock is within the tunable range; tuning is performed bit 8 storpol: frc self-tune out of range interrupt polarity bit 1 = a self-tune out of range interrupt is generated when stor is ? 0 ? 0 = a self-tune out of range interrupt is generated when stor is ? 1 ? bit 7-6 unimplemented: read as ? 0 ? bit 5-0 tun<5:0>: frc oscillator tuning bits ( 2 ) 011111 = maximum frequency deviation 011110 = ? ? ? 000001 = 000000 = center frequency, oscillator is running at factory calibrated frequency 111111 = ? ? ? 100001 = 100000 = minimum frequency deviation note 1: use of either clock tuning reference source has specific application requirements. see section 9.5 ?frc active clock tuning? for details. 2: these bits are read-only when sten = 1 .
? 2012-2013 microchip technology inc. ds30009312b-page 165 PIC24FJ128GC010 family 9.4 clock switching operation with few limitations, applications are free to switch between any of the four clock sources (posc, sosc, frc and lprc) under software control and at any time. to limit the possible side effects that could result from this flexibility, pic24f devices have a safeguard lock built into the switching process. 9.4.1 enabling clock switching to enable clock switching, the fcksm1 configuration bit in cw2 must be programmed to ? 0 ?. (refer to section 34.1 ?configuration bits? for further details.) if the fcksm1 configuration bit is unprogrammed (? 1 ?), the clock switching function and fail-safe clock monitor function are disabled; this is the default setting. the noscx control bits (osccon<10:8>) do not control the clock selection when clock switching is disabled. however, the cosc<2:0> bits (osccon<14:12>) will reflect the clock source selected by the fnoscx configuration bits. the oswen control bit (osccon<0>) has no effect when clock switching is disabled; it is held at ? 0 ? at all times. 9.4.2 oscillator switching sequence at a minimum, performing a clock switch requires this basic sequence: 1. if desired, read the coscx bits (osccon<14:12>) to determine the current oscillator source. 2. perform the unlock sequence to allow a write to the osccon register high byte. 3. write the appropriate value to the noscx bits (osccon<10:8>) for the new oscillator source. 4. perform the unlock sequence to allow a write to the osccon register low byte. 5. set the oswen bit to initiate the oscillator switch. once the basic sequence is completed, the system clock hardware responds automatically as follows: 1. the clock switching hardware compares the coscx bits with the new value of the noscx bits. if they are the same, then the clock switch is a redundant operation. in this case, the oswen bit is cleared automatically and the clock switch is aborted. 2. if a valid clock switch has been initiated, the lock (osccon<5>) and cf (osccon<3>) bits are cleared. 3. the new oscillator is turned on by the hardware if it is not currently running. if a crystal oscillator must be turned on, the hardware will wait until the ost expires. if the new source is using the pll, then the hardware waits until a pll lock is detected (lock = 1 ). 4. the hardware waits for 10 clock cycles from the new clock source and then performs the clock switch. 5. the hardware clears the oswen bit to indicate a successful clock transition. in addition, the noscx bit values are transferred to the coscx bits. 6. the old clock source is turned off at this time, with the exception of lprc (if wdt or fscm is enabled) or sosc (if soscen remains set). note: the primary oscillator mode has three different submodes (xt, hs and ec) which are determined by the poscmdx configuration bits. while an application can switch to and from primary oscillator mode in software, it cannot switch between the different primary submodes without reprogramming the device. note 1: the processor will continue to execute code throughout the clock switching sequence. timing-sensitive code should not be executed during this time. 2: direct clock switches between any primary oscillator mode with pll and frcpll mode are not permitted. this applies to clock switches in either direc- tion. in these instances, the application must switch to frc mode as a transi- tional clock source between the two pll modes.
PIC24FJ128GC010 family ds30009312b-page 166 ? 2012-2013 microchip technology inc. a recommended code sequence for a clock switch includes the following: 1. disable interrupts during the osccon register unlock and write sequence. 2. execute the unlock sequence for the osccon high byte by writing 78h and 9ah to osccon<15:8> in two back-to-back instructions. 3. write the new oscillator source to the noscx bits in the instruction immediately following the unlock sequence. 4. execute the unlock sequence for the osccon low byte by writing 46h and 57h to osccon<7:0> in two back-to-back instructions. 5. set the oswen bit in the instruction immediately following the unlock sequence. 6. continue to execute code that is not clock-sensitive (optional). 7. invoke an appropriate amount of software delay (cycle counting) to allow the selected oscillator and/or pll to start and stabilize. 8. check to see if oswen is ? 0 ?. if it is, the switch was successful. if oswen is still set, then check the lock bit to determine the cause of the failure. the core sequence for unlocking the osccon register and initiating a clock switch is shown in example 9-1 . example 9-1: basic code sequence for clock switching 9.5 frc active clock tuning PIC24FJ128GC010 family devices include an automatic mechanism to calibrate the frc during run time. this system uses active clock tuning from a source of known accuracy to maintain the frc within a very narrow margin of its nominal 8 mhz frequency. this allows for a frequency accuracy that is well within the requirements of the ?usb 2.0 specification? , regarding full-speed usb devices. the self-tune system is controlled by the bits in the upper half of the osctun register. setting the sten bit (osctun<15>) enables the self-tuning feature, allowing the hardware to calibrate to a source selected by the stsrc bit (osctun<12>). when stsrc = 1 , the system uses the start-of-frame (sof) packets from an external usb host for its source. when stsrc = 0 , the system uses the crystal-controlled sosc for its calibration source. regardless of the source, the system uses the tun<5:0> bits (osctun<5:0>) to change the frc oscillator?s fre- quency. frequency monitoring and adjustment is dynamic, occurring continuously during run time. while the system is active, the tunx bits cannot be written to by software. the self-tune system can generate a hardware interrupt, fstif. the interrupt can result from a drift of the frc from the reference by greater than 0.2% in either direction, or whenever the frequency deviation is beyond the ability of the tunx bits to correct (i.e., greater than 1.5%). the stlock and stor status bits (osctun<11,9>) are used to indicate these conditions. the stlpol and storpol bits (osctun<10,8>) configure the fstif interrupt to occur in the presence or the absence of the conditions. it is the user?s respon- sibility to monitor both the stlock and stor bits to determine the exact cause of the interrupt. ;place the new oscillator selection in w0 ;oscconh (high byte) unlock sequence mov #oscconh, w1 mov #0x78, w2 mov #0x9a, w3 mov.b w2, [w1] mov.b w3, [w1] ;set new oscillator selection mov.b wreg, oscconh ;oscconl (low byte) unlock sequence mov #oscconl, w1 mov #0x46, w2 mov #0x57, w3 mov.b w2, [w1] mov.b w3, [w1] ;start oscillator switch operation bset osccon,#0 note: the self-tune feature maintains sufficient accuracy for operation in usb device mode. for applications that function as a usb host, a high-accuracy clock source (0.05%) is still required. note: to use the usb as a reference clock tuning source (stsrc = 1 ), the micro- controller must be configured for usb device operation and connected to a non-suspended usb host or hub port. if the sosc is to be used as the reference clock tuning source (stsrc = 0 ), the sosc must also be enabled for clock tuning to occur. note: the stlpol and storpol bits should be ignored when the self-tune system is disabled (sten = 0 ).
? 2012-2013 microchip technology inc. ds30009312b-page 167 PIC24FJ128GC010 family 9.6 oscillator modes and usb operation because of the timing requirements imposed by usb, an internal clock of 48 mhz is required at all times while the usb module is enabled and not in a suspended operating state. since this is well beyond the maximum cpu clock speed, a method is provided to internally generate both the usb and system clocks from a single oscillator source. PIC24FJ128GC010 family devices use the same clock structure as most other pic24fj devices, but include a two-branch pll system to generate the two clock signals. the usb pll block is shown in figure 9-2 . in this system, the input from the primary oscillator is divided down by a pll prescaler to generate a 4 mhz output. this is used to drive an on-chip, 96 mhz pll frequency multiplier to drive the two clock branches. one branch uses a fixed, divide-by-2 frequency divider to generate the 48 mhz usb clock. the other branch uses a fixed, divide-by-3 frequency divider and configurable pll prescaler/divider to generate a range of system clock frequencies. the cpdiv<1:0> bits select the system clock speed; available clock options are listed in table 9-2 . the usb pll prescaler does not automatically sense the incoming oscillator frequency. the user must man- ually configure the pll divider to generate the required 4 mhz output, using the plldiv<3:0> configuration bits. this limits the choices for primary oscillator frequency to a total of 8 possibilities, shown in table 9-3 . table 9-2: system clock options during usb operation table 9-3: valid primary oscillator configurations for usb operations figure 9-2: pll block mcu clock division (cpdiv<1:0>) microcontroller clock frequency none ( 00 )32mhz ? 2 ( 01 )16mhz ? 4 ( 10 ) ( 1 ) 8mhz ? 8 ( 11 ) ( 1 ) 4mhz note 1: this is not compatible with usb operation. the usb module must be disabled to use this system clock option. input oscillator frequency clock mode pll division (plldiv<3:0>) 48 mhz ecpll ? 12 ( 0111 ) 32 mhz hspll, ecpll ? 8 ( 0110 ) 24 mhz hspll, ecpll ? 6 ( 0101 ) 20 mhz hspll, ecpll ? 5 ( 0100 ) 16 mhz hspll, ecpll ? 4 ( 0011 ) 12 mhz hspll, ecpll ? 3 ( 0010 ) 8 mhz ecpll, xtpll, frcpll ( 1 ) ? 2 ( 0001 ) 4 mhz ecpll, xtpll, frcpll ( 1 ) ? 1 ( 0000 ) note 1: this requires the use of the frc self-tune feature to maintain required clock accuracy. pll 96 mhz pll ? 2 prescaler 4 mhz cpu divider 48 mhz clock for usb module pll output for system clock cpdiv<1:0> plldiv<3:0> input from posc input from frc (note 1) (4 mhz or 8 mhz) 32 mhz 0111 0110 0101 0100 0011 0010 0001 0000 ? 12 ? 8 ? 8 ? 6 ? 5 ? 4 ? 3 ? 2 ? 1 ? 4 ? 2 ? 1 ? 3 00 01 10 11 note 1: this mux is controlled by the cosc<2:0> bits w hen running from the pll, or the nosc<2:0> bits when preparing to switch to the pll.
PIC24FJ128GC010 family ds30009312b-page 168 ? 2012-2013 microchip technology inc. 9.6.1 considerations for usb operation when using the usb on-the-go module in PIC24FJ128GC010 family devices, users must always observe these rules in configuring the system clock: ? the oscillator modes listed in table 9-3 are the only oscillator configurations that permit usb oper- ation. there is no provision to provide a separate external clock source to the usb module. ? for usb operation, the selected clock source (ec, hs or xt) must meet the usb clock tolerance requirements. ? when the frcpll oscillator mode is used for usb applications, the frc self-tune system should be used as well. while the frc is accu- rate, the only two ways to ensure the level of accuracy required by the ?usb 2.0 specification?, throughout the application?s operating range, are either the self-tune system or manually changing the tun<5:0> bits. ? the user must always ensure that the frc source is configured to provide a frequency of 4 mhz or 8 mhz (rcdiv<2:0> = 001 or 000 ) and that the usb pll prescaler is configured appropriately. ? all other oscillator modes are available; however, usb operation is not possible when these modes are selected. they may still be useful in cases where other power levels of operation are desirable and the usb module is not needed (e.g., the application is sleeping and waiting for a bus attachment). 9.7 reference clock output in addition to the clko output (f osc /2) available in certain oscillator modes, the device clock in the PIC24FJ128GC010 family devices can also be config- ured to provide a reference clock output signal to a port pin. this feature is available in all oscillator configura- tions and allows the user to select a greater range of clock submultiples to drive external devices in the application. this reference clock output is controlled by the refocon register ( register 9-4 ). setting the roen bit (refocon<15>) makes the clock signal available on the refo pin. the rodiv<3:0> bits (refocon<11:8>) enable the selection of 16 different clock divider options. the rosslp and rosel bits (refocon<13:12>) control the availability of the reference output during sleep mode. the rosel bit determines if the oscillator on osc1 and osc2, or the current system clock source, is used for the reference clock output. the rosslp bit determines if the reference source is available on refo when the device is in sleep mode. to use the reference clock output in sleep mode, both the rosslp and rosel bits must be set. the device clock must also be configured for one of the primary modes (ec, hs or xt); otherwise, if the poscen bit is not also set, the oscillator on osc1 and osc2 will be powered down when the device enters sleep mode. clearing the rosel bit allows the reference output frequency to change as the system clock changes during any clock switches. 9.8 secondary oscillator 9.8.1 basic sosc operation PIC24FJ128GC010 family devices do not have to set the soscen bit to use the secondary oscillator. any module requiring the sosc (such as rtcc, timer1 or dswdt) will automatically turn on the sosc when the clock signal is needed. the sosc, however, has a long start-up time (as long as 1 second).to avoid delays for peripheral start-up, the sosc can be manually started using the soscen bit. to use the secondary oscillator, the soscsel bit (cw3<8>) must be set to ? 1 ?. programming the soscsel bit to ? 0 ? configures the sosc pins for digital mode, enabling digital i/o functionality on the pins. 9.8.2 crystal selection the 32.768 khz crystal used for the sosc must have the following specifications in order to properly start up and run at the correct frequency: ? 12.5 pf loading capacitance ? 1.0 pf shunt capacitance ? a typical esr of 50k; 70k maximum in addition, the two external crystal loading capacitors should be in the range of 22-27 pf, which will be based on the pc board layout. the capacitors should be c0g, 5% tolerance and rated 25v or greater. the accuracy and duty cycle of the sosc can be measured on the refo pin and is recommended to be in the range of 40-60% and accurate to 0.65hz. note: do not enable the lcd segment pin, seg17, on rd0 when using the 64-pin package if the sosc is used for time-sensitive applications. avoid high-frequency traces adjacent to the sosco and sosci pins as this can cause errors in the sosc frequency and/or duty cycle.
? 2012-2013 microchip technology inc. ds30009312b-page 169 PIC24FJ128GC010 family register 9-4: refocon: reference oscillator control register r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 roen ? rosslp rosel rodiv3 rodiv2 rodiv1 rodiv0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 roen: reference oscillator output enable bit 1 = reference oscillator is enabled on the refo pin 0 = reference oscillator is disabled bit 14 unimplemented: read as ? 0 ? bit 13 rosslp: reference oscillator output stop in sleep bit 1 = reference oscillator continues to run in sleep 0 = reference oscillator is disabled in sleep bit 12 rosel: reference oscillator source select bit 1 = primary oscillator is used as the base clock. note that the crystal oscillator must be enabled using the fosc<2:0> bits; crystal maintains the operation in sleep mode. 0 = system clock is used as the base clock; base clock reflects any clock switching of the device bit 11-8 rodiv<3:0>: reference oscillator divisor select bits 1111 = base clock value divided by 32,768 1110 = base clock value divided by 16,384 1101 = base clock value divided by 8,192 1100 = base clock value divided by 4,096 1011 = base clock value divided by 2,048 1010 = base clock value divided by 1,024 1001 = base clock value divided by 512 1000 = base clock value divided by 256 0111 = base clock value divided by 128 0110 = base clock value divided by 64 0101 = base clock value divided by 32 0100 = base clock value divided by 16 0011 = base clock value divided by 8 0010 = base clock value divided by 4 0001 = base clock value divided by 2 0000 = base clock value bit 7-0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 170 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 171 PIC24FJ128GC010 family 10.0 power-saving features the PIC24FJ128GC010 family of devices provides the ability to manage power consumption by selectively man- aging clocking to the cpu and the peripherals. in general, a lower clock frequency and a reduction in the number of circuits being clocked reduces consumed power. PIC24FJ128GC010 family devices manage power consumption with five strategies: ? instruction-based power reduction modes ? hardware-based power reduction features ? clock frequency control ? software controlled doze mode ? selective peripheral control in software combinations of these methods can be used to selectively tailor an application?s power consumption, while still maintaining critical application features, such as timing-sensitive communications. 10.1 overview of power-saving modes in addition to full-power operation, otherwise known as run mode, the PIC24FJ128GC010 family of devices offers three instruction-based power-saving modes and one hardware-based mode: ?idle ? sleep (sleep and low-voltage sleep) ? deep sleep (with and without retention) ?v bat (with and without rtcc) all four modes can be activated by powering down dif- ferent functional areas of the microcontroller, allowing progressive reductions of operating and idle power consumption. in addition, three of the modes can be tailored for more power reduction, at a trade-off of some operating features. ta b l e 1 0 - 1 lists all of the operating modes, in order of increasing power savings. table 10-2 summarizes how the microcontroller exits the different modes. specific information is provided in the following sections. table 10-1: operating modes for PIC24FJ128GC010 family devices note: this data sheet summarizes the features of this group of pic24fj devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?power-saving features with deep sleep? (ds39727). mode entry active systems core peripherals data ram retention rtcc ( 1 ) dsgpr0/ dsgpr1 retention run (default) n/ayyyyy idle instruction n y y y y sleep: sleep instruction n s ( 2 ) yyy low-voltage sleep instruction + reten bit ns ( 2 ) yyy deep sleep: retention deep sleep instruction + dsen bit + reten bit nnyyy deep sleep instruction + dsen bit nnnyy v bat : with rtcc hardware n n n y y w/o rtcc hardware + rtcbat config. bit nnnny note 1: if rtcc is otherwise enabled in firmware. 2: a select peripheral can operate during this mode from lprc or some external clock.
PIC24FJ128GC010 family ds30009312b-page 172 ? 2012-2013 microchip technology inc. table 10-2: exiting power saving modes 10.1.1 instruction-based power-saving modes three of the power-saving modes are entered through the execution of the pwrsav instruction. sleep mode stops clock operation and halts all code execution. idle mode halts the cpu and code execution, but allows peripheral modules to continue operation. deep sleep mode stops clock operation, code execution and all peripherals, except rtcc and dswdt. it also freezes i/o states and removes power to flash memory, and may remove power to sram. the assembly syntax of the pwrsav instruction is shown in example 10-1 . sleep and idle modes are entered directly with a single assembler command. deep sleep requires an additional sequence to unlock and enable the entry into deep sleep, which is described in section 10.4.2 ?entering deep sleep mode? . sleep and idle modes can be exited as a result of an enabled interrupt, wdt time-out or a device reset. when the device exits these modes, it is said to ?wake-up?. the features enabled with the low-voltage/retention regulator result in some changes to the way that sleep and deep sleep modes behave. see section 10.3 ?sleep mode? and section 10.4 ?deep sleep mode? for additional information. 10.1.1.1 interrupts coincident with power save instructions any interrupt that coincides with the execution of a pwrsav instruction will be held off until entry into sleep or idle mode has completed. the device will then wake-up from sleep or idle mode. for deep sleep mode, interrupts that coincide with the execution of the pwrsav instruction may be lost. if the low-voltage/retention regulator is not enabled, the microcontroller resets on leaving deep sleep and the interrupt will be lost. if the low-voltage/retention regula- tor is enabled, the microcontroller will exit deep sleep and the interrupt will then be handled. interrupts that occur during the deep sleep unlock sequence will interrupt the mandatory five-instruction cycle sequence timing and cause a failure to enter deep sleep. for this reason, it is recommended to disable all interrupts during the deep sleep unlock sequence. example 10-1: pwrsav instruction syntax mode exit conditions code execution resumes interrupts resets rtcc alarm wdt v dd restore ( 2 ) all int0 all por mclr idle y y y y y y y n/a next instruction sleep (all modes) y y y y y y y n/a deep sleep n y n y y y y ( 1 ) n/a reset vector retention deep sleep nynyyyy ( 1 ) n/a next instruction v bat n n n n n n n y reset vector note 1: deep sleep wdt. 2: a por or por-like reset results whenever v dd is removed and restored in any mode except for retention deep sleep. note: sleep_mode and idle_mode are constants defined in the assembler include file for the selected device. // syntax to enter sleep mode: pwrsav #sleep_mode ; put the device into sleep mode // //synatx to enter idle mode: pwrsav #idle_mode ; put the device into idle mode // // syntax to enter deep sleep mode: // first use the unlock sequence to set the dsen bit (see example 10-2 ) bset dscon, #dsen ;enable deep sleep bset dscon, #dsen ; enable deep sleep(repeat the command) pwrsav #sleep_mode ; put the device into deep sleep mode
? 2012-2013 microchip technology inc. ds30009312b-page 173 PIC24FJ128GC010 family 10.1.2 hardware-based power-saving mode the hardware-based v bat mode does not require any action by the user during code development. instead, it is a hardware design feature that allows the micro- controller to retain critical data (using the dsgprx registers) and maintain the rtcc when v dd is removed from the application. this is accomplished by supplying a backup power source to a specific power pin. v bat mode is described in more detail in section 10.5 ?vbat mode? . 10.1.3 low-voltage/retention regulator PIC24FJ128GC010 family devices incorporate a second on-chip voltage regulator, designed to provide power to select microcontroller features at 1.2v, nomi- nal. this regulator allows features, such as data ram and the wdt, to be maintained in power-saving modes where they would otherwise be inactive, or maintain them at a lower power than would otherwise be the case. the low-voltage/retention regulator is only available when sleep or deep sleep modes are invoked. it is controlled by the lpcfg configuration bit (cw1<10>) and in firmware by the reten bit (rcon<12>). lpcfg must be programmed (= 0 ) and the reten bit must be set (= 1 ) for the regulator to be enabled. 10.2 idle mode idle mode provides these features: ? the cpu will stop executing instructions. ? the wdt is automatically cleared. ? the system clock source remains active. by default, all peripheral modules continue to operate normally from the system clock source, but can also be selectively disabled (see section 10.8 ?selective peripheral module control? ). ? if the wdt or fscm is enabled, the lprc will also remain active. the device will wake from idle mode on any of these events: ? any interrupt that is individually enabled ? any device reset ? a wdt time-out on wake-up from idle, the clock is re-applied to the cpu and instruction execution begins immediately, starting with the instruction following the pwrsav instruction or the first instruction in the interrupt service routine (isr). 10.3 sleep mode sleep mode includes these features: ? the system clock source is shut down. if an on-chip oscillator is used, it is turned off. ? the device current consumption will be reduced to a minimum provided that no i/o pin is sourcing current. ? the i/o pin directions and states are frozen. ? the fail-safe clock monitor does not operate during sleep mode since the system clock source is disabled. ? the lprc clock will continue to run in sleep mode if the wdt or rtcc, with lprc as the clock source, is enabled. ? the wdt, if enabled, is automatically cleared prior to entering sleep mode. ? some device features or peripherals may continue to operate in sleep mode. this includes items, such as the input change notification (icn) on the i/o ports, or peripherals that use an external clock input. any peripheral that requires the system clock source for its operation will be disabled in sleep mode. the device will wake-up from sleep mode on any of these events: ? on any interrupt source that is individually enabled ? on any form of device reset ? on a wdt time-out on wake-up from sleep, the processor will restart with the same clock source that was active when sleep mode was entered. 10.3.1 low-voltage/retention sleep mode low-voltage/retention sleep mode functions as sleep mode with the same features and wake-up triggers. the difference is that the low-voltage/retention regula- tor allows core digital logic voltage (v core ) to drop to 1.2v nominal. this permits an incremental reduction of power consumption over what would be required if v core was maintained at a 1.8v (minimum) level. low-voltage sleep mode requires a longer wake-up time than sleep mode, due to the additional time required to bring v core back to 1.8v (known as t reg ). in addition, the use of the low-voltage/retention regula- tor limits the amount of current that can be sourced to any active peripherals, such as the rtcc/lcd, etc.
PIC24FJ128GC010 family ds30009312b-page 174 ? 2012-2013 microchip technology inc. 10.4 deep sleep mode deep sleep mode provides the lowest levels of power consumption available from the instruction-based modes. PIC24FJ128GC010 family devices have two deep sleep modes: legacy deep sleep, found in other pic24f devices, and retention deep sleep, described below. deep sleep modes have these features: ? the system clock source is shut down. if an on-chip oscillator is used, it is turned off. ? the device current consumption will be reduced to a minimum. ? the i/o pin directions and states are frozen. ? the fail-safe clock monitor does not operate during sleep mode since the system clock source is disabled. ? the lprc clock will continue to run in deep sleep mode if the wdt, or rtcc with lprc as the clock source, is enabled. ? the dedicated deep sleep wdt and bor systems, if enabled, are used. ? the rtcc and its clock source continue to run, if enabled. all other peripherals are disabled. entry into deep sleep mode is completely under software control. exit from the deep sleep modes can be triggered from any of the following events: ? por event ?mclr event ? rtcc alarm (if the rtcc is present) ? external interrupt 0 ? deep sleep watchdog timer (dswdt) time-out 10.4.1 retention deep sleep unlike deep sleep mode, retention deep sleep mode represents an incremental increase in power consump- tion. although it also allows the device to operate at a v core of 1.2v, the low-voltage/retention regulator is used in this mode to maintain the contents of the data ram, which slightly increases current consumption. maintaining data ram (including the sfrs) has sev- eral effects that make retention deep sleep different form deep sleep: ? the wake-up sources are the same as those for deep sleep mode. ? wake-up from retention deep sleep allows the device to resume its previous state and start code execution where it left off, instead of restarting at the reset vector (as with deep sleep). 10.4.2 entering deep sleep mode deep sleep mode is entered by setting the dsen bit in the dscon register and then executing a sleep command ( pwrsav #sleep_mode ) within one instruc- tion cycle to minimize the chance that deep sleep will be spuriously entered. if the low-voltage/retention regulator is already enabled, prior to setting the dsen bit, the device will enter retention deep sleep. if the pwrsav command is not given within one instruction cycle, the dsen bit will be cleared by the hardware and must be set again by the software before entering deep sleep mode. the dsen bit is also automatically cleared when exiting deep sleep mode. the sequence to enter deep sleep mode is: 1. if the application requires the deep sleep wdt, enable it and configure its clock source. for more information on deep sleep wdt, see section 10.4.6 ?deep sleep wdt? . 2. if the application requires deep sleep bor, enable it by programming the dsboren configuration bit (cw4<6>). 3. if the application requires wake-up from deep sleep on rtcc alarm, enable and configure the rtcc module. for more information on rtcc, see section 23.0 ?real-time clock and calendar (rtcc)? . 4. if needed, save any critical application context data by writing it to the dsgpr0 and dsgpr1 registers (optional). 5. enable deep sleep mode by setting the dsen bit (dscon<15>). 6. enter deep sleep mode by issuing 3 nop commands and then a pwrsav #0 instruction. note: to re-enter deep sleep after a deep sleep wake-up, allow a delay of at least 3 t cy after clearing the release bit. note: a repeat sequence is required to set the dsen bit. the repeat sequence (repeating the instruction twice) is required to write to any of the deep sleep registers (dscon, dswake, dsgpr0, dsgpr1). this is required to prevent the user from entering deep sleep by mistake. any write to these registers has to be done twice to actually complete the write (see example 10-2 ).
? 2012-2013 microchip technology inc. ds30009312b-page 175 PIC24FJ128GC010 family any time the dsen bit is set, all bits in the dswake register will be automatically cleared. example 10-2: the repeat sequence 10.4.3 exiting deep sleep modes deep sleep modes exit on any one of the following events: ? por event on v dd supply. if there is no dsbor circuit to re-arm the v dd supply por circuit, the external v dd supply must be lowered to the natural arming voltage of the por circuit. ? dswdt time-out. when the dswdt timer times out, the device exits deep sleep. ? rtcc alarm (if rtcen = 1 ). ? assertion (? 0 ?) of the mclr pin. ? assertion of the int0 pin (if the interrupt was enabled before deep sleep mode was entered). the polarity configuration is used to determine the assertion level (? 0 ? or ? 1 ?) of the pin that will cause an exit from deep sleep mode. exiting from deep sleep mode requires a change on the int0 pin while in deep sleep mode. exiting deep sleep generally does not retain the state of the device and is equivalent to a power-on reset (por) of the device. exceptions to this include the rtcc (if present), which remains operational through the wake-up, the dsgprx registers and dswdt. wake-up events that occur from the time deep sleep exits, until the time the por sequence completes, are not ignored. the dswake register will capture all wake-up events, from setting dsen to clearing release. the sequence for exiting deep sleep mode is: 1. after a wake-up event, the device exits deep sleep and performs a por. the dsen bit is cleared automatically. code execution resumes at the reset vector. 2. to determine if the device exited deep sleep, read the deep sleep bit, dpslp (rcon<10>). this bit will be set if there was an exit from deep sleep mode. if the bit is set, clear it. 3. determine the wake-up source by reading the dswake register. 4. determine if a dsbor event occurred during deep sleep mode by reading the dsbor bit (dscon<1>). 5. if application context data has been saved, read it back from the dsgpr0 and dsgpr1 registers. 6. clear the release bit (dscon<0>). 10.4.4 saving context data with the dsgprx registers as exiting deep sleep mode causes a por, most special function registers reset to their default por values. in addition, because v core power is not sup- plied in deep sleep mode, information in data ram may be lost when exiting this mode. applications which require critical data to be saved, prior to deep sleep, may use the deep sleep general purpose registers, dsgpr0 and dsgpr1, or data eeprom (if available). unlike other sfrs, the con- tents of these registers are preserved while the device is in deep sleep mode. after exiting deep sleep, software can restore the data by reading the registers and clearing the release bit (dscon<0>). 10.4.5 i/o pins in deep sleep modes during deep sleep, the general purpose i/o pins retain their previous states and the secondary oscillator (sosc) will remain running, if enabled. pins that are configured as inputs (trisx bit set), prior to entry into deep sleep, remain high-impedance during deep sleep. pins that are configured as outputs (trisx bit clear), prior to entry into deep sleep, remain as output pins during deep sleep. while in this mode, they continue to drive the output level determined by their corresponding latx bit at the time of entry into deep sleep. note: any interrupt pending when entering deep sleep mode is cleared. example 1: mov #8000, w2 ; enable ds mov w2, dscon mov w2, dscon ; second write required to actually write to dscon example 2: bset dscon, #15 nop nop nop bset dscon, #15 ; enable ds (two writes required)
PIC24FJ128GC010 family ds30009312b-page 176 ? 2012-2013 microchip technology inc. once the device wakes back up, all i/o pins continue to maintain their previous states, even after the device has finished the por sequence and is executing application code again. pins configured as inputs during deep sleep remain high-impedance and pins configured as outputs continue to drive their previous value. after waking up, the tris and lat registers, and the soscen bit (osccon<1>), are reset. if firmware modifies any of these bits or registers, the i/o will not immediately go to the newly configured states. once the firmware clears the release bit (dscon<0>), the i/o pins are ?released?. this causes the i/o pins to take the states configured by their respective trisx and latx bit values. this means that keeping the sosc running after waking up requires the soscen bit to be set before clearing release. if the deep sleep bor (dsbor) is enabled, and a dsbor or a true por event occurs during deep sleep, the i/o pins will be immediately released, similar to clearing the release bit. all previous state information will be lost, including the general purpose dsgpr0 and dsgpr1 contents. if a mclr reset event occurs during deep sleep, the dsgprx, dscon and dswake registers will remain valid, and the release bit will remain set. the state of the sosc will also be retained. the i/o pins, however, will be reset to their mclr reset state. since release is still set, changes to the soscen bit (osccon<1>) cannot take effect until the release bit is cleared. in all other deep sleep wake-up cases, application firmware must clear the release bit in order to reconfigure the i/o pins. 10.4.6 deep sleep wdt to enable the dswdt in deep sleep mode, program the configuration bit, dswdten (cw4<7>). the device wdt need not be enabled for the dswdt to function. entry into deep sleep modes automatically resets the dswdt. the dswdt clock source is selected by the dswdtosc configuration bit (cw4<5>). the posts- caler options are programmed by the dswdps<4:0> configuration bits (cw4<4:0>). the minimum time-out period that can be achieved is 1 ms and the maximum is 25.7 days. for more details on dswdt configuration options, refer to section 34.0 ?special features? . 10.4.6.1 switching clocks in deep sleep mode both the rtcc and the dswdt may run from either sosc or the lprc clock source. this allows both the rtcc and dswdt to run without requiring both the lprc and sosc to be enabled together, reducing power consumption. running the rtcc from lprc will result in a loss of accuracy in the rtcc, of approximately 5 to 10%. if a more accurate rtcc is required, it must be run from the sosc clock source. the rtcc clock source is selected with the rtclk<1:0> bits (rtcpwc<11:10>). under certain circumstances, it is possible for the dswdt clock source to be off when entering deep sleep mode. in this case, the clock source is turned on automatically (if dswdt is enabled) without the need for software intervention. however, this can cause a delay in the start of the dswdt counters. in order to avoid this delay when using sosc as a clock source, the application can activate sosc prior to entering deep sleep mode. 10.4.7 checking and clearing the status of deep sleep upon entry into deep sleep mode, the status bit, dpslp (rcon<10>), becomes set and must be cleared by the software. on power-up, the software should read this status bit to determine if the reset was due to an exit from deep sleep mode and clear the bit if it is set. of the four possible combinations of dpslp and por bit states, three cases can be considered: ? both the dpslp and por bits are cleared. in this case, the reset was due to some event other than a deep sleep mode exit. ? the dpslp bit is clear, but the por bit is set; this is a normal por. ? both the dpslp and por bits are set. this means that deep sleep mode was entered, the device was powered down and deep sleep mode was exited. 10.4.8 power-on resets (pors) v dd voltage is monitored to produce pors. since exiting from deep sleep mode functionally looks like a por, the technique described in section 10.4.7 ?checking and clearing the status of deep sleep? should be used to distinguish between deep sleep and a true por event. when a true por occurs, the entire device, including all deep sleep logic (deep sleep registers, rtcc, dswdt, etc.), is reset.
? 2012-2013 microchip technology inc. ds30009312b-page 177 PIC24FJ128GC010 family 10.5 v bat mode this mode represents the lowest power state that the microcontroller can achieve and still resume operation. v bat mode is automatically triggered when the micro- controller?s main power supply on v dd fails. when this happens, the microcontroller?s on-chip power switch connects to a backup power source, such as a battery, supplied to the v bat pin. this maintains a few key systems at an extremely low-power draw until v dd is restored. the power supplied on v bat only runs two systems: the rtcc and the deep sleep semaphore registers (dsgpr0 and dsgpr1). to maintain these systems during a sudden loss of v dd , it is essential to connect a power source, other than v dd or av dd , to the v bat pin. when the rtcc is enabled, it continues to operate with the same clock source (sosc or lprc) that was selected prior to entering v bat mode. there is no pro- vision to switch to a lower power clock source after the mode switch. since the loss of v dd is usually an unforeseen event, it is recommended that the contents of the deep sleep semaphore registers be loaded with the data to be retained at an early point in code execution. 10.5.1 v bat mode with no rtcc by disabling rtcc operation during v bat mode, power consumption is reduced to the lowest of all power-saving modes. this is done by programming the rtcbat configuration bit (cw4<9>) to ? 0 ?. in this mode, only the deep sleep semaphore registers are maintained. 10.5.2 wake-up from v bat modes when v dd is restored to a device in v bat mode, it auto- matically wakes. wake-up occurs with a por, after which, the device starts executing code from the reset vector. all sfrs, except the deep sleep semaphore registers, are reset to their por values. if the rtcc was not configured to run during v bat mode, it will remain disabled and rtcc will not run. wake-up timing is similar to that for a normal por. to differentiate a wake-up from v bat mode from other por states, check the vbat status bit (rcon2<0>). if this bit is set while the device is starting to execute the code from the reset vector, it indicates that there has been an exit from v bat mode. the application must clear the vbat bit to ensure that future v bat wake-up events are captured. if a por occurs without a power source connected to the v bat pin, the vbpor bit (rcon2<1>) is set. if this bit is set on a por, it indicates that a battery needs to be connected to the v bat pin. in addition, if the v bat power source falls below the level needed for deep sleep semaphore operation while in v bat mode (e.g., the battery has been drained), the vbpor bit will be set. vbpor is also set when the microcontroller is powered up the very first time, even if power is supplied to v bat . 10.5.3 i/o pins during v bat modes all i/o pins switch to input mode during v bat mode. the only exceptions are the sosci and sosco pins, which maintain their states if the secondary oscillator is being used as the rtcc clock source. it is the user?s responsibility to restore the i/o pins to their proper states, using the trisx and latx bits, once v dd has been restored. 10.5.4 saving context data with the dsgprx registers as with deep sleep mode (i.e., without the low-voltage/retention regulator), all sfrs are reset to their por values after v dd has been restored. only the deep sleep semaphore registers are preserved. appli- cations which require critical data to be saved should save it in dsgpr0 and dsgpr1. the por should be enabled for the reliable operation of the v bat . note: if the v bat mode is not used, it is recommended to connect the v bat pin to v dd .
PIC24FJ128GC010 family ds30009312b-page 178 ? 2012-2013 microchip technology inc. register 10-1: dscon: deep sleep control register ( 1 ) r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 dsen ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r-0 r/w-0 r/c-0, hs ? ? ? ? ? r dsbor ( 2 ) release bit 7 bit 0 legend: c = clearable bit u = unimplemented bit, read as ?0? r = readable bit w = writable bit hs = hardware settable bit r = reserved bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 dsen: deep sleep enable bit 1 = enters deep sleep on execution of pwrsav #0 0 = enters normal sleep on execution of pwrsav #0 bit 14-3 unimplemented: read as ? 0 ? bit 2 reserved: maintain as ? 0 ? bit 1 dsbor: deep sleep bor event bit ( 2 ) 1 = the dsbor was active and a bor event was detected during deep sleep 0 = the dsbor was not active or was active but did not detect a bor event during deep sleep bit 0 release: i/o pin state release bit 1 = upon waking from deep sleep, i/o pins maintain their states previous to deep sleep entry 0 = releases i/o pins from their state previous to deep sleep entry, and allows their respective trisx and latx bits to control their states note 1: all register bits are reset only in the case of a por event outside of deep sleep mode. 2: unlike all other events, a deep sleep bor event will not cause a wake-up from deep sleep; this re-arms the por.
? 2012-2013 microchip technology inc. ds30009312b-page 179 PIC24FJ128GC010 family register 10-2: dswake: deep sleep wake-up source register ( 1 ) u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0, hs ? ? ? ? ? ? ?dsint0 bit 15 bit 8 r/w-0, hs u-0 u-0 r/w-0, hs r/w-0, hs r/w-0, hs u-0 u-0 dsflt ? ? dswdt dsrtcc dsmclr ? ? bit 7 bit 0 legend: hs = hardware settable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-9 unimplemented: read as ? 0 ? bit 8 dsint0: deep sleep interrupt-on-change bit 1 = interrupt-on-change was asserted during deep sleep 0 = interrupt-on-change was not asserted during deep sleep bit 7 dsflt: deep sleep fault detect bit 1 = a fault occurred during deep sleep and some deep sleep configuration settings may have been corrupted 0 = no fault was detected during deep sleep bit 6-5 unimplemented: read as ? 0 ? bit 4 dswdt: deep sleep watchdog timer time-out bit 1 = the deep sleep watchdog timer timed out during deep sleep 0 = the deep sleep watchdog timer did not time out during deep sleep bit 3 dsrtcc: deep sleep real-time clock and calendar alarm bit 1 = the real-time clock and calendar triggered an alarm during deep sleep 0 = the real-time clock and calendar did not trigger an alarm during deep sleep bit 2 dsmclr: deep sleep mclr event bit 1 = the mclr pin was active and was asserted during deep sleep 0 = the mclr pin was not active or was active, but not asserted during deep sleep bit 1-0 unimplemented: read as ? 0 ? note 1: all register bits are cleared when the dsen (dscon<15>) bit is set.
PIC24FJ128GC010 family ds30009312b-page 180 ? 2012-2013 microchip technology inc. register 10-3: rcon2: reset and system control register 2 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 r-0 r/co-1 r/co-1 r/co-1 r/co-0 ? ? ? r vddbor ( 1 ) vddpor ( 1 , 2 ) vbpor ( 1 , 3 ) vbat ( 1 ) bit 7 bit 0 legend: co = clearable only bit r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-5 unimplemented: read as ? 0 ? bit 4 reserved: maintain as ? 0 ? bit 3 vddbor: v dd brown-out reset flag bit ( 1 ) 1 =a v dd brown-out reset has occurred (set by hardware) 0 =a v dd brown-out reset has not occurred bit 2 vddpor: v dd power-on reset flag bit ( 1 , 2 ) 1 =a v dd power-on reset has occurred (set by hardware) 0 =a v dd power-on reset has not occurred bit 1 vbpor: v bat power-on reset flag bit ( 1 , 3 ) 1 =a v bat por has occurred (no battery connected to the v bat pin or v bat power is below deep sleep semaphore retention level, set by hardware) 0 =a v bat por has not occurred bit 0 vbat: v bat flag bit ( 1 ) 1 = a por exit has occurred while power was applied to the v bat pin (set by hardware) 0 = a por exit from v bat has not occurred note 1: this bit is set in hardware only; it can only be cleared in software. 2: indicates a v dd por. setting the por bit (rcon<0>) indicates a v core por. 3: this bit is set when the device is originally powered up, even if power is present on v bat .
? 2012-2013 microchip technology inc. ds30009312b-page 181 PIC24FJ128GC010 family 10.6 clock frequency and clock switching in run and idle modes, all pic24fj devices allow for a wide range of clock frequencies to be selected under application control. if the system clock configu- ration is not locked, users can choose low-power or high-precision oscillators by simply changing the noscx bits. the process of changing a system clock during operation, as well as limitations to the process, are discussed in more detail in section 9.0 ?oscillator configuration? . 10.7 doze mode generally, changing clock speed and invoking one of the power-saving modes are the preferred strategies for reducing power consumption. there may be circum- stances, however, where this is not practical. for example, it may be necessary for an application to maintain uninterrupted synchronous communication, even while it is doing nothing else. reducing system clock speed may introduce communication errors, while using a power-saving mode may stop communications completely. doze mode is a simple and effective alternative method to reduce power consumption while the device is still executing code. in this mode, the system clock continues to operate from the same source and at the same speed. peripheral modules continue to be clocked at the same speed, while the cpu clock speed is reduced. synchronization between the two clock domains is maintained, allowing the peripherals to access the sfrs while the cpu executes code at a slower rate. doze mode is enabled by setting the dozen bit (clkdiv<11>). the ratio between peripheral and core clock speed is determined by the doze<2:0> bits (clkdiv<14:12>). there are eight possible configurations, from 1:1 to 1:128, with 1:8 being the default. it is also possible to use doze mode to selectively reduce power consumption in event driven applications. this allows clock-sensitive functions, such as synchronous communications, to continue without interruption while the cpu idles, waiting for something to invoke an inter- rupt routine. enabling the automatic return to full-speed cpu operation on interrupts is enabled by setting the roi bit (clkdiv<15>). by default, interrupt events have no effect on doze mode operation. 10.8 selective peripheral module control idle and doze modes allow users to substantially reduce power consumption by slowing or stopping the cpu clock. even so, peripheral modules still remain clocked, and thus, consume power. there may be cases where the application needs what these modes do not provide: the allocation of power resources to the cpu processing with minimal power consumption from the peripherals. pic24f devices address this requirement by allowing peripheral modules to be selectively disabled, reducing or eliminating their power consumption. this can be done with two control bits: ? the peripheral enable bit, generically named, ?xxxen?, located in the module?s main control sfr. ? the peripheral module disable (pmd) bit, generically named, ?xxxmd?, located in one of the pmdn control registers (xxxmd bits are in pmdn registers, shown in table 4-39 ). both bits have similar functions in enabling or disabling its associated module. setting the pmd bit for a module disables all clock sources to that module, reducing its power consumption to an absolute minimum. in this state, the control and status registers associated with the peripheral will also be disabled, so writes to those registers will have no effect and read values will be invalid. many peripheral modules have a corresponding pmd bit. in contrast, disabling a module by clearing its xxxen bit disables its functionality, but leaves its registers available to be read and written to. power consumption is reduced, but not by as much as when the pmd bits are used. most peripheral modules have an enable bit; exceptions include capture, compare and rtcc. to achieve more selective power savings, peripheral modules can also be selectively disabled when the device enters idle mode. this is done through the control bit of the generic name format, ?xxxidl?. by default, all modules that can operate during idle mode will do so. using the disable on idle feature disables the module while in idle mode, allowing further reduction of power consumption during idle mode, enhancing power savings for extremely critical power applications.
PIC24FJ128GC010 family ds30009312b-page 182 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 183 PIC24FJ128GC010 family 11.0 i/o ports all of the device pins (except v dd , v ss , mclr and osci/clki) are shared between the peripherals and the parallel i/o ports. all i/o input ports feature schmitt trigger (st) inputs for improved noise immunity. 11.1 parallel i/o (pio) ports a parallel i/o port that shares a pin with a peripheral is, in general, subservient to the peripheral. the periph- eral?s output buffer data and control signals are provided to a pair of multiplexers. the multiplexers select whether the peripheral or the associated port has ownership of the output data and control signals of the i/o pin. the logic also prevents ?loop through?, in which a port?s digital output can drive the input of a peripheral that shares the same pin. figure 11-1 shows how ports are shared with other peripherals and the associated i/o pin to which they are connected. when a peripheral is enabled and the peripheral is actively driving an associated pin, the use of the pin as a general purpose output pin is disabled. the i/o pin may be read, but the output driver for the parallel port bit will be disabled. if a peripheral is enabled, but the peripheral is not actively driving a pin, that pin may be driven by a port. all port pins have three registers directly associated with their operation as digital i/o and one register asso- ciated with their operation as analog inputs. the data direction register (trisx) determines whether the pin is an input or an output. if the data direction bit is a ? 1 ?, then the pin is an input. all port pins are defined as inputs after a reset. reads from the output latch reg- ister (latx), read the latch; writes to the latch, write the latch. reads from the port (portx), read the port pins; writes to the port pins, write the latch. any bit and its associated data and control registers that are not valid for a particular device will be disabled. that means the corresponding latx and trisx registers, and the port pin will read as zeros. when a pin is shared with another peripheral or func- tion that is defined as an input only, it is regarded as a dedicated port because there is no other competing source of inputs. rc13 and rc14 can be input ports only; they cannot be configured as outputs. figure 11-1: block diagram of a typical shared port structure note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?i/o ports with peripheral pin select (pps)? (ds39711). the information in this data sheet supersedes the information in the frm. q d ck wr lat + tris latch i/o pin wr port data bus q d ck data latch read port read tris 1 0 1 0 wr tris peripheral output data output enable peripheral input data i/o peripheral module peripheral output enable pio module output multiplexers output data input data peripheral module enable read lat
PIC24FJ128GC010 family ds30009312b-page 184 ? 2012-2013 microchip technology inc. 11.1.1 i/o port write/read timing one instruction cycle is required between a port direction change or port write operation and a read operation of the same port. typically, this instruction would be a nop . 11.1.2 open-drain configuration in addition to the portx, latx and trisx registers for data control, each port pin can also be individually configured for either a digital or open-drain output. this is controlled by the open-drain control register, odcx, associated with each port. setting any of the bits configures the corresponding pin to act as an open-drain output. the open-drain feature allows the generation of outputs higher than v dd (e.g., 5v) on any desired digital only pins by using external pull-up resistors. the maximum open-drain voltage allowed is the same as the maximum v ih specification. 11.1.3 gpio functions on the usb pins when the usb module is enabled, the usb module controls the rg2/rg3/rf7 port pins. general purpose input/output and related interrupt-on-change function- ality can be made available on the rg2/rg3/rf7 pins when the usb module is disabled and the utrdis (u1cnfg2<0>) bit is set. additionally, for general purpose digital input function on rf7/v bus , the ansf7 bit must be cleared. 11.2 configuring analog port pins (ansx) the ansx and trisx registers control the operation of the pins with analog function. each port pin with analog function is associated with one of the ansx bits (see register 11-1 through register 11-7 ), which decides if the pin function should be analog or digital. refer to table 11-1 for detailed behavior of the pin for different ansx and trisx bit settings. when reading the portx register, all pins configured as analog input channels will read as cleared (a low level). 11.2.1 analog input pins and voltage considerations the voltage tolerance of pins used as device inputs is dependent on the pin?s input function. most input pins are able to handle dc voltages of up to 5.5v, a level typical for digital logic circuits. however, several pins can only tolerate voltages up to v dd . voltage excursions beyond v dd on these pins should always be avoided. table 11-2 summarizes the different voltage tolerances. refer to section 37.0 ?electrical characteristics? for more details. table 11-1: configuring analog/d igital function of an i/o pin pin function ansx setting trisx setting comments analog input 11 it is recommended to keep ansx = 1 . analog output 11 it is recommended to keep ansx = 1 . digital input 01 firmware must wait at least one instruction cycle after configuring a pin as a digital input before a valid input value can be read. digital output 00 make sure to disable the analog output function on the pin if any is present.
? 2012-2013 microchip technology inc. ds30009312b-page 185 PIC24FJ128GC010 family table 11-2: input voltage levels for po rt or pin tolerated description input port or pin tolerated input description porta<15:14,7:0> ( 1 ) 5.5v tolerates input levels above v dd ; useful for most standard logic. portb<15:14,12,7,4,2> portc<4:1> ( 1 ) portd<15:0> ( 1 ) porte<9:8,4:0> ( 1 ) portf<13:12,8:7,5:0> ( 1 ) portg<15:12,1:0> ( 1 ) porta<10:9> v dd only v dd input levels are tolerated. portb<13,6:5,3,1:0> portc<15:12> ( 1 ) porte<7:5> portg<9:6,3:2> note 1: not all of these pins are implemented in 64-pin devices. refer to section 1.0 ?device overview? for a complete description of port pin implementation.
PIC24FJ128GC010 family ds30009312b-page 186 ? 2012-2013 microchip technology inc. register 11-1: ansa: porta analog function selection register r/w-1 r/w-1 u-0 u-0 u-0 r/w-1 r/w-1 u-0 ansa15 ( 1 ) ansa14 ( 1 ) ? ? ? ansa10 ( 1 ) ansa9 ( 1 ) ? bit 15 bit 8 r/w-1 r/w-1 r/w-1 r/w-1 u-0 u-0 r/w-1 u-0 ansa7 ( 1 ) ansa6 ( 1 ) ansa5 ( 1 ) ansa4 ( 1 ) ? ? ansa1 ( 1 ) ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 ansa<15:14>: analog function selection bits ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 13-11 unimplemented: read as ? 0 ? bit 10-9 ansa<10:9>: analog function selection bits ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 8 unimplemented: read as ? 0 ? bit 7-4 ansa<7:4>: analog function selection bits ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 3-2 unimplemented: read as ? 0 ? bit 1 ansa1: analog function selection bit ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 0 unimplemented: read as ? 0 ? note 1: these bits are not available in 64-pin devices.
? 2012-2013 microchip technology inc. ds30009312b-page 187 PIC24FJ128GC010 family register 11-2: ansb: portb analog function selection register r/w-1 r/w-1 r/w-1 r/w-1 u-0 u-0 u-0 u-0 ansb15 ansb14 ansb13 ansb12 ? ? ? ? bit 15 bit 8 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ansb7 ansb6 ansb5 ansb4 ansb3 ansb2 ansb1 ansb0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-12 ansb<15:12>: analog function selection bits 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 11-8 unimplemented: read as ? 0 ? bit 7-0 ansb<7:0>: analog function selection bits 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled register 11-3: ansc: portc analog function selection register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 r/w-1 r/w-1 u-0 r/w-1 u-0 ? ? ? ansc4 ( 1 ) ansc3 ( 1 ) ? ansc1 ( 1 ) ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-5 unimplemented: read as ? 0 ? bit 4-3 ansc<4:3>: analog function selection bits ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 2 unimplemented: read as ? 0 ? bit 1 ansc1: analog function selection bit ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 0 unimplemented: read as ? 0 ? note 1: these bits are not available in 64-pin devices.
PIC24FJ128GC010 family ds30009312b-page 188 ? 2012-2013 microchip technology inc. register 11-4: ansd: portd analog function selection register r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ansd15 ( 1 ) ansd14 ( 1 ) ansd13 ( 1 ) ansd12 ( 1 ) ansd11 ansd10 ansd9 ansd8 bit 15 bit 8 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 u-0 r/w-1 ansd7 ansd6 ansd5 ansd4 ansd3 ansd2 ? ansd0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-2 ansd<15:2>: analog function selection bits ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 1 unimplemented: read as ? 0 ? bit 0 ansd0: analog function selection bit 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled note 1: these bits are not available in 64-pin devices. register 11-5: anse: porte analog function selection register ( 1 ) u-0 u-0 u-0 u-0 u-0 u-0 r/w-1 u-0 ? ? ? ? ? ? anse9 ? bit 15 bit 8 r/w-1 r/w-1 r/w-1 r/w-1 u-0 u-0 u-0 u-0 anse7 anse6 anse5 anse4 ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-10 unimplemented: read as ? 0 ? bit 9 anse9: analog function selection bit 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 8 unimplemented: read as ? 0 ? bit 7-4 anse<7:4>: analog function selection bits 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 3-0 unimplemented: read as ? 0 ? note 1: this register is not available in 64-pin devices.
? 2012-2013 microchip technology inc. ds30009312b-page 189 PIC24FJ128GC010 family register 11-6: ansf: portf analog function selection register u-0 u-0 r/w-1 u-0 u-0 u-0 u-0 r/w-1 ? ?ansf13 ( 1 ) ? ? ? ?ansf8 ( 1 ) bit 15 bit 8 r/w-1 u-0 r/w-1 r/w-1 r/w-1 r/w-1 u-0 r/w-1 ansf7 ? ansf5 ansf4 ansf3 ansf2 ( 1 ) ?ansf0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13 ansf13: analog function selection bit ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 12-9 unimplemented: read as ? 0 ? bit 8-7 ansf<8:7>: analog function selection bits ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 6 unimplemented: read as ? 0 ? bit 5-2 ansf<5:2>: analog function selection bits ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 1 unimplemented: read as ? 0 ? bit 0 ansf0: analog function selection bit 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled note 1: these bits are not available in 64-pin devices.
PIC24FJ128GC010 family ds30009312b-page 190 ? 2012-2013 microchip technology inc. register 11-7: ansg: portg anal og function selection register r/w-1 u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-1 ansg15 ( 1 ) ? ? ? ? ? ansg9 ansg8 bit 15 bit 8 r/w-1 r/w-1 u-0 u-0 u-0 u-0 u-0 u-0 ansg7 ansg6 ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 ansg15: analog function selection bit ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 14-10 unimplemented: read as ? 0 ? bit 9-6 ansg<9:6>: analog function selection bits 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 5-0 unimplemented: read as ? 0 ? note 1: this bit is not available in 64-pin devices.
? 2012-2013 microchip technology inc. ds30009312b-page 191 PIC24FJ128GC010 family 11.3 input change notification (icn) the input change notification function of the i/o ports allows the PIC24FJ128GC010 family of devices to gen- erate interrupt requests to the processor in response to a change-of-state (cos) on selected input pins. this feature is capable of detecting input change-of-states, even in sleep mode, when the clocks are disabled. depending on the device pin count, there are up to 82 external inputs that may be selected (enabled) for generating an interrupt request on a change-of-state. registers, cnen1 through cnen6, contain the interrupt enable control bits for each of the change notification (cn) input pins. setting any of these bits enables a cn interrupt for the corresponding pins. each cn pin has both a weak pull-up and a weak pull-down connected to it. the pull-ups act as a current source that is connected to the pin, while the pull-downs act as a current sink that is connected to the pin. these eliminate the need for external resistors when push but- ton or keypad devices are connected. the pull-ups and pull-downs are separately enabled using the cnpu1 through cnpu6 registers (for pull-ups) and the cnpd1 through cnpd6 registers (for pull-downs). each cn pin has individual control bits for its pull-up and pull-down. setting a control bit enables the weak pull-up or pull-down for the corresponding pin. when the internal pull-up is selected, the pin pulls up to v dd ? 1.1v (typical). when the internal pull-down is selected, the pin pulls down to v ss . example 11-1: port write/read in assembly example 11-2: port write/read in ?c? note: pull-ups on change notification pins should always be disabled whenever the port pin is configured as a digital output. mov 0xff00, w0 ; configure portb<15:8> as inputs mov w0, trisb ; and portb<7:0> as outputs nop ; delay 1 cycle btss portb, #13 ; next instruction trisb = 0xff00; // configure portb<15:8> as inputs and portb<7:0> as outputs nop(); // delay 1 cycle if (portbbits.rb13){ }; // next instruction
PIC24FJ128GC010 family ds30009312b-page 192 ? 2012-2013 microchip technology inc. 11.4 peripheral pin select (pps) a major challenge in general purpose devices is provid- ing the largest possible set of peripheral features while minimizing the conflict of features on i/o pins. in an application that needs to use more than one peripheral multiplexed on a single pin, inconvenient work arounds in application code, or a complete redesign, may be the only option. the peripheral pin select (pps) feature provides an alternative to these choices by enabling the user?s peripheral set selection and its placement on a wide range of i/o pins. by increasing the pinout options available on a particular device, users can better tailor the microcontroller to their entire application, rather than trimming the application to fit the device. the peripheral pin select feature operates over a fixed subset of digital i/o pins. users may independently map the input and/or output of any one of many digital peripherals to any one of these i/o pins. pps is per- formed in software and generally does not require the device to be reprogrammed. hardware safeguards are included that prevent accidental or spurious changes to the peripheral mapping once it has been established. 11.4.1 available pins the pps feature is used with a range of up to 44 pins, depending on the particular device and its pin count. pins that support the peripheral pin select feature include the designation, ?rpn? or ?rpin?, in their full pin designation, where ?n? is the remappable pin number. ?rp? is used to designate pins that support both remap- pable input and output functions, while ?rpi? indicates pins that support remappable input functions only. PIC24FJ128GC010 family devices support a larger number of remappable input only pins than remappable input/output pins. in this device family, there are up to 32 remappable input/output pins, depending on the pin count of the particular device selected. these pins are numbered, rp0 through rp31. remappable input only pins are numbered above this range, from rpi32 to rpi43 (or the upper limit for that particular device). see ta bl e 1 - 3 for a summary of pinout options in each package offering. 11.4.2 available peripherals the peripherals managed by the pps are all digital only peripherals. these include general serial commu- nications (uart and spi), general purpose timer clock inputs, timer related peripherals (input capture and out- put compare) and external interrupt inputs. also included are the outputs of the comparator module, since these are discrete digital signals. pps is not available for these peripherals: ?i 2 c? (input and output) ? usb (all module inputs and outputs) ? change notification inputs ? rtcc alarm output(s) ? epmp signals (input and output) ? lcd signals ? analog (inputs and outputs) ?int0 a key difference between pin select and non-pin select peripherals is that pin select peripherals are not asso- ciated with a default i/o pin. the peripheral must always be assigned to a specific i/o pin before it can be used. in contrast, non-pin select peripherals are always available on a default pin, assuming that the peripheral is active and not conflicting with another peripheral. 11.4.2.1 peripheral pin select function priority pin-selectable peripheral outputs (e.g., oc, uart transmit) will take priority over general purpose digital functions on a pin, such as epmp and port i/o. special- ized digital outputs (e.g., usb on usb-enabled devices) will take priority over pps outputs on the same pin. the pin diagrams list peripheral outputs in the order of priority. refer to them for priority concerns on a particular pin. unlike pic24f devices with fixed peripherals, pin-selectable peripheral inputs will never take owner- ship of a pin. the pin?s output buffer will be controlled by the trisx setting or by a fixed peripheral on the pin. if the pin is configured in digital mode, then the pps input will operate correctly. if an analog function is enabled on the pin, the pps input will be disabled. 11.4.3 controlling peripheral pin select pps features are controlled through two sets of special function registers (sfrs): one to map peripheral inputs and one to map the outputs. because they are separately controlled, a particular peripheral?s input and output (if the peripheral has both) can be placed on any selectable function pin without constraint. the association of a peripheral to a peripheral-selectable pin is handled in two different ways, depending on if an input or an output is being mapped.
? 2012-2013 microchip technology inc. ds30009312b-page 193 PIC24FJ128GC010 family 11.4.3.1 input mapping the inputs of the peripheral pin select options are mapped on the basis of the peripheral; that is, a control register associated with a peripheral dictates the pin it will be mapped to. the rpinrx registers are used to configure peripheral input mapping (see register 11-8 through register 11-26 ). each register contains two sets of 6-bit fields, with each set associated with one of the pin-selectable peripher- als. programming a given peripheral?s bit field, with an appropriate 6-bit value, maps the rpn/rpin pin with that value to that peripheral. for any given device, the valid range of values for any of the bit fields corre- sponds to the maximum number of peripheral pin selections supported by the device. table 11-3: selectable input sources (maps input to function) ( 1 ) input name function name register function mapping bits dsm modulation input mdmin rpinr30 mdmir<5:0> dsm carrier 1 input mdcin1 rpinr31 mdc1r<5:0> dsm carrier 2 input mdcin2 rpinr31 mdc2r<5:0> external interrupt 1 int1 rpinr0 int1r<5:0> external interrupt 2 int2 rpinr1 int2r<5:0> external interrupt 3 int3 rpinr1 int3r<5:0> external interrupt 4 int4 rpinr2 int4r<5:0> input capture 1 ic1 rpinr7 ic1r<5:0> input capture 2 ic2 rpinr7 ic2r<5:0> input capture 3 ic3 rpinr8 ic3r<5:0> input capture 4 ic4 rpinr8 ic4r<5:0> input capture 5 ic5 rpinr9 ic5r<5:0> input capture 6 ic6 rpinr9 ic6r<5:0> input capture 7 ic7 rpinr10 ic7r<5:0> input capture 8 ic8 rpinr10 ic8r<5:0> input capture 9 ic9 rpinr15 ic9r<5:0> output compare fault a ocfa rpinr11 ocfar<5:0> output compare fault b ocfb rpinr11 ocfbr<5:0> spi1 clock input sck1in rpinr20 sck1r<5:0> spi1 data input sdi1 rpinr20 sdi1r<5:0> spi1 slave select input ss1in rpinr21 ss1r<5:0> spi2 clock input sck2in rpinr22 sck2r<5:0> spi2 data input sdi2 rpinr22 sdi2r<5:0> spi2 slave select input ss2in rpinr23 ss2r<5:0> generic timer external clock tmrck rpinr23 tmrck<5:0> uart1 clear-to-send u1cts rpinr18 u1ctsr<5:0> uart1 receive u1rx rpinr18 u1rxr<5:0> uart2 clear-to-send u2cts rpinr19 u2ctsr<5:0> uart2 receive u2rx rpinr19 u2rxr<5:0> uart3 clear-to-send u3cts rpinr21 u3ctsr<5:0> uart3 receive u3rx rpinr17 u3rxr<5:0> uart4 clear-to-send u4cts rpinr27 u4ctsr<5:0> uart4 receive u4rx rpinr27 u4rxr<5:0> note 1: unless otherwise noted, all inputs use the schmitt trigger (st) input buffers.
PIC24FJ128GC010 family ds30009312b-page 194 ? 2012-2013 microchip technology inc. 11.4.3.2 output mapping in contrast to inputs, the outputs of the peripheral pin select options are mapped on the basis of the pin. in this case, a control register associated with a particular pin dictates the peripheral output to be mapped. the rporx registers are used to control output mapping. each register contains two 6-bit fields, with each field being associated with one rpn pin (see register 11-27 through register 11-42 ). the value of the bit field corresponds to one of the peripherals and that peripheral?s output is mapped to the pin (see table 11-4 ). because of the mapping technique, the list of peripher- als for output mapping also includes a null value of ? 000000 ?. this permits any given pin to remain discon- nected from the output of any of the pin-selectable peripherals. table 11-4: selectable output so urces (maps function to output) output function number ( 1 ) function output name 0 null ( 2 ) null 1 c1out comparator 1 output 2 c2out comparator 2 output 3 u1tx uart1 transmit 4u1rts ( 3 ) uart1 request-to-send 5 u2tx uart2 transmit 6u2rts ( 3 ) uart2 request-to-send 7 sdo1 spi1 data output 8 sck1out spi1 clock output 9 ss1out spi1 slave select output 10 sdo2 spi2 data output 11 sck2out spi2 clock output 12 ss2out spi2 slave select output 18 oc1 output compare 1 19 oc2 output compare 2 20 oc3 output compare 3 21 oc4 output compare 4 22 oc5 output compare 5 23 oc6 output compare 6 24 oc7 output compare 7 25 oc8 output compare 8 28 u3tx uart3 transmit 29 u3rts ( 3 ) uart3 request-to-send 30 u4tx uart4 transmit 31 u4rts ( 3 ) uart4 request-to-send 35 oc9 output compare 9 36 c3out comparator 3 output 37 mdout dsm modulator output 38-63 (unused) nc note 1: setting the rporx register with the listed value assigns that output function to the associated rpn pin. 2: the null function is assigned to all rpn outputs at device reset and disables the rpn output function. 3: irda ? bclkx functionality uses this output.
? 2012-2013 microchip technology inc. ds30009312b-page 195 PIC24FJ128GC010 family 11.4.3.3 mapping limitations the control schema of the peripheral pin select is extremely flexible. other than systematic blocks that prevent signal contention, caused by two physical pins being configured as the same functional input or two functional outputs configured as the same pin, there are no hardware enforced lockouts. the flexibility extends to the point of allowing a single input to drive multiple peripherals or a single functional output to drive multiple output pins. 11.4.3.4 mapping exceptions for PIC24FJ128GC010 family devices although the pps registers theoretically allow for up to 64 remappable i/o pins, not all of these are imple- mented in all devices. for PIC24FJ128GC010 family devices, the maximum number of remappable pins available is 44, which includes 12 input only pins. in addition, some pins in the rp and rpi sequences are unimplemented in lower pin count devices. the differences in available remappable pins are summarized in ta b l e 11 - 5 . when developing applications that use remappable pins, users should also keep these things in mind: ? for the rpinrx registers, bit combinations corre- sponding to an unimplemented pin for a particular device are treated as invalid; the corresponding module will not have an input mapped to it. for all PIC24FJ128GC010 family devices, this includes all values greater than 43 (? 101011 ?). ? for rporx registers, the bit fields corresponding to an unimplemented pin will also be unimplemented. writing to these fields will have no effect. 11.4.4 controlling configuration changes because peripheral remapping can be changed during run time, some restrictions on peripheral remapping are needed to prevent accidental configuration changes. pic24f devices include three features to prevent alterations to the peripheral map: ? control register lock sequence ? continuous state monitoring ? configuration bit remapping lock 11.4.4.1 control register lock under normal operation, writes to the rpinrx and rporx registers are not allowed. attempted writes will appear to execute normally, but the contents of the registers will remain unchanged. to change these reg- isters, they must be unlocked in hardware. the register lock is controlled by the iolock bit (osccon<6>). setting iolock prevents writes to the control registers; clearing iolock allows writes. to set or clear iolock, a specific command sequence must be executed: 1. write 46h to osccon<7:0>. 2. write 57h to osccon<7:0>. 3. clear (or set) iolock as a single operation. unlike the similar sequence with the oscillator?s lock bit, iolock remains in one state until changed. this allows all of the peripheral pin selects to be configured with a single unlock sequence, followed by an update to all control registers, then locked with a second lock sequence. 11.4.4.2 continuous state monitoring in addition to being protected from direct writes, the contents of the rpinrx and rporx registers are constantly monitored in hardware by shadow registers. if an unexpected change in any of the registers occurs (such as cell disturbances caused by esd or other external events), a configuration mismatch reset will be triggered. 11.4.4.3 configuration bit pin select lock as an additional level of safety, the device can be con- figured to prevent more than one write session to the rpinrx and rporx registers. the iol1way (cw4<15>) configuration bit blocks the iolock bit from being cleared after it has been set once. if iolock remains set, the register unlock procedure will not execute and the peripheral pin select control reg- isters cannot be written to. the only way to clear the bit and re-enable peripheral remapping is to perform a device reset. in the default (unprogrammed) state, iol1way is set, restricting users to one write session. programming iol1way allows users unlimited access (with the proper use of the unlock sequence) to the peripheral pin select registers. table 11-5: remappable pin exceptions for PIC24FJ128GC010 family devices device rp pins (i/o) rpi pins total unimplemented total unimplemented pic24fjxxxgc006 28 rp5, rp15, rp30, rp31 1 rpi32-36, rpi38-43 pic24fjxxxgc010 32 ? 12 ?
PIC24FJ128GC010 family ds30009312b-page 196 ? 2012-2013 microchip technology inc. 11.4.5 considerations for peripheral pin selection the ability to control peripheral pin selection intro- duces several considerations into application design that could be overlooked. this is particularly true for several common peripherals that are available only as remappable peripherals. the main consideration is that the peripheral pin selects are not available on default pins in the device?s default (reset) state. since all rpinrx registers reset to ? 111111 ? and all rporx registers reset to ? 000000 ?, all peripheral pin select inputs are tied to v ss and all peripheral pin select outputs are disconnected. this situation requires the user to initialize the device with the proper peripheral configuration before any other application code is executed. since the iolock bit resets in the unlocked state, it is not necessary to execute the unlock sequence after the device has come out of reset. for application safety, however, it is best to set iolock and lock the configuration after writing to the control registers. because the unlock sequence is timing-critical, it must be executed as an assembly language routine in the same manner as changes to the oscillator configura- tion. if the bulk of the application is written in ?c?, or another high-level language, the unlock sequence should be performed by writing in-line assembly. choosing the configuration requires a review of all peripheral pin selects and their pin assignments, especially those that will not be used in the application. in all cases, unused pin-selectable peripherals should be disabled completely. unused peripherals should have their inputs assigned to an unused rpn/rpin pin function. i/o pins with unused rpn functions should be configured with the null peripheral output. the assignment of a peripheral to a particular pin does not automatically perform any other configuration of the pin?s i/o circuitry. in theory, this means adding a pin-selectable output to a pin may mean inadvertently driving an existing peripheral input when the output is driven. users must be familiar with the behavior of other fixed peripherals that share a remappable pin and know when to enable or disable them. to be safe, fixed digital peripherals that share the same pin should be disabled when not in use. along these lines, configuring a remappable pin for a specific peripheral does not automatically turn that feature on. the peripheral must be specifically config- ured for operation and enabled as if it were tied to a fixed pin. where this happens in the application code (immediately following a device reset and peripheral configuration or inside the main application routine) depends on the peripheral and its use in the application. a final consideration is that peripheral pin select func- tions neither override analog inputs nor reconfigure pins with analog functions for digital i/o. if a pin is configured as an analog input on device reset, it must be explicitly reconfigured as digital i/o when used with a peripheral pin select. example 11-3 shows a configuration for bidirectional communication with flow control using uart1. the following input and output functions are used: ? input functions: u1rx, u1cts ? output functions: u1tx, u1rts example 11-3: configuring uart1 input and output functions note: in tying peripheral pin select inputs to rp63, the rp63 pin need not exist on a device for the registers to be reset to it. // unlock registers asm volatile ("mov #osccon, w1 \n" "mov #0x46, w2 \n" "mov #0x57, w3 \n" "mov.b w2, [w1] \n" "mov.b w3, [w1] \n" "bclr osccon, #6") ; // or use c30 built-in macro: // __builtin_write_oscconl(osccon & 0xbf); // configure input functions ( table 11-2 )) // assign u1rx to pin rp0 rpinr18bits.u1rxr = 0; // assign u1cts to pin rp1 rpinr18bits.u1ctsr = 1; // configure output functions ( table 11-4 ) // assign u1tx to pin rp2 rpor1bits.rp2r = 3; // assign u1rts to pin rp3 rpor1bits.rp3r = 4; // lock registers asm volatile ("mov #osccon, w1 \n" "mov #0x46, w2 \n" "mov #0x57, w3 \n" "mov.b w2, [w1] \n" "mov.b w3, [w1] \n" "bset osccon, #6"); // or use c30 built-in macro: // __builtin_write_oscconl(osccon | 0x40);
? 2012-2013 microchip technology inc. ds30009312b-page 197 PIC24FJ128GC010 family 11.4.6 peripheral pin select registers the PIC24FJ128GC010 family of devices implements a total of 35 registers for remappable peripheral configuration: ? input remappable peripheral registers (19) ? output remappable peripheral registers (16) note: input and output register values can only be changed if iolock (osccon<6>) = 0 . see section 11.4.4.1 ?control register lock? for a specific command sequence. register 11-8: rpinr0: peripheral pin select input register 0 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? int1r5 int1r4 int1r3 int1r2 int1r1 int1r0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 int1r<5:0>: assign external interrupt 1 (int1) to corresponding rpn or rpin pin bits bit 7-0 unimplemented: read as ? 0 ? register 11-9: rpinr1: peripheral pin select input register 1 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? int3r5 int3r4 int3r3 int3r2 int3r1 int3r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? int2r5 int2r4 int2r3 int2r2 int2r1 int2r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 int3r<5:0>: assign external interrupt 3 (int3) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 int2r<5:0>: assign external interrupt 2 (int2) to corresponding rpn or rpin pin bits
PIC24FJ128GC010 family ds30009312b-page 198 ? 2012-2013 microchip technology inc. register 11-10: rpinr2: peripheral pin select input register 2 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? int4r5 int4r4 int4r3 int4r2 int4r1 int4r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as ? 0 ? bit 5-0 int4r<5:0>: assign external interrupt 4 (int4) to corresponding rpn or rpin pin bits register 11-11: rpinr7: peripheral pin select input register 7 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ic2r5 ic2r4 ic2r3 ic2r2 ic2r1 ic2r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ic1r5 ic1r4 ic1r3 ic1r2 ic1r1 ic1r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 ic2r<5:0>: assign input capture 2 (ic2) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 ic1r<5:0>: assign input capture 1 (ic1) to corresponding rpn or rpin pin bits
? 2012-2013 microchip technology inc. ds30009312b-page 199 PIC24FJ128GC010 family register 11-12: rpinr8: peripheral pin select input register 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ic4r5 ic4r4 ic4r3 ic4r2 ic4r1 ic4r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ic3r5 ic3r4 ic3r3 ic3r2 ic3r1 ic3r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 ic4r<5:0>: assign input capture 4 (ic4) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 ic3r<5:0>: assign input capture 3 (ic3) to corresponding rpn or rpin pin bits register 11-13: rpinr9: peripheral pin select input register 9 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ic6r5 ic6r4 ic6r3 ic6r2 ic6r1 ic6r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ic5r5 ic5r4 ic5r3 ic5r2 ic5r1 ic5r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 ic6r<5:0>: assign input capture 6 (ic6) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 ic5r<5:0>: assign input capture 5 (ic5) to corresponding rpn or rpin pin bits
PIC24FJ128GC010 family ds30009312b-page 200 ? 2012-2013 microchip technology inc. register 11-14: rpinr10: peripheral pin select input register 10 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ic8r5 ic8r4 ic8r3 ic8r2 ic8r1 ic8r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ic7r5 ic7r4 ic7r3 ic7r2 ic7r1 ic7r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 ic8r<5:0>: assign input capture 8 (ic8) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 ic7r<5:0>: assign input capture 7 (ic7) to corresponding rpn or rpin pin bits register 11-15: rpinr11: peripheral pin select input register 11 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ocfbr5 ocfbr4 ocfbr3 ocfbr2 ocfbr1 ocfbr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ocfar5 ocfar4 ocfar3 ocfar2 ocfar1 ocfar0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 ocfbr<5:0>: assign output compare fault b (ocfb) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 ocfar<5:0>: assign output compare fault a (ocfa) to corresponding rpn or rpin pin bits
? 2012-2013 microchip technology inc. ds30009312b-page 201 PIC24FJ128GC010 family register 11-16: rpinr15: peripheral pin select input register 15 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ic9r5 ic9r4 ic9r3 ic9r2 ic9r1 ic9r0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 ic9r<5:0>: assign input capture 9 (ic9) to corresponding rpn or rpin pin bits bit 7-0 unimplemented: read as ? 0 ? register 11-17: rpinr17: peripheral pin select input register 17 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? u3rxr5 u3rxr4 u3rxr3 u3rxr2 u3rxr1 u3rxr0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 u3rxr<5:0>: assign uart3 receive (u3rx) to corresponding rpn or rpin pin bits bit 7-0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 202 ? 2012-2013 microchip technology inc. register 11-18: rpinr18: peripheral pin select input register 18 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? u1ctsr5 u1ctsr4 u1ctsr3 u1ctsr2 u1ctsr1 u1ctsr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? u1rxr5 u1rxr4 u1rxr3 u1rxr2 u1rxr1 u1rxr0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 u1ctsr<5:0>: assign uart1 clear-to-send (u1cts ) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 u1rxr<5:0>: assign uart1 receive (u1rx) to corresponding rpn or rpin pin bits register 11-19: rpinr19: peripheral pin select input register 19 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? u2ctsr5 u2ctsr4 u2ctsr3 u2ctsr2 u2ctsr1 u2ctsr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? u2rxr5 u2rxr4 u2rxr3 u2rxr2 u2rxr1 u2rxr0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 u2ctsr<5:0>: assign uart2 clear-to-send (u2cts ) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 u2rxr<5:0>: assign uart2 receive (u2rx) to corresponding rpn or rpin pin bits
? 2012-2013 microchip technology inc. ds30009312b-page 203 PIC24FJ128GC010 family register 11-20: rpinr20: peripheral pin select input register 20 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? sck1r5 sck1r4 sck1r3 sck1r2 sck1r1 sck1r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? sdi1r5 sdi1r4 sdi1r3 sdi1r2 sdi1r1 sdi1r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 sck1r<5:0>: assign spi1 clock input (sck1in) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 sdi1r<5:0>: assign spi1 data input (sdi1) to corresponding rpn or rpin pin bits register 11-21: rpinr21: peripheral pin select input register 21 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? u3ctsr5 u3ctsr4 u3ctsr3 u3ctsr2 u3ctsr1 u3ctsr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ss1r5 ss1r4 ss1r3 ss1r2 ss1r1 ss1r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 u3ctsr<5:0>: assign uart3 clear-to-send (u3cts ) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 ss1r<5:0>: assign spi1 slave select input (ss1in) to corresponding rpn or rpin pin bits
PIC24FJ128GC010 family ds30009312b-page 204 ? 2012-2013 microchip technology inc. register 11-22: rpinr22: peripheral pin select input register 22 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? sck2r5 sck2r4 sck2r3 sck2r2 sck2r1 sck2r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? sdi2r5 sdi2r4 sdi2r3 sdi2r2 sdi2r1 sdi2r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 sck2r<5:0>: assign spi2 clock input (sck2in) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 sdi2r<5:0>: assign spi2 data input (sdi2) to corresponding rpn or rpin pin bits register 11-23: rpinr23: peripheral pin select input register 23 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? tmrckr5 tmrckr4 tmrckr3 tmrckr2 tmrckr1 tmrckr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ss2r5 ss2r4 ss2r3 ss2r2 ss2r1 ss2r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 tmrck<5:0>: assign general timer external input (tmrck) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 ss2r<5:0>: assign spi2 slave select input (ss2in) to corresponding rpn or rpin pin bits
? 2012-2013 microchip technology inc. ds30009312b-page 205 PIC24FJ128GC010 family register 11-24: rpinr27: peripheral pin select input register 27 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? u4ctsr5 u4ctsr4 u4ctsr3 u4ctsr2 u4ctsr1 u4ctsr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? u4rxr5 u4rxr4 u4rxr3 u4rxr2 u4rxr1 u4rxr0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 u4ctsr<5:0>: assign uart4 clear-to-send input (u4cts) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 u4rxr<5:0>: assign uart4 receive input (u4rx) to corresponding rpn or rpin pin bits register 11-25: rpinr30: peripheral pin select input register 30 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? mdmir5 mdmir4 mdmir3 m dmir2 mdmir1 mdmir0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as ? 0 ? bit 5-0 mdmir<5:0>: assign tx modulation input (mdmi) to corresponding rpn or rpin pin bits
PIC24FJ128GC010 family ds30009312b-page 206 ? 2012-2013 microchip technology inc. register 11-26: rpinr31: peripheral pin select input register 31 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? mdc2r5 mdc2r4 mdc2r3 mdc2r2 mdc2r1 mdc2r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? mdc1r5 mdc1r4 mdc1r3 mdc1r2 mdc21r1 mdc1r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 mdc2r<5:0>: assign tx carrier 2 input (mdcin2) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as ? 0 ? bit 5-0 mdc1r<5:0>: assign tx carrier 1 input (mdcin1) to corresponding rpn or rpin pin bits
? 2012-2013 microchip technology inc. ds30009312b-page 207 PIC24FJ128GC010 family register 11-27: rpor0: peripheral pin select output register 0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp1r5 rp1r4 rp1r3 rp1r2 rp1r1 rp1r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp0r5 rp0r4 rp0r3 rp0r2 rp0r1 rp0r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp1r<5:0>: rp1 output pin mapping bits peripheral output number n is assigned to pin, rp1 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp0r<5:0>: rp0 output pin mapping bits peripheral output number n is assigned to pin, rp0 (see table 11-4 for peripheral function numbers). register 11-28: rpor1: peripheral pin select output register 1 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp3r5 rp3r4 rp3r3 rp3r2 rp3r1 rp3r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp2r5 rp2r4 rp2r3 rp2r2 rp2r1 rp2r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp3r<5:0>: rp3 output pin mapping bits peripheral output number n is assigned to pin, rp3 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp2r<5:0>: rp2 output pin mapping bits peripheral output number n is assigned to pin, rp2 (see table 11-4 for peripheral function numbers).
PIC24FJ128GC010 family ds30009312b-page 208 ? 2012-2013 microchip technology inc. register 11-29: rpor2: peripheral pin select output register 2 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ?rp5r5 ( 1 ) rp5r4 ( 1 ) rp5r3 ( 1 ) rp5r2 ( 1 ) rp5r1 ( 1 ) rp5r0 ( 1 ) bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp4r5 rp4r4 rp4r3 rp4r2 rp4r1 rp4r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp5r<5:0>: rp5 output pin mapping bits ( 1 ) peripheral output number n is assigned to pin, rp5 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp4r<5:0>: rp4 output pin mapping bits peripheral output number n is assigned to pin, rp4 (see table 11-4 for peripheral function numbers). note 1: these bits are unimplemented in 64-pin devices; read as ? 0 ?. register 11-30: rpor3: peripheral pin select output register 3 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp7r5 rp7r4 rp7r3 rp7r2 rp7r1 rp7r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp6r5 rp6r4 rp6r3 rp6r2 rp6r1 rp6r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp7r<5:0>: rp7 output pin mapping bits peripheral output number n is assigned to pin, rp7 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp6r<5:0>: rp6 output pin mapping bits peripheral output number n is assigned to pin, rp6 (see table 11-4 for peripheral function numbers).
? 2012-2013 microchip technology inc. ds30009312b-page 209 PIC24FJ128GC010 family register 11-31: rpor4: peripheral pin select output register 4 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp9r5 rp9r4 rp9r3 rp9r2 rp9r1 rp9r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp8r5 rp8r4 rp8r3 rp8r2 rp8r1 rp8r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp9r<5:0>: rp9 output pin mapping bits peripheral output number n is assigned to pin, rp9 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp8r<5:0>: rp8 output pin mapping bits peripheral output number n is assigned to pin, rp8 (see table 11-4 for peripheral function numbers). register 11-32: rpor5: peripheral pin select output register 5 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp11r5 rp11r4 rp11r3 rp11r2 rp11r1 rp11r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp10r5 rp10r4 rp10r3 rp10r2 rp10r1 rp10r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp11r<5:0>: rp11 output pin mapping bits peripheral output number n is assigned to pin, rp11 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp10r<5:0>: rp10 output pin mapping bits peripheral output number n is assigned to pin, rp10 (see table 11-4 for peripheral function numbers).
PIC24FJ128GC010 family ds30009312b-page 210 ? 2012-2013 microchip technology inc. register 11-33: rpor6: peripheral pin select output register 6 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp13r5 rp13r4 rp13r3 rp13r2 rp13r1 rp13r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp12r5 rp12r4 rp12r3 rp12r2 rp12r1 rp12r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp13r<5:0>: rp13 output pin mapping bits peripheral output number n is assigned to pin, rp13 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp12r<5:0>: rp12 output pin mapping bits peripheral output number n is assigned to pin, rp12 (see table 11-4 for peripheral function numbers). register 11-34: rpor7: peripheral pin select output register 7 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ?rp15r5 ( 1 ) rp15r4 ( 1 ) rp15r3 ( 1 ) rp15r2 ( 1 ) rp15r1 ( 1 ) rp15r0 ( 1 ) bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp14r5 rp14r4 rp14r3 rp14r2 rp14r1 rp14r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp15r<5:0>: rp15 output pin mapping bits ( 1 ) peripheral output number n is assigned to pin, rp15 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp14r<5:0>: rp14 output pin mapping bits peripheral output number n is assigned to pin, rp14 (see table 11-4 for peripheral function numbers). note 1: these bits are unimplemented in 64-pin devices; read as ? 0 ?.
? 2012-2013 microchip technology inc. ds30009312b-page 211 PIC24FJ128GC010 family register 11-35: rpor8: peripheral pin select output register 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp17r5 rp17r4 rp17r3 rp17r2 rp17r1 rp17r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp16r5 rp16r4 rp16r3 rp16r2 rp16r1 rp16r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp17r<5:0>: rp17 output pin mapping bits peripheral output number n is assigned to pin, rp17 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp16r<5:0>: rp16 output pin mapping bits peripheral output number n is assigned to pin, rp16 (see table 11-4 for peripheral function numbers). register 11-36: rpor9: peripheral pin select output register 9 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp19r5 rp19r4 rp19r3 rp19r2 rp19r1 rp19r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp18r5 rp18r4 rp18r3 rp18r2 rp18r1 rp18r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp19r<5:0>: rp19 output pin mapping bits peripheral output number n is assigned to pin, rp19 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp18r<5:0>: rp18 output pin mapping bits peripheral output number n is assigned to pin, rp18 (see table 11-4 for peripheral function numbers).
PIC24FJ128GC010 family ds30009312b-page 212 ? 2012-2013 microchip technology inc. register 11-37: rpor10: peripheral pin select output register 10 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp21r5 rp21r4 rp21r3 rp21r2 rp21r1 rp21r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp20r5 rp20r4 rp20r3 rp20r2 rp20r1 rp20r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp21r<5:0>: rp21 output pin mapping bits peripheral output number n is assigned to pin, rp21 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp20r<5:0>: rp20 output pin mapping bits peripheral output number n is assigned to pin, rp20 (see table 11-4 for peripheral function numbers). register 11-38: rpor11: peripheral pin select output register 11 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp23r5 rp23r4 rp23r3 rp23r2 rp23r1 rp23r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp22r5 rp22r4 rp22r3 rp22r2 rp22r1 rp22r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp23r<5:0>: rp23 output pin mapping bits peripheral output number n is assigned to pin, rp23 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp22r<5:0>: rp22 output pin mapping bits peripheral output number n is assigned to pin, rp22 (see table 11-4 for peripheral function numbers).
? 2012-2013 microchip technology inc. ds30009312b-page 213 PIC24FJ128GC010 family register 11-39: rpor12: peripheral pin select output register 12 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp25r5 rp25r4 rp25r3 rp25r2 rp25r1 rp25r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp24r5 rp24r4 rp24r3 rp24r2 rp24r1 rp24r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp25r<5:0>: rp25 output pin mapping bits peripheral output number n is assigned to pin, rp25 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp24r<5:0>: rp24 output pin mapping bits peripheral output number n is assigned to pin, rp24 (see table 11-4 for peripheral function numbers). register 11-40: rpor13: peripheral pin select output register 13 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp27r5 rp27r4 rp27r3 rp27r2 rp27r1 rp27r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp26r5 rp26r4 rp26r3 rp26r2 rp26r1 rp26r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp27r<5:0>: rp27 output pin mapping bits peripheral output number n is assigned to pin, rp27 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp26r<5:0>: rp26 output pin mapping bits peripheral output number n is assigned to pin, rp26 (see table 11-4 for peripheral function numbers).
PIC24FJ128GC010 family ds30009312b-page 214 ? 2012-2013 microchip technology inc. register 11-41: rpor14: peripheral pin select output register 14 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp29r5 rp29r4 rp29r3 rp29r2 rp29r1 rp29r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp28r5 rp28r4 rp28r3 rp28r2 rp28r1 rp28r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp29r<5:0>: rp29 output pin mapping bits peripheral output number n is assigned to pin, rp29 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp28r<5:0>: rp28 output pin mapping bits peripheral output number n is assigned to pin, rp28 (see table 11-4 for peripheral function numbers). register 11-42: rpor15: peripheral pin select output register 15 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ?rp31r5 ( 1 ) rp31r4 ( 1 ) rp31r3 ( 1 ) rp31r2 ( 1 ) rp31r1 ( 1 ) rp31r0 ( 1 ) bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? rp30r5 rp30r4 rp30r3 rp30r2 rp30r1 rp30r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 rp31r<5:0>: rp31 output pin mapping bits ( 1 ) peripheral output number n is assigned to pin, rp31 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as ? 0 ? bit 5-0 rp30r<5:0>: rp30 output pin mapping bits peripheral output number n is assigned to pin, rp30 (see table 11-4 for peripheral function numbers). note 1: these bits are unimplemented in 64-pin devices; read as ? 0 ?.
? 2012-2013 microchip technology inc. ds30009312b-page 215 PIC24FJ128GC010 family 12.0 timer1 the timer1 module is a 16-bit timer, which can serve as the time counter for the real-time clock (rtc) or operate as a free-running, interval timer/counter. tim- er1 can operate in three modes: ?16-bit timer ? 16-bit synchronous counter ? 16-bit asynchronous counter timer1 also supports these features: ? timer gate operation ? selectable prescaler settings ? timer operation during cpu idle and sleep modes ? interrupt on 16-bit period register match or falling edge of external gate signal figure 12-1 presents a block diagram of the 16-bit timer module. to configure timer1 for operation: 1. set the ton bit (= 1 ). 2. select the timer prescaler ratio using the tckps<1:0> bits. 3. set the clock and gating modes using the tcs, tiecs<1:0> and tgate bits. 4. set or clear the tsync bit to configure synchronous or asynchronous operation. 5. load the timer period value into the pr1 register. 6. if interrupts are required, set the timer1 interrupt enable bit, t1ie. use the timer1 interrupt priority bits, t1ip<2:0>, to set the interrupt priority. figure 12-1: 16-bit timer1 module block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ? pic24f family reference manual ?, ?timers? (ds39704). the information in this data sheet supersedes the information in the frm. ton sync sosci sosco pr1 set t1if equal comparator reset soscen 1 0 tsync q q d ck tckps<1:0> 2 tgate t cy 1 0 tcs tgate sosc input gate output clock output to tmr1 clock input select detail lprc input 2 tiecs<1:0> t1ck input soscsel<1:0> lprc clock input select prescaler 1, 8, 64, 256 tmrck input tmr1 gate sync
PIC24FJ128GC010 family ds30009312b-page 216 ? 2012-2013 microchip technology inc. register 12-1: t1con: ti mer1 control register ( 1 ) r/w-0 u-0 r/w-0 u-0 u-0 u-0 r/w-0 r/w-0 ton ?tsidl ? ? ? tiecs1 tiecs0 bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 u-0 ? tgate tckps1 tckps0 ? tsync tcs ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 ton: timer1 on bit 1 = starts 16-bit timer1 0 = stops 16-bit timer1 bit 14 unimplemented: read as ? 0 ? bit 13 tsidl: timer1 stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-10 unimplemented: read as ? 0 ? bit 9-8 tiecs<1:0>: timer1 extended clock source select bits (selected when tcs = 1 ) when tcs = 1 : 11 = generic timer (tmrck) external input 10 = lprc oscillator 01 = t1ck external clock input 00 =sosc when tcs = 0 : these bits are ignored; timer is clocked from internal system clock (f osc /2). bit 7 unimplemented: read as ? 0 ? bit 6 tgate: timer1 gated time accumulation enable bit when tcs = 1 : this bit is ignored. when tcs = 0 : 1 = gated time accumulation is enabled 0 = gated time accumulation is disabled bit 5-4 tckps<1:0>: timer1 input clock prescale select bits 11 =1:256 10 =1:64 01 =1:8 00 =1:1 bit 3 unimplemented: read as ? 0 ? bit 2 tsync: timer1 external clock input synchronization select bit when tcs = 1 : 1 = synchronizes external clock input 0 = does not synchronize external clock input when tcs = 0 : this bit is ignored. bit 1 tcs: timer1 clock source select bit 1 = extended clock is selected by the tiecs<1:0> bits 0 = internal clock (f osc /2) bit 0 unimplemented: read as ? 0 ? note 1: changing the value of t1con while the timer is running (ton = 1 ) causes the timer prescale counter to reset and is not recommended.
? 2012-2013 microchip technology inc. ds30009312b-page 217 PIC24FJ128GC010 family 13.0 timer2/3 and timer4/5 the timer2/3 and timer4/5 modules are 32-bit timers, which can also be configured as four independent, 16-bit timers with selectable operating modes. as 32-bit timers, timer2/3 and timer4/5 can each operate in three modes: ? two independent 16-bit timers with all 16-bit operating modes (except asynchronous counter mode) ? single 32-bit timer ? single 32-bit synchronous counter they also support these features: ? timer gate operation ? selectable prescaler settings ? timer operation during idle and sleep modes ? interrupt on a 32-bit period register match ? a/d event trigger (only on timer2/3 in 32-bit mode and timer3 in 16-bit mode) individually, all four of the 16-bit timers can function as synchronous timers or counters. they also offer the features listed above, except for the a/d event trigger. this trigger is implemented only on timer2/3 in 32-bit mode and timer3 in 16-bit mode. the operating modes and enabled features are determined by setting the appropriate bit(s) in the t2con, t3con, t4con and t5con registers. t2con and t4con are shown in generic form in register 13-1 ; t3con and t5con are shown in register 13-2 . for 32-bit timer/counter operation, timer2 and timer4 are the least significant word; timer3 and timer5 are the most significant word of the 32-bit timers. to configure timer2/3 or timer4/5 for 32-bit operation: 1. set the t32 or t45 bit (t2con<3> or t4con<3> = 1 ). 2. select the prescaler ratio for timer2 or timer4 using the tckps<1:0> bits. 3. set the clock and gating modes using the tcs and tgate bits. if tcs is set to an external clock, rpinrx (txck) must be configured to an available rpn/rpin pin. for more informa- tion, see section 11.4 ?peripheral pin select (pps)? . 4. load the timer period value. pr3 (or pr5) will contain the most significant word (msw) of the value, while pr2 (or pr4) contains the least significant word (lsw). 5. if interrupts are required, set the interrupt enable bit, t3ie or t5ie. use the priority bits, t3ip<2:0> or t5ip<2:0>, to set the interrupt priority. note that while timer2 or timer4 controls the timer, the interrupt appears as a timer3 or timer5 interrupt. 6. set the ton bit (= 1 ). the timer value, at any point, is stored in the register pair, tmr<3:2> (or tmr<5:4>). tmr3 (tmr5) always contains the most significant word of the count, while tmr2 (tmr4) contains the least significant word. to configure any of the timers for individual 16-bit operation: 1. clear the t32 bit corresponding to that timer (t2con<3> for timer2 and timer3 or t4con<3> (t45) for timer4 and timer5). 2. select the timer prescaler ratio using the tckps<1:0> bits. 3. set the clock and gating modes using the tcs and tgate bits. see section 11.4 ?peripheral pin select (pps)? for more information. 4. load the timer period value into the prx register. 5. if interrupts are required, set the interrupt enable bit, txie. use the priority bits, txip<2:0>, to set the interrupt priority. 6. set the ton (txcon<15> = 1 ) bit. note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?timers? (ds39704). the information in this data sheet supersedes the information in the frm. note: for 32-bit operation, t3con and t5con control bits are ignored. only t2con and t4con control bits are used for setup and control. timer2 and timer4 clock and gate inputs are utilized for the 32-bit timer modules, but an interrupt is generated with the timer3 or timer5 interrupt flags.
PIC24FJ128GC010 family ds30009312b-page 218 ? 2012-2013 microchip technology inc. figure 13-1: timer2/3 and timer4/5 (32-bit) block diagram set t3if (t5if) equal reset lsb msb note 1: the 32-bit timer configuration bit, t32, must be set fo r 32-bit timer/counter operation. all control bits are respective to the t2con and t4con registers. 2: the timer clock input must be assigned to an available rpn/rpin pin before use. see section 11.4 ?peripheral pin select (pps)? for more information. 3: the a/d event trigger is available only on timer2/3 in 32-bit mode and timer3 in 16-bit mode. data bus<15:0> tmr3hld read tmr2 (tmr4) (1) write tmr2 (tmr4) (1) 16 16 16 tgate 0 1 tckps<1:0> 2 sync a/d event trigger (3) (tmr5hld) t2ck (t4ck) t cy tcs (2) tgate (2) sosc input lprc input tiecs<1:0> tmrck prescaler 1, 8, 64, 256 gate sync q qd ck pr3 pr2 (pr5) (pr4) tmr3 tmr2 (tmr5) (tmr4) comparator
? 2012-2013 microchip technology inc. ds30009312b-page 219 PIC24FJ128GC010 family figure 13-2: timer2 and timer4 (1 6-bit synchronous) block diagram figure 13-3: timer3 and timer5 (1 6-bit asynchronous) block diagram ton tckps<1:0> prescaler 1, 8, 64, 256 2 t2ck pr2 (pr4) set t2if (t4if) equal comparator reset q qd ck tgate 1 0 (t4ck) sync note 1: the timer clock input must be assigned to an available rpn/rpin pin before use. see section 11.4 ?peripheral pin select (pps)? for more information. tmr2 (tmr4) t cy tcs (1) tgate (1) sosc input lprc input tiecs<1:0> tmrck gate sync ton tckps<1:0> 2 pr3 (pr5) set t3if (t5if) equal comparator reset tgate 1 0 a/d event trigger (2) prescaler 1, 8, 64, 256 note 1: the timer clock input must be assigned to an available rpn/rpin pin before use. see section 11.4 ?peripheral pin select (pps)? for more information. 2: the a/d event trigger is available only on timer3. t3ck (t5ck) t cy tcs (1) tgate (1) sosc input lprc input tiecs<1:0> tmrck gate sync q qd ck tmr3 (tmr5)
PIC24FJ128GC010 family ds30009312b-page 220 ? 2012-2013 microchip technology inc. register 13-1: txcon: timer2 and timer4 control register ( 1 ) r/w-0 u-0 r/w-0 u-0 u-0 u-0 r/w-0 r/w-0 ton ?tsidl ? ? ?tiecs1 ( 2 ) tiecs0 ( 2 ) bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 u-0 ? tgate tckps1 tckps0 t32 ( 3 ) ?tcs ( 2 ) ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 ton: timerx on bit when txcon<3> = 1 : 1 = starts 32-bit timerx/y 0 = stops 32-bit timerx/y when txcon<3> = 0 : 1 = starts 16-bit timerx 0 = stops 16-bit timerx bit 14 unimplemented: read as ? 0 ? bit 13 tsidl: timerx stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-10 unimplemented: read as ? 0 ? bit 9-8 tiecs<1:0>: timerx extended clock source select bits (selected when tcs = 1 ) ( 2 ) when tcs = 1 : 11 = generic timer (tmrck) external input 10 = lprc oscillator 01 = txck external clock input 00 =sosc when tcs = 0 : these bits are ignored; timer is clocked from internal system clock (f osc /2). bit 7 unimplemented: read as ? 0 ? bit 6 tgate: timerx gated time accumulation enable bit when tcs = 1 : this bit is ignored. when tcs = 0 : 1 = gated time accumulation is enabled 0 = gated time accumulation is disabled bit 5-4 tckps<1:0>: timerx input clock prescale select bits 11 =1:256 10 =1:64 01 =1:8 00 =1:1 note 1: changing the value of txcon while the timer is running (ton = 1 ) causes the timer prescale counter to reset and is not recommended. 2: if tcs = 1 and tiecs<1:0> = x1 , the selected external timer input (tmrck or txck) must be configured to an available rpn/rpin pin. for more information, see section 11.4 ?peripheral pin select (pps)? . 3: in t4con, the t45 bit is implemented instead of t32 to select 32-bit mode. in 32-bit mode, the t3con or t5con control bits do not affect 32-bit timer operation.
? 2012-2013 microchip technology inc. ds30009312b-page 221 PIC24FJ128GC010 family bit 3 t32: 32-bit timer mode select bit ( 3 ) 1 = timerx and timery form a single 32-bit timer 0 = timerx and timery act as two 16-bit timers in 32-bit mode, t3con control bits do not affect 32-bit timer operation. bit 2 unimplemented: read as ? 0 ? bit 1 tcs: timerx clock source select bit ( 2 ) 1 = timer source is selected by tiecs<1:0> 0 = internal clock (f osc /2) bit 0 unimplemented: read as ? 0 ? register 13-1: txcon: timer2 and timer4 control register ( 1 ) note 1: changing the value of txcon while the timer is running (ton = 1 ) causes the timer prescale counter to reset and is not recommended. 2: if tcs = 1 and tiecs<1:0> = x1 , the selected external timer input (tmrck or txck) must be configured to an available rpn/rpin pin. for more information, see section 11.4 ?peripheral pin select (pps)? . 3: in t4con, the t45 bit is implemented instead of t32 to select 32-bit mode. in 32-bit mode, the t3con or t5con control bits do not affect 32-bit timer operation.
PIC24FJ128GC010 family ds30009312b-page 222 ? 2012-2013 microchip technology inc. register 13-2: tycon: timer3 and timer5 control register ( 1 ) r/w-0 u-0 r/w-0 u-0 u-0 u-0 r/w-0 r/w-0 ton ( 2 ) ?tsidl ( 2 ) ? ? ?tiecs1 ( 2 , 3 ) tiecs0 ( 2 , 3 ) bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 u-0 ?tgate ( 3 ) tckps1 ( 3 ) tckps0 ( 3 ) ? ?tcs ( 2 , 3 ) ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 ton: timery on bit ( 2 ) 1 = starts 16-bit timery 0 = stops 16-bit timery bit 14 unimplemented: read as ? 0 ? bit 13 tsidl: timery stop in idle mode bit ( 2 ) 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-10 unimplemented: read as ? 0 ? bit 9-8 tiecs<1:0>: timery extended clock source select bits (selected when tcs = 1 ) ( 2 , 3 ) 11 = generic timer (tmrck) external input 10 = lprc oscillator 01 = txck external clock input 00 =sosc bit 7 unimplemented: read as ? 0 ? bit 6 tgate: timery gated time accumulation enable bit ( 2 ) when tcs = 1 : this bit is ignored. when tcs = 0 : 1 = gated time accumulation is enabled 0 = gated time accumulation is disabled bit 5-4 tckps<1:0>: timery input clock prescale select bits ( 2 ) 11 = 1:256 10 = 1:64 01 = 1:8 00 = 1:1 bit 3-2 unimplemented: read as ? 0 ? bit 1 tcs: timery clock source select bit ( 2 , 3 ) 1 = external clock from pin, tyck (on the rising edge) 0 = internal clock (f osc /2) bit 0 unimplemented: read as ? 0 ? note 1: changing the value of tycon while the timer is running (ton = 1 ) causes the timer prescale counter to reset and is not recommended. 2: when 32-bit operation is enabled (t2con<3> or t4con<3> = 1 ), these bits have no effect on timery operation; all timer functions are set through t2con and t4con. 3: if tcs = 1 and tiecs<1:0> = x1 , the selected external timer input (tmrck or tyck) must be configured to an available rpn/rpin pin. for more information, see section 11.4 ?peripheral pin select (pps)? .
? 2012-2013 microchip technology inc. ds30009312b-page 223 PIC24FJ128GC010 family 14.0 input capture with dedicated timers devices in the PIC24FJ128GC010 family contain seven independent input capture modules. each of the modules offers a wide range of configuration and operating options for capturing external pulse events and generating interrupts. key features of the input capture module include: ? hardware-configurable for 32-bit operation in all modes by cascading two adjacent modules ? synchronous and trigger modes of output compare operation, with up to 30 user-selectable sync/trigger sources available ? a 4-level fifo buffer for capturing and holding timer values for several events ? configurable interrupt generation ? up to 6 clock sources available for each module, driving a separate internal 16-bit counter the module is controlled through two registers: icxcon1 ( register 14-1 ) and icxcon2 ( register 14-2 ). a general block diagram of the module is shown in figure 14-1 . 14.1 general operating modes 14.1.1 synchronous and trigger modes when the input capture module operates in a free-running mode, the internal 16-bit counter, icx- tmr, counts up continuously, wrapping around from ffffh to 0000h on each overflow. its period is synchronized to the selected external clock source. when a capture event occurs, the current 16-bit value of the internal counter is written to the fifo buffer. in synchronous mode, the module begins capturing events on the icx pin as soon as its selected clock source is enabled. whenever an event occurs on the selected sync source, the internal counter is reset. in trigger mode, the module waits for a sync event from another internal module to occur before allowing the internal counter to run. standard, free-running operation is selected by setting the syncselx bits (icxcon2<4:0>) to ? 00000 ? and clearing the ictrig bit (icxcon2<7>). synchronous and trigger modes are selected any time the syncselx bits are set to any value except ? 00000 ?. the ictrig bit selects either synchronous or trigger mode; setting the bit selects trigger mode operation. in both modes, the syncsel<4:0> bits determine the sync/trigger source. when the syncselx bits are set to ? 00000 ? and ictrig is set, the module operates in software trigger mode. in this case, capture operations are started by manually setting the trigstat bit (icxcon2<6>). figure 14-1: input capture x block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?input capture with dedicated timer? (ds39722). the information in this data sheet supersedes the information in the frm. note 1: the icx inputs must be assigned to an available rpn/rpin pin before use. see section 11.4 ?peripheral pin select (pps)? for more information. icxbuf 4-level fifo buffer icx pin (1) icm<2:0> set icxif edge detect logic ici<1:0> icov, icbne interrupt logic system bus and clock synchronizer event and clock select ic clock sources sync and ictsel<2:0> syncsel<4:0> trigger 16 16 16 increment reset sync and trigger logic trigger sources icxtmr prescaler counter 1:1/4/16
PIC24FJ128GC010 family ds30009312b-page 224 ? 2012-2013 microchip technology inc. 14.1.2 cascaded (32-bit) mode by default, each module operates independently with its own 16-bit timer. to increase resolution, adjacent even and odd modules can be configured to function as a single 32-bit module. (for example, modules 1 and 2 are paired, as are modules 3 and 4, and so on.) the odd numbered module (icx) provides the least signif- icant 16 bits of the 32-bit register pairs and the even module (icy) provides the most significant 16 bits. wrap-arounds of the icx registers cause an increment of their corresponding icy registers. cascaded operation is configured in hardware by setting the ic32 bits (icxcon2<8>) for both modules. 14.2 capture operations the input capture module can be configured to capture timer values and generate interrupts on rising edges on icx or all transitions on icx. captures can be config- ured to occur on all rising edges or just some (every 4 th or 16 th ). interrupts can be independently configured to generate on each event or a subset of events. to set up the module for capture operations: 1. configure the icx input for one of the available peripheral pin select pins. 2. if synchronous mode is to be used, disable the sync source before proceeding. 3. make sure that any previous data has been removed from the fifo by reading icxbuf until the icbne bit (icxcon1<3>) is cleared. 4. set the syncsel<4:0> bits (icxcon2<4:0>) to the desired sync/trigger source. 5. set the ictsel<2:0> bits (icxcon1<12:10>) for the desired clock source. 6. set the ici<1:0> bits (icxcon1<6:5>) to the desired interrupt frequency 7. select synchronous or trigger mode operation: a) check that the syncselx bits are not set to ? 00000 ?. b) for synchronous mode, clear the ictrig bit (icxcon2<7>). c) for trigger mode, set ictrig and clear the trigstat bit (icxcon2<6>). 8. set the icm<2:0> bits (icxcon1<2:0>) to the desired operational mode. 9. enable the selected sync/trigger source. for 32-bit cascaded operations, the setup procedure is slightly different: 1. set the ic32 bits for both modules (icy- con2<8>) and (icxcon2<8>), enabling the even numbered module first. this ensures the modules will start functioning in unison. 2. set the ictselx and syncselx bits for both modules to select the same sync/trigger and time base source. set the even module first, then the odd module. both modules must use the same ictselx and syncselx bits settings. 3. clear the ictrig bit of the even module (icy- con2<7>). this forces the module to run in synchronous mode with the odd module, regardless of its trigger setting. 4. use the odd module?s icix bits (icxcon1<6:5>) to set the desired interrupt frequency. 5. use the ictrig bit of the odd module (icx- con2<7>) to configure trigger or synchronous mode operation. 6. use the icmx bits of the odd module (icx- con1<2:0>) to set the desired capture mode. the module is ready to capture events when the time base and the sync/trigger source are enabled. when the icbne bit (icxcon1<3>) becomes set, at least one capture value is available in the fifo. read input capture values from the fifo until the icbne clears to ? 0 ?. for 32-bit operation, read both the icxbuf and icybuf for the full 32-bit timer value (icxbuf for the lsw, icybuf for the msw). at least one capture value is available in the fifo buffer when the odd module?s icbne bit (icxcon1<3>) becomes set. continue to read the buffer registers until icbne is cleared (performed automatically by hardware). note: for synchronous mode operation, enable the sync source as the last step. both input capture modules are held in reset until the sync source is enabled.
? 2012-2013 microchip technology inc. ds30009312b-page 225 PIC24FJ128GC010 family register 14-1: icxcon1: input capture x control register 1 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 ? ? icsidl ictsel2 ictsel1 ictsel0 ? ? bit 15 bit 8 u-0 r/w-0 r/w-0 r-0, hsc r-0, hsc r/w-0 r/w-0 r/w-0 ? ici1 ici0 icov icbne icm2 ( 1 ) icm1 ( 1 ) icm0 ( 1 ) bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13 icsidl: input capture x module stop in idle control bit 1 = input capture module halts in cpu idle mode 0 = input capture module continues to operate in cpu idle mode bit 12-10 ictsel<2:0>: input capture x timer select bits 111 = system clock (f osc /2) 110 = reserved 101 = reserved 100 = timer1 011 = timer5 010 = timer4 001 = timer2 000 = timer3 bit 9-7 unimplemented: read as ? 0 ? bit 6-5 ici<1:0>: select number of captures per interrupt bits 11 = interrupt on every fourth capture event 10 = interrupt on every third capture event 01 = interrupt on every second capture event 00 = interrupt on every capture event bit 4 icov: input capture x overflow status flag bit (read-only) 1 = input capture overflow has occurred 0 = no input capture overflow has occurred bit 3 icbne: input capture x buffer empty status bit (read-only) 1 = input capture buffer is not empty, at least one more capture value can be read 0 = input capture buffer is empty bit 2-0 icm<2:0>: input capture x mode select bits ( 1 ) 111 = interrupt mode: input capture functions as an interrupt pin only when the device is in sleep or idle mode (rising edge detect only, all other control bits are not applicable) 110 = unused (module is disabled) 101 = prescaler capture mode: capture on every 16 th rising edge 100 = prescaler capture mode: capture on every 4 th rising edge 011 = simple capture mode: capture on every rising edge 010 = simple capture mode: capture on every falling edge 001 = edge detect capture mode: capture on every edge (rising and falling); ici<1:0> bits do not control interrupt generation for this mode 000 = input capture module is turned off note 1: the icx input must also be configured to an available rpn/rpin pin. for more information, see section 11.4 ?peripheral pin select (pps)? .
PIC24FJ128GC010 family ds30009312b-page 226 ? 2012-2013 microchip technology inc. register 14-2: icxcon2: input capture x control register 2 u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 ? ? ? ? ? ? ?ic32 bit 15 bit 8 r/w-0 r/w-0, hs u-0 r/w-0 r/w-1 r/w-1 r/w-0 r/w-1 ictrig trigstat ? syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 bit 7 bit 0 legend: hs = hardware settable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-9 unimplemented: read as ? 0 ? bit 8 ic32: cascade two ic modules enable bit (32-bit operation) 1 = icx and icy operate in cascade as a 32-bit module (this bit must be set in both modules) 0 = icx functions independently as a 16-bit module bit 7 ictrig: icx sync/trigger select bit 1 = triggers icx from the source designated by the syncselx bits 0 = synchronizes icx with the source designated by the syncselx bits bit 6 trigstat: timer trigger status bit 1 = timer source has been triggered and is running (set in hardware, can be set in software) 0 = timer source has not been triggered and is being held clear bit 5 unimplemented: read as ? 0 ? bit 4-0 syncsel<4:0>: synchronization/trigger source selection bits 1111x = reserved 11101 = reserved 11100 = ctmu ( 1 ) 11011 = pipeline a/d ( 1 ) 11010 = comparator 3 ( 1 ) 11001 = comparator 2 ( 1 ) 11000 = comparator 1 ( 1 ) 10111 = input capture 8 ( 2 ) 10110 = input capture 7 ( 2 ) 10101 = input capture 6 ( 2 ) 10100 = input capture 5 ( 2 ) 10011 = input capture 4 ( 2 ) 10010 = input capture 3 ( 2 ) 10001 = input capture 2 ( 2 ) 10000 = input capture 1 ( 2 ) 01111 = timer5 01110 = timer4 01101 = timer3 01100 = timer2 01011 = timer1 01010 = input capture 9 ( 2 ) 01001 = output compare 9 ? ? ? 00010 = output compare 2 00001 = output compare 1 00000 = not synchronized to any other module note 1: use these inputs as trigger sources only and never as sync sources. 2: never use an ic module as its own trigger source by selecting this mode.
? 2012-2013 microchip technology inc. ds30009312b-page 227 PIC24FJ128GC010 family 15.0 output compare with dedicated timers devices in the PIC24FJ128GC010 family all feature seven independent output compare modules. each of these modules offers a wide range of configuration and operating options for generating pulse trains on internal device events, and can produce pulse-width modulated (pwm) waveforms for driving power applications. key features of the output compare module include: ? hardware-configurable for 32-bit operation in all modes by cascading two adjacent modules ? synchronous and trigger modes of output compare operation, with up to 31 user-selectable trigger/sync sources available ? two separate period registers (a main register, ocxr, and a secondary register, ocxrs) for greater flexibility in generating pulses of varying widths ? configurable for single pulse or continuous pulse generation on an output event, or continuous pwm waveform generation ? up to 6 clock sources available for each module, driving a separate internal 16-bit counter 15.1 general operating modes 15.1.1 synchronous and trigger modes when the output compare module operates in a free-running mode, the internal 16-bit counter, ocxtmr, runs counts up continuously, wrapping around from 0xffff to 0x0000 on each overflow. its period is synchronized to the selected external clock source. compare or pwm events are generated each time a match between the internal counter and one of the period registers occurs. in synchronous mode, the module begins performing its compare or pwm operation as soon as its selected clock source is enabled. whenever an event occurs on the selected sync source, the module?s internal counter is reset. in trigger mode, the module waits for a sync event from another internal module to occur before allowing the counter to run. free-running mode is selected by default or any time that the syncsel<4:0> bits (ocxcon2<4:0>) are set to ? 00000 ?. synchronous or trigger modes are selected any time the syncselx bits are set to any value except ? 00000 ?. the octrig bit (ocxcon2<7>) selects either synchronous or trigger mode; setting the bit selects trigger mode operation. in both modes, the syncselx bits determine the sync/trigger source. 15.1.2 cascaded (32-bit) mode by default, each module operates independently with its own set of 16-bit timer and duty cycle registers. to increase resolution, adjacent even and odd modules can be configured to function as a single 32-bit module. (for example, modules 1 and 2 are paired, as are modules 3 and 4, and so on.) the odd numbered module (ocx) provides the least significant 16 bits of the 32-bit register pairs and the even numbered module (ocy) provides the most significant 16 bits. wrap-arounds of the ocx registers cause an increment of their corresponding ocy registers. cascaded operation is configured in hardware by set- ting the oc32 bit (ocxcon2<8>) for both modules. for more details on cascading, refer to the ? pic24f family reference manual ?, section 35. ?output compare with dedicated timer? (ds39723). note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual?, ?output compare with dedicated timer? (ds39723). the information in this data sheet supersedes the information in the frm.
PIC24FJ128GC010 family ds30009312b-page 228 ? 2012-2013 microchip technology inc. figure 15-1: output compare x block diagram (16-bit mode) 15.2 compare operations in compare mode ( figure 15-1 ), the output compare module can be configured for single-shot or continuous pulse generation. it can also repeatedly toggle an output pin on each timer event. to set up the module for compare operations: 1. configure the ocx output for one of the available peripheral pin select pins. 2. calculate the required values for the ocxr and (for double compare modes) ocxrs duty cycle registers: a) determine the instruction clock cycle time. take into account the frequency of the external clock to the timer source (if one is used) and the timer prescaler settings. b) calculate time to the rising edge of the output pulse relative to the timer start value (0000h). c) calculate the time to the falling edge of the pulse based on the desired pulse width and the time to the rising edge of the pulse. 3. write the rising edge value to ocxr and the falling edge value to ocxrs. 4. set the timer period register, pry, to a value equal to or greater than the value in ocxrs. 5. set the ocm<2:0> bits for the appropriate compare operation (= 0xx ). 6. for trigger mode operations, set octrig to enable trigger mode. set or clear trigmode to configure trigger operation and trigstat to select a hardware or software trigger. for synchronous mode, clear octrig. 7. set the syncsel<4:0> bits to configure the trigger or synchronization source. if free-running timer operation is required, set the syncselx bits to ? 00000 ? (no sync/trigger source). 8. select the time base source with the octsel<2:0> bits. if necessary, set the ton bit for the selected timer, which enables the com- pare time base to count. synchronous mode operation starts as soon as the time base is enabled; trigger mode operation starts after a trigger source event occurs. comparator ocxtmr ocxcon1 ocxcon2 ocx interrupt ocx pin (1) comparator match event match event trigger and sync logic clock select increment reset oc clock sources trigger and sync sources reset match event ocfa/ocfb (2) octselx syncselx trigstat trigmode octrig ocmx ocinv octris fltout flttrien fltmd enflt<2:0> ocflt<2:0> note 1: the ocx outputs must be assigned to an available rpn pin before use. see section 11.4 ?peripheral pin select (pps)? for more information. 2: the ocfa/ocfb fault inputs must be assigned to an available rpn/rpin pin before use. see section 11.4 ?peripheral pin select (pps)? for more information. dcb<1:0> oc output and fault logic ocxr and dcb<1:0> ocxrs
? 2012-2013 microchip technology inc. ds30009312b-page 229 PIC24FJ128GC010 family for 32-bit cascaded operation, these steps are also necessary: 1. set the oc32 bits for both registers (ocycon2<8>) and (ocxcon2<8>). enable the even numbered module first to ensure the modules will start functioning in unison. 2. clear the octrig bit of the even module (ocycon2<7>), so the module will run in synchronous mode. 3. configure the desired output and fault settings for ocy. 4. force the output pin for ocx to the output state by clearing the octris bit. 5. if trigger mode operation is required, configure the trigger options in ocx by using the octrig (ocxcon2<7>), trigmode (ocxcon1<3>) and syncselx (ocxcon2<4:0>) bits. 6. configure the desired compare or pwm mode of operation (ocm<2:0>) for ocy first, then for ocx. depending on the output mode selected, the module holds the ocx pin in its default state and forces a tran- sition to the opposite state when ocxr matches the timer. in double compare modes, ocx is forced back to its default state when a match with ocxrs occurs. the ocxif interrupt flag is set after an ocxr match in single compare modes and after each ocxrs match in double compare modes. single-shot pulse events only occur once, but may be repeated by simply rewriting the value of the ocxcon1 register. continuous pulse events continue indefinitely until terminated. 15.3 pulse-width modulation (pwm) mode in pwm mode, the output compare module can be configured for edge-aligned or center-aligned pulse waveform generation. all pwm operations are double-buffered (buffer registers are internal to the module and are not mapped into sfr space). to configure the output compare module for pwm operation: 1. configure the ocx output for one of the available peripheral pin select pins. 2. calculate the desired duty cycles and load them into the ocxr register. 3. calculate the desired period and load it into the ocxrs register. 4. select the current ocx as the synchronization source by writing 0x1f to the syncsel<4:0> bits (ocxcon2<4:0>) and ? 0 ? to the octrig bit (ocxcon2<7>). 5. select a clock source by writing to the octsel<2:0> bits (ocxcon1<12:10>). 6. enable interrupts, if required, for the timer and output compare modules. the output compare interrupt is required for pwm fault pin utilization. 7. select the desired pwm mode in the ocm<2:0> bits (ocxcon1<2:0>). 8. appropriate fault inputs may be enabled by using the enflt<2:0> bits as described in register 15-1 . 9. if a timer is selected as a clock source, set the selected timer prescale value. the selected timer?s prescaler output is used as the clock input for the ocx timer and not the selected timer output. note: this peripheral contains input and output functions that may need to be configured by the peripheral pin select. see section 11.4 ?peripheral pin select (pps)? for more information.
PIC24FJ128GC010 family ds30009312b-page 230 ? 2012-2013 microchip technology inc. figure 15-2: output compare x block diagram (double-buffered, 16-bit pwm mode) 15.3.1 pwm period the pwm period is specified by writing to pry, the timer period register. the pwm period can be calculated using equation 15-1 . equation 15-1: calculating the pwm period ( 1 ) comparator ocxcon1 ocxcon2 ocx interrupt ocx pin (1) ocxrs buffer comparator match match trigger and sync logic clock select increment reset oc clock sources trigger and sync sources reset match event ocfa/ocfb (2) octselx syncselx trigstat trigmode octrig ocmx ocinv octris fltout flttrien fltmd enflt<2:0> ocflt<2:0> ocxrs event event rollover rollover/reset rollover/reset note 1: the ocx outputs must be assigned to an available rpn pin before use. see section 11.4 ?peripheral pin select (pps)? for more information. 2: the ocfa/ocfb fault inputs must be assigned to an available rpn/rpin pin before use. see section 11.4 ?peripheral pin select (pps)? for more information. ocxr and dcb<1:0> dcb<1:0> ocxr and dcb<1:0> buffers oc output and fault logic ocxtmr note 1: based on t cy = t osc * 2; doze mode and pll are disabled. pwm period = [(pry) + 1 ? t cy ? (timer prescale value) where: pwm frequency = 1/[pwm period] note: a pry value of n will produce a pwm period of n + 1 time base count cycles. for example, a value of 7, written into the pry register, will yield a period consisting of 8 time base cycles.
? 2012-2013 microchip technology inc. ds30009312b-page 231 PIC24FJ128GC010 family 15.3.2 pwm duty cycle the pwm duty cycle is specified by writing to the ocxrs and ocxr registers. the ocxrs and ocxr registers can be written to at any time, but the duty cycle value is not latched until a match between pry and tmry occurs (i.e., the period is complete). this provides a double buffer for the pwm duty cycle and is essential for glitchless pwm operation. some important boundary parameters of the pwm duty cycle include: ? if ocxr, ocxrs and pry are all loaded with 0000h, the ocx pin will remain low (0% duty cycle). ? if ocxrs is greater than pry, the pin will remain high (100% duty cycle). see example 15-1 for pwm mode timing details. ta b l e 1 5 - 1 and table 15-2 show example pwm frequencies and resolutions for a device operating at 4 mips and 10 mips, respectively. equation 15-2: calculation for maximum pwm resolution ( 1 ) example 15-1: pwm period and duty cycle calculations ( 1 ) note 1: based on f cy = f osc /2; doze mode and pll are disabled. maximum pwm resolution (bits) = log 10 log 10 (2) fpwm ? (timer prescale value) bits f cy () 1. find the timer period register value for a desired pwm frequency of 52.08 khz, where f osc = 8 mhz with pll (32 mhz device clock rate) and a timer2 prescaler setting of 1:1. t cy = 2 * t osc = 62.5 ns pwm period = 1/pwm frequency = 1/52.08 khz = 19.2 ms pwm period = (pr2 + 1) ? t cy ? (timer2 prescale value) 19.2 ms = pr2 + 1) ? 62.5 ns ? 1 pr2 = 306 2. find the maximum resolution of the duty cycle that can be used with a 52.08 khz frequency and a 32 mhz device clock rate: pwm resolution = log 10 (f cy /f pwm )/log 10 2) bits = (log 10 (16 mhz/52.08 khz)/log 10 2) bits = 8.3 bits note 1: based on t cy = 2 * t osc ; doze mode and pll are disabled. table 15-1: example pwm frequencies and resolutions at 4 mips (f cy = 4 mhz) ( 1 ) pwm frequency 7.6 hz 61 hz 122 hz 977 hz 3.9 khz 31.3 khz 125 khz timer prescaler ratio 8111111 period register value ffffh ffffh 7fffh 0fffh 03ffh 007fh 001fh resolution (bits) 16 16 15 12 10 7 5 note 1: based on f cy = f osc /2; doze mode and pll are disabled. table 15-2: example pwm frequencies and resolutions at 16 mips (f cy = 16 mhz) ( 1 ) pwm frequency 30.5 hz 244 hz 488 hz 3.9 khz 15.6 khz 125 khz 500 khz timer prescaler ratio 8111111 period register value ffffh ffffh 7fffh 0fffh 03ffh 007fh 001fh resolution (bits) 16 16 15 12 10 7 5 note 1: based on f cy = f osc /2; doze mode and pll are disabled.
PIC24FJ128GC010 family ds30009312b-page 232 ? 2012-2013 microchip technology inc. register 15-1: ocxcon1: output compare x control register 1 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? ocsidl octsel2 octsel1 octsel0 enflt2 ( 2 ) enflt1 ( 2 ) bit 15 bit 8 r/w-0 r/w-0, hsc r/w-0, hsc r/w-0, hsc r/w-0 r/w-0 r/w-0 r/w-0 enflt0 ( 2 ) ocflt2 ( 2 , 3 ) ocflt1 ( 2 , 4 ) ocflt0 ( 2 , 4 ) trigmode ocm2 ( 1 ) ocm1 ( 1 ) ocm0 ( 1 ) bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13 ocsidl: output compare x stop in idle mode control bit 1 = output compare x halts in cpu idle mode 0 = output compare x continues to operate in cpu idle mode bit 12-10 octsel<2:0>: output compare x timer select bits 111 = peripheral clock (f cy ) 110 = reserved 101 = reserved 100 = timer1 clock (only the synchronous clock is supported) 011 = timer5 clock 010 = timer4 clock 001 = timer3 clock 000 = timer2 clock bit 9 enflt2: fault input 2 enable bit ( 2 ) 1 = fault 2 (comparator 1/2/3 out) is enabled ( 3 ) 0 = fault 2 is disabled bit 8 enflt1: fault input 1 enable bit ( 2 ) 1 = fault 1 (ocfb pin) is enabled ( 4 ) 0 = fault 1 is disabled bit 7 enflt0: fault input 0 enable bit ( 2 ) 1 = fault 0 (ocfa pin) is enabled ( 4 ) 0 = fault 0 is disabled bit 6 ocflt2: pwm fault 2 (comparator 1/2/3) condition status bit ( 2 , 3 ) 1 = pwm fault 2 has occurred 0 = no pwm fault 2 has occurred bit 5 ocflt1: pwm fault 1 (ocfb pin) condition status bit ( 2 , 4 ) 1 = pwm fault 1 has occurred 0 = no pwm fault 1 has occurred note 1: the ocx output must also be configured to an available rpn pin. for more information, see section 11.4 ?peripheral pin select (pps)? . 2: the fault input enable and fault status bits are valid when ocm<2:0> = 111 or 110 . 3: the comparator 1 output controls the oc1-oc3 chan nels; comparator 2 output controls the oc4-oc6 channels; comparator 3 output controls the oc7-oc9 channels. 4: the ocfa/ocfb fault inputs must also be configured to an available rpn/rpin pin. for more information, see section 11.4 ?peripheral pin select (pps)? .
? 2012-2013 microchip technology inc. ds30009312b-page 233 PIC24FJ128GC010 family bit 4 ocflt0: pwm fault 0 (ocfa pin) condition status bit ( 2 , 4 ) 1 = pwm fault 0 has occurred 0 = no pwm fault 0 has occurred bit 3 trigmode: trigger status mode select bit 1 = trigstat (ocxcon2<6>) is cleared when ocxrs = ocxtmr or by software 0 = trigstat is only cleared by software bit 2-0 ocm<2:0>: output compare x mode select bits ( 1 ) 111 = center-aligned pwm mode on ocx ( 2 ) 110 = edge-aligned pwm mode on ocx ( 2 ) 101 = double compare continuous pulse mode: initializes the ocx pin low; toggles the ocx state continuously on alternate matches of ocxr and ocxrs 100 = double compare single-shot mode: initializes the ocx pin low; toggles the ocx state on matches of ocxr and ocxrs for one cycle 011 = single compare continuous pulse mode: compare events continuously toggle the ocx pin 010 = single compare single-shot mode: initializes oc x pin high; compare event forces the ocx pin low 001 = single compare single-shot mode: initializes oc x pin low; compare event forces the ocx pin high 000 = output compare channel is disabled register 15-1: ocxcon1: output compare x control register 1 (continued) note 1: the ocx output must also be configured to an available rpn pin. for more information, see section 11.4 ?peripheral pin select (pps)? . 2: the fault input enable and fault status bits are valid when ocm<2:0> = 111 or 110 . 3: the comparator 1 output controls the oc1-oc3 chan nels; comparator 2 output controls the oc4-oc6 channels; comparator 3 output controls the oc7-oc9 channels. 4: the ocfa/ocfb fault inputs must also be configured to an available rpn/rpin pin. for more information, see section 11.4 ?peripheral pin select (pps)? .
PIC24FJ128GC010 family ds30009312b-page 234 ? 2012-2013 microchip technology inc. register 15-2: ocxcon2: output compare x control register 2 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 fltmd fltout flttrien ocinv ? dcb1 ( 3 ) dcb0 ( 3 ) oc32 bit 15 bit 8 r/w-0 r/w-0, hs r/w-0 r/w-0 r/w-1 r/w-1 r/w-0 r/w-0 octrig trigstat octris syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 bit 7 bit 0 legend: hs = hardware settable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 fltmd: fault mode select bit 1 = fault mode is maintained until the fault source is removed and the corresponding ocflt0 bit is cleared in software 0 = fault mode is maintained until the fault source is removed and a new pwm period starts bit 14 fltout: fault out bit 1 = pwm output is driven high on a fault 0 = pwm output is driven low on a fault bit 13 flttrien: fault output state select bit 1 = pin is forced to an output on a fault condition 0 = pin i/o condition is unaffected by a fault bit 12 ocinv: ocx invert bit 1 = ocx output is inverted 0 = ocx output is not inverted bit 11 unimplemented: read as ? 0 ? bit 10-9 dcb<1:0>: pwm duty cycle least significant bits ( 3 ) 11 = delays ocx falling edge by ? of the instruction cycle 10 = delays ocx falling edge by ? of the instruction cycle 01 = delays ocx falling edge by ? of the instruction cycle 00 = ocx falling edge occurs at the start of the instruction cycle bit 8 oc32: cascade two output compare modules enable bit (32-bit operation) 1 = cascade module operation is enabled 0 = cascade module operation is disabled bit 7 octrig: ocx trigger/sync select bit 1 = triggers ocx from the source designated by the syncselx bits 0 = synchronizes ocx with the source designated by the syncselx bits bit 6 trigstat: timer trigger status bit 1 = timer source has been triggered and is running 0 = timer source has not been triggered and is being held clear bit 5 octris: ocx output pin direction select bit 1 = ocx pin is tri-stated 0 = output compare peripheral x is connected to an ocx pin note 1: never use an oc module as its own trigger source, either by selecting this mode or another equivalent syncselx setting. 2: use these inputs as trigger sources only and never as sync sources. 3: the dcb<1:0> bits are double-buffered in the pwm modes only (ocm<2:0> (ocxcon1<2:0>) = 111 , 110 ).
? 2012-2013 microchip technology inc. ds30009312b-page 235 PIC24FJ128GC010 family bit 4-0 syncsel<4:0>: trigger/synchronization source selection bits 11111 = this oc module ( 1 ) 11110 = octrig1 external input 11101 = octrig2 external input 11100 = ctmu ( 2 ) 11011 = pipeline a/d ( 2 ) 11010 = comparator 3 ( 2 ) 11001 = comparator 2 ( 2 ) 11000 = comparator 1 ( 2 ) 10111 = input capture 8 ( 2 ) 10110 = input capture 7 ( 2 ) 10101 = input capture 6 ( 2 ) 10100 = input capture 5 ( 2 ) 10011 = input capture 4 ( 2 ) 10010 = input capture 3 ( 2 ) 10001 = input capture 2 ( 2 ) 10000 = input capture 1 ( 2 ) 01111 = timer5 01110 = timer4 01101 = timer3 01100 = timer2 01011 = timer1 01010 = input capture 9 ( 2 ) 01001 = output compare 9 ( 1 ) 01000 = output compare 8 ( 1 ) 00111 = output compare 7 ( 1 ) 00110 = output compare 6 ( 1 ) 00101 = output compare 5 ( 1 ) 00100 = output compare 4 ( 1 ) 00011 = output compare 3 ( 1 ) 00010 = output compare 2 ( 1 ) 00001 = output compare 1 ( 1 ) 00000 = not synchronized to any other module register 15-2: ocxcon2: output compare x control register 2 (continued) note 1: never use an oc module as its own trigger source, either by selecting this mode or another equivalent syncselx setting. 2: use these inputs as trigger sources only and never as sync sources. 3: the dcb<1:0> bits are double-buffered in the pwm modes only (ocm<2:0> (ocxcon1<2:0>) = 111 , 110 ).
PIC24FJ128GC010 family ds30009312b-page 236 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 237 PIC24FJ128GC010 family 16.0 serial peripheral interface (spi) the serial peripheral interface (spi) module is a synchronous serial interface useful for communicating with other peripheral or microcontroller devices. these peripheral devices may be serial eeproms, shift registers, display drivers, a/d converters, etc. the spi module is compatible with the spi and siop motorola ? interfaces. all devices of the PIC24FJ128GC010 family include two spi modules. the module supports operation in two buffer modes. in standard buffer mode, data is shifted through a single serial buffer. in enhanced buffer mode, data is shifted through an 8-level fifo buffer. the module also supports a basic framed spi protocol while operating in either master or slave mode. a total of four framed spi configurations are supported. the spi serial interface consists of four pins: ? sdix: serial data input ? sdox: serial data output ? sckx: shift clock input or output ? ssx : active-low slave select or frame synchronization i/o pulse the spi module can be configured to operate using 2, 3 or 4 pins. in the 3-pin mode, ssx is not used; in the 2-pin mode, both sdox and ssx are not used. block diagrams of the module in standard and enhanced modes are shown in figure 16-1 and figure 16-2 . note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?serial peripheral interface (spi)? (ds39699). the information in this data sheet supersedes the information in the frm. note: do not perform read/modify/write opera- tions (such as bit-oriented instructions) on the spixbuf register in either standard or enhanced buffer mode. note: in this section, the spi modules are referred to together as spix, or separately as spi1 or spi2. special function regis- ters will follow a similar notation. for example, spixcon1 and spixcon2 refer to the control registers for any of the two spi modules.
PIC24FJ128GC010 family ds30009312b-page 238 ? 2012-2013 microchip technology inc. to set up the spi module for the standard master mode of operation: 1. if using interrupts: a) clear the spixif bit in the respective ifsx register. b) set the spixie bit in the respective iecx register. c) write the spixip bits in the respective ipcx register to set the interrupt priority. 2. write the desired settings to the spixcon1 and spixcon2 registers with msten (spixcon1<5>) = 1 . 3. clear the spirov bit (spixstat<6>). 4. enable spi operation by setting the spien bit (spixstat<15>). 5. write the data to be transmitted to the spixbuf register. transmission (and reception) will start as soon as data is written to the spixbuf register. to set up the spi module for the standard slave mode of operation: 1. clear the spixbuf register. 2. if using interrupts: a) clear the spixif bit in the respective ifsx register. b) set the spixie bit in the respective iecx register. c) write the spixip bits in the respective ipcx register to set the interrupt priority. 3. write the desired settings to the spixcon1 and spixcon2 registers with msten (spixcon1<5>) = 0 . 4. clear the smp bit. 5. if the cke bit (spixcon1<8>) is set, then the ssen bit (spixcon1<7>) must be set to enable the ssx pin. 6. clear the spirov bit (spixstat<6>). 7. enable spi operation by setting the spien bit (spixstat<15>). figure 16-1: spix module bl ock diagram (standard mode) internal data bus sdix sdox ssx /fsyncx sckx spixsr bit 0 shift control primary 1:1/4/16/64 enable prescaler sync spixbuf control transfer transfer write spixbuf read spixbuf 16 spixcon1<1:0> spixcon1<4:2> master clock secondary prescaler 1:1 to 1:8 f cy clock control edge select
? 2012-2013 microchip technology inc. ds30009312b-page 239 PIC24FJ128GC010 family to set up the spi module for the enhanced buffer master mode of operation: 1. if using interrupts: a) clear the spixif bit in the respective ifsx register. b) set the spixie bit in the respective iecx register. c) write the spixip bits in the respective ipcx register. 2. write the desired settings to the spixcon1 and spixcon2 registers with msten (spix- con1<5>) = 1 . 3. clear the spirov bit (spixstat<6>). 4. select enhanced buffer mode by setting the spiben bit (spixcon2<0>). 5. enable spi operation by setting the spien bit (spixstat<15>). 6. write the data to be transmitted to the spixbuf register. transmission (and reception) will start as soon as data is written to the spixbuf register. to set up the spi module for the enhanced buffer slave mode of operation: 1. clear the spixbuf register. 2. if using interrupts: a) clear the spixif bit in the respective ifsx register. b) set the spixie bit in the respective iecx register. c) write the spixip bits in the respective ipcx register to set the interrupt priority. 3. write the desired settings to the spixcon1 and spixcon2 registers with msten (spixcon1<5>) = 0 . 4. clear the smp bit. 5. if the cke bit is set, then the ssen bit must be set, thus enabling the ssx pin. 6. clear the spirov bit (spixstat<6>). 7. select enhanced buffer mode by setting the spiben bit (spixcon2<0>). 8. enable spi operation by setting the spien bit (spixstat<15>). figure 16-2: spix module bl ock diagram (enhanced mode) internal data bus sdix sdox ss x /fsyncx sckx spixsr bit 0 shift control edge select f cy enable sync spixbuf control transfer transfer write spixbuf read spixbuf 16 spixcon1<1:0> spixcon1<4:2> master clock 8-level fifo receive buffer 8-level fifo transmit buffer primary 1:1/4/16/64 prescaler secondary prescaler 1:1 to 1:8 clock control
PIC24FJ128GC010 family ds30009312b-page 240 ? 2012-2013 microchip technology inc. register 16-1: spixstat: spix status and control register r/w-0 u-0 r/w-0 u-0 u-0 r-0, hsc r-0, hsc r-0, hsc spien ( 1 ) ? spisidl ? ? spibec2 spibec1 spibec0 bit 15 bit 8 r-0, hsc r/c-0, hs r-0, hsc r/w-0 r/w-0 r/w-0 r-0, hsc r-0, hsc srmpt spirov srxmpt sisel2 sisel1 sisel0 spitbf spirbf bit 7 bit 0 legend: c = clearable bit hs = hardware settable bit 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 hsc = hardware settable/clearable bit bit 15 spien: spix enable bit ( 1 ) 1 = enables module and configures sckx, sdox, sdix and ssx as serial port pins 0 = disables module bit 14 unimplemented: read as ? 0 ? bit 13 spisidl: spix stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-11 unimplemented: read as ? 0 ? bit 10-8 spibec<2:0>: spix buffer element count bits (valid in enhanced buffer mode) master mode: the number of spi transfers pending. slave mode: the number of spi transfers unread. bit 7 srmpt: spix shift register (spixsr) empty bit (valid in enhanced buffer mode) 1 = spix shift register is empty and ready to send or receive 0 = spix shift register is not empty bit 6 spirov: spix receive overflow flag bit 1 = a new byte/word is completely received and discarded; the user software has not read the previous data in the spixbuf register. 0 = no overflow has occurred bit 5 srxmpt: spix receive fifo empty bit (valid in enhanced buffer mode) 1 = receive fifo is empty 0 = receive fifo is not empty bit 4-2 sisel<2:0>: spix buffer interrupt mode bits (valid in enhanced buffer mode) 111 = interrupt when the spix transmit buffer is full (spitbf bit is set) 110 = interrupt when the last bit is shifted into spixsr; as a result, the tx fifo is empty 101 = interrupt when the last bit is shifted out of spixsr; now the transmit is complete 100 = interrupt when one data is shifted into the spixsr; as a result, the tx fifo has one open spot 011 = interrupt when the spix receive buffer is full (spirbf bit is set) 010 = interrupt when the spix receive buffer is 3/4 or more full 001 = interrupt when data is available in the receive buffer (srmpt bit is set) 000 = interrupt when the last data in the receive buffer is read; as a result, the buffer is empty (srxmpt bit is set) note 1: if spien = 1 , these functions must be assigned to available rpn/rpin pins before use. see section 11.4 ?peripheral pin select (pps)? for more information.
? 2012-2013 microchip technology inc. ds30009312b-page 241 PIC24FJ128GC010 family bit 1 spitbf: spix transmit buffer full status bit 1 = transmit has not yet started, spixtxb is full 0 = transmit has started, spixtxb is empty in standard buffer mode: automatically set in hardware when the cpu writes to the spixbuf location, loading the spixtxb. automatically cleared in hardware when the spix module transfers data from spixtxb to spixsr. in enhanced buffer mode: automatically set in hardware when the cpu writes to the spixbuf location, loading the last available buffer location. automatically cleared in hardware when a buffer location is available for a cpu write. bit 0 spirbf: spix receive buffer full status bit 1 = receive is complete, spixrxb is full 0 = receive is not complete, spixrxb is empty in standard buffer mode: automatically set in hardware when spix transfers data from spixsr to spixrxb. automatically cleared in hardware when the core reads the spixbuf location, reading spixrxb. in enhanced buffer mode: automatically set in hardware when spix transfers data from the spixsr to the buffer, filling the last unread buffer location. automatically cleared in hardware when a buffer location is available for a transfer from spixsr. register 16-1: spixstat: spix status and control register (continued) note 1: if spien = 1 , these functions must be assigned to available rpn/rpin pins before use. see section 11.4 ?peripheral pin select (pps)? for more information.
PIC24FJ128GC010 family ds30009312b-page 242 ? 2012-2013 microchip technology inc. register 16-2: spi x con1: spix control register 1 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? ? dissck ( 1 ) dissdo ( 2 ) mode16 smp cke ( 3 ) bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ssen ( 4 ) ckp msten spre2 spre1 spre0 ppre1 ppre0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-13 unimplemented: read as ? 0 ? bit 12 dissck: disable sckx pin bit (spi master modes only) ( 1 ) 1 = internal spi clock is disabled; pin functions as i/o 0 = internal spi clock is enabled bit 11 dissdo: disable sdox pin bit ( 2 ) 1 = sdox pin is not used by the module; pin functions as i/o 0 = sdox pin is controlled by the module bit 10 mode16: word/byte communication select bit 1 = communication is word-wide (16 bits) 0 = communication is byte-wide (8 bits) bit 9 smp: spix data input sample phase bit master mode: 1 = input data is sampled at the end of data output time 0 = input data is sampled at the middle of data output time slave mode: smp must be cleared when spix is used in slave mode. bit 8 cke: spix clock edge select bit ( 3 ) 1 = serial output data changes on transition from active clock state to idle clock state (see bit 6) 0 = serial output data changes on transition from idle clock state to active clock state (see bit 6) bit 7 ssen: slave select enable (slave mode) bit ( 4 ) 1 =ssx pin is used for slave mode 0 =ssx pin is not used by the module; pin is controlled by the port function bit 6 ckp: clock polarity select bit 1 = idle state for the clock is a high level; active state is a low level 0 = idle state for the clock is a low level; active state is a high level bit 5 msten: spix master mode enable bit 1 = master mode 0 =slave mode note 1: if dissck = 0 , sckx must be configured to an available rpn pin. see section 11.4 ?peripheral pin select (pps)? for more information. 2: if dissdo = 0 , sdox must be configured to an available rpn pin. see section 11.4 ?peripheral pin select (pps)? for more information. 3: the cke bit is not used in the framed spi modes. the user should program this bit to ? 0 ? for the framed spi modes (frmen = 1 ). 4: if ssen = 1 , ssx must be configured to an available rpn/prin pin. see section 11.4 ?peripheral pin select (pps)? for more information.
? 2012-2013 microchip technology inc. ds30009312b-page 243 PIC24FJ128GC010 family bit 4-2 spre<2:0>: secondary prescale bits (master mode) 111 = secondary prescale 1:1 110 = secondary prescale 2:1 . . . 000 = secondary prescale 8:1 bit 1-0 ppre<1:0>: primary prescale bits (master mode) 11 = primary prescale 1:1 10 = primary prescale 4:1 01 = primary prescale 16:1 00 = primary prescale 64:1 register 16-2: spi x con1: spix control register 1 (continued) note 1: if dissck = 0 , sckx must be configured to an available rpn pin. see section 11.4 ?peripheral pin select (pps)? for more information. 2: if dissdo = 0 , sdox must be configured to an available rpn pin. see section 11.4 ?peripheral pin select (pps)? for more information. 3: the cke bit is not used in the framed spi modes. the user should program this bit to ? 0 ? for the framed spi modes (frmen = 1 ). 4: if ssen = 1 , ssx must be configured to an available rpn/prin pin. see section 11.4 ?peripheral pin select (pps)? for more information.
PIC24FJ128GC010 family ds30009312b-page 244 ? 2012-2013 microchip technology inc. register 16-3: spixcon2: spix control register 2 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 u-0 frmen spifsd spifpol ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 ? ? ? ? ? ? spife spiben bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 frmen: framed spix support bit 1 = framed spix support is enabled 0 = framed spix support is disabled bit 14 spifsd: spix frame sync pulse direction control on ssx pin bit 1 = frame sync pulse input (slave) 0 = frame sync pulse output (master) bit 13 spifpol: spix frame sync pulse polarity bit (frame mode only) 1 = frame sync pulse is active-high 0 = frame sync pulse is active-low bit 12-2 unimplemented: read as ? 0 ? bit 1 spife: spix frame sync pulse edge select bit 1 = frame sync pulse coincides with the first bit clock 0 = frame sync pulse precedes the first bit clock bit 0 spiben: spix enhanced buffer enable bit 1 = enhanced buffer is enabled 0 = enhanced buffer is disabled (legacy mode)
? 2012-2013 microchip technology inc. ds30009312b-page 245 PIC24FJ128GC010 family figure 16-3: spix master/sla ve connection (standard mode) figure 16-4: spix master/slave connection (enhanced buffer modes) serial receive buffer (spixrxb) (2) shift register (spixsr) (2) lsb msb sdix sdox processor 2 (spi slave) sckx ssx (1) serial transmit buffer (spixtxb) (2) serial receive buffer (spixrxb) shift register (spixsr) msb lsb sdox sdix processor 1 (spi master) serial clock ssen (spixcon1<7>) = 1 and msten (spixcon1<5>) = 0 note 1: using the ssx pin in slave mode of operation is optional. 2: user must write transmit data to read the received data from spixbuf. the spixtxb and spixrxb registers are memory mapped to spixbuf. sckx serial transmit buffer (spixtxb) msten (spixcon1<5>) = 1 ) spix buffer (spixbuf) (2) spix buffer (spixbuf) (2) lsb msb sdix sdox processor 2 (spi enhanced buffer slave) sckx ssx (1) shift register (spixsr) msb lsb sdox sdix processor 1 (spi enhanced buffer master) serial clock ssen (spixcon1<7>) = 1 , ssx sckx 8-level fifo buffer msten (spixcon1<5>) = 1 and spix buffer (spixbuf) (2) 8-level fifo buffer spix buffer (spixbuf) (2) spiben (spixcon2<0>) = 1 msten (spixcon1<5>) = 0 and spiben (spixcon2<0>) = 1 shift register (spixsr) note 1: using the ssx pin in slave mode of operation is optional. 2: user must write transmit data to read the received data from spixbuf. the spixtxb and spixrxb registers are memory mapped to spixbuf.
PIC24FJ128GC010 family ds30009312b-page 246 ? 2012-2013 microchip technology inc. figure 16-5: spix master, fram e master connection diagram figure 16-6: spix master, f rame slave connection diagram figure 16-7: spix slave, fr ame master connection diagram figure 16-8: spix slave, fr ame slave connection diagram sdox sdix pic24f serial clock ssx sckx frame sync pulse sdix sdox processor 2 ssx sckx (spi master, frame master) sdox sdix pic24f serial clock ssx sckx frame sync pulse sdix sdox processor 2 ssx sckx spi master, frame slave) sdox sdix pic24f serial clock ssx sckx frame sync. pulse sdix sdox processor 2 ssx sckx (spi slave, frame master) sdox sdix pic24f serial clock ssx sckx frame sync pulse sdix sdox processor 2 ssx sckx (spi slave, frame slave)
? 2012-2013 microchip technology inc. ds30009312b-page 247 PIC24FJ128GC010 family equation 16-1: relationship between device and spix clock speed ( 1 ) note 1: based on f cy = f osc /2; doze mode and pll are disabled. fsck = f cy primary prescaler x secondary prescaler table 16-1: sample sckx frequencies ( 1 , 2 ) f cy = 16 mhz secondary prescaler settings 1:1 2:1 4:1 6:1 8:1 primary prescaler settings 1:1 invalid 8000 4000 2667 2000 4:1 4000 2000 1000 667 500 16:1 1000 500 250 167 125 64:1 250 125 63 42 31 f cy = 5 mhz primary prescaler settings 1:1 5000 2500 1250 833 625 4:1 1250 625 313 208 156 16:1 313 156 78 52 39 64:17839201310 note 1: based on f cy = f osc /2; doze mode and pll are disabled. 2: sckx frequencies are shown in khz.
PIC24FJ128GC010 family ds30009312b-page 248 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 249 PIC24FJ128GC010 family 17.0 inter-integrated circuit? (i 2 c?) the inter-integrated circuit? (i 2 c?) module is a serial interface useful for communicating with other periph- eral or microcontroller devices. these peripheral devices may be serial eeproms, display drivers, a/d converters, etc. the i 2 c module supports these features: ? independent master and slave logic ? 7-bit and 10-bit device addresses ? general call address as defined in the i 2 c protocol ? clock stretching to provide delays for the processor to respond to a slave data request ? both 100 khz and 400 khz bus specifications ? configurable address masking ? multi-master modes to prevent loss of messages in arbitration ? bus repeater mode, allowing the acceptance of all messages as a slave regardless of the address ? automatic scl a block diagram of the module is shown in figure 17-1 . 17.1 communicating as a master in a single master environment the details of sending a message in master mode depends on the communications protocol for the device being communicated with. typically, the sequence of events is as follows: 1. assert a start condition on sdax and sclx. 2. send the i 2 c device address byte to the slave with a write indication. 3. wait for and verify an acknowledge from the slave. 4. send the first data byte (sometimes known as the command) to the slave. 5. wait for and verify an acknowledge from the slave. 6. send the serial memory address low byte to the slave. 7. repeat steps 4 and 5 until all data bytes are sent. 8. assert a repeated start condition on sdax and sclx. 9. send the device address byte to the slave with a read indication. 10. wait for and verify an acknowledge from the slave. 11. enable master reception to receive serial memory data. 12. generate an ack or nack condition at the end of a received byte of data. 13. generate a stop condition on sdax and sclx. note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?inter-integrated circuit? (i 2 c?)? (ds39702). the information in this data sheet supersedes the information in the frm.
PIC24FJ128GC010 family ds30009312b-page 250 ? 2012-2013 microchip technology inc. figure 17-1: i 2 c? block diagram internal data bus sclx sdax shift start and stop bit detect clock address match clock stretching i2cxtrn lsb shift clock brg down counter reload control t cy /2 start and stop bit generation acknowledge generation collision detect i2cxcon i2cxstat control logic read lsb write read i2cxbrg i2cxrsr write read write read write read write read write read i2cxmsk i2cxrcv match detect i2cxadd
? 2012-2013 microchip technology inc. ds30009312b-page 251 PIC24FJ128GC010 family 17.2 setting baud rate when operating as a bus master to compute the baud rate generator reload value, use equation 17-1 . equation 17-1: computing baud rate reload value ( 1 , 2 ) 17.3 slave address masking the i2cxmsk register ( register 17-3 ) designates address bit positions as ?don?t care? for both 7-bit and 10-bit addressing modes. setting a particular bit loca- tion (= 1 ) in the i2cxmsk register causes the slave module to respond, whether the corresponding address bit value is a ? 0 ? or a ? 1 ?. for example, when i2cxmsk is set to ? 00100000 ?, the slave module will detect both addresses, ? 0000000 ? and ? 0100000 ?. to enable address masking, the intelligent peripheral management interface (ipmi) must be disabled by clearing the ipmien bit (i2cxcon<11>). table 17-2: i 2 c? reserved addresses ( 1 ) note 1: based on f cy = f osc /2; doze mode and pll are disabled. 2: these clock rate values are for guid- ance only. the actual clock rate can be affected by various system-level parameters. the actual clock rate should be measured in its intended application. fscl = f cy i2cxbrg + 1 + f cy 10,000,000 i2cxbrg = f cy 10,000,000 f cy fscl ?? 1 or: () note: as a result of changes in the i 2 c? proto- col, the addresses in tab l e 1 7- 2 are reserved and will not be acknowledged in slave mode. this includes any address mask settings that include any of these addresses. table 17-1: i 2 c? clock rates ( 1 , 2 ) required system f scl f cy i2cxbrg value actual f scl (decimal) (hexadecimal) 100 khz 16 mhz 157 9d 100 khz 100 khz 8 mhz 78 4e 100 khz 100 khz 4 mhz 39 27 99 khz 400 khz 16 mhz 37 25 404 khz 400 khz 8 mhz 18 12 404 khz 400 khz 4 mhz 9 9 385 khz 400 khz 2 mhz 4 4 385 khz 1 mhz 16 mhz 13 d 1.026 mhz 1mhz 8mhz 6 6 1.026mhz 1mhz 4mhz 3 3 0.909mhz note 1: based on f cy = f osc /2; doze mode and pll are disabled. 2: these clock rate values are for guidance only. the actual clock rate can be affected by various system-level parameters. the actual clock rate should be measured in its intended application. slave address r/w bit description 0000 000 0 general call address ( 2 ) 0000 000 1 start byte 0000 001 x cbus address 0000 01x x reserved 0000 1xx x hs mode master code 1111 0xx x 10-bit slave upper byte ( 3 ) 1111 1xx x reserved note 1: the address bits listed here will never cause an address match, independent of address mask settings. 2: the address will be acknowledged only if gcen = 1 . 3: a match on this address can only occur on the upper byte in 10-bit addressing mode.
PIC24FJ128GC010 family ds30009312b-page 252 ? 2012-2013 microchip technology inc. register 17-1: i2cxcon: i2cx control register r/w-0 u-0 r/w-0 r/w-1, hc r/w-0 r/w-0 r/w-0 r/w-0 i2cen ? i2csidl sclrel ipmien a10m disslw smen bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0, hc r/w-0, hc r/w-0, hc r/w-0, hc r/w-0, hc gcen stren ackdt acken rcen pen rsen sen bit 7 bit 0 legend: hc = hardware clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 i2cen: i2cx enable bit 1 = enables the i2cx module and configures the sdax and sclx pins as serial port pins 0 = disables the i2cx module; all i 2 c? pins are controlled by port functions bit 14 unimplemented: read as ? 0 ? bit 13 i2csidl: i2cx stop in idle mode bit 1 = discontinues module operation when device enters an idle mode 0 = continues module operation in idle mode bit 12 sclrel: sclx release control bit (when operating as i 2 c slave) 1 = releases sclx clock 0 = holds sclx clock low (clock stretch) if stren = 1 : bit is r/w (i.e., software may write ? 0 ? to initiate stretch and write ? 1 ? to release clock). hardware is clear at the beginning of slave transmission. hardware is clear at the end of slave reception. if stren = 0 : bit is r/s (i.e., software may only write ? 1 ? to release clock). hardware is clear at the beginning of slave transmission. bit 11 ipmien: intelligent platform management interface (ipmi) enable bit 1 = ipmi support mode is enabled; all addresses are acknowledged 0 = ipmi support mode is disabled bit 10 a10m: 10-bit slave addressing bit 1 = i2cxadd is a 10-bit slave address 0 = i2cxadd is a 7-bit slave address bit 9 disslw: disable slew rate control bit 1 = slew rate control is disabled 0 = slew rate control is enabled bit 8 smen: smbus input levels bit 1 = enables i/o pin thresholds compliant with smbus specifications 0 = disables the smbus input thresholds bit 7 gcen: general call enable bit (when operating as i 2 c slave) 1 = enables interrupt when a general call address is received in the i2cxrsr (module is enabled for reception) 0 = general call address is disabled bit 6 stren: sclx clock stretch enable bit (when operating as i 2 c slave) used in conjunction with the sclrel bit. 1 = enables software or receive clock stretching 0 = disables software or receive clock stretching
? 2012-2013 microchip technology inc. ds30009312b-page 253 PIC24FJ128GC010 family bit 5 ackdt: acknowledge data bit (when operating as i 2 c master; applicable during master receive) value that will be transmitted when the software initiates an acknowledge sequence. 1 = sends nack during acknowledge 0 = sends ack during acknowledge bit 4 acken: acknowledge sequence enable bit (when operating as i 2 c master; applicable during master receive) 1 = initiates acknowledge sequence on sdax and sclx pins and transmits the ackdt data bit. hardware is clear at the end of the master acknowledge sequence. 0 = acknowledge sequence is not in progress bit 3 rcen: receive enable bit (when operating as i 2 c master) 1 = enables receive mode for i 2 c. hardware is clear at the end of the eighth bit of the master receive data byte. 0 = receive sequence is not in progress bit 2 pen: stop condition enable bit (when operating as i 2 c master) 1 = initiates stop condition on the sdax and sclx pins. hardware is clear at the end of the master stop sequence. 0 = stop condition is not in progress bit 1 rsen: repeated start condition enable bit (when operating as i 2 c master) 1 = initiates repeated start condition on the sdax and sclx pins. hardware is clear at the end of the master repeated start sequence. 0 = repeated start condition is not in progress bit 0 sen: start condition enable bit (when operating as i 2 c master) 1 = initiates start condition on sdax and sclx pins. hardware is clear at the end of the master start sequence. 0 = start condition is not in progress register 17-1: i2cxcon: i2cx control register (continued)
PIC24FJ128GC010 family ds30009312b-page 254 ? 2012-2013 microchip technology inc. register 17-2: i2cxstat: i2cx status register r-0, hsc r-0, hsc u-0 u-0 u-0 r/c-0, hs r-0, hsc r-0, hsc ackstat trstat ? ? ? bcl gcstat add10 bit 15 bit 8 r/c-0, hs r/c-0, hs r-0, hsc r/c-0, hsc r/c-0, hsc r-0, hsc r-0, hsc r-0, hsc iwcol i2cov dac p s r/w rbf tbf bit 7 bit 0 legend: c = clearable bit hs = hardware settable bit 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 hsc = hardware settable/clearable bit bit 15 ackstat: acknowledge status bit 1 = nack was detected last 0 = ack was detected last hardware is set or cleared at the end of acknowledge. bit 14 trstat: transmit status bit (when operating as i 2 c? master; applicable to master transmit operation) 1 = master transmit is in progress (8 bits + ack) 0 = master transmit is not in progress hardware is set at the beginning of master transmission; hardware is clear at the end of slave acknowledge. bit 13-11 unimplemented: read as ? 0 ? bit 10 bcl: master bus collision detect bit 1 = a bus collision has been detected during a master operation 0 = no bus collision hardware is set at the detection of a bus collision. bit 9 gcstat: general call status bit 1 = general call address was received 0 = general call address was not received hardware is set when the address matches the general call address; hardware is clear at stop detection. bit 8 add10: 10-bit address status bit 1 = 10-bit address was matched 0 = 10-bit address was not matched hardware is set at the match of the 2 nd byte of the matched 10-bit address; hardware is clear at stop detection. bit 7 iwcol: write collision detect bit 1 = an attempt to write to the i2cxtrn register failed because the i 2 c module is busy 0 = no collision hardware is set at an occurrence of a write to i2cxtrn while busy (cleared by software). bit 6 i2cov: i2cx receive overflow flag bit 1 = a byte was received while the i2cxrcv register is still holding the previous byte 0 = no overflow hardware is set at an attempt to transfer i2cxrsr to i2cxrcv (cleared by software). bit 5 dac: data/address bit (when operating as i 2 c slave) 1 = indicates that the last byte received was data 0 = indicates that the last byte received was a device address hardware is clear at the device address match. hardware is set after a transmission finishes or by reception of a slave byte.
? 2012-2013 microchip technology inc. ds30009312b-page 255 PIC24FJ128GC010 family bit 4 p: stop bit 1 = indicates that a stop bit has been detected last 0 = stop bit was not detected last hardware is set or clear when start, repeated start or stop is detected. bit 3 s: start bit 1 = indicates that a start (or repeated start) bit has been detected last 0 = start bit was not detected last hardware is set or clear when start, repeated start or stop is detected. bit 2 r/w : read/write information bit (when operating as i 2 c slave) 1 = read: indicates the data transfer is output from the slave 0 = write: indicates the data transfer is input to the slave hardware is set or clear after the reception of an i 2 c device address byte. bit 1 rbf: receive buffer full status bit 1 = receive is complete, i2cxrcv is full 0 = receive is not complete, i2cxrcv is empty hardware is set when i2cxrcv is written with the received byte; hardware is clear when the software reads i2cxrcv. bit 0 tbf: transmit buffer full status bit 1 = transmit is in progress, i2cxtrn is full 0 = transmit is complete, i2cxtrn is empty hardware is set when software writes to i2cxtrn; hardware is clear at the completion of data transmission. register 17-2: i2cxstat: i2cx status register (continued) register 17-3: i2cxmsk: i2cx sl ave mode address mask register u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 ? ? ? ? ? ? amsk9 amsk8 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 amsk7 amsk6 amsk5 amsk4 amsk3 amsk2 amsk1 amsk0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-10 unimplemented: read as ? 0 ? bit 9-0 amsk<9:0>: mask for address bit x select bits 1 = enables masking for bit x of the incoming message address; bit match is not required in this position 0 = disables masking for bit x; bit match is required in this position
PIC24FJ128GC010 family ds30009312b-page 256 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 257 PIC24FJ128GC010 family 18.0 universal asynchronous receiver transmitter (uart) the universal asynchronous receiver transmitter (uart) module is one of the serial i/o modules available in the pic24f device family. the uart is a full-duplex, asynchronous system that can communicate with peripheral devices, such as personal computers, lin/j2602, rs-232 and rs-485 interfaces. the module also supports a hardware flow control option with the uxcts and uxrts pins, and includes an irda ? encoder and decoder. the primary features of the uartx module are: ? full-duplex, 8 or 9-bit data transmission through the uxtx and uxrx pins ? even, odd or no parity options (for 8-bit data) ? one or two stop bits ? hardware flow control option with the uxcts and uxrts pins ? fully integrated baud rate generator with 16-bit prescaler ? baud rates ranging from 15 bps to 1 mbps at 16 mips ? 4-deep, first-in-first-out (fifo) transmit data buffer ? 4-deep fifo receive data buffer ? parity, framing and buffer overrun error detection ? support for 9-bit mode with address detect (9 th bit = 1 ) ? transmit and receive interrupts ? loopback mode for diagnostic support ? support for sync and break characters ? supports automatic baud rate detection ?irda ? encoder and decoder logic ? 16x baud clock output for irda support a simplified block diagram of the uartx is shown in figure 18-1 . the uartx module consists of these key important hardware elements: ? baud rate generator ? asynchronous transmitter ? asynchronous receiver figure 18-1: uartx simp lified block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?uart? (ds39708). the information in this data sheet supersedes the information in the frm. uxrx irda ? hardware flow control uartx receiver uartx transmitter uxtx uxcts uxrts/ bclkx baud rate generator note: the uartx inputs and outputs must all be assigned to available rpn/rpin pins before use. see section 11.4 ?peripheral pin select (pps)? for more information.
PIC24FJ128GC010 family ds30009312b-page 258 ? 2012-2013 microchip technology inc. 18.1 uartx baud rate generator (brg) the uartx module includes a dedicated, 16-bit baud rate generator. the uxbrg register controls the period of a free-running, 16-bit timer. equation 18-1 shows the formula for computation of the baud rate with brgh = 0 . equation 18-1: uartx baud rate with brgh = 0 ( 1 , 2 ) example 18-1 shows the calculation of the baud rate error for the following conditions: ?f cy = 4 mhz ? desired baud rate = 9600 the maximum baud rate (brgh = 0 ) possible is f cy /16 (for uxbrg = 0 ) and the minimum baud rate possible is f cy /(16 * 65536). equation 18-2 shows the formula for computation of the baud rate with brgh = 1 . equation 18-2: uartx baud rate with brgh = 1 ( 1 , 2 ) the maximum baud rate (brgh = 1 ) possible is f cy /4 (for uxbrg = 0 ) and the minimum baud rate possible is f cy /(4 * 65536). writing a new value to the uxbrg register causes the brg timer to be reset (cleared). this ensures the brg does not wait for a timer overflow before generating the new baud rate. example 18-1: baud rate erro r calculation (brgh = 0 ) ( 1 ) note 1: f cy denotes the instruction cycle clock frequency (f osc /2). 2: based on f cy = f osc /2; doze mode and pll are disabled. baud rate = f cy 16 ? (uxbrg + 1) uxbrg = f cy 16 ? baud rate ? 1 note 1: f cy denotes the instruction cycle clock frequency . 2: based on f cy = f osc /2; doze mode and pll are disabled. baud rate = f cy 4 ? (uxbrg + 1) uxbrg = f cy 4 ? baud rate ? 1 note 1: based on f cy = f osc /2; doze mode and pll are disabled. desired baud rate = f cy /(16 (brgx + 1)) solving for brgx value: brgx = ((f cy /desired baud rate)/16) ? 1 brgx = ((4000000/9600)/16) ? 1 brgx = 25 calculated baud rate = 4000000/(16 (25 + 1)) = 9615 error = (calculated baud rate ? desi red baud rate)/desired baud rate = (9615 ? 9600)/9600 = 0.16%
? 2012-2013 microchip technology inc. ds30009312b-page 259 PIC24FJ128GC010 family 18.2 transmitting in 8-bit data mode 1. set up the uartx: a) write appropriate values for data, parity and stop bits. b) write appropriate baud rate value to the uxbrg register. c) set up transmit and receive interrupt enable and priority bits. 2. enable the uartx. 3. set the utxen bit (causes a transmit interrupt, two cycles after being set). 4. write a data byte to the lower byte of the uxtx- reg word. the value will be immediately trans- ferred to the transmit shift register (tsr) and the serial bit stream will start shifting out with the next rising edge of the baud clock. 5. alternatively, the data byte may be transferred while utxen = 0 and then the user may set utxen. this will cause the serial bit stream to begin immediately because the baud clock will start from a cleared state. 6. a transmit interrupt will be generated as per interrupt control bit, utxiselx. 18.3 transmitting in 9-bit data mode 1. set up the uartx (as described in section 18.2 ?transmitting in 8-bit data mode? ). 2. enable the uartx. 3. set the utxen bit (causes a transmit interrupt). 4. write uxtxreg as a 16-bit value only. 5. a word write to uxtxreg triggers the transfer of the 9-bit data to the tsr. the serial bit stream will start shifting out with the first rising edge of the baud clock. 6. a transmit interrupt will be generated as per the setting of control bit, utxiselx. 18.4 break and sync transmit sequence the following sequence will send a message frame header, made up of a break, followed by an auto-baud sync byte. 1. configure the uartx for the desired mode. 2. set utxen and utxbrk to set up the break character. 3. load the uxtxreg with a dummy character to initiate transmission (value is ignored). 4. write ?55h? to uxtxreg; this loads the sync character into the transmit fifo. 5. after the break has been sent, the utxbrk bit is reset by hardware. the sync character now transmits. 18.5 receiving in 8-bit or 9-bit data mode 1. set up the uartx (as described in section 18.2 ?transmitting in 8-bit data mode? ). 2. enable the uartx. 3. a receive interrupt will be generated when one or more data characters have been received, as per interrupt control bit, urxiselx. 4. read the oerr bit to determine if an overrun error has occurred. the oerr bit must be reset in software. 5. read uxrxreg. the act of reading the uxrxreg character will move the next character to the top of the receive fifo, including a new set of perr and ferr values. 18.6 operation of uxcts and uxrts control pins uartx clear-to-send (uxcts ) and request-to-send (uxrts ) are the two hardware controlled pins that are associated with the uartx module. these two pins allow the uartx to operate in simplex and flow control mode. they are implemented to control the transmission and reception between the data terminal equipment (dte). the uen<1:0> bits in the uxmode register configure these pins. 18.7 infrared support the uartx module provides two types of infrared uart support: one is the irda clock output to support an external irda encoder and decoder device (legacy module support), and the other is the full implementa- tion of the irda encoder and decoder. note that because the irda modes require a 16x baud clock, they will only work when the brgh bit (uxmode<3>) is ? 0 ?. 18.7.1 irda clock output for external irda support to support external irda encoder and decoder devices, the bclkx pin (same as the uxrts pin) can be configured to generate the 16x baud clock. with uen<1:0> = 11 , the bclkx pin will output the 16x baud clock if the uartx module is enabled. it can be used to support the irda codec chip. 18.7.2 built-in irda encoder and decoder the uartx has full implementation of the irda encoder and decoder as part of the uartx module. the built-in irda encoder and decoder functionality is enabled using the iren bit (uxmode<12>). when enabled (iren = 1 ), the receive pin (uxrx) acts as the input from the infrared receiver. the transmit pin (uxtx) acts as the output to the infrared transmitter.
PIC24FJ128GC010 family ds30009312b-page 260 ? 2012-2013 microchip technology inc. register 18-1: uxmode: uartx mode register r/w-0 u-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 uarten ( 1 ) ? usidl iren ( 2 ) rtsmd ? uen1 uen0 bit 15 bit 8 r/w-0, hc r/w-0 r/w-0, hc r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 wake lpback abaud rxinv brgh pdsel1 pdsel0 stsel bit 7 bit 0 legend: hc = hardware clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 uarten: uartx enable bit ( 1 ) 1 = uartx is enabled, all uartx pins are controlled by uartx as defined by uen<1:0> 0 = uartx is disabled, all uartx pins are controlled by port latches; uartx power consumption is minimal bit 14 unimplemented: read as ? 0 ? bit 13 usidl: uartx stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 iren: irda ? encoder and decoder enable bit ( 2 ) 1 = irda encoder and decoder are enabled 0 = irda encoder and decoder are disabled bit 11 rtsmd: mode selection for uxrts pin bit 1 =uxrts pin is in simplex mode 0 =uxrts pin is in flow control mode bit 10 unimplemented: read as ? 0 ? bit 9-8 uen<1:0>: uartx enable bits 11 = uxtx, uxrx and bclkx pins are enabled and used; uxcts pin is controlled by port latches 10 = uxtx, uxrx, uxcts and uxrts pins are enabled and used 01 = uxtx, uxrx and uxrts pins are enabled and used; uxcts pin is controlled by port latches 00 = uxtx and uxrx pins are enabled and used; uxcts and uxrts /bclkx pins are controlled by port latches bit 7 wake: wake-up on start bit detect during sleep mode enable bit 1 = uartx will continue to sample the uxrx pin; interrupt is generated on the falling edge, bit is cleared in hardware on the following rising edge 0 = no wake-up is enabled bit 6 lpback: uartx loopback mode select bit 1 = enables loopback mode 0 = loopback mode is disabled bit 5 abaud: auto-baud enable bit 1 = enables baud rate measurement on the next character ? requires reception of a sync field (55h); cleared in hardware upon completion 0 = baud rate measurement is disabled or completed note 1: if uarten = 1 , the peripheral inputs and outputs must be configured to an available rpn/rpin pin. see section 11.4 ?peripheral pin select (pps)? for more information. 2: this feature is only available for the 16x brg mode (brgh = 0 ).
? 2012-2013 microchip technology inc. ds30009312b-page 261 PIC24FJ128GC010 family bit 4 rxinv: receive polarity inversion bit 1 = uxrx idle state is ? 0 ? 0 = uxrx idle state is ? 1 ? bit 3 brgh: high baud rate enable bit 1 = high-speed mode (4 brg clock cycles per bit) 0 = standard speed mode (16 brg clock cycles per bit) bit 2-1 pdsel<1:0>: parity and data selection bits 11 = 9-bit data, no parity 10 = 8-bit data, odd parity 01 = 8-bit data, even parity 00 = 8-bit data, no parity bit 0 stsel: stop bit selection bit 1 = two stop bits 0 = one stop bit register 18-1: uxmode: uartx mode register (continued) note 1: if uarten = 1 , the peripheral inputs and outputs must be configured to an available rpn/rpin pin. see section 11.4 ?peripheral pin select (pps)? for more information. 2: this feature is only available for the 16x brg mode (brgh = 0 ).
PIC24FJ128GC010 family ds30009312b-page 262 ? 2012-2013 microchip technology inc. register 18-2: uxsta: uartx status and control register r/w-0 r/w-0 r/w-0 u-0 r/w-0, hc r/w-0 r-0, hsc r-1, hsc utxisel1 utxinv ( 1 ) utxisel0 ? utxbrk utxen ( 2 ) utxbf trmt bit 15 bit 8 r/w-0 r/w-0 r/w-0 r-1, hsc r-0, hsc r-0, hsc r/c-0, hs r-0, hsc urxisel1 urxisel0 adden ridle perr ferr oerr urxda bit 7 bit 0 legend: c = clearable bit hsc = hardware settable/clearable bit 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 hs = hardware settable bit hc = hardware clearable bit bit 15,13 utxisel<1:0>: uartx transmission interrupt mode selection bits 11 = reserved; do not use 10 = interrupt when a character is transferred to the transmit shift register (tsr), and as a result, the transmit buffer becomes empty 01 = interrupt when the last character is shifted out of the transmit shift register; all transmit operations are completed 00 = interrupt when a character is transferred to the transmit shift register (this implies there is at least one character open in the transmit buffer) bit 14 utxinv: irda ? encoder transmit polarity inversion bit ( 1 ) iren = 0 : 1 = uxtx is idle ? 0 ? 0 = uxtx is idle ? 1 ? iren = 1 : 1 = uxtx is idle ? 1 ? 0 = uxtx is idle ? 0 ? bit 12 unimplemented: read as ? 0 ? bit 11 utxbrk: uartx transmit break bit 1 = sends sync break on next transmission ? start bit, followed by twelve ? 0 ? bits, followed by stop bit; cleared by hardware upon completion 0 = sync break transmission is disabled or completed bit 10 utxen: uartx transmit enable bit ( 2 ) 1 = transmit is enabled, uxtx pin is controlled by uartx 0 = transmit is disabled, any pending transmission is aborted and the buffer is reset; uxtx pin is controlled by the port bit 9 utxbf: uartx transmit buffer full status bit (read-only) 1 = transmit buffer is full 0 = transmit buffer is not full, at least one more character can be written bit 8 trmt: transmit shift register empty bit (read-only) 1 = transmit shift register is empty and transmit buffer is empty (the last transmission has completed) 0 = transmit shift register is not empty, a transmission is in progress or queued note 1: the value of the bit only affects the transmit properties of the module when the irda ? encoder is enabled (iren = 1 ). 2: if uarten = 1 , the peripheral inputs and outputs must be configured to an available rpn/rpin pin. see section 11.4 ?peripheral pin select (pps)? for more information.
? 2012-2013 microchip technology inc. ds30009312b-page 263 PIC24FJ128GC010 family bit 7-6 urxisel<1:0>: uartx receive interrupt mode selection bits 11 = interrupt is set on an rsr transfer, making the receive buffer full (i.e., has 4 data characters) 10 = interrupt is set on an rsr transfer, making the receive buffer 3/4 full (i.e., has 3 data characters) 0x = interrupt is set when any character is received and transferred from the rsr to the receive buffer; receive buffer has one or more characters bit 5 adden: address character detect bit (bit 8 of received data = 1 ) 1 = address detect mode is enabled (if 9-bit mode is not selected, this does not take effect) 0 = address detect mode is disabled bit 4 ridle: receiver idle bit (read-only) 1 = receiver is idle 0 = receiver is active bit 3 perr: parity error status bit (read-only) 1 = parity error has been detected for the current character (character at the top of the receive fifo) 0 = parity error has not been detected bit 2 ferr: framing error status bit (read-only) 1 = framing error has been detected for the current character (character at the top of the receive fifo) 0 = framing error has not been detected bit 1 oerr: receive buffer overrun error status bit (clear/read-only) 1 = receive buffer has overflowed 0 = receive buffer has not overflowed (clearing a previously set oerr bit ( 1 ? 0 transition); will reset the receiver buffer and the rsr to the empty state bit 0 urxda: uartx receive buffer data available bit (read-only) 1 = receive buffer has data, at least one more character can be read 0 = receive buffer is empty register 18-2: uxsta: uartx status and control register (continued) note 1: the value of the bit only affects the transmit properties of the module when the irda ? encoder is enabled (iren = 1 ). 2: if uarten = 1 , the peripheral inputs and outputs must be configured to an available rpn/rpin pin. see section 11.4 ?peripheral pin select (pps)? for more information.
PIC24FJ128GC010 family ds30009312b-page 264 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 265 PIC24FJ128GC010 family 19.0 universal serial bus with on-the-go support (usb otg) PIC24FJ128GC010 family devices contain a full-speed and low-speed compatible, on-the-go (otg) usb serial interface engine (sie). the otg capability allows the device to act as either a usb peripheral device or as a usb embedded host with limited host capabilities. the otg capability allows the device to dynamically switch from device to host operation using otg?s host negotiation protocol (hnp). for more details on otg operation, refer to the ? on-the-go supplement? to the ? usb 2.0 specifica- tion ?, published by the usb-if. for more details on usb operation, refer to the ? universal serial bus specification ?, v2.0. the usb otg module offers these features: ? usb functionality in device and host modes, and otg capabilities for application-controlled mode switching ? software-selectable module speeds of full speed (12 mbps) or low speed (1.5 mbps, available in host mode only) ? support for all four usb transfer types: control, interrupt, bulk and isochronous ? 16 bidirectional endpoints for a total of 32 unique endpoints ? dma interface for data ram access ? queues up to sixteen unique endpoint transfers without servicing ? integrated, on-chip usb transceiver with support for off-chip transceivers via a digital interface ? integrated v bus generation with on-chip comparators and boost generation, and support of external v bus comparators and regulators through a digital interface ? configurations for on-chip bus pull-up and pull-down resistors a simplified block diagram of the usb otg module is shown in figure 19-1 . the usb otg module can function as a usb peripheral device or as a usb host, and may dynamically switch between device and host modes under software control. in either mode, the same data paths and buffer descriptors (bds) are used for the transmission and reception of data. in discussing usb operation, this section will use a controller-centric nomenclature for describing the direc- tion of the data transfer between the microcontroller and the usb. rx (receive) will be used to describe transfers that move data from the usb to the microcontroller and tx (transmit) will be used to describe transfers that move data from the microcontroller to the usb. table 19-1 shows the relationship between data direction in this nomenclature and the usb tokens exchanged. table 19-1: controller-centric data direction for usb host or target this chapter presents the most basic operations needed to implement usb otg functionality in an application. a complete and detailed discussion of the usb protocol and its otg supplement are beyond the scope of this data sheet. it is assumed that the user already has a basic understanding of usb architecture and the latest version of the protocol. not all steps for proper usb operation (such as device enumeration) are presented here. it is recommended that application developers use an appropriate device driver to implement all of the necessary features. microchip provides a number of application-specific resources, such as usb firmware and driver support. refer to www.microchip.com/usb for the latest firmware and driver support. note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?usb on-the-go (otg)? (ds39721). the infor- mation in this data sheet supersedes the information in the frm. usb mode direction rx tx device out or setup in host in out or setup
PIC24FJ128GC010 family ds30009312b-page 266 ? 2012-2013 microchip technology inc. figure 19-1: usb otg module block diagram 48 mhz usb clock d+ (1) d- (1) usbid (1) v bus (1) transceiver comparators usb srp charge srp discharge registers and control interface voltage system ram full-speed pull-up host pull-down host pull-down note 1: pins are multiplexed with digi tal i/o and other device features. 2: connecting v bus3v3 to v dd is highly recommended, as floating this input can cause increased i pd currents. the pin should be tied to v dd when the usb functions are not used. vmio (1) vpio (1) dmh (1) dph (1) dmln (1) dpln (1) rcv (1) v bus boost assist external transceiver interface usboen (1) v cmpst1 /v busvld (1) v cmpst2 /sessvld (1) v busst (1) v cpcon (1) sessend (1) transceiver power 3.3v v usb3v3 (2) sie usb
? 2012-2013 microchip technology inc. ds30009312b-page 267 PIC24FJ128GC010 family 19.1 hardware configuration 19.1.1 device mode 19.1.1.1 d+ pull-up resistor PIC24FJ128GC010 family devices have a built-in 1.5 k ? resistor on the d+ line that is available when the microcontroller is operating in device mode. this is used to signal an external host that the device is operating in full-speed device mode. it is engaged by setting the usben bit (u1c on<0>) and powering up the usb module (usbpwr = 1 ). if the otgen bit (u1otgcon<2>) is set, then the d+ pull-up is enabled through the dppulup bit (u1otgcon<7>). 19.1.1.2 the v bus pin in order to meet the usb 2.0 specification requirement, relating to the back drive voltage on the d+/d- pins, the usb module incorporates v bus level sensing compar- ators. when the comparators detect the v bus level below the v a _ sess _v ld level, the hardware will auto- matically disable the d+ pull-up resistor described in section 19.1.1.1 ?d+ pull-up resistor? . this allows the device to automatically meet the back drive require- ment for d+ and d-, even if the application firmware does not explicitly monitor the v bus level. therefore, the v bus microcontroller pin should not be left floating in usb device mode application designs, and should normally be connected to the v bus pin on the usb connector/cable (either directly or through a small resistance ? 100 ohms). 19.1.1.3 power modes many usb applications will likely have several different sets of power requirements and configuration. the most common power modes encountered are: ?bus power only mode ? self-power only mode ? dual power with self-power dominance bus power only mode ( figure 19-2 ) is effectively the simplest method. all power for the application is drawn from the usb. to meet the inrush current requirements of the ?usb 2.0 otg specification? , the total effective capac- itance, appearing across v bus and ground, must be no more than 10 ? f. in the usb suspend mode, devices must consume no more than 2.5 ma from the 5v v bus line of the usb cable. during the usb suspend mode, the d+ or d- pull-up resistor must remain active, which will consume some of the allowed suspend current. in self-power only mode ( figure 19-3 ), the usb application provides its own power, with very little power being pulled from the usb. note that an attach indication is added to indicate when the usb has been connected and the host is actively powering v bus . to meet compliance specifications, the usb module (and the d+ or d- pull-up resistor) should not be enabled until the host actively drives v bus high. one of the 5.5v tolerant i/o pins may be used for this purpose. the application should never source any current onto the 5v v bus pin of the usb cable when the usb module is operated in usb device mode. the dual power mode with self-power dominance ( figure 19-4 ) allows the application to use internal power primarily, but switch to power from the usb when no internal power is available. dual power devices must also meet all of the special requirements for inrush current and suspend mode current previ- ously described, and must not enable the usb module until v bus is driven high. figure 19-2: bus-powered interface example figure 19-3: self-power only figure 19-4: dual power example v dd v usb3v3 v ss v bus ~5v 3.3v mcp1801 attach sense v bus 100 ? 3.3v ldo 1 ? f v dd v usb3v3 v ss v self ~3.3v attach sense 100 k ? 100 ? v bus ~5v v bus v dd v usb3v3 v bus v ss attach sense v bus v self 100 ? ~3.3v ~5v 100 k ? 3.3v low i q regulator
PIC24FJ128GC010 family ds30009312b-page 268 ? 2012-2013 microchip technology inc. 19.1.2 host and otg modes 19.1.2.1 d+ and d- pull-down resistors PIC24FJ128GC010 family devices have a built-in 15 k ? pull-down resistor on the d+ and d- lines. these are used in tandem to signal to the bus that the micro- controller is operating in host mode. they are engaged by setting the hosten bit (u1con<3>). if the otgen bit (u1otgcon<2>) is set, then these pull-downs are enabled by setting the dppuldwn and dmpuldwn bits (u1otgcon<5:4>). 19.1.2.2 power configurations in host mode, as well as host mode in on-the-go operation, the ?usb 2.0 otg specification? requires that the host application should supply power on v bus . since the microcontroller is running below v bus , and is not able to source sufficient current, a separate power supply must be provided. when the application is always operating in host mode, a simple circuit can be used to supply v bus and regulate current on the bus ( figure 19-5 ). for otg operation, it is necessary to be able to turn v bus on or off as needed, as the microcontroller switches between device and host modes. a typical example using an external charge pump is shown in figure 19-6 . figure 19-5: host interface example figure 19-6: otg interface example a/d pin v usb3v3 v dd v ss d+ d- v bus id d+ d- v bus id gnd +3.3v +3.3v polymer ptc thermal fuse micro a/b connector 150 f 2 k ? 2 k ? 0.1 f 3.3v +5v pic ? mcu i/o i/o v ss d+ d- v bus id micro a/b connector 40 k ? 4.7 f v dd pic ? mcu 10 f v in select shnd pgood mcp1253 v out c+ c- gnd 1 f d+ d- v bus id gnd v usb3v3 v dd +3.3v +3.3v 0.1 f 3.3v
? 2012-2013 microchip technology inc. ds30009312b-page 269 PIC24FJ128GC010 family 19.1.3 using an external interface some applications may require the usb interface to be isolated from the rest of the system. PIC24FJ128GC010 family devices include a complete interface to communicate with and control an external usb transceiver, including the control of data line pull-ups and pull-downs. the v bus voltage generation control circuit can also be configured for different v bus generation topologies. refer to the ? pic24f family reference manual ?, section 27. ?usb on-the-go (otg)? for information on using the external interface. 19.1.4 calculating transceiver power requirements the usb transceiver consumes a variable amount of current depending on the characteristic impedance of the usb cable, the length of the cable, the v usb supply voltage and the actual data patterns moving across the usb cable. longer cables have larger capacitances and consume more total energy when switching output states. the total transceiver current consumption will be application-specific. equation 19-1 can help estimate how much current actually may be required in full-speed applications. refer to the ? pic24f family reference manual ?, section 27. ?usb on-the-go (otg)? for a complete discussion on transceiver power consumption. equation 19-1: estimating usb t ransceiver current consumption legend: v usb ? voltage applied to the v usb3v3 pin in volts (3.0v to 3.6v). p zero ? percentage (in decimal) of the in traffic bits sent by the pic ? microcontroller that are a value of ? 0 ?. p in ? percentage (in decimal) of total bus bandwidth that is used for in traffic. l cable ? length (in meters) of the usb cable. the ?usb 2.0 otg specification? requires that full-speed applications use cables no longer than 5m. i pullup ? current which the nominal, 1.5 k ? pull-up resistor (when enabled) must supply to the usb cable. 40 ma ? v usb ? p zero ? p in ? l cable ixcvr = 3.3v ? 5m + i pullup
PIC24FJ128GC010 family ds30009312b-page 270 ? 2012-2013 microchip technology inc. 19.2 usb buffer descriptors and the bdt endpoint buffer control is handled through a structure called the buffer descriptor table (bdt). this provides a flexible method for users to construct and control endpoint buffers of various lengths and configurations. the bdt can be located in any available 512-byte, aligned block of data ram. the bdt pointer (u1bdtp1) contains the upper address byte of the bdt and sets the location of the bdt in ram. the user must set this pointer to indicate the table?s location. the bdt is composed of buffer descriptors (bds) which are used to define and control the actual buffers in the usb ram space. each bd consists of two 16-bit, ?soft? (non-fixed-address) registers, bdnstat and bdnadr, where n represents one of the 64 possible bds (range of 0 to 63). bdnstat is the status register for bdn, while bdnadr specifies the starting address for the buffer associated with bdn. depending on the endpoint buffering configuration used, there are up to 64 sets of buffer descriptors, for a total of 256 bytes. at a minimum, the bdt must be at least 8 bytes long. this is because the ?usb 2.0 otg specification? mandates that every device must have endpoint 0 with both input and output for initial setup. endpoint mapping in the bdt is dependent on three variables: ? endpoint number (0 to 15) ? endpoint direction (rx or tx) ? ping-pong settings (u1cnfg1<1:0>) figure 19-7 illustrates how these variables are used to map endpoints in the bdt. in host mode, only endpoint 0 buffer descriptors are used. all transfers utilize the endpoint 0 buffer descrip- tor and endpoint control register (u1ep0). for received packets, the attached device?s source endpoint is indicated by the value of endpt<3:0> in the usb status register (u1stat<7:4>). for transmitted packets, the attached device?s destination endpoint is indicated by the value written to the token register (u1tok). figure 19-7: bdt mapping for endpoint buffering modes note: since bdnadr is a 16-bit register, only the first 64 kbytes of ram can be accessed by the usb module. ep1 tx even ep1 rx even ep1 rx odd ep1 tx odd descriptor descriptor descriptor descriptor ep1 tx ep15 tx ep1 rx ep0 rx ppb<1:0> = 00 ep0 tx ep1 tx no ping-pong ep15 tx ep0 tx ep0 rx even ppb<1:0> = 01 ep0 rx odd ep1 rx ping-pong buffer ep15 tx odd ep0 tx even ep0 rx even ppb<1:0> = 10 ep0 rx odd ep0 tx odd ping-pong buffers descriptor descriptor descriptor descriptor descriptor descriptor descriptor descriptor descriptor descriptor descriptor descriptor note: memory area is not shown to scale. descriptor descriptor descriptor descriptor buffers on ep0 out on all eps ep1 tx even ep1 rx even ep1 rx odd ep1 tx odd descriptor descriptor descriptor descriptor ep15 tx odd ep0 rx ppb<1:0> = 11 ep0 tx ping-pong buffers descriptor descriptor descriptor on all other eps except ep0 total bdt space: total bdt space: total bdt space: total bdt space: 128 bytes 132 bytes 256 bytes 248 bytes
? 2012-2013 microchip technology inc. ds30009312b-page 271 PIC24FJ128GC010 family bds have a fixed relationship to a particular endpoint, depending on the buffering configuration. tab l e 1 9- 2 provides the mapping of bds to endpoints. this rela- tionship also means that gaps may occur in the bdt if endpoints are not enabled contiguously. this, theoreti- cally, means that the bds for disabled endpoints could be used as buffer space. in practice, users should avoid using such spaces in the bdt unless a method of validating bd addresses is implemented. 19.2.1 buffer ownership because the buffers and their bds are shared between the cpu and the usb module, a simple semaphore mechanism is used to distinguish which is allowed to update the bd and associated buffers in memory. this is done by using the uown bit as a semaphore to distinguish which is allowed to update the bd and associated buffers in memory. uown is the only bit that is shared between the two configurations of bdnstat. when uown is clear, the bd entry is ?owned? by the microcontroller core. when the uown bit is set, the bd entry and the buffer memory are ?owned? by the usb peripheral. the core should not modify the bd or its corresponding data buffer during this time. note that the microcontroller core can still read bdnstat while the sie owns the buffer and vice versa. the buffer descriptors have a different meaning based on the source of the register update. register 19-1 and register 19-2 show the differences in bdnstat depending on its current ?ownership?. when uown is set, the user can no longer depend on the values that were written to the bds. from this point, the usb module updates the bds as necessary, over- writing the original bd values. the bdnstat register is updated by the sie with the token pid and the transfer count is updated. 19.2.2 dma interface the usb otg module uses a dedicated dma to access both the bdt and the endpoint data buffers. since part of the address space of the dma is dedi- cated to the buffer descriptors, a portion of the memory connected to the dma must comprise a contiguous address space, properly mapped for the access by the module. table 19-2: assignment of buffer descriptors for the different buffering modes endpoint bds assigned to endpoint mode 0 (no ping-pong) mode 1 (ping-pong on ep0 out) mode 2 (ping-pong on all eps) mode 3 (ping-pong on all other eps, except ep0) out in out in out in out in 0 0 1 0 (e), 1 (o) 2 0 (e), 1 (o) 2 (e), 3 (o) 0 1 1 2 3 3 4 4 (e), 5 (o) 6 (e), 7 (o) 2 (e), 3 (o) 4 (e), 5 (o) 2 4 5 5 6 8 (e), 9 (o) 10 (e), 11 (o) 6 (e), 7 (o) 8 (e), 9 (o) 3 6 7 7 8 12 (e), 13 (o) 14 (e), 15 (o) 10 (e), 11 (o) 12 (e), 13 (o) 4 8 9 9 10 16 (e), 17 (o) 18 (e), 19 (o) 14 (e), 15 (o) 16 (e), 17 (o) 5 10 11 11 12 20 (e), 21 (o) 22 (e), 23 (o) 18 (e), 19 (o) 20 (e), 21 (o) 6 12 13 13 14 24 (e), 25 (o) 26 (e), 27 (o) 22 (e), 23 (o) 24 (e), 25 (o) 7 14 15 15 16 28 (e), 29 (o) 30 (e), 31 (o) 26 (e), 27 (o) 28 (e), 29 (o) 8 16 17 17 18 32 (e), 33 (o) 34 (e), 35 (o) 30 (e), 31 (o) 32 (e), 33 (o) 9 18 19 19 20 36 (e), 37 (o) 38 (e), 39 (o) 34 (e), 35 (o) 36 (e), 37 (o) 10 20 21 21 22 40 (e), 41 (o) 42 (e), 43 (o) 38 (e), 39 (o) 40 (e), 41 (o) 11 22 23 23 24 44 (e), 45 (o) 46 (e), 47 (o) 42 (e), 43 (o) 44 (e), 45 (o) 12 24 25 25 26 48 (e), 49 (o) 50 (e), 51 (o) 46 (e), 47 (o) 48 (e), 49 (o) 13 26 27 27 28 52 (e), 53 (o) 54 (e), 55 (o) 50 (e), 51 (o) 52 (e), 53 (o) 14 28 29 29 30 56 (e), 57 (o) 58 (e), 59 (o) 54 (e), 55 (o) 56 (e), 57 (o) 15 30 31 31 32 60 (e), 61 (o) 62 (e), 63 (o) 58 (e), 59 (o) 60 (e), 61 (o) legend: (e) = even transaction buffer, (o) = odd transaction buffer
PIC24FJ128GC010 family ds30009312b-page 272 ? 2012-2013 microchip technology inc. register 19-1: bdnstat: buffer descriptor n status register prototype, usb mode (bd0stat through bd63stat) r/w-x r/w-x r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc uown dts pid3 pid2 pid1 pid0 bc9 bc8 bit 15 bit 8 r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r /w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc bc7 bc6 bc5 bc4 bc3 bc2 bc1 bc0 bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 uown: usb own bit 1 = the usb module owns the bd and its corresponding buffer; the cpu must not modify the bd or the buffer bit 14 dts: data toggle packet bit 1 = data 1 packet 0 = data 0 packet bit 13-10 pid<3:0>: packet identifier bits (written by the usb module) in device mode: represents the pid of the received token during the last transfer. in host mode: represents the last returned pid or the transfer status indicator. bit 9-0 bc<9:0>: byte count bits this represents the number of bytes to be transmitted or the maximum number of bytes to be received during a transfer. upon completion, the byte count is updated by the usb module with the actual number of bytes transmitted or received.
? 2012-2013 microchip technology inc. ds30009312b-page 273 PIC24FJ128GC010 family register 19-2: bdnstat: buffer descriptor n status register prototype, cpu mode (bd0stat through bd63stat) r/w-x r/w-x r-0 r-0 r/w-x r/w-x r/w-x, hsc r/w-x, hsc uown dts ( 1 ) r r dtsen bstall bc9 bc8 bit 15 bit 8 r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r /w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc bc7 bc6 bc5 bc4 bc3 bc2 bc1 bc0 bit 7 bit 0 legend: r = reserved bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?r? = reserved bit x = bit is unknown bit 15 uown: usb own bit 0 = the microcontroller core owns the bd and its corresponding buffer; the usb module ignores all other fields in the bd bit 14 dts: data toggle packet bit ( 1 ) 1 = data 1 packet 0 = data 0 packet bit 13-12 reserved: maintain as ? 0 ? bit 11 dtsen: data toggle synchronization enable bit 1 = data toggle synchronization is enabled; data packets with incorrect sync value will be ignored 0 = no data toggle synchronization is performed bit 10 bstall: buffer stall enable bit 1 = buffer stall is enabled; stall handshake issued if a token is received that would use the bd in the given location (uown bit remains set, bd value is unchanged); corresponding epstall bit will get set on any stall handshake 0 = buffer stall is disabled bit 9-0 bc<9:0>: byte count bits this represents the number of bytes to be transmitted or the maximum number of bytes to be received during a transfer. upon completion, the byte count is updated by the usb module with the actual number of bytes transmitted or received. note 1: this bit is ignored unless dtsen = 1 .
PIC24FJ128GC010 family ds30009312b-page 274 ? 2012-2013 microchip technology inc. 19.3 usb interrupts the usb otg module has many conditions that can be configured to cause an interrupt. all interrupt sources use the same interrupt vector. figure 19-8 shows the interrupt logic for the usb module. there are two layers of interrupt registers in the usb module. the top level consists of overall usb status interrupts; these are enabled and flagged in the u1ie and u1ir registers, respectively. the second level consists of usb error conditions, which are enabled and flagged in the u1eir and u1eie registers. an interrupt condition in any of these triggers a usb error interrupt flag (uerrif) in the top level. unlike the device-level interrupt flags in the ifsx registers, usb interrupt flags in the u1ir registers can only be cleared by writing a ? 1 ? to the bit position. interrupts may be used to trap routine events in a usb transaction. figure 19-9 provides some common events within a usb frame and their corresponding interrupts. figure 19-8: usb otg interrupt funnel dmaef dmaee btoef btoee dfn8ef dfn8ee crc16ef crc16ee crc5ef (eofef) crc5ee (eofee) pidef pidee attachif attachie resumeif resumeie idleif idleie trnif trnie sofif sofie urstif (detachif) urstie (detachie) (uerrif) uerrie set usb1if stallif stallie btsef btsee t1msecif timsecie lstateif lstateie actvif actvie sesvdif sesvdie sesendif sesendie vbusvdif vbusvdie idif idie second level (usb error) interrupts top level (usb status) interrupts top level (usb otg) interrupts
? 2012-2013 microchip technology inc. ds30009312b-page 275 PIC24FJ128GC010 family 19.3.1 clearing usb otg interrupts unlike device level interrupts, the usb otg interrupt status flags are not freely writable in software. all usb otg flag bits are implemented as hardware set only bits. additionally, these bits can only be cleared in software by writing a ? 1 ? to their locations (i.e., perform- ing a mov type instruction). writing a ? 0 ? to a flag bit (i.e., a bclr instruction) has no effect. figure 19-9: example of a usb transaction and interrupt events 19.4 device mode operation the following section describes how to perform a com- mon device mode task. in device mode, usb transfers are performed at the transfer level. the usb module automatically performs the status phase of the transfer. 19.4.1 enabling device mode 1. reset the ping-pong buffer pointers by setting, then clearing, the ping-pong buffer reset bit, ppbrst (u1con<1>). 2. disable all interrupts (u1ie and u1eie = 00h). 3. clear any existing interrupt flags by writing ffh to u1ir and u1eir. 4. verify that v bus is present (non-otg devices only). 5. enable the usb module by setting the usben bit (u1con<0>). 6. set the otgen bit (u1otgcon<2>) to enable otg operation. 7. enable the endpoint zero buffer to receive the first setup packet by setting the eprxen and ephshk bits for endpoint 0 (u1ep0<3,0> = 1 ). 8. power up the usb module by setting the usbpwr bit (u1pwrc<0>). 9. enable the d+ pull-up resistor to signal an attach by setting the dppulup bit (u1otgcon<7>). note: throughout this data sheet, a bit that can only be cleared by writing a ? 1 ? to its loca- tion is referred to as ?write 1 to clear?. in register descriptions, this function is indicated by the descriptor, ?k?. usb reset sof reset setup data status sof setup token data ack out token empty data ack start-of-frame (sof) in token data ack sofif urstif 1ms frame differential data from host from host to host from host to host from host from host from host to host transaction control transfer (1) transaction complete note 1: the control transfer shown here is only an example showi ng events that can occur for every transaction. typical control transfers will spread across multiple frames. set trnif set trnif set trnif
PIC24FJ128GC010 family ds30009312b-page 276 ? 2012-2013 microchip technology inc. 19.4.2 receiving an in token in device mode 1. attach to a usb host and enumerate as described in chapter 9 of the ?usb 2.0 specification? . 2. create a data buffer and populate it with the data to send to the host. 3. in the appropriate (even or odd) tx bd for the desired endpoint: a) set up the status register (bdnstat) with the correct data toggle (data0/1) value and the byte count of the data buffer. b) set up the address register (bdnadr) with the starting address of the data buffer. c) set the uown bit of the status register to ? 1 ?. 4. when the usb module receives an in token, it automatically transmits the data in the buffer. upon completion, the module updates the status register (bdnstat) and sets the token complete interrupt flag, trnif (u1ir<3>). 19.4.3 receiving an out token in device mode 1. attach to a usb host and enumerate as described in chapter 9 of the ?usb 2.0 specification? . 2. create a data buffer with the amount of data you are expecting from the host. 3. in the appropriate (even or odd) tx bd for the desired endpoint: a) set up the status register (bdnstat) with the correct data toggle (data0/1) value and the byte count of the data buffer. b) set up the address register (bdnadr) with the starting address of the data buffer. c) set the uown bit of the status register to ? 1 ?. 4. when the usb module receives an out token, it automatically receives the data sent by the host to the buffer. upon completion, the module updates the status register (bdnstat) and sets the token complete interrupt flag, trnif (u1ir<3>). 19.5 host mode operation the following sections describe how to perform common host mode tasks. in host mode, usb transfers are invoked explicitly by the host software. the host software is responsible for the acknowledge portion of the transfer. also, all transfers are performed using the endpoint 0 control register (u1ep0) and buffer descriptors. 19.5.1 enable host mode and discover a connected device 1. enable host mode by setting the hosten bit (u1con<3>). this causes the host mode con- trol bits in other usb otg registers to become available. 2. enable the d+ and d- pull-down resistors by setting the dppuldwn and dmpuldwn bits (u1otgcon<5:4>). disable the d+ and d- pull-up resistors by clearing the dppulup and dmpulup bits (u1otgcon<7:6>). 3. at this point, sof generation begins with the sof counter loaded with 12,000. eliminate noise on the usb by clearing the sofen bit (u1con<0>) to disable start-of-frame (sof) packet generation. 4. enable the device attached interrupt by setting the attachie bit (u1ie<6>). 5. wait for the device attached interrupt (u1ir<6> = 1 ). this is signaled by the usb device changing the state of d+ or d- from ? 0 ? to ? 1 ? (se0 to j-state). after it occurs, wait 100 ms for the device power to stabilize. 6. check the state of the jstate and se0 bits in u1con. if the jstate bit (u1con<7>) is ? 0 ?, the connecting device is low speed. if the con- necting device is low speed, set the low lspden and lspd bits (u1addr<7> and u1ep0<7>) to enable low-speed operation. 7. reset the usb device by setting the usbrst bit (u1con<4>) for at least 50 ms, sending reset signaling on the bus. after 50 ms, terminate the reset by clearing usbrst. 8. in order to keep the connected device from going into suspend, enable the sof packet generation by setting the sofen bit. 9. wait 10 ms for the device to recover from reset. 10. perform enumeration as described by chapter 9 of the ?usb 2.0 specification? .
? 2012-2013 microchip technology inc. ds30009312b-page 277 PIC24FJ128GC010 family 19.5.2 complete a control transaction to a connected device 1. follow the procedure described in section 19.5.1 ?enable host mode and discover a connected device? to discover a device. 2. set up the endpoint control register for bidirectional control transfers by writing 0dh to u1ep0 (this sets the epcondis, eptxen and ephshk bits). 3. place a copy of the device framework setup command in a memory buffer. see chapter 9 of the ?usb 2.0 specification? for information on the device framework command set. 4. initialize the buffer descriptor (bd) for the current (even or odd) tx ep0 to transfer the eight bytes of command data for a device framework command (i.e., get device descriptor ): a) set the bd data buffer address (bd0adr) to the starting address of the 8-byte memory buffer containing the command. b) write 8008h to bd0stat (this sets the uown bit and sets a byte count of 8). 5. set the usb device address of the target device in the address register (u1addr<6:0>). after a usb bus reset, the device usb address will be zero. after enumeration, it will be set to another value between 1 and 127. 6. write d0h to u1tok; this is a setup token to endpoint 0, the target device?s default control pipe. this initiates a setup token on the bus, followed by a data packet. the device hand- shake is returned in the pid field of bd0stat after the packets are complete. when the usb module updates bd0stat, a token complete interrupt flag is asserted (the trnif flag is set). this completes the setup phase of the setup transaction, as referenced in chapter 9 of the ?usb 2.0 specification? . 7. to initiate the data phase of the setup transac- tion (i.e., get the data for the get device descriptor command), set up a buffer in memory to store the received data. 8. initialize the current (even or odd) rx or tx (rx for in, tx for out) ep0 bd to transfer the data. a) write c040h to bd0stat. this sets the uown, configures data toggle (dts) to data1 and sets the byte count to the length of the data buffer (64 or 40h in this case). b) set bd0adr to the starting address of the data buffer. 9. write the token register with the appropriate in or out token to endpoint 0, the target device?s default control pipe (e.g., write 90h to u1tok for an in token for a get device descriptor command). this initiates an in token on the bus, followed by a data packet from the device to the host. when the data packet completes, the bd0stat is written and a token complete inter- rupt flag is asserted (the trnif flag is set). for control transfers with a single packet data phase, this completes the data phase of the setup transaction, as referenced in chapter 9 of the ?usb 2.0 specification? . if more data needs to be transferred, return to step 8. 10. to initiate the status phase of the setup transac- tion, set up a buffer in memory to receive or send the zero length status phase data packet. 11. initialize the current (even or odd) tx ep0 bd to transfer the status data: a) set the bdt buffer address field to the start address of the data buffer. b) write 8000h to bd0stat (set uown bit, configure dts to data0 and set byte count to 0). 12. write the token register with the appropriate in or out token to endpoint 0, the target device?s default control pipe (e.g., write 01h to u1tok for an out token for a get device descriptor command). this initiates an out token on the bus, followed by a zero length data packet from the host to the device. when the data packet completes, the bd is updated with the hand- shake from the device and a token complete interrupt flag is asserted (the trnif flag is set). this completes the status phase of the setup transaction, as described in chapter 9 of the ?usb 2.0 specification? . note: only one control transaction can be performed per frame.
PIC24FJ128GC010 family ds30009312b-page 278 ? 2012-2013 microchip technology inc. 19.5.3 send a full-speed bulk data transfer to a target device 1. follow the procedure described in section 19.5.1 ?enable host mode and discover a connected device? and section 19.5.2 ?complete a con- trol transaction to a connected device? to discover and configure a device. 2. to enable transmit and receive transfers with handshaking enabled, write 1dh to u1ep0. if the target device is a low-speed device, also set the lspd (u1ep0<7>) bit. if you want the hard- ware to automatically retry indefinitely if the target device asserts a nak on the transfer, clear the retry disable bit, retrydis (u1ep0<6>). 3. set up the bd for the current (even or odd) tx ep0 to transfer up to 64 bytes. 4. set the usb device address of the target device in the address register (u1addr<6:0>). 5. write an out token to the desired endpoint to u1tok. this triggers the module?s transmit state machines to begin transmitting the token and the data. 6. wait for the token complete interrupt flag, trnif. this indicates that the bd has been released back to the microprocessor and the transfer has completed. if the retry disable bit (retrydis) is set, the handshake (ack, nak, stall or error (0fh)) is returned in the bd pid field. if a stall interrupt occurs, the pending packet must be dequeued and the error condition in the target device cleared. if a detach interrupt occurs (se0 for more than 2.5 s), then the target has detached (u1ir<0> is set). 7. once the token complete interrupt flag occurs (trnif is set), the bd can be examined and the next data packet queued by returning to step 2. 19.6 otg operation 19.6.1 session request protocol (srp) an otg a-device may decide to power down the v bus supply when it is not using the usb link through the session request protocol (srp). software may do this by configuring a gpio pin to disable an external power transistor, or voltage regulator enable signal, which con- trols the v bus supply. when the v bus supply is powered down, the a-device is said to have ended a usb session. an otg a-device or embedded host may repower the v bus supply at any time (initiate a new session). an otg b-device may also request that the otg a-device repower the v bus supply (initiate a new session). this is accomplished via session request protocol (srp). prior to requesting a new session, the b-device must first check that the previous session has definitely ended. to do this, the b-device must check for two conditions: 1. v bus supply is below the session valid voltage. 2. both d+ and d- have been low for at least 2 ms. the b-device will be notified of condition 1 by the sesendif (u1otgir<2>) interrupt. software will have to manually check for condition 2. the b-device may aid in achieving condition 1 by dis- charging the v bus supply through a resistor. software may do this by setting vbusdis (u1otgcon<0>). after these initial conditions are met, the b-device may begin requesting the new session. the b-device begins by pulsing the d+ data line. software should do this by setting dppulup (u1otgcon<7>). the data line should be held high for 5 to 10 ms. the b-device then proceeds by pulsing the v bus supply. software should do this by setting puvbus (u1cnfg2<4>). when an a-device detects srp sig- naling (either via the attachif (u1ir<6>) interrupt or via the sesvdif (u1otgir <3>) interrupt), the a-device must restore the v bus supply by properly configuring the general purpose i/o port pin controlling the external power source. the b-device should not monitor the state of the v bus supply while performing v bus supply pulsing. when the b-device does detect that the v bus supply has been restored (via the sesvdif (u1otgir<3>) interrupt), the b-device must reconnect to the usb link by pulling up d+ or d- (via the dppulup or dmpulup bit). the a-device must complete the srp by driving usb reset signaling. note: usb speed, transceiver and pull-ups should only be configured during the module setup phase. it is not recom- mended to change these settings while the module is enabled. note: when the a-device powers down the v bus supply, the b-device must discon- nect its pull-up resistor from power. if the device is self-powered, it can do this by clearing dppulup (u1otgcon<7>) and dmpulup (u1otgcon<6>).
? 2012-2013 microchip technology inc. ds30009312b-page 279 PIC24FJ128GC010 family 19.6.2 host negotiation protocol (hnp) in usb otg applications, a dual role device (drd) is a device that is capable of being either a host or a peripheral. any otg drd must support host negotiation protocol (hnp). hnp allows an otg b-device to temporarily become the usb host. the a-device must first enable the b-device to follow hnp. refer to the ?on-the-go supplement? to the ?usb 2.0 specification? for more information regarding hnp. hnp may only be initiated at full speed. after being enabled for hnp by the a-device, the b-device requests being the host any time that the usb link is in suspend state, by simply indicating a discon- nect. this can be done in software by clearing dppulup and dmpulup. when the a-device detects the disconnect condition (via the urstif (u1ir<0>) interrupt), the a-device may allow the b-device to take over as host. the a-device does this by signaling con- nect as a full-speed function. software may accomplish this by setting dppulup. if the a-device responds instead with resume signaling, the a-device remains as host. when the b-device detects the connect condition (via attachif (u1ir<6>), the b-device becomes host. the b-device drives reset signaling prior to using the bus. when the b-device has finished in its role as host, it stops all bus activity and turns on its d+ pull-up resistor by setting dppulup. when the a-device detects a suspend condition (idle for 3 ms), the a-device turns off its d+ pull-up. the a-device may also power down the v bus supply to end the session. when the a-device detects the connect condition (via attachif), the a-device resumes host operation and drives reset signaling. 19.6.3 external v bus comparators the external v bus comparator option is enabled by set- ting the uvcmpdis bit (u1cnfg2<1>). this disables the internal v bus comparators, removing the need to attach v bus to the microcontroller?s v bus pin. the external comparator interface uses either the v cmpst1 and v cmpst2 pins, or the v busvld , sessvld and sessend pins, based upon the setting of the uvcmpsel bit (u1cnfg2<5>). these pins are digital inputs and should be set in the following patterns (see tab l e 1 9- 3 ), based on the current level of the v bus voltage. table 19-3: external v bus comparator states if uvcmpsel = 0 v cmpst1 v cmpst2 bus condition 00 v bus < v b _ sess _ end 10 v b _ sess _ end < v bus < v a _ sess _v ld 01 v a _ sess _v ld < v bus < v a _v bus _v ld 11 v bus > v bus _v ld if uvcmpsel = 1 v busvld sessvld sessend bus condition 00 1 v bus < v b _ sess _ end 00 0 v b _ sess _ end < v bus < v a _ sess _v ld 01 0 v a _ sess _v ld < v bus < v a _v bus _v ld 11 0 v bus > v bus _v ld
PIC24FJ128GC010 family ds30009312b-page 280 ? 2012-2013 microchip technology inc. 19.7 usb otg module registers there are a total of 37 memory mapped registers asso- ciated with the usb otg module. they can be divided into four general categories: ? usb otg module control (12) ? usb interrupt (7) ? usb endpoint management (16) ? usb v bus power control (2) this total does not include the (up to) 128 bd registers in the bdt. their prototypes, described in register 19-1 and register 19-2 , are shown separately in section 19.2 ?usb buffer descriptors and the bdt? . all usb otg registers are implemented in the least significant byte (lsb) of the register. bits in the upper byte are unimplemented and have no function. note that some registers are instantiated only in host mode, while other registers have different bit instantiations and functions in device and host modes. the registers described in the following sections are those that have bits with specific control and configura- tion features. the following registers are used for data or address values only: ? u1bdtp1: specifies the 256-word page in data ram used for the bdt; 8-bit value with bit 0 fixed as ? 0 ? for boundary alignment. ? u1frml and u1frmh: contain the 11-bit byte counter for the current data frame.
? 2012-2013 microchip technology inc. ds30009312b-page 281 PIC24FJ128GC010 family 19.7.1 usb otg module control registers register 19-3: u1otgstat: usb otg st atus register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r-0, hsc u-0 r-0, hsc u-0 r-0, hsc r-0, hsc u-0 r-0, hsc id ?lstate ? sesvd sesend ? vbusvd bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit w = writable bit hsc = hardware settable/clearable bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 id: id pin state indicator bit 1 = no plug is attached or a type b cable has been plugged into the usb receptacle 0 = a type a plug has been plugged into the usb receptacle bit 6 unimplemented: read as ? 0 ? bit 5 lstate: line state stable indicator bit 1 = the usb line state (as defined by se0 and jstate) has been stable for the previous 1 ms 0 = the usb line state has not been stable for the previous 1 ms bit 4 unimplemented: read as ? 0 ? bit 3 sesvd: session valid indicator bit 1 =the v bus voltage is above v a _ sess _v ld (as defined in the ?usb 2.0 otg specification? ) on the a or b-device 0 =the v bus voltage is below v a _ sess _v ld on the a or b-device bit 2 sesend: b session end indicator bit 1 =the v bus voltage is below v b _ sess _ end (as defined in the ?usb 2.0 otg specification? ) on the b-device 0 =the v bus voltage is above v b _ sess _ end on the b-device bit 1 unimplemented: read as ? 0 ? bit 0 vbusvd: a v bus valid indicator bit 1 =the v bus voltage is above v a _v bus _v ld (as defined in the ?usb 2.0 otg specification? ) on the a-device 0 =the v bus voltage is below v a _v bus _v ld on the a-device
PIC24FJ128GC010 family ds30009312b-page 282 ? 2012-2013 microchip technology inc. register 19-4: u1otgcon: usb on-the-go control register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r-0 r/w-0 r-0 r/w-0 dppulup dmpulup dppuldwn ( 1 ) dmpuldwn ( 1 ) rotgen ( 1 ) r vbusdis ( 1 ) bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 dppulup: d+ pull-up enable bit 1 = d+ data line pull-up resistor is enabled 0 = d+ data line pull-up resistor is disabled bit 6 dmpulup: d- pull-up enable bit 1 = d- data line pull-up resistor is enabled 0 = d- data line pull-up resistor is disabled bit 5 dppuldwn: d+ pull-down enable bit ( 1 ) 1 = d+ data line pull-down resistor is enabled 0 = d+ data line pull-down resistor is disabled bit 4 dmpuldwn: d- pull-down enable bit ( 1 ) 1 = d- data line pull-down resistor is enabled 0 = d- data line pull-down resistor is disabled bit 3 reserved: maintain as ? 0 ? bit 2 otgen: otg features enable bit ( 1 ) 1 = usb otg is enabled; all d+/d- pull-up and pull-down bits are enabled 0 = usb otg is disabled; d+/d- pull-up and pull-down bits are controlled in hardware by the settings of the hosten and u sben (u1con<3,0>) bits bit 1 reserved: maintain as ? 0 ? bit 0 vbusdis: v bus discharge enable bit ( 1 ) 1 =v bus line is discharged through a resistor 0 =v bus line is not discharged note 1: these bits are only used in host mode; do not use in device mode.
? 2012-2013 microchip technology inc. ds30009312b-page 283 PIC24FJ128GC010 family register 19-5: u1pwrc: usb power control register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r-x, hsc u-0 u-0 r/w-0 u-0 u-0 r/w-0, hc r/w-0 uactpnd ? ? uslpgrd ? ? ususpnd usbpwr bit 7 bit 0 legend: hc = hardware clearable bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 uactpnd: usb activity pending bit 1 = module should not be suspended at the moment (requires the uslpgrd bit to be set) 0 = module may be suspended or powered down bit 6-5 unimplemented: read as ? 0 ? bit 4 uslpgrd: usb sleep/suspend guard bit 1 = indicates to the usb module that it is about to be suspended or powered down 0 =no suspend bit 3-2 unimplemented: read as ? 0 ? bit 1 ususpnd: usb suspend mode enable bit 1 = usb otg module is in suspend mode; usb clock is gated and the transceiver is placed in a low-power state 0 = normal usb otg operation bit 0 usbpwr: usb operation enable bit 1 = usb otg module is enabled 0 = usb otg module is disabled ( 1 ) note 1: do not clear this bit unless the hosten, usben and otgen bits (u1con<3,0> and u1otgcon<2>) are all cleared.
PIC24FJ128GC010 family ds30009312b-page 284 ? 2012-2013 microchip technology inc. register 19-6: u1stat: usb status register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r-0, hsc r-0, hsc r-0, hsc r-0, hsc r-0, hsc r-0, hsc u-0 u-0 endpt3 endpt2 endpt1 endpt0 dir ppbi ( 1 ) ? ? bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit w = writable bit hsc = hardware settable/clearable bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7-4 endpt<3:0>: number of the last endpoint activity bits (represents the number of the bdt updated by the last usb transfer.) 1111 = endpoint 15 1110 = endpoint 14 . . . 0001 = endpoint 1 0000 = endpoint 0 bit 3 dir: last bd direction indicator bit 1 = the last transaction was a transmit transfer (tx) 0 = the last transaction was a receive transfer (rx) bit 2 ppbi: ping-pong bd pointer indicator bit ( 1 ) 1 = the last transaction was to the odd bd bank 0 = the last transaction was to the even bd bank bit 1-0 unimplemented: read as ? 0 ? note 1: this bit is only valid for endpoints with available even and odd bd registers.
? 2012-2013 microchip technology inc. ds30009312b-page 285 PIC24FJ128GC010 family register 19-7: u1con: usb cont rol register (device mode) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 r-x, hsc r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 ? se0 pktdis ? hosten resume ppbrst usben bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit w = writable bit hsc = hardware settable/clearable bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-7 unimplemented: read as ? 0 ? bit 6 se0: live single-ended zero flag bit 1 = single-ended zero is active on the usb bus 0 = no single-ended zero is detected bit 5 pktdis: packet transfer disable bit 1 = sie token and packet processing are disabled; automatically set when a setup token is received 0 = sie token and packet processing are enabled bit 4 unimplemented: read as ? 0 ? bit 3 hosten: host mode enable bit 1 = usb host capability is enabled; pull-downs on d+ and d- are activated in hardware 0 = usb host capability is disabled bit 2 resume: resume signaling enable bit 1 = resume signaling is activated 0 = resume signaling is disabled bit 1 ppbrst: ping-pong buffers reset bit 1 = resets all ping-pong buffer pointers to the even bd banks 0 = ping-pong buffer pointers are not reset bit 0 usben: usb module enable bit 1 = usb module and supporting circuitry are enabled (device attached); d+ pull-up is activated in hardware 0 = usb module and supporting circuitry are disabled (device detached)
PIC24FJ128GC010 family ds30009312b-page 286 ? 2012-2013 microchip technology inc. register 19-8: u1con: usb control register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r-x, hsc r-x, hsc r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 jstate se0 tokbusy usbrst hosten resume ppbrst sofen bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit w = writable bit hsc = hardware settable/clearable bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 jstate: live differential receiver j-state flag bit 1 = j-state (differential ? 0 ? in low speed, differential ? 1 ? in full speed) is detected on the usb 0 = no j-state is detected bit 6 se0: live single-ended zero flag bit 1 = single-ended zero is active on the usb bus 0 = no single-ended zero is detected bit 5 tokbusy: token busy status bit 1 = token is being executed by the usb module in on-the-go state 0 = no token is being executed bit 4 usbrst: usb module reset bit 1 = usb reset has been generated for a software reset; application must set this bit for 50 ms, then clear it 0 = usb reset is terminated bit 3 hosten: host mode enable bit 1 = usb host capability is enabled; pull-downs on d+ and d- are activated in hardware 0 = usb host capability is disabled bit 2 resume: resume signaling enable bit 1 = resume signaling is activated; software must set bit for 10 ms and then clear to enable remote wake-up 0 = resume signaling is disabled bit 1 ppbrst: ping-pong buffers reset bit 1 = resets all ping-pong buffer pointers to the even bd banks 0 = ping-pong buffer pointers are not reset bit 0 sofen: start-of-frame enable bit 1 = start-of-frame token is sent every one 1 ms 0 = start-of-frame token is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 287 PIC24FJ128GC010 family register 19-9: u1addr: usb address register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 lspden ( 1 ) addr6 addr5 addr4 addr3 addr2 addr1 addr0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 lspden: low-speed enable indicator bit ( 1 ) 1 = usb module operates at low speed 0 = usb module operates at full speed bit 6-0 addr<6:0>: usb device address bits note 1: host mode only. in device mode, this bit is unimplemented and read as ? 0 ?. register 19-10: u1tok: usb token register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pid3 pid2 pid1 pid0 ep3 ep2 ep1 ep0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7-4 pid<3:0>: token type identifier bits 1101 = setup (tx) token type transaction ( 1 ) 1001 = in (rx) token type transaction ( 1 ) 0001 = out (tx) token type transaction ( 1 ) bit 3-0 ep<3:0>: token command endpoint address bits this value must specify a valid endpoint on the attached device. note 1: all other combinations are reserved and are not to be used.
PIC24FJ128GC010 family ds30009312b-page 288 ? 2012-2013 microchip technology inc. register 19-11: u1sof: usb otg start-of-token threshold register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 cnt7 cnt6 cnt5 cnt4 cnt3 cnt2 cnt1 cnt0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7-0 cnt<7:0>: start-of-frame size bits value represents 10 + (packet size of n bytes). for example: 0100 1010 = 64-byte packet 0010 1010 = 32-byte packet 0001 0010 = 8-byte packet
? 2012-2013 microchip technology inc. ds30009312b-page 289 PIC24FJ128GC010 family register 19-12: u1cnfg1: usb configuration register 1 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 u-0 r/w-0 u-0 u-0 r/w-0 r/w-0 uteye uoemon ( 1 ) ? usbsidl ? ? ppb1 ppb0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 uteye: usb eye pattern test enable bit 1 = eye pattern test is enabled 0 = eye pattern test is disabled bit 6 uoemon: usb oe monitor enable bit ( 1 ) 1 =oe signal is active; it indicates intervals during which the d+/d- lines are driving 0 =oe signal is inactive bit 5 unimplemented: read as ? 0 ? bit 4 usbsidl: usb otg stop in idle mode bit 1 = discontinues module operation when the device enters idle mode 0 = continues module operation in idle mode bit 3-2 unimplemented: read as ? 0 ? bit 1-0 ppb<1:0>: ping-pong buffers configuration bits 11 = even/odd ping-pong buffers are enabled for endpoints 1 to 15 10 = even/odd ping-pong buffers are enabled for all endpoints 01 = even/odd ping-pong buffers are enabled for out endpoint 0 00 = even/odd ping-pong buffers are disabled note 1: this bit is only active when the utrdis bit (u1cnfg2<0>) is set.
PIC24FJ128GC010 family ds30009312b-page 290 ? 2012-2013 microchip technology inc. register 19-13: u1cnfg2: usb configuration register 2 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 ? ? uvcmpsel puvbus exti2cen ?uvcmpdis ( 1 ) utrdis ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as ? 0 ? bit 5 uvcmpsel: v bus comparator external interface selection bit 1 = uses v busvld , sessvld and sessend as comparator interface pins 0 = uses v cmpst1 and v cmpst2 as comparator interface pins bit 4 puvbus: v bus pull-up enable bit 1 = pull-up on v bus pin is enabled 0 = pull-up on v bus pin is disabled bit 3 exti2cen: i 2 c? interface for external module control enable bit 1 = external module(s) is controlled via the i 2 c? interface 0 = external module(s) is controlled via the dedicated pins bit 2 unimplemented: read as ? 0 ? bit 1 uvcmpdis: usb on-chip v bus comparator disable bit ( 1 ) 1 = on-chip charge v bus comparator is disabled; digital input status interface is enabled 0 = on-chip charge v bus comparator is active bit 0 utrdis: usb on-chip transceiver disable bit ( 1 ) 1 = on-chip transceiver is disabled; digital transceiver interface is enabled 0 = on-chip transceiver is active note 1: never change these bits while the usbpwr bit is set (u1pwrc<0> = 1 ).
? 2012-2013 microchip technology inc. ds30009312b-page 291 PIC24FJ128GC010 family 19.7.2 usb interrupt registers register 19-14: u1otgir: usb otg interrup t status register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs u-0 r/k-0, hs idif t1msecif lstateif actvif sesvdif sesendif ? vbusvdif bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit k = write ?1? to clear bit hs = hardware settable bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 idif: id state change indicator bit 1 = change in id state is detected 0 = no id state change is detected bit 6 t1msecif: 1 millisecond timer bit 1 = the 1 millisecond timer has expired 0 = the 1 millisecond timer has not expired bit 5 lstateif: line state stable indicator bit 1 = usb line state (as defined by the se0 and jstate bits) has been stable for 1 ms, but different from the last time 0 = usb line state has not been stable for 1 ms bit 4 actvif: bus activity indicator bit 1 = activity on the d+/d- lines or v bus is detected 0 = no activity on the d+/d- lines or v bus is detected bit 3 sesvdif: session valid change indicator bit 1 =v bus has crossed v a _ sess _ end (as defined in the ?usb 2.0 otg specification? ) ( 1 ) 0 =v bus has not crossed v a _ sess _ end bit 2 sesendif: b-device v bus change indicator bit 1 =v bus change on b-device is detected; v bus has crossed v b _ sess _ end (as defined in the ?usb 2.0 otg specification? ) ( 1 ) 0 =v bus has not crossed v a _ sess _ end bit 1 unimplemented: read as ? 0 ? bit 0 vbusvdif: a-device v bus change indicator bit 1 =v bus change on a-device is detected; v bus has crossed v a _v bus _v ld (as defined in the ?usb 2.0 otg specification? ) ( 1 ) 0 =no v bus change on a-device is detected note 1: v bus threshold crossings may either be rising or falling. note: individual bits can only be cleared by writing a ? 1 ? to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise operations to write to a single bit position will cause all set bits, at the moment of the write, to become cleared.
PIC24FJ128GC010 family ds30009312b-page 292 ? 2012-2013 microchip technology inc. register 19-15: u1otgie: usb otg interrup t enable register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 idie t1msecie lstateie actvie sesvdie sesendie ? vbusvdie bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 idie: id interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 6 t1msecie: 1 millisecond timer interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 5 lstateie: line state stable interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 4 actvie: bus activity interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 3 sesvdie: session valid interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 2 sesendie: b-device session end interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 1 unimplemented: read as ? 0 ? bit 0 vbusvdie: a-device v bus valid interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 293 PIC24FJ128GC010 family register 19-16: u1ir: usb interrupt status register (device mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/k-0, hs u-0 r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs stallif ? resumeif idleif trnif sofif uerrif urstif bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit k = write ?1? to clear bit hs = hardware settable bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 stallif: stall handshake interrupt bit 1 = a stall handshake was sent by the peripheral during the handshake phase of the transaction in device mode 0 = a stall handshake has not been sent bit 6 unimplemented: read as ? 0 ? bit 5 resumeif: resume interrupt bit 1 = a k-state is observed on the d+ or d- pin for 2.5 ? s (differential ? 1 ? for low speed, differential ? 0 ? for full speed) 0 = no k-state is observed bit 4 idleif: idle detect interrupt bit 1 = idle condition is detected (constant idle state of 3 ms or more) 0 = no idle condition is detected bit 3 trnif: token processing complete interrupt bit 1 = processing of the current token is complete; read the u1stat register for endpoint information 0 = processing of the current token is not complete; clear the u1stat register or load the next token from stat (clearing this bit causes the stat fifo to advance) bit 2 sofif: start-of-frame token interrupt bit 1 = a start-of-frame token is received by the peripheral or the start-of-frame threshold is reached by the host 0 = no start-of-frame token is received or threshold reached bit 1 uerrif : usb error condition interrupt bit 1 = an unmasked error condition has occurred; only error states enabled in the u1eie register can set this bit 0 = no unmasked error condition has occurred bit 0 urstif: usb reset interrupt bit 1 = valid usb reset has occurred for at least 2.5 ? s; reset state must be cleared before this bit can be re-asserted 0 = no usb reset has occurred; individual bits can only be cleared by writing a ? 1 ? to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise oper- ations to write to a single bit position will cause all set bits, at the moment of the write, to become cleared note: individual bits can only be cleared by writing a ? 1 ? to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise operations to write to a single bit position will cause all set bits, at the moment of the write, to become cleared.
PIC24FJ128GC010 family ds30009312b-page 294 ? 2012-2013 microchip technology inc. register 19-17: u1ir: usb interrupt status register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs stallif attachif resumeif idleif trnif sofif uerrif detachif bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit k = write ?1? to clear bit hs = hardware settable bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 stallif: stall handshake interrupt bit 1 = a stall handshake was sent by the peripheral device during the handshake phase of the transaction in device mode 0 = a stall handshake has not been sent bit 6 attachif: peripheral attach interrupt bit 1 = a peripheral attachment has been detected by the module; it is set if the bus state is not se0 and there has been no bus activity for 2.5 ? s 0 = no peripheral attachment has been detected bit 5 resumeif: resume interrupt bit 1 = a k-state is observed on the d+ or d- pin for 2.5 ? s (differential ? 1 ? for low speed, differential ? 0 ? for full speed) 0 = no k-state is observed bit 4 idleif: idle detect interrupt bit 1 = idle condition is detected (constant idle state of 3 ms or more) 0 = no idle condition is detected bit 3 trnif: token processing complete interrupt bit 1 = processing of the current token is complete; read the u1stat register for endpoint information 0 = processing of the current token is not complete; clear the u1stat register or load the next token from u1stat bit 2 sofif: start-of-frame token interrupt bit 1 = a start-of-frame token is received by the peripheral or the start-of-frame threshold is reached by the host 0 = no start-of-frame token is received or threshold reached bit 1 uerrif: usb error condition interrupt bit 1 = an unmasked error condition has occurred; only error st ates enabled in the u1eie register can set this bit 0 = no unmasked error condition has occurred bit 0 detachif: detach interrupt bit 1 = a peripheral detachment has been detected by the module; reset state must be cleared before this bit can be re-asserted 0 = no peripheral detachment is detected. individual bits can only be cleared by writing a ? 1 ? to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise operations to write to a single bit position will cause all set bits, at the moment of the write, to become cleared. note: individual bits can only be cleared by writing a ? 1 ? to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise operations to write to a single bit position will cause all set bits, at the moment of the write, to become cleared.
? 2012-2013 microchip technology inc. ds30009312b-page 295 PIC24FJ128GC010 family register 19-18: u1ie: usb interrupt enable register (all usb modes) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 stallie attachie ( 1 ) resumeie idleie trnie sofie uerrie urstie detachie bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 stallie: stall handshake interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 6 attachie: peripheral attach interrupt bit (host mode only) ( 1 ) 1 = interrupt is enabled 0 = interrupt is disabled bit 5 resumeie: resume interrupt bit 1 = interrupt is enabled 0 = interrupt is disabled bit 4 idleie: idle detect interrupt bit 1 = interrupt is enabled 0 = interrupt is disabled bit 3 trnie: token processing complete interrupt bit 1 = interrupt is enabled 0 = interrupt is disabled bit 2 sofie: start-of-frame token interrupt bit 1 = interrupt is enabled 0 = interrupt is disabled bit 1 uerrie: usb error condition interrupt bit 1 = interrupt is enabled 0 = interrupt is disabled bit 0 urstie or detachie: usb reset interrupt (device mode) or usb detach interrupt (host mode) enable bit 1 = interrupt is enabled 0 = interrupt is disabled note 1: this bit is unimplemented in device mode, read as ? 0 ?.
PIC24FJ128GC010 family ds30009312b-page 296 ? 2012-2013 microchip technology inc. register 19-19: u1eir: usb error interrupt status register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/k-0, hs u-0 r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs btsef ? dmaef btoef dfn8ef crc16ef crc5ef pidef eofef bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit k = write ?1? to clear bit hs = hardware settable bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 btsef: bit stuff error flag bit 1 = bit stuff error has been detected 0 = no bit stuff error has been detected bit 6 unimplemented: read as ? 0 ? bit 5 dmaef: dma error flag bit 1 = a usb dma error condition is detected; the data size indicated by the bd byte count field is less than the number of received bytes, the received data is truncated 0 = no dma error bit 4 btoef: bus turnaround time-out error flag bit 1 = bus turnaround time-out has occurred 0 = no bus turnaround time-out has occurred bit 3 dfn8ef: data field size error flag bit 1 = data field was not an integral number of bytes 0 = data field was an integral number of bytes bit 2 crc16ef: crc16 failure flag bit 1 = crc16 failed 0 = crc16 passed bit 1 for device mode: crc5ef: crc5 host error flag bit 1 = token packet is rejected due to crc5 error 0 = token packet is accepted (no crc5 error) for host mode: eofef: end-of-frame (eof) error flag bit 1 = end-of-frame error has occurred 0 = end-of-frame interrupt is disabled bit 0 pidef: pid check failure flag bit 1 = pid check failed 0 = pid check passed note: individual bits can only be cleared by writing a ? 1 ? to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise operations to write to a single bit position will cause all set bits, at the moment of the write, to become cleared.
? 2012-2013 microchip technology inc. ds30009312b-page 297 PIC24FJ128GC010 family register 19-20: u1eie: usb error interrupt enable register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 btsee ? dmaee btoee dfn8ee crc16ee crc5ee pidee eofee bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 btsee: bit stuff error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 6 unimplemented: read as ? 0 ? bit 5 dmaee: dma error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 4 btoee: bus turnaround time-out error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 3 dfn8ee: data field size error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 2 crc16ee: crc16 failure interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 1 for device mode: crc5ee: crc5 host error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled for host mode: eofee: end-of-frame (eof) error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 0 pidee: pid check failure interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled
PIC24FJ128GC010 family ds30009312b-page 298 ? 2012-2013 microchip technology inc. 19.7.3 usb endpoint management registers register 19-21: u1epn: usb endpoint n control registers (n = 0 to 15) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 lspd ( 1 ) retrydis ( 1 ) ? epcondis eprxen eptxen epstall ephshk bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 lspd: low-speed direct connection enable bit (u1ep0 only) ( 1 ) 1 = direct connection to a low-speed device is enabled 0 = direct connection to a low-speed device is disabled bit 6 retrydis: retry disable bit (u1ep0 only) ( 1 ) 1 = retry nak transactions are disabled 0 = retry nak transactions are enabled; retry is done in hardware bit 5 unimplemented: read as ? 0 ? bit 4 epcondis: bidirectional endpoint control bit if eptxen and eprxen = 1 : 1 = disables endpoint n from control transfers; only tx and rx transfers are allowed 0 = enables endpoint n for control (setup) transfers; tx and rx transfers are also allowed for all other combinations of eptxen and eprxen: this bit is ignored. bit 3 eprxen: endpoint receive enable bit 1 = endpoint n receive is enabled 0 = endpoint n receive is disabled bit 2 eptxen: endpoint transmit enable bit 1 = endpoint n transmit is enabled 0 = endpoint n transmit is disabled bit 1 epstall: endpoint stall status bit 1 = endpoint n was stalled 0 = endpoint n was not stalled bit 0 ephshk: endpoint handshake enable bit 1 = endpoint handshake is enabled 0 = endpoint handshake is disabled (typically used for isochronous endpoints) note 1: these bits are available only for u1ep0 and only in host mode. for all other u1epn registers, these bits are always unimplemented and read as ? 0 ?.
? 2012-2013 microchip technology inc. ds30009312b-page 299 PIC24FJ128GC010 family 20.0 data signal modulator the data signal modulator (dsm) allows the user to mix a digital data stream (the ?modulator signal?) with a carrier signal to produce a modulated output. both the carrier and the modulator signals are supplied to the dsm module, either internally from the output of a peripheral, or externally through an input pin. the modulated output signal is generated by perform- ing a logical and operation of both the carrier and modulator signals and then it is provided to the mdout pin. using this method, the dsm can generate the following types of key modulation schemes: ? frequency shift keying (fsk) ? phase-shift keying (psk) ? on-off keying (ook) figure 20-1 shows a simplified block diagram of the data signal modulator peripheral. figure 20-1: simplified block diagram of the data signal modulator note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?data signal modulator (dsm)? (ds39744). the information in this data sheet supersedes the information in the frm. d q mdbit mdmin ssp1 (sdo x ) ssp2 (sdo x ) uart1 (tx) uart2 (tx) uart3 (tx) uart4 (tx) v ss mdcin1 mdcin2 refo clock oc/pwm1 oc/pwm2 oc/pwm3 oc/pwm4 ch<3:0> ms<3:0> cl<3:0> oc/pwm1 oc/pwm2 sync chpol clpol d q 1 0 sync chsync clsync mdout mdopol mdoe mdcarh mdcarl en mden data signal modulator mdcon oc/pwm5 oc/pwm6 oc/pwm7 v ss mdcin1 mdcin2 refo clock oc/pwm1 oc/pwm2 oc/pwm3 oc/pwm4 oc/pwm5 oc/pwm6 oc/pwm7 oc/pwm3 oc/pwm4 oc/pwm5 oc/pwm6 oc/pwm7 1 0
PIC24FJ128GC010 family ds30009312b-page 300 ? 2012-2013 microchip technology inc. register 20-1: mdcon: data sig nal modulator control register r/w-0 u-0 r/w-0 u-0 u-0 u-0 u-0 u-0 mden ?msidl ? ? ? ? ? bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 r/w-0 ? mdoe mdslr mdopol ? ? ?mdbit ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 mden: dsm module enable bit 1 = dsm module is enabled and mixing input signals 0 = dsm module is disabled and has no output bit 14 unimplemented: read as ? 0 ? bit 13 msidl: dsm stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-7 unimplemented: read as ? 0 ? bit 6 mdoe: dsm module pin output enable bit 1 = dsm pin output is enabled 0 = dsm pin output is disabled bit 5 mdslr: mdout pin slew rate limiting bit 1 = mdout pin slew rate limiting is enabled 0 = mdout pin slew rate limiting is disabled bit 4 mdopol: dsm output polarity select bit 1 = dsm output signal is inverted 0 = dsm output signal is not inverted bit 3-1 unimplemented: read as ? 0 ? bit 0 mdbit: dsm manual modulation input bit ( 1 ) 1 = carrier is modulated 0 = carrier is not modulated note 1: the mdbit must be selected as the modulation source (mdsrc<3:0> = 0000 ).
? 2012-2013 microchip technology inc. ds30009312b-page 301 PIC24FJ128GC010 family register 20-2: mdsrc: data signal modulator source control register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-x u-0 u-0 u-0 r/w-x r/w-x r/w-x r/w-x sodis ( 1 ) ? ? ?ms3 ( 2 ) ms2 ( 2 ) ms1 ( 2 ) ms0 ( 2 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 sodis: dsm modulation source output disable bit ( 1 ) 1 = output signal driving the peripheral output pin (selected by ms<3:0>) is disabled 0 = output signal driving the peripheral output pin (selected by ms<3:0>) is enabled bit 6-4 unimplemented: read as ? 0 ? bit 3-0 ms<3:0>: dsm modulation source selection bits ( 2 ) 1111 = unimplemented 1110 = output compare/pwm module 7 output 1101 = output compare/pwm module 6 output 1100 = output compare/pwm module 5 output 1011 = output compare/pwm module 4 output 1010 = output compare/pwm module 3 output 1001 = output compare/pwm module 2 output 1000 = output compare/pwm module 1 output 0111 = uart4 tx output 0110 = uart3 tx output 0101 = uart2 tx output 0100 = uart1 tx output 0011 = spi2 module output (sdo2) 0010 = spi1 module output (sdo1) 0001 = input on mdmin pin 0000 = manual modulation using mdbit (mdcon<0>) note 1: this bit is only affected by a por. 2: these bits are not affected by a por.
PIC24FJ128GC010 family ds30009312b-page 302 ? 2012-2013 microchip technology inc. register 20-3: mdcar: data signal modulator carrier control register r/w-x r/w-x r/w-x u-0 r/w-x r/w-x r/w-x r/w-x chodis chpol chsync ? ch3 ( 1 ) ch2 ( 1 ) ch1 ( 1 ) ch0 ( 1 ) bit 15 bit 8 r/w-0 r/w-x r/w-x u-0 r/w-x r/w-x r/w-x r/w-x clodis clpol clsync ?cl3 ( 1 ) cl2 ( 1 ) cl1 ( 1 ) cl0 ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 chodis: dsm high carrier output disable bit 1 = output signal driving the peripheral output pin (selected by ch<3:0>) is disabled 0 = output signal driving the peripheral output pin is enabled bit 14 chpol: dsm high carrier polarity select bit 1 = selected high carrier signal is inverted 0 = selected high carrier signal is not inverted bit 13 chsync: dsm high carrier synchronization enable bit 1 = modulator waits for a falling edge on the high carrier before allowing a switch to the low carrier 0 = modulator output is not synchronized to the high time carrier signal ( 1 ) bit 12 unimplemented: read as ? 0 ? bit 11-8 ch<3:0>: dsm data high carrier selection bits ( 1 ) 1111 . . . = reserved 1011 1010 = output compare/pwm module 7 output 1001 = output compare/pwm module 6 output 1000 = output compare/pwm module 5 output 0111 = output compare/pwm module 4 output 0110 = output compare/pwm module 3 output 0101 = output compare/pwm module 2 output 0100 = output compare/pwm module 1 output 0011 = reference clock (refo) output 0010 = input on mdcin2 pin 0001 = input on mdcin1 pin 0000 = v ss bit 7 clodis: dsm low carrier output disable bit 1 = output signal driving the peripheral output pin (selected by cl<3:0>) is disabled 0 = output signal driving the peripheral output pin is enabled bit 6 clpol: dsm low carrier polarity select bit 1 = selected low carrier signal is inverted 0 = selected low carrier signal is not inverted bit 5 clsync: dsm low carrier synchronization enable bit 1 = modulator waits for a falling edge on the low carrier before allowing a switch to the high carrier 0 = modulator output is not synchronized to the low time carrier signal ( 1 ) bit 4 unimplemented: read as ? 0 ? bit 3-0 cl<3:0>: dsm data low carrier selection bits ( 1 ) bit settings are identical to those for ch<3:0>. note 1: narrowed carrier pulse widths or spurs may occur in the signal stream if the carrier is not synchronized.
? 2012-2013 microchip technology inc. ds30009312b-page 303 PIC24FJ128GC010 family 21.0 enhanced parallel master port (epmp) the enhanced parallel master port (epmp) module pro- vides a parallel, 4-bit (master mode only), 8-bit (master and slave modes) or 16-bit (master mode only) data bus interface to communicate with off-chip modules, such as memories, fifos, lcd controllers and other microcon- trollers. this module can serve as either the master or the slave on the communication bus. for epmp master modes, all external addresses are mapped into the internal extended data space (eds). this is done by allocating a region of the eds for each chip select (cs) and then assigning each chip select to a particular external resource, such as a memory or external controller. this region should not be assigned to another device resource, such as ram or sfrs. to perform a write or read on an external resource, the cpu simply performs a write or read within the address range assigned for the epmp. key features of the epmp module are: ? extended data space (eds) interface allows direct access from the cpu ? up to 23 programmable address lines ? up to 2 chip select lines ? up to 2 acknowledgment lines (one per chip select) ? 4-bit, 8-bit or 16-bit wide data bus ? programmable strobe options (per chip select): - individual read and write strobes; or - read/write strobe with enable strobe ? programmable address/data multiplexing ? programmable address wait states ? programmable data wait states (per chip select) ? programmable polarity on control signals (per chip select) ? legacy parallel slave port (psp) support ? enhanced parallel slave support: - address support - 4-byte deep auto-incrementing buffer 21.1 specific package variations while all PIC24FJ128GC010 family devices implement the epmp, i/o pin constraints place some limits on 16-bit master mode operations in some package types. this is reflected in the number of dedicated chip select pins implemented and the number of dedicated address lines that are available. the differences are summarized in table 21-1 . all available epmp pin functions are summarized in tab l e 2 1- 2 . for 64-pin devices, the dedicated chip select pins (pmcs1 and pmcs2) are not implemented. in addi- tion, only 16 address lines (pma<15:0>) are available. if required, pma14 and pma15 can be remapped to function as pmcs1 and pmcs2, respectively. the memory space addressable by the device depends on the number of address lines available, as well as the number of chip select signals required for the application. devices with lower pin counts are more affected by chip select requirements, as these take away address lines. table 21-1 shows the maximum addressable range for each pin count. table 21-1: epmp feature differences by device pin count note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ? pic24f family reference manual ?, ?enhanced parallel master port (epmp)? (ds39730). the information in this data sheet supersedes the information in the frm. device dedicated chip select address lines address range (bytes) cs1 cs2 no cs 1 cs 2 cs pic24fjxxxgc006 (64-pin) ? ? 16 64k 32k 16k pic24fjxxxgc010 (100/121-pin) x x 23 16m
PIC24FJ128GC010 family ds30009312b-page 304 ? 2012-2013 microchip technology inc. table 21-2: enhanced parallel master port pin descriptions pin name (alternate function) type description pma<22:16> o address bus bits<22:16> pma<15> (pmcs2) o address bus bit 15 i/o data bus bit 15 (16-bit port with multiplexed addressing) o chip select 2 (alternate location) pma<14> (pmcs1) o address bus bit 14 i/o data bus bit 14 (16-bit port with multiplexed addressing) o chip select 1 (alternate location) pma<13:8> o address bus bits<13:8> i/o data bus bits<13:8> (16-bit port with multiplexed addressing) pma<7:3> o address bus bits<7:3> pma<2> (pmalu) o address bus bit 2 o address latch upper strobe for multiplexed addressing pma<1> (pmalh) i/o address bus bit 1 o address latch high strobe for multiplexed addressing pma<0> (pmall) i/o address bus bit 0 o address latch low strobe for multiplexed addressing pmd<15:8> i/o data bus bits<15:8> (demultiplexed addressing) pmd<7:4> i/o data bus bits<7:4> o address bus bits<7:4> (4-bit port with 1-phase multiplexed addressing) pmd<3:0> i/o data bus bits<3:0> pmcs1 ( 1 ) i/o chip select 1 pmcs2 ( 1 ) o chip select 2 pmwr i/o write strobe ( 2 ) (pmenb) i/o enable signal ( 2 ) pmrd i/o read strobe ( 2 ) (pmrd/pmwr) i/o read/write signal ( 2 ) pmbe1 o byte indicator pmbe0 o nibble or byte indicator pmack1 i acknowledgment signal 1 pmack2 i acknowledgment signal 2 note 1: these pins are implemented in 100/121-pin devices only. 2: signal function depends on the setting of the mode<1:0> and sm bits (pmcon1<9:8> and pmcsxcf<8>).
? 2012-2013 microchip technology inc. ds30009312b-page 305 PIC24FJ128GC010 family register 21-1: pmcon1: ep mp control register 1 r/w-0 u-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 pmpen ? psidl adrmux1 adrmux0 ?mode1mode0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 csf1 csf0 alp almode ? buskeep irqm1 irqm0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 pmpen: parallel master port enable bit 1 = epmp is enabled 0 = epmp is disabled bit 14 unimplemented: read as ? 0 ? bit 13 psidl: epmp stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-11 adrmux<1:0>: address/data multiplexing selection bits 11 = lower address bits are multiplexed with data bits using 3 address phases 10 = lower address bits are multiplexed with data bits using 2 address phases 01 = lower address bits are multiplexed with data bits using 1 address phase 00 = address and data appear on separate pins bit 10 unimplemented: read as ? 0 ? bit 9-8 mode<1:0>: parallel port mode select bits 11 = master mode 10 = enhanced psp; pins used are pmrd, pmwr, pmcs<2:1>, pmd<7:0> and pma<1:0> 01 = buffered psp; pins used are pmrd, pmwr, pmcs<2:1> and pmd<7:0> 00 = legacy psp; pins used are pmrd, pmwr, pmcs<2:1> and pmd<7:0> bit 7-6 csf<1:0>: chip select function bits 11 = reserved 10 = pma<15> is used for chip select 2, pma<14> is used for chip select 1 01 = pma<15> is used for chip select 2, pmcs1 is used for chip select 1 00 = pmcs2 is used for chip select 2, pmcs1 is used for chip select 1 bit 5 alp: address latch polarity bit 1 = active-high (pmall, pmalh and pmalu) 0 = active-low (pmall , pmalh and pmalu ) bit 4 almode: address latch strobe mode bit 1 = enables ?smart? address strobes (each address phase is only present if the current access would cause a different address in the latch than the previous address) 0 = disables ?smart? address strobes bit 3 unimplemented: read as ? 0 ? bit 2 buskeep: bus keeper bit 1 = data bus keeps its last value when not actively being driven 0 = data bus is in a high-impedance state when not actively being driven
PIC24FJ128GC010 family ds30009312b-page 306 ? 2012-2013 microchip technology inc. bit 1-0 irqm<1:0>: interrupt request mode bits 11 = interrupt is generated when read buffer 3 is read or write buffer 3 is written (buffered psp mode), or on a read or write operation when pma<1:0> = 11 (addressable psp mode only) 10 = reserved 01 = interrupt is generated at the end of a read/write cycle 00 = no interrupt is generated register 21-1: pmcon1: epmp co ntrol register 1 (continued) register 21-2: pmcon2: ep mp control register 2 r-0, hsc u-0 r/c-0, hs r/c-0, hs u-0 u-0 u-0 u-0 busy ? error timeout ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 raddr23 ( 1 ) raddr22 ( 1 ) raddr21 ( 1 ) raddr20 ( 1 ) raddr19 ( 1 ) raddr18 ( 1 ) raddr17 ( 1 ) raddr16 ( 1 ) bit 7 bit 0 legend: hs = hardware settable bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown c = clearable bit bit 15 busy: busy bit (master mode only) 1 = port is busy 0 = port is not busy bit 14 unimplemented: read as ? 0 ? bit 13 error: error bit 1 = transaction error (illegal transaction was requested) 0 = transaction completed successfully bit 12 timeout: time-out bit 1 = transaction timed out 0 = transaction completed successfully bit 11-8 unimplemented: read as ? 0 ? bit 7-0 raddr<23:16>: parallel master port reserved address space bits ( 1 ) note 1: if raddr<23:16> = 00000000 , then the last eds address for chip select 2 will be ffffffh.
? 2012-2013 microchip technology inc. ds30009312b-page 307 PIC24FJ128GC010 family register 21-3: pmcon3: ep mp control register 3 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 ptwren ptrden ptbe1en ptbe0en ? awaitm1 awaitm0 awaite bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ?pten22 ( 1 ) pten21 ( 1 ) pten20 ( 1 ) pten19 ( 1 ) pten18 ( 1 ) pten17 ( 1 ) pten16 ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 ptwren: epmp write/enable strobe port enable bit 1 = pmwr/pmenb port is enabled 0 = pmwr/pmenb port is disabled bit 14 ptrden: epmp read/write strobe port enable bit 1 = pmrd/pmwr port is enabled 0 = pmrd/pmwr port is disabled bit 13 ptbe1en: epmp high nibble/byte enable port enable bit 1 = pmbe1 port is enabled 0 = pmbe1 port is disabled bit 12 ptbe0en: epmp low nibble/byte enable port enable bit 1 = pmbe0 port is enabled 0 = pmbe0 port is disabled bit 11 unimplemented: read as ? 0 ? bit 10-9 awaitm<1:0>: address latch strobe wait states bits 11 = wait of 3? t cy 10 = wait of 2? t cy 01 = wait of 1? t cy 00 = wait of ? t cy bit bit 8 awaite: address hold after address latch strobe wait states bit 1 = wait of 1? t cy 0 = wait of ? t cy bit 7 unimplemented: read as ? 0 ? bit 6-0 pten<22:16>: epmp address port enable bits ( 1 ) 1 = pma<22:16> function as epmp address lines 0 = pma<22:16> function as port i/os note 1: these bits are not available in 64-pin devices (pic24fjxxxgc006).
PIC24FJ128GC010 family ds30009312b-page 308 ? 2012-2013 microchip technology inc. register 21-4: pmcon4: ep mp control register 4 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pten15 pten14 pten13 pten12 pten11 pten10 pten9 pten8 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pten7 pten6 pten5 pten4 pten3 pten2 pten1 pten0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 pten15: pma15 port enable bit 1 = pma15 functions as either address line 15 or chip select 2 0 = pma15 functions as port i/o bit 14 pten14: pma14 port enable bit 1 = pma14 functions as either address line 14 or chip select 1 0 = pma14 functions as port i/o bit 13-3 pten<13:3>: epmp address port enable bits 1 = pma<13:3> function as epmp address lines 0 = pma<13:3> function as port i/os bit 2-0 pten<2:0>: pmalu/pmalh/pmall strobe enable bits 1 = pma<2:0> function as either address lines or address latch strobes 0 = pma<2:0> function as port i/os
? 2012-2013 microchip technology inc. ds30009312b-page 309 PIC24FJ128GC010 family register 21-5: pmcsxcf: epmp chip select x configuration register r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 csdis csp cspten bep ? wrsp rdsp sm bit 15 bit 8 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 u-0 ackp ptsz1 ptsz0 ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 csdis: chip select x disable bit 1 = disables the chip select x functionality 0 = enables the chip select x functionality bit 14 csp: chip select x polarity bit 1 = active-high (pmcsx) 0 =active-low (pmcsx ) bit 13 cspten: pmcsx port enable bit 1 = pmcsx port is enabled 0 = pmcsx port is disabled bit 12 bep: chip select x nibble/byte enable polarity bit 1 = nibble/byte enable is active-high (pmbe0, pmbe1) 0 = nibble/byte enable is active-low (pmbe0 , pmbe1 ) bit 11 unimplemented: read as ? 0 ? bit 10 wrsp: chip select x write strobe polarity bit for slave modes and master mode when sm = 0 : 1 = write strobe is active-high (pmwr) 0 = write strobe is active-low (pmwr ) for master mode when sm = 1 : 1 = enable strobe is active-high (pmenb) 0 = enable strobe is active-low (pmenb ) bit 9 rdsp: chip select x read strobe polarity bit for slave modes and master mode when sm = 0 : 1 = read strobe is active-high (pmrd) 0 = read strobe is active-low (pmrd ) for master mode when sm = 1 : 1 = read/write strobe is active-high (pmrd/pmwr ) 0 = read/write strobe is active-low (pmrd /pmwr) bit 8 sm: chip select x strobe mode bit 1 = read/write and enable strobes (pmrd/pmwr and pmenb) 0 = read and write strobes (pmrd and pmwr) bit 7 ackp: chip select x acknowledge polarity bit 1 = ack is active-high (pmack1) 0 = ack is active-low (pmack1 ) bit 6-5 ptsz<1:0>: chip select x port size bits 11 = reserved 10 = 16-bit port size (pmd<15:0>) 01 = 4-bit port size (pmd<3:0>) 00 = 8-bit port size (pmd<7:0>) bit 4-0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 310 ? 2012-2013 microchip technology inc. register 21-6: pmcsxbs: epmp chip select x base address register ( 2 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) base23 base22 base21 base20 base19 base18 base17 base16 bit 15 bit 8 r/w ( 1 ) u-0 u-0 u-0 u-0 u-0 u-0 u-0 base15 ? ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-7 base<23:15>: chip select x base address bits ( 1 ) bit 6-0 unimplemented: read as ? 0 ? note 1: the value at por is 0080h for pmcs1bs and 0880h for pmcs2bs. 2: if the whole pmcs2bs register is written together as 0x0000, then the last eds address for chip select 1 will be ffffffh. in this case, chip select 2 should not be used. pmcs1bs has no such feature.
? 2012-2013 microchip technology inc. ds30009312b-page 311 PIC24FJ128GC010 family register 21-7: pmcsxmd: epmp chip select x mode register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 ackm1 ackm0 amwait2 amwait1 amwait0 ? ? ? bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 dwaitb1 dwaitb0 dwaitm3 dwaitm2 dwaitm1 dwaitm0 dwaite1 dwaite0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 ackm<1:0>: chip select x acknowledge mode bits 11 = reserved 10 = pmackx is used to determine when a read/write operation is complete 01 = pmackx is used to determine when a read/write operation is complete with time-out (if dwaitm<3:0> = 0000 , the maximum time-out is 255 t cy or else it is dwaitm<3:0> cycles) 00 = pmackx is not used bit 13-11 amwait<2:0>: chip select x alternate master wait states bits 111 = wait of 10 alternate master cycles . . . 001 = wait of 4 alternate master cycles 000 = wait of 3 alternate master cycles bit 10-8 unimplemented: read as ? 0 ? bit 7-6 dwaitb<1:0>: chip select x data setup before read/write strobe wait states bits 11 = wait of 3? t cy 10 = wait of 2? t cy 01 = wait of 1? t cy 00 = wait of ? t cy bit 5-2 dwaitm<3:0>: chip select x data read/write strobe wait states bits for write operations: 1111 = wait of 15? t cy . . . 0001 = wait of 1? t cy 0000 = wait of ? t cy for read operations: 1111 = wait of 15? t cy . . . 0001 = wait of 1? t cy 0000 = wait of ? t cy bit 1-0 dwaite<1:0>: chip select x data hold after read/write strobe wait states bits for write operations: 11 = wait of 3? t cy 10 = wait of 2? t cy 01 = wait of 1? t cy 00 = wait of ? t cy for read operations: 11 = wait of 3 t cy 10 = wait of 2 t cy 01 = wait of 1 t cy 00 = wait of 0 t cy
PIC24FJ128GC010 family ds30009312b-page 312 ? 2012-2013 microchip technology inc. register 21-8: pmstat: epmp status register (slave mode only) r-0, hsc r/w-0, hs u-0 u-0 r-0, hsc r-0, hsc r-0, hsc r-0, hsc ibf ibov ? ?ib3f ( 1 ) ib2f ( 1 ) ib1f ( 1 ) ib0f ( 1 ) bit 15 bit 8 r-1, hsc r/w-0, hs u-0 u-0 r-1, hsc r-1, hsc r-1, hsc r-1, hsc obe obuf ? ? ob3e ob2e ob1e ob0e bit 7 bit 0 legend: hs = hardware settable bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 ibf: input buffer full status bit 1 = all writable input buffer registers are full 0 = some or all of the writable input buffer registers are empty bit 14 ibov: input buffer overflow status bit 1 = a write attempt to a full input register occurred (must be cleared in software) 0 = no overflow occurred bit 13-12 unimplemented: read as ? 0 ? bit 11-8 ib3f:ib0f: input buffer x status full bits ( 1 ) 1 = input buffer contains unread data (reading the buffer will clear this bit) 0 = input buffer does not contain unread data bit 7 obe: output buffer empty status bit 1 = all readable output buffer registers are empty 0 = some or all of the readable output buffer registers are full bit 6 obuf: output buffer underflow status bit 1 = a read occurred from an empty output register (must be cleared in software) 0 = no underflow occurred bit 5-4 unimplemented: read as ? 0 ? bit 3-0 ob3e:ob0e: output buffer x status empty bit 1 = output buffer is empty (writing data to the buffer will clear this bit) 0 = output buffer contains untransmitted data note 1: even though an individual bit represents the byte in the buffer, the bits corresponding to the word (byte 0 and 1 or byte 2 and 3) get cleared, even on byte reading.
? 2012-2013 microchip technology inc. ds30009312b-page 313 PIC24FJ128GC010 family register 21-9: padcfg1: pad co nfiguration control register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 ? ? ? ? ? ? ?pmpttl bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-1 unimplemented: read as ? 0 ? bit 0 pmpttl: epmp module ttl input buffer select bit 1 = epmp module inputs (pmdx, pmcs1) use ttl input buffers 0 = epmp module inputs use schmitt trigger input buffers
PIC24FJ128GC010 family ds30009312b-page 314 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 315 PIC24FJ128GC010 family 22.0 liquid crystal display (lcd) controller the liquid crystal display (lcd) controller generates the data and timing control required to directly drive a static or multiplexed lcd panel. in 100-pin devices (pic24fjxxxgc010), the module can drive panels of up to eight commons and up to 59 segments when 5 to 8 commons are used, or up to 63 segments when 1 to 4 commons are used. the module has these features: ? direct driving of lcd panel ? three lcd clock sources with selectable prescaler ? up to eight commons: - static (one common) - 1/2 multiplex (two commons) - 1/3 multiplex (three commons) - 1/8 multiplex (eight commons) ? ability to drive from 29 (in 64-pin devices) to 63 (100/121-pin) segments, depending on the multiplexing mode selected ? static, 1/2 or 1/3 lcd bias ? on-chip bias generator with dedicated charge pump to support a range of fixed and variable bias options ? internal resistors for bias voltage generation ? software contrast control for lcd using internal biasing a simplified block diagram of the module is shown in figure 22-1 . figure 22-1: lcd contro ller module block diagram note: this data sheet summarizes the features of the PIC24FJ128GC010 family of devices. it is not intended to be a compre- hensive reference source. to complement the information in this data sheet, refer to the ?pic24f family reference manual? , ?liquid crystal display (lcd)? (ds39740) which is available from the microchip web site ( www.microchip.com ). com<7:0> data bus sosc frc oscillator lprc oscillator 512 to 64 mux seg<62:0> to i/o pins 32 x 16 (= 8 x 64) lcd data lcddata0 lcddata1 lcddata30 lcddata31 . . . lcd bias generation lcd clock source select lcd charge pump 64 8 bias voltage 16 (secondary oscillator) resistor ladder lcdref lcdreg lcdcon lcdps lcdsex timing control
PIC24FJ128GC010 family ds30009312b-page 316 ? 2012-2013 microchip technology inc. 22.1 registers the lcd controller has up to 40 registers: ? lcd control register (lcdcon) ? lcd charge pump control register (lcdreg) ? lcd phase register (lcdps) ? lcd voltage ladder control register (lcdref) ? four lcd segment enable registers (lcdse3:lcdse0) ? up to 32 lcd data registers (lcddata31:lcd- data0) register 22-1: lcdcon: lcd control register r/w-0 u-0 r/w-0 u-0 u-0 u-0 u-0 u-0 lcden ? lcdsidl ? ? ? ? ? bit 15 bit 8 u-0 r/w-0 r/c-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? slpen werr cs1 cs0 lmux2 lmux1 lmux0 bit 7 bit 0 legend: c = clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 lcden: lcd driver enable bit 1 = lcd driver module is enabled 0 = lcd driver module is disabled bit 14 unimplemented: read as ? 0 ? bit 13 lcdsidl: stop lcd drive in cpu idle mode control bit 1 = lcd driver halts in cpu idle mode 0 = lcd driver continues to operate in cpu idle mode bit 12-7 unimplemented: read as ? 0 ? bit 6 slpen: lcd driver enable in sleep mode bit 1 = lcd driver module is disabled in sleep mode 0 = lcd driver module is enabled in sleep mode bit 5 werr: lcd write failed error bit 1 = lcddatax register is written while wa (lcdps<4>) = 0 (must be cleared in software) 0 = no lcd write error bit 4-3 cs<1:0>: clock source select bits 00 =frc 01 =lprc 1x =sosc
? 2012-2013 microchip technology inc. ds30009312b-page 317 PIC24FJ128GC010 family bit 2-0 lmux<2:0>: lcd commons select bits register 22-1: lcdcon: lcd co ntrol register (continued) lmux<2:0> multiplex bias 111 1/8 mux (com<7:0>) 1/3 110 1/7 mux (com<6:0>) 1/3 101 1/6 mux (com<5:0>) 1/3 100 1/5 mux (com<4:0>) 1/3 011 1/4 mux (com<3:0>) 1/3 010 1/3 mux (com<2:0>) 1/2 or 1/3 001 1/2 mux (com<1:0>) 1/2 or 1/3 000 static (com0) static note: for multiplex above 4 commons, com4, com5, com6 and com7 also have segment functionality. therefore, if the com is enabled in multiplexing, the segment will not be available on that pin. register 22-2: lcdreg: lcd charge pump control register rw-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 cpen ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 rw-1 rw-1 rw-1 rw-1 rw-0 rw-0 ? ? bias2 bias1 bias0 mode13 cksel1 cksel0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 cpen: 3.6v charge pump enable bit 1 = the regulator generates the highest (3.6v) voltage 0 = highest voltage in the system is supplied externally (av dd ) bit 14-6 unimplemented: read as ? 0 ? bit 5-3 bias<2:0>: regulator voltage output control bits 111 = 3.60v peak (offset on lcdbias0 of 0v) 110 = 3.47v peak (offset on lcdbias0 of 0.13v) 101 = 3.34v peak (offset on lcdbias0 of 0.26v) 100 = 3.21v peak (offset on lcdbias0 of 0.39v) 011 = 3.08v peak (offset on lcdbias0 of 0.52v) 010 = 2.95v peak (offset on lcdbias0 of 0.65v) 001 = 2.82v peak (offset on lcdbias0 of 0.78v) 000 = 2.69v peak (offset on lcdbias0 of 0.91v) bit 2 mode13: 1/3 lcd bias enable bit 1 = regulator output supports 1/3 lcd bias mode 0 = regulator output supports static lcd bias mode bit 1-0 clksel<1:0>: regulator clock select control bits 11 =sosc 10 =8 mhz frc 01 = lprc 31 khz 00 = disables regulator and floats regulator voltage output
PIC24FJ128GC010 family ds30009312b-page 318 ? 2012-2013 microchip technology inc. register 22-3: lcdps: lcd phase register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 r-0 r-0 r/w-0 r/w-0 r/w-0 r/w-0 wft biasmd lcda wa lp3 lp2 lp1 lp0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 wft: waveform type select bit 1 = type-b waveform (phase changes on each frame boundary) 0 = type-a waveform (phase changes within each common type) bit 6 biasmd: bias mode select bit when lmux<2:0> = 000 or 011 through 111 : 0 = static bias mode (do not set this bit to ? 1 ?) when lmux<2:0> = 001 or 010 : 1 = 1/2 bias mode 0 = 1/3 bias mode bit 5 lcda: lcd active status bit 1 = lcd driver module is active 0 = lcd driver module is inactive bit 4 wa: lcd write allow status bit 1 = write into the lcddatax registers is allowed 0 = write into the lcddatax registers is not allowed bit 3-0 lp<3:0>: lcd prescaler select bits 1111 = 1:16 1110 = 1:15 1101 = 1:14 1100 = 1:13 1011 = 1:12 1010 = 1:11 1001 = 1:10 1000 = 1:9 0111 = 1:8 0110 = 1:7 0101 = 1:6 0100 = 1:5 0011 = 1:4 0010 = 1:3 0001 = 1:2 0000 = 1:1
? 2012-2013 microchip technology inc. ds30009312b-page 319 PIC24FJ128GC010 family register 22-4: lcdsex: lcd segment x enable register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 se(n+15) ( 1 , 2 ) se(n+14) se(n+13) se(n+12) se(n+11) se(n+10) se(n+9) se(n+8) bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 se(n+7) se(n+6) se(n+5) se(n+4) se(n+3) se(n+2) se(n+1) se(n) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 7-0 se(n+15):se(n) : segment enable bits for lcdse0: n = 0 for lcdse1: n = 16 for lcdse2: n = 32 for lcdse3: n = 48 ( 1 , 2 ) 1 = segment function of the pin is enabled, digital i/o is disabled 0 = segment function of the pin is disabled, digital i/o is enabled note 1: se63 (lcdse3<15>) is not implemented. 2: for the seg49 to work correctly, the jtag needs to be disabled. register 22-5: lcddatax: lcd data x register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 s(n+15)cy s(n+14)cy s(n+13)cy s(n+12)cy s(n+11)cy s(n+10)cy s(n+9)cy s(n+8)cy bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 s(n+7)cy s(n+6)cy s(n+5)cy s(n+4)cy s(n+3)cy s(n+2)cy s(n+1)cy s(n)cy bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-0 s(n+15)cy:s(n)cy : pixel on bits for registers, lcddata0 through lcddata3: n = (16x), y = 0 for registers, lcddata4 through lcddata7: n = (16(x ? 4)), y = 1 for registers, lcddata8 through lcddata11: n = (16(x ? 8)), y = 2 for registers, lcddata12 through lcddata15: n = (16(x ? 12)), y = 3 for registers, lcddata16 through lcddata19: n = (16(x ? 16)), y = 4 for registers, lcddata20 through lcddata23: n = (16(x ? 20)), y = 5 for registers, lcddata24 through lcddata27: n = (16(x ? 24)), y = 6 for registers, lcddata28 through lcddata31: n = (16(x ? 28)), y = 7 1 = pixel is on 0 = pixel is off
PIC24FJ128GC010 family ds30009312b-page 320 ? 2012-2013 microchip technology inc. table 22-1: lcddata registers and bits for segment and com combinations com lines segments 0 to 15 16 to 31 32 to 47 48 to 64 0 lcddata0 s00c0:s15c0 lcddata1 s16c0:s31c0 lcddata2 s32c0:s47c0 lcddata3 s48c0:s63c0 1 lcddata4 s00c1:s15c1 lcddata5 s16c1:s31c1 lcddata6 s32c1:s47c1 lcddata7 s48c1:s63c1 2 lcddata8 s00c2:s15c2 lcddata9 s16c2:s31c2 lcddata10 s32c2:s47c2 lcddata11 s48c2:s63c2 3 lcddata12 s00c3:s15c3 lcddata13 s16c3:s31c3 lcddata14 s32c3:s47c3 lcddata15 s48c3:s63c3 4 lcddata16 s00c4:s15c4 lcddata17 s16c4:s31c4 lcddata18 s32c4:s47c4 lcddata19 s48c4:s59c4 5 lcddata20 s00c5:s15c5 lcddata21 s16c5:s31c5 lcddata22 s32c5:s47c5 lcddata23 s48c5:s69c5 6 lcddata24 s00c6:s15c6 lcddata25 s16c6:s31c6 lcddata26 s32c6:s47c6 lcddata27 s48c6:s59c6 7 lcddata28 s00c7:s15c7 lcddata29 s16c7:s31c7 lcddata30 s32c7:s47c7 lcddata31 s48c7:s59c7
? 2012-2013 microchip technology inc. ds30009312b-page 321 PIC24FJ128GC010 family register 22-6: lcdref: lcd refe rence ladder control register r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 lcdire ? lcdcst2 lcdcst1 lcdcst0 vlcd3pe vlcd2pe vlcd1pe bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 lrlap1 lrlap0 lrlbp1 lrlbp0 ? lrlat2 lrlat1 lrlat0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 lcdire : lcd internal reference enable bit 1 = internal lcd reference is enabled and connected to the internal contrast control circuit 0 = internal lcd reference is disabled bit 14 unimplemented : read as ? 0 ? bit 13-11 lcdcst<2:0> : lcd contrast control bits selects the resistance of the lcd contrast control resistor ladder: 111 = resistor ladder is at maximum resistance (minimum contrast) 110 = resistor ladder is at 6/7th of maximum resistance 101 = resistor ladder is at 5/7th of maximum resistance 100 = resistor ladder is at 4/7th of maximum resistance 011 = resistor ladder is at 3/7th of maximum resistance 010 = resistor ladder is at 2/7th of maximum resistance 001 = resistor ladder is at 1/7th of maximum resistance 000 = minimum resistance (maximum contrast); resistor ladder is shorted bit 10 vlcd3pe : lcd bias 3 pin enable bit 1 = bias 3 level is connected to the external pin, lcdbias3 0 = bias 3 level is internal (internal resistor ladder) bit 9 vlcd2pe : lcd bias 2 pin enable bit 1 = bias 2 level is connected to the external pin, lcdbias2 0 = bias 2 level is internal (internal resistor ladder) bit 8 vlcd1pe : lcd bias 1 pin enable bit 1 = bias 1 level is connected to the external pin, lcdbias1 0 = bias 1 level is internal (internal resistor ladder) bit 7-6 lrlap<1:0> : lcd reference ladder a time power control bits during time interval a: 11 = internal lcd reference ladder is powered in high-power mode 10 = internal lcd reference ladder is powered in medium power mode 01 = internal lcd reference ladder is powered in low-power mode 00 = internal lcd reference ladder is powered down and unconnected bit 5-4 lrlbp<1:0> : lcd reference ladder b time power control bits during time interval b: 11 = internal lcd reference ladder is powered in high-power mode 10 = internal lcd reference ladder is powered in medium power mode 01 = internal lcd reference ladder is powered in low-power mode 00 = internal lcd reference ladder is powered down and unconnected bit 3 unimplemented : read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 322 ? 2012-2013 microchip technology inc. bit 2-0 lrlat<2:0> : lcd reference ladder a time interval control bits sets the number of 32 clock counts when the a time interval power mode is active. for type-a waveforms (wft = 0 ): 111 = internal lcd reference ladder is in a power mode for 7 clocks and b power mode for 9 clocks 110 = internal lcd reference ladder is in a power mode for 6 clocks and b power mode for 10 clocks 101 = internal lcd reference ladder is in a power mode for 5 clocks and b power mode for 11 clocks 100 = internal lcd reference ladder is in a power mode for 4 clocks and b power mode for 12 clocks 011 = internal lcd reference ladder is in a power mode for 3 clocks and b power mode for 13 clocks 010 = internal lcd reference ladder is in a power mode for 2 clocks and b power mode for 14 clocks 001 = internal lcd reference ladder is in a power mode for 1 clock and b power mode for 15 clocks 000 = internal lcd reference ladder is always in b power mode for type-b waveforms (wft = 1 ): 111 = internal lcd reference ladder is in a power mode for 7 clocks and b power mode for 25 clocks 110 = internal lcd reference ladder is in a power mode for 6 clocks and b power mode for 26 clocks 101 = internal lcd reference ladder is in a power mode for 5 clocks and b power mode for 27 clocks 100 = internal lcd reference ladder is in a power mode for 4 clocks and b power mode for 28 clocks 011 = internal lcd reference ladder is in a power mode for 3 clocks and b power mode for 29 clocks 010 = internal lcd reference ladder is in a power mode for 2 clocks and b power mode for 30 clocks 001 = internal lcd reference ladder is in a power mode for 1 clock and b power mode for 31 clocks 000 = internal lcd reference ladder is always in b power mode register 22-6: lcdref: lcd reference ladder control register (continued)
? 2012-2013 microchip technology inc. ds30009312b-page 323 PIC24FJ128GC010 family 23.0 real-time clock and calendar (rtcc) the rtcc provides the user with a real-time clock and calendar (rtcc) function that can be calibrated. key features of the rtcc module are: ? operates in deep sleep mode ? selectable clock source ? provides hours, minutes and seconds using 24-hour format ? visibility of one half second period ? provides calendar ? weekday, date, month and year ? alarm-configurable for half a second, one second, 10 seconds, one minute, 10 minutes, one hour, one day, one week, one month or one year ? alarm repeat with decrementing counter ? alarm with indefinite repeat chime ? year 2000 to 2099 leap year correction ? bcd format for smaller software overhead ? optimized for long-term battery operation ? user calibration of the 32.768 khz clock crystal/32k intrc frequency with periodic auto-adjust ? optimized for long-term battery operation ? fractional second synchronization ? calibration to within 2.64 seconds error per month ? calibrates up to 260 ppm of crystal error ? ability to periodically wake up external devices without cpu intervention (external power control) ? power control output for external circuit control ? calibration takes effect every 15 seconds ? runs from any one of the following: - external real-time clock (rtc) of 32.768 khz - internal 31.25 khz lprc clock - 50 hz or 60 hz external input 23.1 rtcc source clock the user can select between the sosc crystal oscillator, lprc internal oscillator or an external 50 hz/60 hz power line input as the clock reference for the rtcc module. this gives the user an option to trade off system cost, accuracy and power consumption, based on the overall system needs. figure 23-1: rtcc block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information on the real-time clock and calendar, refer to the ?pic24f family reference manual? , ?real-time clock and calendar (rtcc)? (ds39696). rtcc clock domain cpu clock domain rtcc rtcc prescalers rtcc timer comparator alarm registers with masks repeat counter 0.5 sec alrmval rtcval alcfgrpt rcfgcal alarm event year mthdy wkdyhr minsec almthdy alwdhr alminsec rtcc interrupt rtcout<1:0> rtcoe 10 01 00 clock source 1s pin alarm input from sosc/lprc oscillator or external source rtcc interrupt logic pulse
PIC24FJ128GC010 family ds30009312b-page 324 ? 2012-2013 microchip technology inc. 23.2 rtcc module registers the rtcc module registers are organized into three categories: ? rtcc control registers ? rtcc value registers ? alarm value registers 23.2.1 register mapping to limit the register interface, the rtcc timer and alarm time registers are accessed through corre- sponding register pointers. the rtcc value register window (rtcvalh and rtcvall) uses the rtcptr<1:0> bits (rcfgcal<9:8>) to select the desired timer register pair (see tab l e 2 3- 1 ). by writing the rtcvalh byte, the rtcc pointer value, the rtcptr<1:0> bits decrement by one until they reach ? 00 ?. once they reach ? 00 ?, the minutes and seconds value will be accessible through rtcvalh and rtcvall until the pointer value is manually changed. table 23-1: rtcval register mapping the alarm value register window (alrmvalh and alrmvall) uses the alrmptr<1:0> bits (alcfgrpt<9:8>) to select the desired alarm register pair (see table 23-2 ). by writing the alrmvalh byte, the alarm pointer value, alrmptr<1:0> bits, decrement by one until they reach ? 00 ?. once they reach ? 00 ?, the alrmmin and alrmsec value will be accessible through alrmvalh and alrmvall until the pointer value is manually changed. table 23-2: alrmval register mapping considering that the 16-bit core does not distinguish between 8-bit and 16-bit read operations, the user must be aware that when reading either the alrmvalh or alrmvall bytes, the alrmptr<1:0> value will be decremented. the same applies to the rtcvalh or rtcvall bytes with the rtcptr<1:0> bits being decremented. 23.2.2 write lock in order to perform a write to any of the rtcc timer registers, the rtcwren bit (rcfgcal<13>) must be set (see example 23-1 ). 23.2.3 selecting rtcc clock source the clock source for the rtcc module can be selected using the rtclk<1:0> bits in the rtcpwc register. when the bits are set to ? 00 ?, the secondary oscillator (sosc) is used as the reference clock and when the bits are ? 01 ?, lprc is used as the reference clock. when rtclk<1:0> = 10 and 11 , the external power line (50 hz and 60 hz) is used as the clock source. example 23-1: setting the rtcwren bit rtcptr<1:0> rtcc value register window rtcval<15:8> rtcval<7:0> 00 minutes seconds 01 weekday hours 10 month day 11 ? year alrmptr <1:0> alarm value register window alrmval<15:8> alrmval<7:0> 00 alrmmin alrmsec 01 alrmwd alrmhr 10 alrmmnth alrmday 11 ?? note: this only applies to read operations and not write operations. note: to avoid accidental writes to the timer, it is recommended that the rtcwren bit (rcfgcal<13>) is kept clear at any other time. for the rtcwren bit to be set, there is only one instruction cycle time window allowed between the 55h/aa sequence and the setting of rtcwren; therefore, it is recommended that code follow the procedure in example 23-1 . asm volatile (?push w7?); asm volatile (?push w8?); asm volatile (?disi #5?); asm volatile (?mov #0x55, w7?); asm volatile (?mov w7, _nvmkey?); asm volatile (?mov #0xaa, w8?); asm volatile (?mov w8, _nvmkey?); asm volatile (?bset _rcfgcal, #13?); //set the rtcwren bit asm volatile (?pop w8?); asm volatile (?pop w7?);
? 2012-2013 microchip technology inc. ds30009312b-page 325 PIC24FJ128GC010 family 23.3 registers 23.3.1 rtcc control registers register 23-1: rcfgcal: rtcc calibration/configuration register ( 1 ) r/w-0 u-0 r/w-0 r-0, hsc r-0, hsc r/w-0 r/w-0 r/w-0 rtcen ( 2 ) ? rtcwren rtcsync halfsec ( 3 ) rtcoe rtcptr1 rtcptr0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 cal7 cal6 cal5 cal4 cal3 cal2 cal1 cal0 bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 rtcen: rtcc enable bit ( 2 ) 1 = rtcc module is enabled 0 = rtcc module is disabled bit 14 unimplemented: read as ? 0 ? bit 13 rtcwren: rtcc value registers write enable bit 1 = rtcvalh and rtcvall registers can be written to by the user 0 = rtcvalh and rtcvall registers are locked out from being written to by the user bit 12 rtcsync: rtcc value registers read synchronization bit 1 = rtcvalh, rtcvall and alcfgrpt registers can change while reading due to a rollover ripple resulting in an invalid data read. if the register is read twice and results in the same data, the data can be assumed to be valid. 0 = rtcvalh, rtcvall or alcfgrpt registers can be read without concern over a rollover ripple bit 11 halfsec: half second status bit ( 3 ) 1 = second half period of a second 0 = first half period of a second bit 10 rtcoe: rtcc output enable bit 1 = rtcc output is enabled 0 = rtcc output is disabled bit 9-8 rtcptr<1:0>: rtcc value register window pointer bits points to the corresponding rtcc value registers when reading the rtcvalh and rtcvall registers. the rtcptr<1:0> value decrements on every read or write of rtcvalh until it reaches ? 00 ?. rtcval<15:8>: 11 = reserved 10 = month 01 = weekday 00 = minutes rtcval<7:0>: 11 = year 10 = day 01 = hours 00 = seconds note 1: the rcfgcal register is only affected by a por. 2: a write to the rtcen bit is only allowed when rtcwren = 1 . 3: this bit is read-only; it is cleared to ? 0 ? on a write to the lower half of the minsec register.
PIC24FJ128GC010 family ds30009312b-page 326 ? 2012-2013 microchip technology inc. bit 7-0 cal<7:0>: rtc drift calibration bits 01111111 = maximum positive adjustment; adds 127 rtc clock pulses every 15 seconds . . . 01111111 = minimum positive adjustment; adds 1 rtc clock pulse every 15 seconds 00000000 = no adjustment 11111111 = minimum negative adjustment; subtracts 1 rtc clock pulse every 15 seconds . . . 10000000 = maximum negative adjustment; subtracts 128 rtc clock pulses every 15 seconds register 23-1: rcfgcal: rtcc calibration/configuration register ( 1 ) (continued) note 1: the rcfgcal register is only affected by a por. 2: a write to the rtcen bit is only allowed when rtcwren = 1 . 3: this bit is read-only; it is cleared to ? 0 ? on a write to the lower half of the minsec register.
? 2012-2013 microchip technology inc. ds30009312b-page 327 PIC24FJ128GC010 family register 23-2: rtcpwc: rtcc power control register ( 1 ) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pwcen pwcpol pwcpre pwspre rtclk1 ( 2 ) rtclk0 ( 2 ) rtcout1 rtcout0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 pwcen: power control enable bit 1 = power control is enabled 0 = power control is disabled bit 14 pwcpol: power control enable bit 1 = power control is enabled 0 = power control is disabled bit 13 pwcpre: power control/stability prescaler bit 1 = pwc stability window clock is divide-by-2 of source rtcc clock 0 = pwc stability window clock is divide-by-1 of source rtcc clock bit 12 pwspre: power control sample prescaler bit 1 = pwc sample window clock is divide-by-2 of source rtcc clock 0 = pwc sample window clock is divide-by-1 of source rtcc clock bit 11-10 rtclk<1:0>: rtcc clock source select bits ( 2 ) 11 = external power line (60 hz) 10 = external power line source (50 hz) 01 = internal lprc oscillator 00 = external secondary oscillator (sosc) bit 9-8 rtcout<1:0>: rtcc output source select bits 11 = power control 10 = rtcc clock 01 = rtcc seconds clock 00 = rtcc alarm pulse bit 7-0 unimplemented: read as ? 0 ? note 1: the rtcpwc register is only affected by a por. 2: when a new value is written to these register bits, the lower half of the minsec register should also be written to properly reset the clock prescalers in the rtcc.
PIC24FJ128GC010 family ds30009312b-page 328 ? 2012-2013 microchip technology inc. register 23-3: alcfgrpt: al arm configuration register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 alrmen chime amask3 amask2 amask1 amask0 alrmptr1 alrmptr0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 arpt7 arpt6 arpt5 arpt4 arpt3 arpt2 arpt1 arpt0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 alrmen: alarm enable bit 1 = alarm is enabled (cleared automatically after an alarm event whenever arpt<7:0> = 00h and chime = 0 ) 0 = alarm is disabled bit 14 chime: chime enable bit 1 = chime is enabled; arpt<7:0> bits are allowed to roll over from 00h to ffh 0 = chime is disabled; arpt<7:0> bits stop once they reach 00h bit 13-10 amask<3:0>: alarm mask configuration bits 0000 = every half second 0001 = every second 0010 = every 10 seconds 0011 = every minute 0100 = every 10 minutes 0101 = every hour 0110 = once a day 0111 = once a week 1000 = once a month 1001 = once a year (except when configured for february 29 th , once every 4 years) 101x = reserved ? do not use 11xx = reserved ? do not use bit 9-8 alrmptr<1:0>: alarm value register window pointer bits points to the corresponding alarm value registers when reading the alrmvalh and alrmvall registers. the alrmptr<1:0> value decrements on every read or write of alrmvalh until it reaches ? 00 ?. alrmval<15:8>: 00 = alrmmin 01 = alrmwd 10 = alrmmnth 11 = unimplemented alrmval<7:0>: 00 = alrmsec 01 = alrmhr 10 = alrmday 11 = unimplemented bit 7-0 arpt<7:0>: alarm repeat counter value bits 11111111 = alarm will repeat 255 more times . . . 00000000 = alarm will not repeat the counter decrements on any alarm event; it is prevented from rolling over from 00h to ffh unless chime = 1 .
? 2012-2013 microchip technology inc. ds30009312b-page 329 PIC24FJ128GC010 family 23.3.2 rtcval register mappings register 23-4: year: year value register ( 1 ) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x yrten3 yrten2 yrten2 yrten1 yrone3 yrone2 yrone1 yrone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7-4 yrten<3:0>: binary coded decimal value of year?s tens digit bits contains a value from 0 to 9. bit 3-0 yrone<3:0>: binary coded decimal value of year?s ones digit bits contains a value from 0 to 9. note 1: a write to the year register is only allowed when rtcwren = 1 . register 23-5: mthdy: month and day value register ( 1 ) u-0 u-0 u-0 r/w-x r/w-x r/w-x r/w-x r/w-x ? ? ? mthten0 mthone3 mthone2 mthone1 mthone0 bit 15 bit 8 u-0 u-0 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x ? ? dayten1 dayten0 dayone3 dayone2 dayone1 dayone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-13 unimplemented: read as ? 0 ? bit 12 mthten0: binary coded decimal value of month?s tens digit bit contains a value of ? 0 ? or ? 1 ?. bit 11-8 mthone<3:0>: binary coded decimal value of month?s ones digit bits contains a value from 0 to 9. bit 7-6 unimplemented: read as ? 0 ? bit 5-4 dayten<1:0>: binary coded decimal value of day?s tens digit bits contains a value from 0 to 3. bit 3-0 dayone<3:0>: binary coded decimal value of day?s ones digit bits contains a value from 0 to 9. note 1: a write to this register is only allowed when rtcwren = 1 .
PIC24FJ128GC010 family ds30009312b-page 330 ? 2012-2013 microchip technology inc. register 23-6: wkdyhr: weekday and hours value register ( 1 ) u-0 u-0 u-0 u-0 u-0 r/w-x r/w-x r/w-x ? ? ? ? ? wday2 wday1 wday0 bit 15 bit 8 u-0 u-0 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x ? ? hrten1 hrten0 hrone3 hrone2 hrone1 hrone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as ? 0 ? bit 10-8 wday<2:0>: binary coded decimal value of weekday digit bits contains a value from 0 to 6. bit 7-6 unimplemented: read as ? 0 ? bit 5-4 hrten<1:0>: binary coded decimal value of hour?s tens digit bits contains a value from 0 to 2. bit 3-0 hrone<3:0>: binary coded decimal value of hour?s ones digit bits contains a value from 0 to 9. note 1: a write to this register is only allowed when rtcwren = 1 . register 23-7: minsec: minutes and seconds value register u-0 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x ? minten2 minten1 minten0 minone3 minone2 minone1 minone0 bit 15 bit 8 u-0 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x ? secten2 secten1 secten0 secone3 secone2 secone1 secone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 minten<2:0>: binary coded decimal value of minute?s tens digit bits contains a value from 0 to 5. bit 11-8 minone<3:0>: binary coded decimal value of minute?s ones digit bits contains a value from 0 to 9. bit 7 unimplemented: read as ? 0 ? bit 6-4 secten<2:0>: binary coded decimal value of second?s tens digit bits contains a value from 0 to 5. bit 3-0 secone<3:0>: binary coded decimal value of second?s ones digit bits contains a value from 0 to 9.
? 2012-2013 microchip technology inc. ds30009312b-page 331 PIC24FJ128GC010 family 23.3.3 alrmval register mappings register 23-8: almthdy: alarm month and day value register ( 1 ) u-0 u-0 u-0 r/w-x r/w-x r/w-x r/w-x r/w-x ? ? ? mthten0 mthone3 mthone2 mthone1 mthone0 bit 15 bit 8 u-0 u-0 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x ? ? dayten1 dayten0 dayone3 dayone2 dayone1 dayone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-13 unimplemented: read as ? 0 ? bit 12 mthten0: binary coded decimal value of month?s tens digit bit contains a value of ? 0 ? or ? 1 ?. bit 11-8 mthone<3:0>: binary coded decimal value of month?s ones digit bits contains a value from 0 to 9. bit 7-6 unimplemented: read as ? 0 ? bit 5-4 dayten<1:0>: binary coded decimal value of day?s tens digit bits contains a value from 0 to 3. bit 3-0 dayone<3:0>: binary coded decimal value of day?s ones digit bits contains a value from 0 to 9. note 1: a write to this register is only allowed when rtcwren = 1 . register 23-9: alwdhr: alarm weekday and hours value register ( 1 ) u-0 u-0 u-0 u-0 u-0 r/w-x r/w-x r/w-x ? ? ? ? ? wday2 wday1 wday0 bit 15 bit 8 u-0 u-0 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x ? ? hrten1 hrten0 hrone3 hrone2 hrone1 hrone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as ? 0 ? bit 10-8 wday<2:0>: binary coded decimal value of weekday digit bits contains a value from 0 to 6. bit 7-6 unimplemented: read as ? 0 ? bit 5-4 hrten<1:0>: binary coded decimal value of hour?s tens digit bits contains a value from 0 to 2. bit 3-0 hrone<3:0>: binary coded decimal value of hour?s ones digit bits contains a value from 0 to 9. note 1: a write to this register is only allowed when rtcwren = 1 .
PIC24FJ128GC010 family ds30009312b-page 332 ? 2012-2013 microchip technology inc. register 23-10: alminsec: alarm mi nutes and seconds value register u-0 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x ? minten2 minten1 minten0 minone3 minone2 minone1 minone0 bit 15 bit 8 u-0 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x ? secten2 secten1 secten0 secone3 secone2 secone1 secone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-12 minten<2:0>: binary coded decimal value of minute?s tens digit bits contains a value from 0 to 5. bit 11-8 minone<3:0>: binary coded decimal value of minute?s ones digit bits contains a value from 0 to 9. bit 7 unimplemented: read as ? 0 ? bit 6-4 secten<2:0>: binary coded decimal value of second?s tens digit bits contains a value from 0 to 5. bit 3-0 secone<3:0>: binary coded decimal value of second?s ones digit bits contains a value from 0 to 9.
? 2012-2013 microchip technology inc. ds30009312b-page 333 PIC24FJ128GC010 family 23.4 calibration the real-time crystal input can be calibrated using the periodic auto-adjust feature. when properly calibrated, the rtcc can provide an error of less than 3 seconds per month. this is accomplished by finding the number of error clock pulses and storing the value into the lower half of the rcfgcal register. the 8-bit signed value loaded into the lower half of rcfgcal is multiplied by four and will either be added or subtracted from the rtcc timer, once every minute. refer to the steps below for rtcc calibration: 1. using another timer resource on the device, the user must find the error of the 32.768 khz crystal. 2. once the error is known, it must be converted to the number of error clock pulses per minute. 3. a) if the oscillator is faster than ideal (negative result from step 2), the rcfgcal register value must be negative. this causes the specified number of clock pulses to be subtracted from the timer counter, once every minute. b) if the oscillator is slower than ideal (positive result from step 2), the rcfgcal register value must be positive. this causes the specified number of clock pulses to be subtracted from the timer counter, once every minute. equation 23-1: writes to the lower half of the rcfgcal register should only occur when the timer is turned off, or immediately after the rising edge of the seconds pulse, except when seconds = 00, 15, 30 or 45. this is due to the auto-adjust of the rtcc at 15 second intervals. 23.5 alarm ? configurable from half second to one year ? enabled using the alrmen bit (alcfgrpt<15>) ? one-time alarm and repeat alarm options available 23.5.1 configuring the alarm the alarm feature is enabled using the alrmen bit. this bit is cleared when an alarm is issued. writes to alrmval should only take place when alrmen = 0 . as shown in figure 23-2 , the interval selection of the alarm is configured through the amask<3:0> bits (alcfgrpt<13:10>). these bits determine which, and how many, digits of the alarm must match the clock value for the alarm to occur. the alarm can also be configured to repeat based on a preconfigured interval. the amount of times this occurs, once the alarm is enabled, is stored in the arpt<7:0> bits (alcfgrpt<7:0>). when the value of the arptx bits equals 00h, and the chime bit (alcfgrpt<14>) is cleared, the repeat function is disabled and only a single alarm will occur. the alarm can be repeated, up to 255 times by loading arpt<7:0> with ffh. after each alarm is issued, the value of the arptx bits is decremented by one. once the value has reached 00h, the alarm will be issued one last time, after which, the alrmen bit will be cleared automatically and the alarm will turn off. indefinite repetition of the alarm can occur if the chime bit = 1 . instead of the alarm being disabled when the value of the arptx bits reaches 00h, it rolls over to ffh and continues counting indefinitely while chime is set. 23.5.2 alarm interrupt at every alarm event, an interrupt is generated. in addition, an alarm pulse output is provided that operates at half the frequency of the alarm. this output is completely synchronous to the rtcc clock and can be used as a trigger clock to other peripherals. (ideal frequency ? ? measured frequency) * 60 = clocks per minute ? ideal frequency = 32,768 hz note: it is up to the user to include, in the error value, the initial error of the crystal: drift due to temperature and drift due to crystal aging. note: changing any of the registers, other than the rcfgcal and alcfgrpt registers, and the chime bit, while the alarm is enabled (alrmen = 1 ), can result in a false alarm event leading to a false alarm interrupt. to avoid a false alarm event, the timer and alarm values should only be changed while the alarm is disabled (alrmen = 0 ). it is recommended that the alcfgrpt register and chime bit be changed when rtcsync = 0 .
PIC24FJ128GC010 family ds30009312b-page 334 ? 2012-2013 microchip technology inc. figure 23-2: alarm mask settings 23.6 power control the rtcc includes a power control feature that allows the device to periodically wake-up an external device, wait for the device to be stable before sampling wake-up events from that device, and then shut down the external device. this can be done completely autonomously by the rtcc, without the need to wake from the current lower power mode (sleep, deep sleep, etc.). to use this feature: 1. enable the rtcc (rtcen = 1 ). 2. set the pwcen bit (rtcpwc<15>). 3. configure the rtcc pin to drive the pwc control signal (rtcoe = 1 and rtcout<1:0> = 11 ). the polarity of the pwc control signal may be chosen using the pwcpol bit (rtcpwc<14>). an active-low or active-high signal may be used with the appropriate external switch to turn on or off the power to one or more external devices. the active-low setting may also be used in conjunction with an open-drain setting on the rtcc pin, in order to drive the ground pin(s) of the external device directly (with the appropriate external v dd pull-up device), without the need for external switches. finally, the chime bit should be set to enable the pwc periodicity. 23.7 rtcc v bat operation the rtcc can operate in v bat mode when there is a power loss on the v dd pin. the rtcc will continue to operate if the v bat pin is powered on (it is usually connected to the battery). the v bat bor can be enabled/disabled using the vbtbor bit in the cw2 configuration register (cw2<14>). if the vbtbor enable bit is cleared, the v bat bor is always disabled and there will be no indi- cation of a v bat bor. if the vbtbor bit is set, the rtcc can receive a reset and the rtcen bit will get cleared; it can happen anywhere between 1.95-1.4v (typical). note 1: annually, except when c onfigured for february 29. s ss mss mm s s hh mm ss dhhmmss dd hh mm ss mm dd hh mm ss day of the week month day hours minutes seconds alarm mask setting (amask<3:0>) 0000 - every half second 0001 - every second 0010 - every 10 seconds 0011 - every minute 0100 - every 10 minutes 0101 - every hour 0110 - every day 0111 - every week 1000 - every month 1001 - every year (1) note: it is recommended to connect the v bat pin to v dd if the v bat mode is not used (not connected to the battery).
? 2012-2013 microchip technology inc. ds30009312b-page 335 PIC24FJ128GC010 family 24.0 32-bit programmable cyclic redundancy check (crc) generator the 32-bit programmable crc generator provides a hardware implemented method of quickly generating checksums for various networking and security applications. it offers the following features: ? user-programmable crc polynomial equation, up to 32 bits ? programmable shift direction (little or big-endian) ? independent data and polynomial lengths ? configurable interrupt output ? data fifo figure 24-1 displays a simplified block diagram of the crc generator. a simple version of the crc shift engine is displayed in figure 24-2 . figure 24-1: crc block diagram figure 24-2: crc shift engine detail note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ? pic24f family reference manual ?, ?32-bit programmable cyclic redun- dancy check (crc)? (ds39729). the information in this data sheet supersedes the information in the frm. crc interrupt variable fifo (4x32, 8x16 or 16x8) crcdath crcdatl shift buffer crc shift engine crcwdath crcwdatl shifter clock 2 * f cy lendian crcisel 1 0 fifo empty event shift complete event 1 0 note 1: n = plen<4:1> + 1. crc shift engine crcwdath crcwdatl bit 0 bit 1 bit n (1) x0 x1 xn (1) read/write bus shift buffer data
PIC24FJ128GC010 family ds30009312b-page 336 ? 2012-2013 microchip technology inc. 24.1 user interface 24.1.1 polynomial interface the crc module can be programmed for crc polynomials of up to the 32 nd order, using up to 32 bits. polynomial length, which reflects the highest exponent in the equation, is selected by the plen<4:0> bits (crccon2<4:0>). the crcxorl and crcxorh registers control which exponent terms are included in the equation. setting a particular bit includes that exponent term in the equa- tion. functionally, this includes an xor operation on the corresponding bit in the crc engine. clearing the bit disables the xor. for example, consider two crc polynomials, one a 16-bit and the other a 32-bit equation. equation 24-1: 16-bit, 32-bit crc polynomials to program these polynomials into the crc generator, set the register bits, as shown in table 24-1 . note that the appropriate positions are set to ? 1 ? to indi- cate that they are used in the equation (for example, x26 and x23). the ? 0 ? bit required by the equation is always xored; thus, x0 is a don?t care. for a poly- nomial of length 32, it is assumed that the 32 nd bit will be used. therefore, the x<31:1> bits do not have the 32 nd bit. 24.1.2 data interface the module incorporates a fifo that works with a variable data width. input data width can be configured to any value, between 1 and 32 bits, using the dwidth<4:0> bits (crccon2<12:8>). when the data width is greater than 15, the fifo is 4 words deep. when the dwidthx bits are between 15 and 8, the fifo is 8 words deep. when the dwidthx bits are less than 8, the fifo is 16 words deep. the data for which the crc is to be calculated must first be written into the fifo. even if the data width is less than 8, the smallest data element that can be writ- ten into the fifo is 1 byte. for example, if the dwidthx bits are 5, then the size of the data is dwidth<4:0> + 1 or 6. the data is written as a whole byte; the two unused upper bits are ignored by the module. once data is written into the msb of the crcdat reg- isters (that is, the msb as defined by the data width), the value of the vword<4:0> bits (crccon1<12:8>) increments by one. for example, if the dwidthx bits are 24, the vwordx bits will increment when bit 7 of crcdath is written. therefore, crcdatl must always be written to before crcdath. the crc engine starts shifting data when the crcgo bit is set and the value of the vwordx bits is greater than zero. each word is copied out of the fifo into a buffer regis- ter, which decrements the vwordx bits. the data is then shifted out of the buffer. the crc engine contin- ues shifting at a rate of two bits per instruction cycle, until the vwordx bits reach zero. this means that for a given data width, it takes half that number of instruc- tions for each word to complete the calculation. for example, it takes 16 cycles to calculate the crc for a single word of 32-bit data. when the vwordx bits reach the maximum value for the configured value of the dwidthx bits (4, 8 or 16), the crcful bit becomes set. when the vwordx bits reach zero, the crcmpt bit becomes set. the fifo is emptied and the vword<4:0> bits are set to ? 00000 ? whenever crcen is ? 0 ?. at least one instruction cycle must pass after a write to crcwdat before a read of the vwordx bits is done. and x32+x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 x16 + x12 + x5 + 1 table 24-1: crc setup examples for 16 and 32-bit polynomials crc control bits bit values 16-bit polynomial 32-bit polynomial plen<4:0> 01111 11111 x<31:16> 0000 0000 0000 0001 0000 0100 1100 0001 x<15:0> 0001 0000 0010 000x 0001 1101 1011 011x
? 2012-2013 microchip technology inc. ds30009312b-page 337 PIC24FJ128GC010 family 24.1.3 data shift direction the lendian bit (crccon1<3>) is used to control the shift direction. by default, the crc will shift data through the engine, msb first. setting lendian (= 1 ) causes the crc to shift data, lsb first. this setting allows better integration with various communication schemes and removes the overhead of reversing the bit order in software. note that this only changes the direction the data is shifted into the engine. the result of the crc calculation will still be a normal crc result, not a reverse crc result. 24.1.4 interrupt operation the module generates an interrupt that is configurable by the user for either of two conditions. if crcisel is ? 0 ?, an interrupt is generated when the vword<4:0> bits make a transition from a value of ? 1 ? to ? 0 ?. if crcisel is ? 1 ?, an interrupt will be generated after the crc operation finishes and the module sets the crcgo bit to ? 0 ?. manually setting crcgo to ? 0 ? will not generate an interrupt. note that when an interrupt occurs, the crc calculation would not yet be complete. the module will still need (plenx + 1)/2 clock cycles after the interrupt is generated until the crc calculation is finished. 24.1.5 typical operation to use the module for a typical crc calculation: 1. set the crcen bit to enable the module. 2. configure the module for desired operation: a) program the desired polynomial using the crcxorl and crcxorh registers, and the plen<4:0> bits. b) configure the data width and shift direction using the dwidthx and lendian bits. c) select the desired interrupt mode using the crcisel bit. 3. preload the fifo by writing to the crcdatl and crcdath registers until the crcful bit is set or no data is left. 4. clear old results by writing 00h to crcwdatl and crcwdath. the crcwdat registers can also be left unchanged to resume a previously halted calculation. 5. set the crcgo bit to start calculation. 6. write remaining data into the fifo as space becomes available. 7. when the calculation completes, crcgo is automatically cleared. an interrupt will be generated if crcisel = 1 . 8. read crcwdatl and crcwdath for the result of the calculation. there are eight registers used to control programmable crc operation: ? crccon1 ? crccon2 ? crcxorl ? crcxorh ? crcdatl ? crcdath ? crcwdatl ? crcwdath the crccon1 and crccon2 registers ( register 24-1 and register 24-2 ) control the operation of the module and configure the various settings. the crcxor registers ( register 24-3 and register 24-4 ) select the polynomial terms to be used in the crc equation. the crcdat and crcwdat registers are each register pairs that serve as buffers for the double-word input data, and crc processed output, respectively.
PIC24FJ128GC010 family ds30009312b-page 338 ? 2012-2013 microchip technology inc. register 24-1: crccon1: crc control 1 register r/w-0 u-0 r/w-0 r-0, hsc r-0, hsc r-0, hsc r-0, hsc r-0, hsc crcen ? csidl vword4 vword3 vword2 vword1 vword0 bit 15 bit 8 r-0, hsc r-1, hsc r/w-0 r/w-0, hc r/w-0 u-0 u-0 u-0 crcful crcmpt crcisel crcgo lendian ? ? ? bit 7 bit 0 legend: hc = hardware clearable bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 crcen: crc enable bit 1 = enables module 0 = disables module; all state machines, pointers and crcwdat/crcdath registers are reset; other sfrs are not reset bit 14 unimplemented: read as ? 0 ? bit 13 csidl: crc stop in idle mode bit 1 = discontinues module operation when the device enters idle mode 0 = continues module operation in idle mode bit 12-8 vword<4:0>: pointer value bits indicates the number of valid words in the fifo. has a maximum value of 8 when plen<4:0> ? 7 or 16 when plen<4:0> ?? 7. bit 7 crcful: crc fifo full bit 1 = fifo is full 0 = fifo is not full bit 6 crcmpt: crc fifo empty bit 1 = fifo is empty 0 = fifo is not empty bit 5 crcisel: crc interrupt selection bit 1 = interrupt on fifo is empty; the final word of data is still shifting through the crc 0 = interrupt on shift is complete and results are ready bit 4 crcgo: start crc bit 1 = starts crc serial shifter 0 = crc serial shifter is turned off bit 3 lendian: data shift direction select bit 1 = data word is shifted into the crc, starting with the lsb (little endian) 0 = data word is shifted into the crc, starting with the msb (big endian) bit 2-0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 339 PIC24FJ128GC010 family register 24-2: crccon2: c rc control 2 register u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? ? dwidth4 dwidth3 dwidth2 dwidth1 dwidth0 bit 15 bit 8 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? ? plen4 plen3 plen2 plen1 plen0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-13 unimplemented: read as ? 0 ? bit 12-8 dwidth<4:0>: data word width configuration bits configures the width of the data word (data word width ? 1). bit 7-5 unimplemented: read as ? 0 ? bit 4-0 plen<4:0>: polynomial length configuration bits configures the length of the polynomial (polynomial length ? 1). register 24-3: crcxorl: crc xor polynomial register, low byte r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 x15 x14 x13 x12 x11 x10 x9 x8 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 x7 x6 x5 x4 x3 x2 x1 ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-1 x<15:1>: xor of polynomial term x n enable bits bit 0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 340 ? 2012-2013 microchip technology inc. register 24-4: crcxorh: crc xor po lynomial register, high byte r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 x31 x30 x29 x28 x27 x26 x25 x24 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 x23 x22 x21 x20 x19 x18 x17 x16 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-0 x<31:16>: xor of polynomial term x n enable bits
? 2012-2013 microchip technology inc. ds30009312b-page 341 PIC24FJ128GC010 family 25.0 overview of advanced analog features the defining feature of PIC24FJ128GC010 family devices is the collection of analog peripherals, designed to extend the range of pic24f microcontrol- lers into high-performance analog and mixed-signal applications. all devices include a set of new advanced modules and several existing analog peripherals, plus a common voltage reference for ease of use. the analog block includes four new modules: ? 12-bit high-speed, pipeline a/d converter (described in section 26.0 ?12-bit high-speed, pipeline a/d converter? ) ? 16-bit sigma-delta a/d (described in section 27.0, 16-bit sigma-delta analog-to-digital (a/d) converter ) ? dual 10-bit digital-to-analog convert- ers (described in section 28.0, 10-bit digital-to-analog converter (dac) ) ? dual operational amplifiers (described in section 29.0, dual operational amplifier module ) it also includes these legacy pic24f analog modules: ? triple comparator module (described in section 30.0, triple comparator module ) with independent voltage reference (described in section 31.0, comparator voltage reference ) ? ctmu (described in section 32.0, charge time measurement unit (ctmu) ) a high-level overview of the analog block and its inte- grating features is shown in figure 25-1 . for a more detailed diagram of each module and an explanation of its operation, please refer to the appropriate chapter. 25.1 shared analog pins apart from the reserved differential inputs for the sigma-delta a/d converter, PIC24FJ128GC010 family devices may have up to 50 analog input channels (in 100-pin devices). because of the number of analog features available on the microcontroller, many of the inputs and outputs of the other advanced analog modules share pins with these channels. table 25-1 describes how features are multiplexed. note that not all of these analog channels and their shared analog peripherals are available on all devices. 25.2 internal band gap references as an integrating feature, the analog block of PIC24FJ128GC010 family devices includes a common internal voltage reference source. this band gap provides several functions: ? a single, configurable internal reference source (bgbuf0) for all on-chip analog consumers ? two additional and independently programmable band gap sources that can provide buffered internal references (bgbuf1 and bgbuf2) to external pins ? independent configurability of all sources in idle, sleep and other low-power modes, allowing for flexibility in power consumption the reference sources are controlled by three registers: bufcon0 for the internal reference ( register 25-1 ), and bufcon1 and bufcon2 ( register 25-2 ) for the buffered references.
PIC24FJ128GC010 family ds30009312b-page 342 ? 2012-2013 microchip technology inc. figure 25-1: analog block overview ch0n ch1n an16 an49 cv ref + oa1pa bgbuf2 c1ind c1ina c1inc c1inb oa1 av ref + av dd 12-bit a/d + ? oa1out c1 cv ref bgbuf0 av ref - av ss ctmu dac2 dac2 c2ind c2ina c2inc c2inb c2 c3ind c3ina c3inc c3inb c3 bgbuf1 ch1p ch0p dv ref + av dd + sv ss + cv ref - av ss av dd oa1pe v bg /2 sv dd bgbuf1 v bg /2 bgbuf0 cv ref ? oa1na oa1ne oa2pa oa2 oa2out oa2pe oa2na oa2ne dac1 dac1 + bgbuf0 oa1out oa2out te m p av dd av ss an0 an15 bgbuf1 bgbuf0 sd a/d 12-bit pipeline a/d converter 10-bit dac converters operational amplifiers ctmu out temp out ctmu out v ss sigma-delta a/d converter comparators ctmu comparator voltage bgbuf2 internal voltage references reference ctpls ctcmp band gap internal
? 2012-2013 microchip technology inc. ds30009312b-page 343 PIC24FJ128GC010 family table 25-1: shared analog pins analog input channel op amp comparator comparator reference dac band gap other analog an0 ? ? cv ref +dv ref + bgbuf1 av ref + an1 oa2pb ? cv ref -? ?av ref - an2 oa2nc c2inb ? ? ? ctcmp an3 oa2outc2ina???? an4oa1nac1inb???? an5 oa1outc1ina???? an6oa1pd????? an9oa1nc????? an10 oa2pc ? cv ref ??? an11oa2nd????? an13 oa2pd ? ? dac2 ? ? an14 oa2ne ? ? ? ? ctpls an17 oa1pb c1ind ? ? bgbuf2 ? an18oa1nec1inc???? an19oa1ncc2ind???? an20?c3ina???? an25oa2nb????? an30?????? an34oa1pcc3inb???? an41?c3ind???? an42oa2pac3inc???? an43oa2na????? an44oa2pe????? an47oa1pe????? an48oa1nb????? an49 oa1pa c2inc ? dac1 ? ? legend: shaded cells are analog outputs.
PIC24FJ128GC010 family ds30009312b-page 344 ? 2012-2013 microchip technology inc. register 25-1: bufcon0: internal voltage reference control register r/w-0 u-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 bufen ? bufsidl bufslp ? ? ? ? bit 15 bit 8 u-0 r/w-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 ? bufstby ? ? ? ? bufref1 ( 1 ) bufref0 ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 bufen: enable buffer v ref source bit 1 = band gap and buffer are enabled 0 = band gap and buffer are disabled bit 14 unimplemented: read as ? 0 ? bit 13 bufsidl: buffer stop in idle bit 1 = buffer is disabled in idle mode 0 = buffer works normally in idle mode bit 12 bufslp: buffer sleep enable bit 1 = buffer is disabled in sleep mode 0 = buffer works normally in sleep mode bit 11-7 unimplemented: read as ? 0 ? bit 6 bufstby: buffer standby enable bit 1 = buffer in low-power standby mode (output unknown or weak drive strength; allows quicker start-up than clearing bufen) 0 = buffer output works normally bit 5-2 unimplemented: read as ? 0 ? bit 1-0 bufref<1:0>: internal voltage reference select bits ( 1 ) 11 = reference output set at 3.072v 10 = reference output set at 2.560v 01 = reference output set at 2.048v 00 = reference output set at 1.2v note 1: the bgbuf cannot ?boost? the av dd voltage to a higher level. therefore, bufref<1:0> bits settings higher than the applied av dd level are considered invalid.
? 2012-2013 microchip technology inc. ds30009312b-page 345 PIC24FJ128GC010 family register 25-2: bufconx: band gap buffers 1 and 2 control registers r/w-0 u-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 bufen ? bufsidl bufslp ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 bufoe bufstby ? ? ? ? bufref1 bufref0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 bufen: enable buffer v ref source bit 1 = band gap and buffer are enabled 0 = band gap and buffer are disabled bit 14 unimplemented: read as ? 0 ? bit 13 bufsidl: buffer stop in idle bit 1 = buffer is disabled in idle mode 0 = buffer works normally in idle mode bit 12 bufslp: buffer sleep enable bit 1 = buffer is disabled in sleep mode 0 = buffer works normally in sleep mode bit 11-8 unimplemented: read as ? 0 ? bit 7 bufoe: buffer output enable bit 1 = buffer voltage is output to the corresponding pin 0 = buffer voltage is not output to the pin bit 6 bufstby: buffer standby enable bit 1 = buffer in low-power standby mode (output unknown or weak drive strength; allows quicker start-up than clearing bufen) 0 = buffer output works normally bit 5-2 unimplemented: read as ? 0 ? bit 1-0 bufref<1:0>: internal voltage reference select bits 11 = reference output set at 3.072v 10 = reference output set at 2.560v 01 = reference output set at 2.048v 00 = reference output set at 1.2v
PIC24FJ128GC010 family ds30009312b-page 346 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 347 PIC24FJ128GC010 family 26.0 12-bit high-speed, pipeline a/d converter the 12-bit pipeline a/d converter has the following key features: ? conversion speeds of up to 10 msps ? up to 50 analog single-ended input channels or up to 15 unique differential input channel pairs ? 12-bit conversion resolution ? multiple internal reference input channels ? external voltage reference input pins ? automated threshold scan and compare operation to pre-evaluate conversion results ? extended automated and fully programmable sampling sequences from up to four different lists ? conversion result accumulation ? selectable conversion trigger source ? internal 32-word, configurable conversion result buffer ? eight options for results alignment ? configurable interrupt generation ? operation during cpu sleep and idle modes the a/d converter module is a pipelined 12-bit a/d converter, capable of sampling up to once per a/d clock cycle. its operation is enhanced with a wide range of automatic sampling options, tighter integration with other analog modules, result accumulation across many samples and a configurable results buffer. a simplified block diagram for the module is shown in figure 26-1 . 26.1 basic operation to perform a standard a/d conversion: 1. configure the module: a) configure port pins as analog inputs by setting the appropriate bits in the ansx registers (see section 11.2 ?configuring analog port pins (ansx)? for more information). b) configure ?global? adcon1, adcon2 and adcon3 control settings, but do not set the adon bit until all global settings are configured: ? configure a/d clock source/rate ? select a/d reference sources ? configure data formatting ? configure other settings c) enable the a/d module by setting the adon bit (adcon1<15>). d) wait until the adready bit (adstath<1>) becomes set, indicating the module is finished with internal calibration and initialization. e) configure sample list 0 settings, controlled by the adl0conh and adl0conl regis- ters, but do not enable the sample list yet (slen): ? select the desired sample list interrupt generation settings ? select a data write mode (ex: write all results to buffer) ? configure analog sampling time (samc<4:0>) ? select a trigger source ? specify how many entries are in the sample list (slsize<4:0>) ? configure other sample list 0 specific settings f) initialize the adtbl0 register (and higher if slsizex > 0) to select the analog channel(s) to be included in sample list 0. g) configure and enable a/d interrupts (if desired): ? clear the ad1if and sl0if bits ? select an interrupt priority ? enable ad1ie h) enable sample list 0 by setting the slen bit (in adl0conl<15>). i) generate a trigger event for sample list 0 (as configured in step e ). j) wait for the sl0if or top level ad1if inter- rupt flag to assert, indicating that the a/d result(s) are now ready. k) read the respective result(s) from the appro- priate adresn register(s) (as configured based on the buforg setting). note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information on the pipe- line a/d converter, refer to the ?pic24f family reference manual? , ?12-bit, high-speed pipeline a/d converter? (ds30686).
PIC24FJ128GC010 family ds30009312b-page 348 ? 2012-2013 microchip technology inc. 26.2 registers the pipeline a/d converter uses a total of 116 registers. of these, 75 registers control the module?s operations; the remainder are data and result buffers. five ?global? registers control overall module operation and provide module status: ? adcon1 through adcon3 ( register 26-1 through register 26-3 ) ? adstath and adstatl ( register 26-4 and register 26-5 ) twelve registers control accumulator and threshold detect operations: ? acconh and acconl ( register 26-11 and register 26-12 ) ? adchith and adchitl ( register 26-13 and register 26-14 ) ? adthnh and adthnl (0 through 3) (prototypes, register 26-15 and register 26-16 ) sixty-four registers control sample list selection, configuration and execution: ? adlnconh and adlnconl (0 through 3) (prototypes, register 26-6 and register 26-7 ) ? adlnstat (0 through 3) (prototype, register 26-8 ) ? adlnptr (0 through 3) (prototype, register 26-9 ) ? adltlbn (0 through 31) (prototype, register 26-10 ) ? adlnmsel0 through adlnmsel3 (0 through 3) (prototypes, register 26-17 through register 26-20 )
? 2012-2013 microchip technology inc. ds30009312b-page 349 PIC24FJ128GC010 family figure 26-1: 12-bit pipeline a/d converter block diagram v ref + an48 (1) an49 (1) an16 (1) an47 (1) an14 an15 an0 an1 an2 v ref - sample control av ss av dd adcon1 adcon2 adcon3 acconl acconh adchitl input mux control internal data bus 16 v r + v r - v inh v inl v r + v r - v r select v bg adchith note 1: not all external analog inputs are implemented on all devices. see table 1-3 for a list of implemented channels by pin count. ctmu v bat av ss av dd adstath v bg /2 bgbuf1 dma data 16 adstatl bgbuf0 te m p opa1o opa2o input channel mux adlnconh adlnconl adlnstat adlnptr adtbln adtnh1h adtnh1l adlnmsel3 adlnmsel2 adlnmsel1 adlnmsel0 (n = 0-3) threshold detect and compare data s/h bus control logic and sample list sequencing data formatting 12-bit a/d (result buffer) adres31: adres0 conversion logic
PIC24FJ128GC010 family ds30009312b-page 350 ? 2012-2013 microchip technology inc. register 26-1: adcon1: a/ d control register 1 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 adon ? adsidl adslp form3 form2 form1 form0 bit 15 bit 8 r/w-0 r/w-0 u-0 u-0 u-0 u-0 u-0 r/w-0 pumpen adcal ( 2 ) ? ? ? ? ?pwrlvl bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 adon: a/d module enable bit 1 = module is enabled 0 = module is disabled (registers are still readable and writable) bit 14 unimplemented: read as ? 0 ? bit 13 adsidl: a/d stop in idle control bit 1 = halts when cpu is in idle mode 0 = continues to operate in cpu idle mode bit 12 adslp: a/d suspend in sleep control bit 1 = continues operation in sleep mode 0 = ignores triggers and clocks when cpu is in sleep mode bit 11-8 form<3:0>: data output format bits 1xxx = unimplemented, do not use 0111 = signed fractional ( sddd dddd dddd 0000 ) 0110 = fractional ( dddd dddd dddd 0000) 0101 = signed integer ( ssss sddd dddd dddd ) 0100 = integer ( 0000 dddd dddd dddd ) 0011 = signed fractional ( sddd dddd dddd 0000 ) 0010 = fractional ( dddd dddd dddd 0000 ) 0001 = signed integer ( ssss sddd dddd dddd ) 0000 = integer, raw data ( 0000 dddd dddd dddd ) bit 7 pumpen: analog channel switch charge pump enable bit 1 = charge pump for switches is enabled, reducing switch impedance ( 1 ) 0 = charge pump for switches is disabled bit 6 adcal: a/d internal analog calibration bit ( 2 ) 1 = initiates internal analog calibration 0 = no operation bit 5-1 unimplemented: read as ? 0 ? bit 0 pwrlvl: power level select bit 1 = full-power mode; a/d clock rates from 1 mhz to 10 mhz are allowed 0 = low-power mode; a/d clock rates from 1 mhz to 2.5 mhz are allowed note 1: use of the channel switch charge pump is recommended when av dd <2.5v. 2: when set, adcal remains set for at least one t ad and is then automatically cleared by hardware. manually clearing the bit does not necessarily cancel the calibration routine. calibration is complete when adstath<1> = 1 .
? 2012-2013 microchip technology inc. ds30009312b-page 351 PIC24FJ128GC010 family register 26-2: adcon2: a/ d control register 2 r/w-0 r/w-0 u-0 r/w-0 u-0 r/w-0 r/w-1 r/w-1 pvcfg1 pvcfg0 ?nvcfg0 ?buforg r r bit 15 bit 8 r/w-0 r/w-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r r ? ? ? ? refpump ( 1 ) r bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 pvcfg<1:0>: converter voltage reference configuration for adref+ bits 10 = bgbuf1 internal reference ( 2 ) 01 =external v ref + 00 =a vdd bit 13 unimplemented: read as ? 0 ? bit 12 nvcfg0: converter voltage reference configuration for adref- bit 1 =external v ref - 0 =a vss bit 11 unimplemented: read as ? 0 ? bit 10 buforg: adres result buffer organization control bit 1 = result buffer is organized as an indexed buffer; adtbln conversion result is stored in adresn (where n is the same number between 0-31) 0 = result buffer is organized as a 32 result deep fifo like buffer; results get stored in the sequential order that they are generated bit 9-8 reserved: always write ? 11 ? to these bits for normal a/d operation bit 7-6 reserved: always write ? 00 ? to these bits for normal a/d operation bit 5-2 unimplemented: read as ? 0 ? bit 1 refpump: a/d reference charge pump control bit ( 1 ) 1 = reference charge pump is enabled, to optimize inter nal operation with small references < (0.65 * av dd ) 0 = reference charge pump is disabled bit 0 reserved: always write ? 0 ? to this bit for normal a/d operation note 1: never set the refpump bit unless the magnitude of the a/d reference (ex: av ref + ? av ref -) is less than (0.65 * av dd ). 2: in order to use the bgbuf1 internal reference for the a/d, firmware must also configure and enable the buffer through the bufcon1.
PIC24FJ128GC010 family ds30009312b-page 352 ? 2012-2013 microchip technology inc. register 26-3: adcon3: a/ d control register 3 r/w-0 u-0 u-0 u-0 r/w-0, hc r/w-0, hc r/w-0, hc r/w-0, hc adrc ( 1 ) ? ? ? slen3 slen2 slen1 slen0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 adcs7 ( 2 ) adcs6 ( 2 ) adcs5 ( 2 ) adcs4 ( 2 ) adcs3 ( 2 ) adcs2 ( 2 ) adcs1 ( 2 ) adcs0 ( 2 ) bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit w = writable bit hc = hardware clearable bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 adrc: a/d conversion clock source (t src ) bit ( 1 ) 1 = conversion clock derived from frc (t src = t frc ) 0 = conversion clock derived from system clock (t src = t sys ) bit 14-12 unimplemented: read as ? 0 ? bit 11 slen3: a/d sample list 3 enable bit 1 = sampling for this list is enabled; triggers defined by adl3conl<12:8> are processed 0 = sampling for this list is disabled bit 10 slen2: a/d sample list 2 enable bit 1 = sampling for this list is enabled; triggers defined by adl2conl<12:8> are processed 0 = sampling for this list is disabled bit 9 slen1: a/d sample list 1 enable bit 1 = sampling for this list is enabled; triggers defined by adl1conl<12:8> are processed 0 = sampling for this list is disabled bit 8 slen0: a/d sample list 0 enable bit 1 = sampling for this list is enabled; triggers defined by adl0conl<12:8> are processed 0 = sampling for this list is disabled bit 7-0 adcs<7:0>: a/d conversion clock prescaler bits ( 2 ) t ad = t src (2 adcs<7:0>) except when ad cs< 7:0> = 00h: t ad = t src otherwise : 00100001 and higher = reserved 00100000 = 32 t src 00011111 = 31 t src 00000010 = 4 t src 00000001 = 2 t src note 1: this bit must be set for sleep operation. 2: final a/d clock frequency (1/t ad ) must be at or between 1 mhz and 10 mhz.
? 2012-2013 microchip technology inc. ds30009312b-page 353 PIC24FJ128GC010 family register 26-4: adstath: a/d status high register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r-0 r-0 r-0 ? ? ? ? ? pumpst adready adbusy bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-3 unimplemented: read as ? 0 ? bit 2 pumpst: a/d boost pump status bit 1 = the a/d boost pump is active 0 = the a/d boost pump is idle bit 1 adready: a/d analog ready bit 1 = the analog portion of the a/d is warmed up, internally calibrated and ready 0 = the analog portion of the a/d is not ready bit 0 adbusy: a/d busy bit 1 = a/d conversion is in progress 0 = a/d is idle
PIC24FJ128GC010 family ds30009312b-page 354 ? 2012-2013 microchip technology inc. register 26-5: adstatl: a/d status low register u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 ? ? ? ? ? ? ?slov bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? r accif sl3if ( 1 ) sl2if ( 1 ) sl1if ( 1 ) sl0if ( 1 ) bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-9 unimplemented: read as ? 0 ? bit 8 slov: a/d sample list error event bit 1 = a buffer overflow has occurred and data has been lost 0 = no buffer overflow has occurred bit 7-6 unimplemented: read as ? 0 ? bit 5 reserved: maintain as ? 0 ? for normal a/d interrupt operation bit 4 accif: accumulator counter interrupt event bit 1 = accumulator counter has counted down to zero 0 = accumulator counter has not reached zero bit 3 sl3if: a/d sample list 3 interrupt event bit ( 1 ) 1 = an interrupt event (defined by adl3conh<14:13>) has occurred in sample list 3 0 = an interrupt event has not occurred bit 2 sl2if: a/d sample list 2 interrupt event bit ( 1 ) 1 = an interrupt event (defined by adl2conh<14:13>) has occurred in sample list 2 0 = an interrupt event has not occurred bit 1 sl1if: a/d sample list 1 interrupt event bit ( 1 ) 1 = an interrupt event (defined by adl1conh<14:13>) has occurred in sample list 1 0 = an interrupt event has not occurred bit 0 sl0if: a/d sample list 0 interrupt event bit ( 1 ) 1 = an interrupt event (defined by adl0conh<14:13>) has occurred in sample list 0 0 = an interrupt event has not occurred note 1: these bits mirror the adlif flag bits for the corresponding adlnstat registers. changes in the adlif bit are simultaneously reflected in the slxif bits.
? 2012-2013 microchip technology inc. ds30009312b-page 355 PIC24FJ128GC010 family register 26-6: adlnconh: a/d sample list n control high register (n = 0 to 3) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 asen slint1 slint0 wm1 wm0 cm2 cm1 cm0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ctmen r mulchen samc4 samc3 samc2 samc1 samc0 bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 asen: a/d auto-scan enable bit 1 = auto-scan: sample and convert all associated inputs sequentially on every trigger event 0 = sequential scan: sample and convert the next associated input on trigger event bit 14-13 slint<1:0>: interrupt trigger control bits when asen = 1 : 11 = interrupt after auto-scan completion only if a match occurred 10 = interrupt after every match 01 = interrupt after auto-scan completion 00 = no interrupt when asen = 0 : 11 = reserved 10 = interrupt after all entries in a sample list have been converted (slsize<4:0> + 1 samples) 01 = interrupt after every sample 00 = no interrupt bit 12-11 wm<1:0>: internal buffer write mode bits 11 = reserved 10 = no conversion results saved (typically for threshold compare only) 01 = conversion results saved when a match occurs (typically for threshold compare only) 00 = all conversion results saved to the adresn register associated with the conversion bit 10-8 cm<2:0>: threshold compare match bits 111 = reserved 110 = reserved 101 = reserved 100 = outside window match: a/d result < low threshold value or a/d result >threshold high value 011 = inside window match: low threshold value < a/d result < threshold high value 010 = greater than match: a/d result > threshold value. 001 = less than match: a/d result < threshold value 000 = matching is disabled bit 7 ctmen: a/d ctmu current source enable bit 1 = ctmu is enabled during sampling and used as a current source driving the selected analog input 0 = ctmu is not used as a current source driving selected analog input bit 6 reserved: maintain as ? 0 ? for normal operation bit 5 mulchen: multiple channel enable bit 1 = channels 15 to n are connected in parallel and scanned together 0 = channels 15 to n in the scan list are sampled one at a time, as defined by the asen bit
PIC24FJ128GC010 family ds30009312b-page 356 ? 2012-2013 microchip technology inc. bit 4-0 samc<4:0>: sample/hold capacitor charge time (acquisition time) bits 11111 = 31 t ad 11110 = 30 t ad 00001 = 1 t ad 00000 = 0.5 t ad register 26-6: adlnconh: a/d sample list n control high register (n = 0 to 3) (continued)
? 2012-2013 microchip technology inc. ds30009312b-page 357 PIC24FJ128GC010 family register 26-7: adlnconl: a/d sample list n control low register (n = 0 to 3) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 slen samp ( 1 ) slenclr sltsrc4 sltsrc3 sltsrc2 sltsrc1 sltsrc0 bit 15 bit 8 r/w-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 thsrc ? ? slsize4 slsize3 slsize2 slsize1 slsize0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 slen: a/d trigger control enable bit 1 = enabled: selected trigger causes sampling of associated analog inputs 0 = disabled: selected trigger does not cause sampling of associated analog inputs bit 14 samp: a/d manual conversion trigger bit ( 1 ) 1 = prepares to generate a trigger event (no generation yet) 0 = see sltsrc<4:0> = 00000 , 00001 and 00010 descriptions bit 13 slenclr: a/d trigger clear bit 1 = adten is cleared by hardware after a trigger is generated by this sample list 0 = adten is only cleared by software bit 12-8 sltsrc<4:0>: trigger source select bits 11111 ... = unimplemented, do not use 10001 10000 = timer1 a/d trigger 01111 = comparator 3 01110 = comparator 2 01101 = comparator 1 01100 = input capture 4 01011 = input capture 1 01010 = output compare 3 01001 = output compare 2 01000 = output compare 1 00111 = internal periodic trigger event; interval defined by the adtmrpr register 00110 =ctmu 00101 =timer2 00100 = timer1 sync 00011 =int0 00010 = manual trigger event: triggers are generated on every a/d clock when samp = 0 00001 = manual trigger event: triggers are generated on every a/d clock when samp = 0 and acconh<7> = 1 00000 = manual trigger event: a single trigger is generated when samp is manually cleared in firmware, creating a 1 to 0 transition bit 7 thsrc: threshold list select bit 1 = source used for threshold compare is the sample list threshold register 0 = source used for threshold compare is the buffer register bit 6-5 unimplemented: read as ? 0 ? note 1: applicable only with manual trigger modes (sltsrc<4:0> = 00010 , 00001 or 00000 ). }
PIC24FJ128GC010 family ds30009312b-page 358 ? 2012-2013 microchip technology inc. bit 4-0 slsize<4:0>: sample list size select bits nu mber of adtbln registers (+ 1) a ssociated with this sample list: 11111 = 32 adtbln registers associated with this sample list 11110 = 31 adtbln registers associated with this sample list 00010 = 3 adtbln registers associated with this sample list 00001 = 2 adtbln registers associated with this sample list 00000 = 1 adtbln register associated with this sample list register 26-7: adlnconl: a/d sample list n control low register (n = 0 to 3) (continued) note 1: applicable only with manual trigger modes (sltsrc<4:0> = 00010 , 00001 or 00000 ).
? 2012-2013 microchip technology inc. ds30009312b-page 359 PIC24FJ128GC010 family register 26-8: adlnstat: a/d sample list n status register (n = 0 to 3) r-0 r-0 u-0 u-0 u-0 u-0 u-0 u-0 adtact lbusy ? ? ? ? ? ? bit 15 bit 8 r-0 u-0 r/w-0, hs u-0 u-0 u-0 u-0 u-0 adtdly ?adlif ( 1 ) ? ? ? ? ? bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit w = writable bit hs = hardware settable bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 adtact: a/d trigger event active bit 1 = a trigger event is asserted 0 = a trigger event is not asserted bit 14 lbusy: trigger control busy bit 1 = the a/d is converting a sample entry associated with this list?s trigger 0 = the a/d is not busy with this trigger bit 13-8 unimplemented: read as ? 0 ? bit 7 adtdly: a/d trigger delayed flag bit 1 = this trigger was delayed by a higher priority trigger 0 = this trigger was not delayed by a higher priority trigger bit 6 unimplemented: read as ? 0 ? bit 5 adlif: a/d sample list interrupt event flag bit ( 1 ) 1 = an interrupt event (defined by adlnconh<14:13>) has occurred in sample list n 0 = no interrupt event has occurred bit 4-0 unimplemented: read as ? 0 ? note 1: adlif is mirrored by the corresponding slxif flag bit in the adstatl register. setting or clearing this bit simultaneously changes the slxif.
PIC24FJ128GC010 family ds30009312b-page 360 ? 2012-2013 microchip technology inc. register 26-9: adlnptr: a/d sample list n pointer register (n = 0 to 3) u-0 r/w-0, hsc r/w-0, hsc r/w-0, hsc r/w-0, hsc r/w-0 r/w-0 r/w-0 ? adnext6 adnext5 adnext4 adnext3 adnext2 adnext1 adnext0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 7 bit 0 legend: u = unimplemented bit, read as ?0? r = readable bit w = writable bit hsc = hardware settable/clearable bit -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 unimplemented: read as ? 0 ? bit 14-8 adnext<6:0>: pointer to next entry on sample list to be converted bits this value is added to the start of the sample list to determine the adtbln register to be used for the next trigger event. bit 7-0 unimplemented: read as ? 0 ? register 26-10: adtbln: a/d sample table entry n register (n = 0 to 31) r/w-0 r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 uctmu diff ? ? ? ? ? ? bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? adch6 adch5 adch4 adch3 adch2 adch1 adch0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 uctmu: enable ctmu during entry conversion bit 1 = ctmu is enabled during channel conversion for this entry 0 = ctmu is disabled during channel conversion for this entry bit 14 diff: differential inputs select bit 1 = analog inputs are sampled as differential pairs for this entry 0 = analog inputs are sampled as single-ended for this entry bit 13-7 unimplemented: read as ? 0 ? bit 6-0 adch<6:0>: a/d channel entry select bits see tab l e 2 6- 1 for a complete description.
? 2012-2013 microchip technology inc. ds30009312b-page 361 PIC24FJ128GC010 family table 26-1: channel entry select values for adch<6:0> adch<6:0> single-ended (diff = 0 ) differential (diff = 1 ) adch<6:0> single-ended (diff = 0 ) differential (diff = 1 ) a in + ( 1 ) a in -a in + ( 1 ) a in - ( 1 ) a in + ( 1 ) a in -a in + ( 1 ) a in - 1111111 ( 2 ) v ref -v ref -v ref -v ref - 0100001 an33 v ref - an33 an14 1111110 ( 3 ) v ref -v ref +v ref -v ref + 0100000 an32 v ref - an32 an14 1111101 ( 4 ) v ref +v ref -v ref +v ref - 0011111 an31 v ref - an31 an14 1111100 ( 2 ) v ref +v ref +v ref +v ref + 0011110 an30 v ref - an30 an14 1110111 ctmu (time) ctmu (time) 0011101 an29 v ref - an29 an14 1110110 unimplemented 0011100 an28 v ref - an28 an14 ... 0011011 an27 v ref - an27 an14 0111101 0011010 an26 v ref - an26 an14 0111100 reserved 0011001 an25 v ref - an25 an14 0111011 opa2 v ref -opa2v ref - 0011000 an24 v ref - an24 an14 0111010 opa1 v ref -opa1v ref - 0010111 an23 v ref - an23 an14 0111001 reserved 0010110 an22 v ref - an22 an14 0111000 v bg /2 v ref -v bg /2 v ref - 0010101 an21 v ref - an21 an14 0110111 v bat /2 v ref -v bat /2 v ref - 0010100 an20 v ref - an20 an14 0110110 av dd v ref -av dd v ref - 0010011 an19 v ref - an19 an14 0110101 av ss v ref -av ss v ref - 0010010 an18 v ref - an18 an14 0110100 bgbuf0 v ref -bgbuf0v ref - 0010001 an17 v ref - an17 an14 0110011 unimplemented 0010000 an16 v ref - an16 an14 0110010 ctmu (temp) ctmu (temp) 0001111 an15 v ref - an15 an14 0110001 an49 v ref - an49 an14 0001110 an14 v ref - an15 an14 0110000 an48 v ref - an48 an14 0001101 an13 v ref - an13 an12 0101111 an47 v ref - an47 an14 0001100 an12 v ref - an13 an12 0101110 an46 v ref - an46 an14 0001011 an11 v ref - an11 an10 0101101 an45 v ref - an45 an14 0001010 an10 v ref - an11 an10 0101100 an44 v ref - an44 an14 0001001 an9 v ref -an9 an8 0101011 an43 v ref - an43 an14 0001000 an8 v ref -an9 an8 0101010 an42 v ref - an42 an14 0000111 an7 v ref -an7 an6 0101001 an41 v ref - an41 an14 0000110 an6 v ref -an7 an6 0101000 an40 v ref - an40 an14 0000101 an5 v ref -an5 an4 0100111 an39 v ref - an39 an14 0000100 an4 v ref -an5 an4 0100110 an38 v ref - an38 an14 0000011 an3 v ref -an3 an2 0100101 an37 v ref - an37 an14 0000010 an2 v ref -an3 an2 0100100 an36 v ref - an36 an14 0000001 an1 v ref -an1 an0 0100011 an35 v ref - an35 an14 0000000 an0 v ref -an1 an0 0100010 an34 v ref - an34 an14 note 1: not all external analog channels ar e available on all devices. see table 1-3 for more information. for 64-pin devices, do not use values of adch<6:0> associated with unimplemented channels. 2: single-ended conversion returns 000h + offset; differential conversions return 8000h + offset. 3: single-ended conversion returns 000h; differential conversion returns 000h + offset and gain error. 4: single-ended conversion returns fffh + offset and gain error; differential conversion returns fffh + offset and gain error.
PIC24FJ128GC010 family ds30009312b-page 362 ? 2012-2013 microchip technology inc. register 26-11: acconh: a/d accumul ator control high register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 r/w-0, hc r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 acen ( 1 ) acie ? ? ? ? ? ? bit 7 bit 0 legend: hc = hardware clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as ? 0 ? bit 7 acen: accumulator enable bit ( 1 ) 1 = accumulation is enabled; sample and convert the current sample list entry on trigger event and add to the contents of acresh/l 0 = the accumulation process has not started or is complete (cleared in hardware when accumulation countx bits decrement to zero) bit 6 acie: accumulator interrupt enable bit 1 = an interrupt event is generated when the accumulator decrements to zero 0 = accumulator interrupt events are disabled bit 5-0 unimplemented: read as ? 0 ? note 1: to avoid unexpected or erroneous results, do not write to acconh or acconl while acen is set. register 26-12: acconl: a/d accum ulator control low register u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? tblsel5 tblsel4 tblsel3 tblsel2 tblsel1 tblsel0 bit 15 bit 8 r/w-0, hsc r/w-0, hsc r/w-0, hsc r/w-0, hsc r/w-0, hsc r/w-0, hsc r/w-0, hsc r/w-0, hsc count7 count6 count5 count4 count3 count2 count1 count0 bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as ? 0 ? bit 13-8 tblsel<5:0>: pointer to adtbln used to select anxx channel to be accumulated bits the anxx channel is designated by the adtbln register (where n = tblsel<5:0> value). bit 7-0 count<7:0> : accumulations to be completed counter bits decrements on each accumulated sample. before starting the accumulation process, preload this countx bits field with the number of samples to accumulate (ex: to get a 9 sample sum, load count with 9). starting with a count value of 0 will result in 256 samples being accumulated.
? 2012-2013 microchip technology inc. ds30009312b-page 363 PIC24FJ128GC010 family register 26-13: adchith: a/d match hit high register r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs chh31 chh30 chh29 chh28 chh27 chh26 chh25 chh24 bit 15 bit 8 r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs chh23 chh22 chh21 chh20 chh19 chh18 chh17 chh16 bit 7 bit 0 legend: hs = hardware settable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 31-0 chh<31:16>: a/d conversion match hit bits 1 = a threshold compare match has occurred on the corresponding sample list entry 0 = no match has occurred register 26-14: adchitl: a/d match hit low register r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs chh15 chh14 chh13 chh12 chh11 chh10 chh9 chh8 bit 15 bit 8 r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs r/w-0, hs chh7 chh6 chh5 chh4 chh3 chh2 chh1 chh0 bit 7 bit 0 legend: hs = hardware settable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 31-0 chh<15:0>: a/d conversion match hit bits 1 = a threshold compare match has occurred on the corresponding sample list entry 0 = no match has occurred
PIC24FJ128GC010 family ds30009312b-page 364 ? 2012-2013 microchip technology inc. register 26-15: adthnh: a/d sample t able n threshold value high register (n = 0 to 3) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 th15 th14 th13 th12 th11 th10 th9 th8 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 th7 th6 th5 th4 th3 th2 th1 th0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-0 th<15:0>: high threshold value for windowed compare operations bits (sample table n) the value in 12-bit unsigned integer format only. register 26-16: adthnl: a/d sample ta ble n threshold value low register (n = 0 to 3) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 th15 th14 th13 th12 th11 th10 th9 th8 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 th7 th6 th5 th4 th3 th2 th1 th0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-0 th<15:0>: low threshold value for windowed compare operations bits (sample table n) also serves as the comparison value for non-windowed threshold compare operations. the value in 12-bit unsigned integer format only.
? 2012-2013 microchip technology inc. ds30009312b-page 365 PIC24FJ128GC010 family register 26-17: adlnmsel3: a/d sample list n multi-channel select register 3 (n = 0 to 3) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 ? ? ? ? ? ? msel49 msel48 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-2 unimplemented: read as ? 0 ? bit 1-0 msel<49:48>: a/d channel select bits 1 = corresponding channel participates in multi-channel operations for sample list n 0 = channel does not participate in multi-channel operations register 26-18: adlnmsel2: a/d sample list n multi-channel select register 2 (n = 0 to 3) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 msel47 msel46 msel45 msel44 msel43 msel42 msel41 msel40 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 msel39 msel38 msel37 msel36 msel35 msel34 msel33 msel32 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-0 msel<47:32>: a/d channel select bits 1 = corresponding channel participates in multi-channel operations for sample list n 0 = channel does not participate in multi-channel operations
PIC24FJ128GC010 family ds30009312b-page 366 ? 2012-2013 microchip technology inc. register 26-19: adlnmsel1: a/d sample list n multi-channel select register 1 (n = 0 to 3) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 msel31 msel30 msel29 msel28 msel27 msel26 msel25 msel24 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 msel23 msel22 msel21 msel20 msel19 msel18 msel17 msel16 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-0 msel<31:16>: a/d channel select bits 1 = corresponding channel participates in multi-channel operations for sample list n 0 = channel does not participate in multi-channel operations register 26-20: adlnmsel0: a/d sample list n multi-channel select register 0 (n = 0 to 3) r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 msel15 ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 msel15: a/d channel select bits 1 = corresponding channel participates in multi-channel operations for sample list n 0 = channel does not participate in multi-channel operations bit 14-0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 367 PIC24FJ128GC010 family figure 26-2: 12-bit a/d converte r single-ended analog input model c pin va rs anx i leakage r ic ? 250 ? sampling switch r ss c hold v ss = 2 pf 50 na typ. legend: c in v t i leakage r ic r ss c hold = pin capacitance + channel mux capacitance (2) = threshold voltage = leakage current at the pin due to = interconnect resistance = sampling switch resistance = sample/hold capacitance (from dac) various junctions note 1: the c in value depends on the device package and is not tested. the effect of c pin is negligible if rs ? 1.5 k ? . 2: the input channel multiplexer will add capacitance based on the input channel selected. selecting channels an0-an14 will add <5 pf and selecting channels an15 and above will add ~16 pf.
PIC24FJ128GC010 family ds30009312b-page 368 ? 2012-2013 microchip technology inc. figure 26-3: 12-bit a/ d transfer function 0010 0000 0001 (2049) 0010 0000 0010 (2050) 0010 0000 0011 (2051) 0001 1111 1101 (2045) 0001 1111 1110 (2046) 0001 1111 1111 (2047) 1111 1111 1110 (4094) 1111 1111 1111 (4095) 0000 0000 0000 (0) 0000 0000 0001 (1) output code 0010 0000 0000 (2048) (v inh ? v inl ) v r- v r+ ? v r- 4096 2048 * (v r+ ? v r- ) 4096 v r+ v r- + v r- + 4095 * (v r+ ? v r- ) 4096 v r- + 0 (binary (decimal)) voltage level
? 2012-2013 microchip technology inc. ds30009312b-page 369 PIC24FJ128GC010 family 27.0 16-bit sigma-delta analog-to-digital (a/d) converter the sigma-delta a/d converter employs sigma-delta modulation techniques to convert analog signals to a digital equivalent. this method achieves exceptional resolution and output code stability, which can signifi- cantly exceed that of conventional 10-bit or 12-bit sar-based a/ds. a block diagram of the 16-bit sigma-delta a/d is shown in figure 27-1 . key features include: ? adjustable sampling rates ? configurable a/d data rates between 976 samples per second (highest quality) and 62.5 ksps (highest speed) ? two differential input channels ? programmable gain amplifier input ? user-selectable clock sources ? user-selectable oversampling, dithering and data rounding ? self-measurement of internal offset and gain error ? operation in idle and sleep modes ? independent module reset option figure 27-1: sigma-delta a/ d converter block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ? pic24f family reference manual ?, ?16-bit sigma-delta a/d converter? (ds30687). the information in this data sheet supersedes the information in the frm. ch0+ sv ref +/ch1+ ch1se sinc 3 ? + pga modulator v ref - ? - ? sda1if sdxresh sdxresl low-pass primary osc frc f cy dither<1:0> sdgain<2:0> sddiv<2:0> sdcs<1:0> v ref + filtdis sdint<1:0> sdwm<1:0> rndres<1:0> sv dd sv ref + sdrefp v ref + sv ref -/ch1- sv ss ch0- sv ss sv ref - filter v ref - sdrefn sdch<2:0> filter/sample control and interrupt logic clock generation
PIC24FJ128GC010 family ds30009312b-page 370 ? 2012-2013 microchip technology inc. 27.1 important differences compared to conventional a/ds in principle, the sigma-delta a/d converter does what most other a/ds do: it samples an analog input voltage and generates a digital output code representing the analog voltage. there are, however, a number of differ- ences when comparing a sigma-delta converter to conventional a/d converters, such as the successive approximation register (sar) design that is popular on many of today?s microcontrollers. the most important differences that are noticeable at the application level include: ? readily achieved resolution/quality of result ? analog channel sampling methodology ? uncorrected offset error ? uncorrected gain error 27.1.1 result quality and oversampling in a typical application, involving switching digital circuitry, oscillators, clocks and other noise sources common in a microcontroller-based circuit, it is often difficult to reduce the high-frequency noise floor below some arbitrary value. for a/ds, which perform instan- taneous ?snapshot? based sampling (e.g., charging a sample-and-hold capacitor in a conventional sar-based a/d), this noise floor ultimately restricts the maximum achievable stable result resolution. to achieve higher effective stable resolution and to minimize the effects of high-frequency noise, the sigma-delta a/d converter implements inherent over- sampling in the design. this oversampling has an effect similar to low-pass filtering the analog signal and voltage references to the a/d. therefore, when the converter generates a result, the output code rep- resents the average voltage of the signal or reference being measured over a specific time window, rather than an instantaneous snapshot in time (like that of the sar-based a/d). this sampling method enables the sigma-delta a/d converter to generate stable results at significantly higher resolution than is typically achievable with conventional a/d designs. the design of this sigma-delta a/d converter allows user-configurable oversampling ratios (osrs), between 16 and 1024. the lowest settings provide the fastest results, but they sacrifice result code accuracy. the highest osr settings provide the best quality and most stable results, but generate results at a much slower rate. 27.1.2 uncorrected offset error when uncorrected, the sigma-delta a/d converter typically has more lsbs worth of offset error than conventional sar-based a/ds. this is partly due to the high resolution and small size of each lsb. additionally, internal or external input circuitry, such as the internal input gain stage, can also introduce some offset error. fortunately, the sigma-delta a/d converter imple- ments a feature that allows it to measure its own internal offset error. this feature is controlled by the voscal bit (sd1con1<4>). once the application firmware has measured the internal offset error, the digital output code can be saved in the firmware, and subsequently subtracted from all future a/d measure- ments on the regular input channel(s). this procedure significantly improves the absolute accuracy of the a/d and is recommended for most applications. 27.1.3 uncorrected gain error when uncorrected, sigma-delta a/d converters typi- cally exhibit high gain error compared to other a/d designs. to obtain high absolute accuracy from the sigma-delta a/d converter, it is necessary to compen- sate for both offset error and gain error. gain error can be corrected by first removing the offset error, then multiplying the resulting code with a suitable gain error correction factor. one of the input channel settings, selectable in the sd1con3 register, allows the a/d to measure its own references. when a measurement (with a gain of 1) is performed on this channel, the result code can be cor- rected for offset error (using the method described in section 27.1.2 ?uncorrected offset error? ) and then used to calculate the gain error correction factor. once the gain error correction factor is known, it can be saved and stored in the firmware, so that it may be used later to correct for gain error when performing measurements on the other a/d input channels.
? 2012-2013 microchip technology inc. ds30009312b-page 371 PIC24FJ128GC010 family register 27-1: sd1con1: s/d control register 1 r/w-0 u-0 r/w-0 r/w-0 r-0 r/w-0 r/w-0 r/w-0 sdon ? sdsidl sdrst r sdgain2 sdgain1 sdgain0 bit 15 bit 8 r/w-0 r/w-0 u-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 dither1 dither0 ?voscal ? sdrefn sdrefp pwrlvl bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 sdon: s/d module enable bit 1 = module is enabled 0 = module is disabled bit 14 unimplemented: read as ? 0 ? bit 13 sdsidl: s/d stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 sdrst: s/d reset bit 1 = resets all s/d module circuitry (analog section remains in reset as long as bit is set) 0 = releases from reset (run mode) bit 11 reserved: maintain as ? 0 ? for proper operation bit 10-8 sdgain<2:0>: s/d gain control bits 11x = reserved 101 = 32 100 = 16 011 = 8 010 = 4 001 = 2 000 = 1 bit 7-6 dither<1:0>: dither mode select bits 11 = high dither (preferred with higher oversampling ratio (osr) and positive reference well below sv dd ) 10 = medium dither (preferred for low to medium osr and positive reference well below sv dd ) 01 = low dither (preferred when the positive reference is at or near sv dd ) 00 = no dither bit 5 unimplemented: read as ? 0 ? bit 4 voscal: internal offset measurement enable bit 1 = converter is configured to sample its own internal offset error 0 = converter is configured for normal operation bit 3 unimplemented: read as ? 0 ? bit 2 sdrefn: s/d negative reference source select bit 1 =sv ref - pin 0 =sv ss pin bit 1 sdrefp: s/d positive reference source select bit 1 =sv ref + pin 0 =sv dd pin bit 0 pwrlvl: analog amplifier bandwidth select bit 1 = 2x bandwidth (higher power consumption compared to normal bandwidth) 0 = normal bandwidth
PIC24FJ128GC010 family ds30009312b-page 372 ? 2012-2013 microchip technology inc. register 27-2: sd1con2: s/d control register 2 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 chop1 chop0 sdint1 sdint0 ? ?sdwm1sdwm0 bit 15 bit 8 u-0 u-0 u-0 r/w-0 r/w-0 u-0 u-0 hs/c-0 ? ? ? rndres1 rndres0 ? ? sdrdy bit 7 bit 0 legend: c = clearable bit hs = hardware settable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-14 chop<1:0>: chopping enable bits 11 = chopping is enabled (recommended setting, improves result quality) 10 = reserved 01 = reserved 00 = chopping is disabled bit 13-12 sdint<1:0>: s/d interrupt event generation select bits 11 = interrupt on every sample clock 10 = interrupt on every fifth sample clock 01 = interrupt when new result < old result 00 = interrupt when new result > old result bit 11-10 unimplemented: read as ? 0 ? bit 9-8 sdwm<1:0>: s/d output result register write bits 11 = reserved; do not use 10 = sd1resh/sd1resl is never updated (used for threshold compare operations) 01 = sd1resh/sd1resl is updated on every interrupt 00 = sd1resh/sd1resl is updated on every interrupt when sdrdy = 0 bit 7-5 unimplemented: read as ? 0 ? bit 4-3 rndres<1:0>: round data control bits 11 = round result to 8 bits 10 = round result to 16 bits 01 = round result to 24 bits 00 = no rounding bit 2-1 unimplemented: read as ? 0 ? bit 0 sdrdy: s/d filter data ready bit (set by hardware) 1 = sync filter delay is satisfied (clear this bit in software) 0 = sync filter delay is not satisfied yet
? 2012-2013 microchip technology inc. ds30009312b-page 373 PIC24FJ128GC010 family register 27-3: sd1con3: s/d control register 3 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 sddiv2 ( 1 ) sddiv1 ( 1 ) sddiv0 ( 1 ) sdosr2 sdosr1 sdosr0 sdcs1 sdcs0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 ? ? ? ? ? sdch2 sdch1 sdch0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-13 sddiv<2:0>: s/d input clock divider/postscaler ratio bits ( 1 ) 111 = reserved 110 =64 101 =32 100 =16 011 =8 010 =4 001 =2 000 = 1 (no divider, clock selected by sdcs<1:0> provided directly to a/d) bit 12-10 sdosr<2:0>: s/d oversampling ratio (osr) selection bits 111 = reserved 110 = 16 (fastest result, lowest quality) 101 =32 100 =64 011 = 128 010 = 256 001 = 512 000 = 1024 (slowest result, best quality) bit 9-8 sdcs<1:0>: s/d a/d module clock source select bits 11 = reserved 10 = primary oscillator (osci/clki) 01 = frc (8 mhz) ( 2 ) 00 = system clock (f osc /2) bit 7-3 unimplemented: read as ? 0 ? bit 2-0 sdch<2:0>: s/d analog channel input select bits (positive input/negative input) 1xx = reserved 011 = measures the reference selected by sdrefp/sdrefn (used for gain error measurements) 010 = ch1se/sv ss (single-ended measurement of ch1se) 001 = ch1+/ch1- (differential channel 1) 000 = ch0+/ch0- (differential channel 0) note 1: to avoid overclocking or underclocking the module, set sddiv<2:0> to obtain an a/d clock frequency (input frequency selected by sdcs<1:0> source, divided by selected sddivx ratio) at or between 1 mhz and 4 mhz. 2: 8 mhz frc output is used directly, prior to the frcdiv postscaler.
PIC24FJ128GC010 family ds30009312b-page 374 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 375 PIC24FJ128GC010 family 28.0 10-bit digital-to-analog converter (dac) PIC24FJ128GC010 family devices include two 10-bit digital-to-analog converters (dacs) for generating analog outputs from digital data. a simplified block diagram for a single dac is shown in figure 28-1 . both of the dacs are identical. the dac generates an analog output voltage based on the digital input code, according to the formula: where v dac is the analog output voltage and v dacref is the reference voltage selected by dacref<1:0>. each dac includes these features: ? precision 10-bit resistor ladder for high accuracy ? fast settling time, supporting 1 msps effective sampling rates ? buffered output voltage ? three user-selectable voltage reference options ? multiple conversion trigger options, plus a manual convert-on-write option ? left and right justified input data options ? user-selectable sleep and idle mode operation when using the dac, it is required to set the ansx and trisx bits for the dacx output pin to configure it as an analog output. see section 11.2 ?configuring analog port pins (ansx)? for more information. figure 28-1: single dac simplified block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ? pic24f family reference manual ?, ?10-bit digital-to-analog converter (dac)? (ds39615). the information in this data sheet supersedes the information in the frm. v dacref ? dacxdat 1024 v dac = resistor ladder avss cmpif int1 tmr2 trigger tmr1 trigger pipeline a/d trigger sd a/d trigger 10 dacsel<4:0> trigger and interrupt logic dacxif dv ref + av dd bgbuf0 dacref<1:0> dacx output dacen dacsidl idle mode dacslp sleep mode dactrig 10-bit 2x gain buffer unity gain buffer pin dacxcon dacxdat
PIC24FJ128GC010 family ds30009312b-page 376 ? 2012-2013 microchip technology inc. register 28-1: dacxcon: dacx control register r/w-0 u-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 dacen ? dacsidl dacslp dacfm ? ?dactrig bit 15 bit 8 u-1 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? dactsel4 dactsel3 dactsel2 dac tsel1 dactsel0 dacref1 dacref0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 dacen: dac enable bit 1 = module is enabled 0 = module is disabled bit 14 unimplemented: read as ? 0 ? bit 13 dacsidl: dac peripheral stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 dacslp: dac enable peripheral during sleep bit 1 = dac continues to output the most recent value of dacxdat during sleep mode 0 = dac is powered down in sleep mode; dacx output pin is controlled by the trisx and latx bits bit 11 dacfm: dac data format select bit 1 = data is left justified (data stored in dacxdat<15:5>) 0 = data is right justified (data stored in dacxdat<9:0>) bit 10-9 unimplemented: read as ? 0 ? bit 8 dactrig: dac trigger input enable bit 1 = analog output value updates when the selected (by dactsel<4:0>) event occurs 0 = analog output value updates as soon as dacxdat is written (dac trigger is ignored) bit 7 unimplemented: recommended to write as ? 1 ? for code compatibility across device families bit 6-2 dactsel<4:0>: dac trigger source select bits 11x = unimplemented 101 = s/d a/d interrupt 100 = pipeline a/d interrupt 011 = timer1 interrupt 010 = timer2 interrupt 001 =int1 000 = comparator 1 trigger bit 1-0 dacref<1:0>: dac reference source select bits 11 = 2.4v internal band gap (2 ? bgbuf0) ( 1 ) 10 =av dd 01 =dv ref + 00 = reference not connected (lowest power but no dac functionality) note 1: user must also enable band gap buffer 0 and set bufcon0<1:0> to ? 00 ? to obtain this voltage. see register 25-1 for details.
? 2012-2013 microchip technology inc. ds30009312b-page 377 PIC24FJ128GC010 family 29.0 dual operational amplifier module PIC24FJ128GC010 family devices include two opera- tional amplifiers to complement the microcontroller?s other analog features. they may be used to provide analog signal conditioning, either as stand-alone devices or in addition to other analog peripherals. they may also be configured to operate as digital compara- tors in addition to the triple comparator module (see section 30.0 ?triple comparator module? for more information). the two op amps are functionally identical; the block diagram for a single amplifier is shown in figure 29-1 . each op amp has these features: ? configurable as either an operational amplifier or a comparator ? internal unity-gain buffer option ? six input options each on the inverting and non-inverting amplifier inputs ? rail-to-rail input and output capabilities ? user-configurable interrupt with comparator operation, including four interrupt options ? user-selectable option for regular or low-power operation ? user-selectable operation in idle and sleep modes when using the op amps, it is recommended to set the ansx and trisx bits of both the input and output pins to configure them as analog pins. see section 11.2 ?configuring analog port pins (ansx)? for more information. figure 29-1: single operatio nal amplifier block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ?pic24f family reference manual? , ?operational amplifier (op amp)? (ds30505). device-specific information in this data sheet supersedes the information in the ?pic24f family reference manual? . cmpsel spdsel cmout ampoe + ? ampen interrupt intpol<1:0> oaxout ampxif ampsidl ampslp ninsel<2:0> pinsel<2:0> logic oaxnb oaxnc oaxnd oaxne vss oaxna ctmu/a/d oaxpb oaxpc oaxpd oaxpe oaxpa vss cmpsel
PIC24FJ128GC010 family ds30009312b-page 378 ? 2012-2013 microchip technology inc. register 29-1: ampxcon: op amp x control register r/w-0 u-0 r/w-0 r/w-0 r/w-0 r-0 r-x r/w-0 ampen ? ampsidl ampslp intpol1 intpol0 cmout cmpsel bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 spdsel ampoe ninsel2 ninsel1 nin sel0 pinsel2 pinsel1 pinsel0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 ampen: op amp control module enable bit 1 = module is enabled 0 = module is disabled bit 14 unimplemented: read as ? 0 ? bit 13 ampsidl: op amp peripheral stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 ampslp: op amp peripheral enabled in sleep mode bit 1 = continues module operation when device enters sleep mode 0 = discontinues module operation in sleep mode bit 11-10 intpol<1:0>: interrupt mode select bits when cmpsel = 1 : 11 = interrupt occurs on any change 10 = interrupt occurs on negative edge 01 = interrupt occurs on positive edge 00 = interrupts are disabled when cmpsel = 0 : op amp interrupts are not generated. bit 9 cmout: comparator mode output state bit when cmpsel = 1 : 1 = non-inverting input is greater than the inverting input 0 = non-inverting input is less than the inverting input when cmpsel = 0 : op amp mode (no digital state information is generated). bit 8 cmpsel: op amp mode select bit 1 = configured as a comparator 0 = configured as an op amp bit 7 spdsel: op amp/comparator power/speed select bit 1 = higher power and bandwidth (faster response time) 0 = lower power and bandwidth (slower response time) bit 6 ampoe: amplifier output enable bit 1 = amplifier or comparator output is sent to oaxout pin 0 = amplifier or comparator output is not sent to oaxout (pin is controlled by trisx and latx bits)
? 2012-2013 microchip technology inc. ds30009312b-page 379 PIC24FJ128GC010 family bit 5-3 ninsel<2:0>: op amp inverting input select bits 111 = reserved; do not use 110 = op amp output (voltage follower configuration) 101 = oaxne 100 = oaxnd 011 = oaxnc 010 = oaxnb 001 = oaxna 000 = v ss bit 2-0 pinsel<2:0>: op amp non-inverting input select bits 111 = reserved; do not use 110 = connected between ctmu output and pipeline a/d 101 = oaxpe 100 = oaxpd 011 = oaxpc 010 = oaxpb 001 = oaxpa 000 = v ss register 29-1: ampxcon: op amp x control register
PIC24FJ128GC010 family ds30009312b-page 380 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 381 PIC24FJ128GC010 family 30.0 triple comparator module the triple comparator module provides three dual input comparators. the inputs to the comparator can be configured to use any one of five external analog inputs (cxina, cxinb, cxinc, cxind and v ref +) and a voltage reference input from one of the internal band gap references or the comparator voltage reference generator (v bg , v bg /2, v bg /6 and cv ref ). the comparator outputs may be directly connected to the cxout pins. when the respective coe equals ? 1 ?, the i/o pad logic makes the unsynchronized output of the comparator available on the pin. a simplified block diagram of the module in shown in figure 30-1 . diagrams of the possible individual comparator configurations are shown in figure 30-2 . each comparator has its own control register, cmxcon ( register 30-1 ), for enabling and configuring its operation. the output and event status of all three comparators is provided in the cmstat register ( register 30-2 ). figure 30-1: triple comp arator module block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ? pic24f family reference manual ?, ?scalable comparator module? (ds39734). the information in this data sheet supersedes the information in the frm. c1 v in - v in + c x inb c x inc c x ina c x ind cv ref v bg c2 v in - v in + c3 v in - v in + coe c1out pin cpol trigger/interrupt logic cevt evpol<1:0> cout input select logic cch<1:0> cref coe c2out pin cpol trigger/interrupt logic cevt evpol<1:0> cout coe c3out pin cpol trigger/interrupt logic cevt evpol<1:0> cout v bg /2 cv ref + cvrefm<1:0> (1) cv ref + cvrefp (1) + 01 00 10 11 01 00 11 1 0 1 0 note 1: refer to the cvrcon register ( register 31-1 ) for bit details.
PIC24FJ128GC010 family ds30009312b-page 382 ? 2012-2013 microchip technology inc. figure 30-2: individual comparator configurations when cref = 0 cx v in - v in + off (read as ? 0 ?) comparator off cen = 0 , cref = x , cch<1:0> = xx comparator cxinb > cxina compare cen = 1 , cch<1:0> = 00 , cvrefm<1:0> = xx coe cxout cx v in - v in + coe c x inb c x ina comparator cxind > cxina compare cen = 1 , cch<1:0> = 10 , cvrefm<1:0> = xx cx v in - v in + coe cxout c x ind c x ina comparator cxinc > cxina compare cx v in - v in + coe c x inc c x ina comparator v bg > cxina compare cx v in - v in + coe v bg c x ina pin pin cxout pin cxout pin cxout pin comparator v bg > cxina compare cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 01 cx v in - v in + coe v bg /2 c x ina cxout pin comparator cxind > cxina compare cx v in - v in + coe cxout v ref + c x ina pin cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 11 cen = 1 , cch<1:0> = 01 , cvrefm<1:0> = xx cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 00
? 2012-2013 microchip technology inc. ds30009312b-page 383 PIC24FJ128GC010 family figure 30-3: individual comparator configurations when cref = 1 and cvrefp = 0 figure 30-4: individual comparator configurations when cref = 1 and cvrefp = 1 comparator cxind > cv ref compare cx v in - v in + coe c x ind cv ref cxout pin comparator v bg > cv ref compare cx v in - v in + coe v bg cv ref cxout pin comparator cxinc > cv ref compare cx v in - v in + coe c x inc cv ref cxout pin comparator cxinb > cv ref compare cen = 1 , cch<1:0> = 00 , cvrefm<1:0> = xx cx v in - v in + coe c x inb cv ref cxout pin comparator v bg > cv ref compare cx v in - v in + coe v bg /2 cv ref cxout pin comparator cxind > cv ref compare cx v in - v in + coe v ref + cv ref cxout pin cen = 1 , cch<1:0> = 10 , cvrefm<1:0> = xx cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 01 cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 11 cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 00 cen = 1 , cch<1:0> = 01 , cvrefm<1:0> = xx comparator cxind > cv ref compare cx v in - v in + coe c x ind v ref + cxout pin comparator v bg > cv ref compare cx v in - v in + coe v bg v ref + cxout pin comparator cxinc > cv ref compare cx v in - v in + coe c x inc v ref + cxout pin comparator cxinb > cv ref compare cx v in - v in + coe c x inb v ref + cxout pin comparator v bg > cv ref compare cx v in - v in + coe v bg /2 v ref + cxout pin cen = 1 , cch<1:0> = 00 , cvrefm<1:0> = xx cen = 1 , cch<1:> = 10 , cvrefm<1:0> = xx cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 01 cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 00 cen = 1 , cch<1:0> = 01 , cvrefm<1:0> = xx
PIC24FJ128GC010 family ds30009312b-page 384 ? 2012-2013 microchip technology inc. register 30-1: cmxcon: comp arator x control registers (comparators 1 through 3) r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 r/w-0, hs r-0, hsc con coe cpol ? ? ? cevt cout bit 15 bit 8 r/w-0 r/w-0 u-0 r/w-0 u-0 u-0 r/w-0 r/w-0 evpol1 evpol0 ? cref ? ? cch1 cch0 bit 7 bit 0 legend: hs = hardware settable bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 con: comparator enable bit 1 = comparator is enabled 0 = comparator is disabled bit 14 coe: comparator output enable bit 1 = comparator output is present on the cxout pin 0 = comparator output is internal only bit 13 cpol: comparator output polarity select bit 1 = comparator output is inverted 0 = comparator output is not inverted bit 12-10 unimplemented: read as ? 0 ? bit 9 cevt: comparator event bit 1 = comparator event that is defined by evpol<1:0> has occurred; subsequent triggers and interrupts are disabled until the bit is cleared 0 = comparator event has not occurred bit 8 cout: comparator output bit when cpol = 0 : 1 =v in + > v in - 0 =v in + < v in - when cpol = 1 : 1 =v in + < v in - 0 =v in + > v in - bit 7-6 evpol<1:0>: trigger/event/interrupt polarity select bits 11 = trigger/event/interrupt is generated on any change of the comparator output (while cevt = 0 ) 10 = trigger/event/interrupt is generated on transition of the comparator output: if cpol = 0 (non-inverted polarity): high-to-low transition only. if cpol = 1 (inverted polarity): low-to-high transition only. 01 = trigger/event/interrupt is generated on transition of comparator output: if cpol = 0 (non-inverted polarity): low-to-high transition only. if cpol = 1 (inverted polarity): high-to-low transition only. 00 = trigger/event/interrupt generation is disabled bit 5 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 385 PIC24FJ128GC010 family bit 4 cref: comparator reference select bits (non-inverting input) 1 = non-inverting input connects to the internal cv ref voltage 0 = non-inverting input connects to the cxina pin bit 3-2 unimplemented: read as ? 0 ? bit 1-0 cch<1:0>: comparator channel select bits 11 = inverting input of the comparator connects to the internal selectable reference voltage specified by the cvrefm<1:0> bits in the cvrcon register 10 = inverting input of the comparator connects to the cxind pin 01 = inverting input of the comparator connects to the cxinc pin 00 = inverting input of the comparator connects to the cxinb pin register 30-1: cmxcon: comp arator x control registers (comparators 1 through 3) (continued) register 30-2: cmstat: comparat or module status register r/w-0 u-0 u-0 u-0 u-0 r-0, hsc r-0, hsc r-0, hsc cmidl ? ? ? ? c3evt c2evt c1evt bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r-0, hsc r-0, hsc r-0, hsc ? ? ? ? ? c3out c2out c1out bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 cmidl: comparator stop in idle mode bit 1 = discontinues operation of all comparators when device enters idle mode 0 = continues operation of all enabled comparators in idle mode bit 14-11 unimplemented: read as ? 0 ? bit 10 c3evt: comparator 3 event status bit (read-only) shows the current event status of comparator 3 (cm3con<9>). bit 9 c2evt: comparator 2 event status bit (read-only) shows the current event status of comparator 2 (cm2con<9>). bit 8 c1evt: comparator 1 event status bit (read-only) shows the current event status of comparator 1 (cm1con<9>). bit 7-3 unimplemented: read as ? 0 ? bit 2 c3out: comparator 3 output status bit (read-only) shows the current output of comparator 3 (cm3con<8>). bit 1 c2out: comparator 2 output status bit (read-only) shows the current output of comparator 2 (cm2con<8>). bit 0 c1out: comparator 1 output status bit (read-only) shows the current output of comparator 1 (cm1con<8>).
PIC24FJ128GC010 family ds30009312b-page 386 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 387 PIC24FJ128GC010 family 31.0 comparator voltage reference 31.1 configuring the comparator voltage reference the voltage reference module is controlled through the cvrcon register ( register 31-1 ). the comparator voltage reference provides a range of output voltages, with 32 distinct levels. the comparator reference sup- ply voltage can come from either v dd and v ss , or the external cv ref + and cv ref - pins. the voltage source is selected by the cvrss bit (cvrcon<5>). the settling time of the comparator voltage reference must be considered when changing the cv ref output. figure 31-1: comparator volt age reference block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the ? pic24f family reference manual ?, ?dual comparator module? (ds39710). the information in this data sheet supersedes the information in the frm. 32-to-1 mux cvr<4:0> r cvren cvrss = 0 av dd cv ref + cvrss = 1 cvrss = 0 cv ref - cvrss = 1 r r r r r r 32 steps cv ref av ss cvroe c vref pin
PIC24FJ128GC010 family ds30009312b-page 388 ? 2012-2013 microchip technology inc. register 31-1: cvrcon: comparator vo ltage reference control register u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 ? ? ? ? ? cvrefp cvrefm1 cvrefm0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 cvren cvroe cvrss cvr4 cvr3 cvr2 cvr1 cvr0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as ? 0 ? bit 10 cvrefp: comparator voltage reference select bit (valid only when cref is ? 1 ?) 1 =v ref + is used as a reference voltage to the comparators 0 = the cvrx (5-bit dac) within this module provides the reference voltage to the comparators bit 9-8 cvrefm<1:0>: comparator voltage band gap reference source select bits (valid only when cch<1:0> = 11 ) 00 = band gap voltage is provided as an input to the comparators 01 = band gap voltage, divided by two, is provided as an input to the comparators 10 = reserved 11 =v ref + pin is provided as an input to the comparators bit 7 cvren: comparator voltage reference enable bit 1 =cv ref circuit is powered on 0 =cv ref circuit is powered down bit 6 cvroe: comparator v ref output enable bit 1 =cv ref voltage level is output on the cv ref pin 0 =cv ref voltage level is disconnected from the cv ref pin bit 5 cvrss: comparator v ref source selection bit 1 = comparator reference source, cv rsrc = v ref + ? v ref - 0 = comparator reference source, cv rsrc = av dd ? av ss bit 4-0 cvr<4:0>: comparator v ref value selection bits cv ref = (cvr<4:0>/32) ? (cv rsrc )
? 2012-2013 microchip technology inc. ds30009312b-page 389 PIC24FJ128GC010 family 32.0 charge time measurement unit (ctmu) the charge time measurement unit (ctmu) is a flexible analog module that provides charge measurement, accurate differential time measurement between pulse sources and asynchronous pulse generation. its key features include: ? thirteen external edge input trigger sources ? polarity control for each edge source ? control of edge sequence ? control of response to edge levels or edge transitions ? time measurement resolution of one nanosecond ? accurate current source suitable for capacitive measurement together with other on-chip analog modules, the ctmu can be used to precisely measure time, measure capacitance, measure relative changes in capacitance or generate output pulses that are independent of the system clock. the ctmu module is ideal for interfacing with capacitive-based touch sensors. the ctmu is controlled through three registers: ctmucon1, ctmucon2 and ctmuicon. ctmucon1 enables the module and controls the mode of operation of the ctmu, as well as controlling edge sequencing. ctmucon2 controls edge source selec- tion and edge source polarity selection. the ctmuicon register selects the current range of current source and trims the current. 32.1 measuring capacitance the ctmu module measures capacitance by generating an output pulse with a width equal to the time between edge events on two separate input channels. the pulse edge events to both input channels can be selected from four sources: two internal peripheral modules (oc1 and timer1) and up to 13 external pins (ctedg1 through ctedg13). this pulse is used with the module?s precision current source to calculate capacitance according to the relationship: equation 32-1: for capacitance measurements, the a/d converter samples an external capacitor (c app ) on one of its input channels, after the ctmu output?s pulse. a precision resistor (r pr ) provides current source calibration on a second a/d channel. after the pulse ends, the converter determines the voltage on the capacitor. the actual calculation of capacitance is performed in software by the application. figure 32-1 illustrates the external connections used for capacitance measurements, and how the ctmu and a/d modules are related in this application. this example also shows the edge events coming from timer1, but other configurations using external edge sources are possible. a detailed discussion on measuring capacitance and time with the ctmu module is provided in the ? pic24f family reference manual?, ?charge time measurement unit (ctmu)? . note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information on the charge measurement unit, refer to the ?pic24f family reference manual? , ?charge time measurement unit (ctmu) with threshold detect? (ds39743). ic dv dt ------ - ? =
PIC24FJ128GC010 family ds30009312b-page 390 ? 2012-2013 microchip technology inc. figure 32-1: typical connections and internal configuration for capacitance measurement 32.2 measuring time time measurements on the pulse width can be similarly performed using the a/d module?s internal capacitor (c ad ) and a precision resistor for current calibration. figure 32-2 displays the external connections used for time measurements, and how the ctmu and a/d modules are related in this application. this example also shows both edge events coming from the external ctedgx pins, but other configurations using internal edge sources are possible. 32.3 pulse generation and delay the ctmu module can also generate an output pulse with edges that are not synchronous with the device?s system clock. more specifically, it can generate a pulse with a programmable delay from an edge event input to the module. when the module is configured for pulse generation delay by setting the tgen bit (ctmucon1<12>), the internal current source is connected to the b input of comparator 2. a capacitor (c delay ) is connected to the comparator 2 pin, c2inb, and the comparator voltage reference, cv ref , is connected to c2ina. cv ref is then configured for a specific trip point. the module begins to charge c delay when an edge event is detected. when c delay charges above the cv ref trip point, a pulse is output on ctpls. the length of the pulse delay is determined by the value of c delay and the cv ref trip point. figure 32-3 illustrates the external connections for pulse generation, as well as the relationship of the different analog modules required. while cted1 is shown as the input pulse source, other options are available. a detailed discussion on pulse generation with the ctmu module is provided in the ? pic24f family reference manual? . pic24f device a/d converter ctmu anx c app output pulse edg1 edg2 r pr an y timer1 current source
? 2012-2013 microchip technology inc. ds30009312b-page 391 PIC24FJ128GC010 family figure 32-2: typical connections and internal configuration for time measurement figure 32-3: typical co nnections and internal co nfiguration for pulse delay generation pic24f device a/d converter ctmu cted x cted x anx output pulse edg1 edg2 c ad r pr current source c2 cv ref ctpls pic24f device current source comparator ctmu cted x c2inb c delay edg1 ?
PIC24FJ128GC010 family ds30009312b-page 392 ? 2012-2013 microchip technology inc. register 32-1: ctmucon1: ct mu control register 1 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ctmuen ? ctmusidl tgen edgen edgseqen idissen cttrig bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 ctmuen: ctmu enable bit 1 = module is enabled 0 = module is disabled bit 14 unimplemented: read as ? 0 ? bit 13 ctmusidl: ctmu stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 tgen: time generation enable bit 1 = enables edge delay generation 0 = disables edge delay generation bit 11 edgen: edge enable bit 1 = edges are not blocked 0 = edges are blocked bit 10 edgseqen: edge sequence enable bit 1 = edge 1 event must occur before edge 2 event can occur 0 = no edge sequence is needed bit 9 idissen: analog current source control bit 1 = analog current source output is grounded 0 = analog current source output is not grounded bit 8 cttrig: ctmu trigger control bit 1 = trigger output is enabled 0 = trigger output is disabled bit 7-0 unimplemented: read as ? 0 ?
? 2012-2013 microchip technology inc. ds30009312b-page 393 PIC24FJ128GC010 family register 32-2: ctmucon2: ct mu control register 2 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 edg1mod edg1pol edg1sel3 edg1sel2 e dg1sel1 edg1sel0 edg2stat edg1stat bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 edg2mod edg2pol edg2sel3 edg2sel2 edg2sel1 edg2sel0 ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 edg1mod: edge 1 edge-sensitive select bit 1 = input is edge-sensitive 0 = input is level-sensitive bit 14 edg1pol: edge 1 polarity select bit 1 = edge 1 is programmed for a positive edge response 0 = edge 1 is programmed for a negative edge response bit 13-10 edg1sel<3:0>: edge 1 source select bits 1111 = edge 1 source is comparator 3 output 1110 = edge 1 source is comparator 2 output 1101 = edge 1 source is comparator 1 output 1100 = edge 1 source is ic3 1011 = edge 1 source is ic2 1010 = edge 1 source is ic1 1001 = edge 1 source is cted8 1000 = edge 1 source is cted7 ( 1 ) 0111 = edge 1 source is cted6 0110 = edge 1 source is cted5 0101 = edge 1 source is cted4 0100 = edge 1 source is cted3 ( 1 ) 0011 = edge 1 source is cted1 0010 = edge 1 source is cted2 0001 = edge 1 source is oc1 0000 = edge 1 source is timer1 bit 9 edg2stat: edge 2 status bit indicates the status of edge 2 and can be written to control current source. 1 = edge 2 has occurred 0 = edge 2 has not occurred bit 8 edg1stat: edge 1 status bit indicates the status of edge 1 and can be written to control current source. 1 = edge 1 has occurred 0 = edge 1 has not occurred bit 7 edg2mod: edge 2 edge-sensitive select bit 1 = input is edge-sensitive 0 = input is level-sensitive bit 6 edg2pol: edge 2 polarity select bit 1 = edge 2 is programmed for a positive edge 0 = edge 2 is programmed for a positive edge note 1: edge sources, cted3, cted7, cted10 and cted11, are available in 100-pin devices only.
PIC24FJ128GC010 family ds30009312b-page 394 ? 2012-2013 microchip technology inc. bit 5-2 edg2sel<3:0>: edge 2 source select bits 1111 = edge 2 source is comparator 3 output 1110 = edge 2 source is comparator 2 output 1101 = edge 2 source is comparator 1 output 1100 = unimplemented do not use 1011 = edge 2 source is ic3 1010 = edge 2 source is ic2 1001 = edge 2 source is ic1 1000 = edge 2 source is cted13 0111 = edge 2 source is cted12 0110 = edge 2 source is cted11 ( 1 ) 0101 = edge 2 source is cted10 ( 1 ) 0100 = edge 2 source is cted9 0011 = edge 2 source is cted1 0010 = edge 2 source is cted2 0001 = edge 2 source is oc1 0000 = edge 2 source is timer1 bit 1-0 unimplemented: read as ? 0 ? register 32-2: ctmucon2: ctmu control register 2 (continued) note 1: edge sources, cted3, cted7, cted10 and cted11, are available in 100-pin devices only.
? 2012-2013 microchip technology inc. ds30009312b-page 395 PIC24FJ128GC010 family register 32-3: ctmuicon: ctmu current control register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 itrim5 itrim4 itrim3 itrim2 itrim1 itrim0 irng1 irng0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15-10 itrim<5:0>: current source trim bits 011111 = maximum positive change from nominal current 011110 . . . 000001 = minimum positive change from nominal current 000000 = nominal current output specified by irng<1:0> 111111 = minimum negative change from nominal current . . . 100010 100001 = maximum negative change from nominal current bit 9-8 irng<1:0>: current source range select bits 11 = 100 base current 10 = 10 base current 01 = base current level (0.55 ? a nominal) 00 = 1000 base current bit 7-0 unimplemented: read as ? 0 ?
PIC24FJ128GC010 family ds30009312b-page 396 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 397 PIC24FJ128GC010 family 33.0 high/low-voltage detect (hlvd) the high/low-voltage detect (hlvd) module is a programmable circuit that allows the user to specify both the device voltage trip point and the direction of change. an interrupt flag is set if the device experiences an excursion past the trip point in the direction of change. if the interrupt is enabled, the program execution will branch to the interrupt vector address and the software can then respond to the interrupt. the hlvd control register (see register 33-1 ) completely controls the operation of the hlvd module. this allows the circuitry to be ?turned off? by the user under software control, which minimizes the current consumption for the device. figure 33-1: high/low-voltage de tect (hlvd) module block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information on the high/low-voltage detect, refer to the ?pic24f family reference manual? , ?high-level integration with programmable high/low-voltage detect (hlvd)? (ds39725). set v dd 16-to-1 mux hlvden hlvdl<3:0> hlvdin v dd externally generated trip point hlvdif hlvden internal voltage reference vdir 1.20v typical
PIC24FJ128GC010 family ds30009312b-page 398 ? 2012-2013 microchip technology inc. register 33-1: hlvdcon: high/low-v oltage detect control register r/w-0 u-0 r/w-0 u-0 u-0 u-0 u-0 u-0 hlvden ?lsidl ? ? ? ? ? bit 15 bit 8 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 vdir bgvst irvst ? hlvdl3 hlvdl2 hlvdl1 hlvdl0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 15 hlvden: high/low-voltage detect power enable bit 1 = hlvd is enabled 0 = hlvd is disabled bit 14 unimplemented: read as ? 0 ? bit 13 lsidl: hlvd stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-8 unimplemented: read as ? 0 ? bit 7 vdir: voltage change direction select bit 1 = event occurs when voltage equals or exceeds trip point (hlvdl<3:0>) 0 = event occurs when voltage equals or falls below trip point (hlvdl<3:0>) bit 6 bgvst: band gap voltage stable flag bit 1 = indicates that the band gap voltage is stable 0 = indicates that the band gap voltage is unstable bit 5 irvst: internal reference voltage stable flag bit 1 = internal reference voltage is stable; the high-voltage detect logic generates the interrupt flag at the specified voltage range 0 = internal reference voltage is unstable; the high-voltage detect logic will not generate the interrupt flag at the specified voltage range and the hlvd interrupt should not be enabled bit 4 unimplemented: read as ? 0 ? bit 3-0 hlvdl<3:0>: high/low-voltage detection limit bits 1111 = external analog input is used (input comes from the hlvdin pin) 1110 = trip point 1 ( 1 ) 1101 = trip point 2 ( 1 ) 1100 = trip point 3 ( 1 ) . . . 0100 = trip point 11 ( 1 ) 00xx = unused note 1: for the actual trip point, see section 37.0 ?electrical characteristics? .
? 2012-2013 microchip technology inc. ds30009312b-page 399 PIC24FJ128GC010 family 34.0 special features PIC24FJ128GC010 family devices include several features intended to maximize application flexibility and reliability, and minimize cost through elimination of external components. these are: ? flexible configuration ? watchdog timer (wdt) ? code protection ? jtag boundary scan interface ? in-circuit serial programming? ? in-circuit emulation 34.1 configuration bits the configuration bits can be programmed (read as ? 0 ?), or left unprogrammed (read as ? 1 ?), to select various device configurations. these bits are mapped, starting at program memory location, f80000h. a detailed expla- nation of the various bit functions is provided in register 34-1 through register 34-6 . note that address, f80000h, is beyond the user program memory space. in fact, it belongs to the configuration memory space (800000h-ffffffh), which can only be accessed using table reads and table writes. 34.1.1 considerations for configuring PIC24FJ128GC010 family devices in PIC24FJ128GC010 family devices, the configuration bytes are implemented as volatile memory. this means that configuration data must be programmed each time the device is powered up. configuration data is stored in the four words at the top of the on-chip program memory space, known as the flash configuration words. their specific locations are shown in table 34-1 . these are packed representations of the actual device configuration bits, whose actual locations are distributed among several locations in configuration space. the configuration data is automat- ically loaded from the flash configuration words to the proper configuration registers during device resets. when creating applications for these devices, users should always specifically allocate the location of the flash configuration word for configuration data. this is to make certain that program code is not stored in this address when the code is compiled. the upper byte of all flash configuration words in pro- gram memory should always be ? 0000 0000 ?. this makes them appear to be nop instructions in the remote event that their locations are ever executed by accident. since configuration bits are not implemented in the corresponding locations, writing ? 0 ?s to these locations has no effect on device operation. table 34-1: flash configu ration word locations for PIC24FJ128GC010 family devices note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the following sections of the ? pic24f family reference manual ?. the information in this data sheet supersedes the information in the frms. ? ?watchdog timer (wdt)? (ds39697) ? ?high-level device integration? (ds39719) ? ?programming and diagnostics? (ds39716) note: configuration data is reloaded on all types of device resets. note: performing a page erase operation on the last page of program memory clears the flash configuration words, enabling code protection as a result. therefore, users should avoid performing page erase operations on the last page of program memory. device configuration word addresses 1234 pic24fj64gc0xx abfeh abfch abfah abf8h pic24fj128gc0xx 157feh 157fch 157fah 157f8h
PIC24FJ128GC010 family ds30009312b-page 400 ? 2012-2013 microchip technology inc. register 34-1: cw1: flash configuration word 1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 ? ? ? ? ? ? ? ? bit 23 bit 16 r-x r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r jtagen gcp gwrp debug lpcfg ics1 ics0 bit 15 bit 8 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 fwdten1 fwdten0 windis fwpsa wdtps3 wdtps2 wdtps1 wdtps0 bit 7 bit 0 legend: r = reserved bit po = program once bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 23-16 unimplemented: read as ? 1 ? bit 15 reserved: the value is unknown; program as ? 0 ? bit 14 jtagen: jtag port enable bit 1 = jtag port is enabled 0 = jtag port is disabled bit 13 gcp: general segment program memory code protection bit 1 = code protection is disabled 0 = code protection is enabled for the entire program memory space bit 12 gwrp: general segment code flash write protection bit 1 = writes to program memory are allowed 0 = writes to program memory are not allowed bit 11 debug : background debugger enable bit 1 = device resets into operational mode 0 = device resets into debug mode bit 10 lpcfg : low-voltage/retention regulator configuration bit 1 = low-voltage/retention regulator is always disabled 0 = low-power, low-voltage/retention regulator is enabled and controlled in firmware by the reten bit bit 9-8 ics<1:0>: emulator pin placement select bits 11 = emulator functions are shared with pgec1/pged1 10 = emulator functions are shared with pgec2/pged2 01 = emulator functions are shared with pgec3/pged3 00 = reserved; do not use bit 7-6 fwdten<1:0>: watchdog timer configuration bits 11 = wdt is always enabled; swdten bit has no effect 10 = wdt is enabled and controlled in firmware by the swdten bit 01 = wdt is enabled only in run mode and disabled in sleep modes; swdten bit is disabled 00 = wdt is disabled; swdten bit is disabled bit 5 windis: windowed watchdog timer disable bit 1 = standard watchdog timer is enabled 0 = windowed watchdog timer is enabled (fwdten<1:0> must not be ? 00 ?)
? 2012-2013 microchip technology inc. ds30009312b-page 401 PIC24FJ128GC010 family bit 4 fwpsa: wdt prescaler ratio select bit 1 = prescaler ratio of 1:128 0 = prescaler ratio of 1:32 bit 3-0 wdtps<3:0>: watchdog timer postscaler select bits 1111 = 1:32,768 1110 = 1:16,384 1101 = 1:8,192 1100 = 1:4,096 1011 = 1:2,048 1010 = 1:1,024 1001 = 1:512 1000 = 1:256 0111 = 1:128 0110 = 1:64 0101 = 1:32 0100 = 1:16 0011 = 1:8 0010 = 1:4 0001 = 1:2 0000 = 1:1 register 34-1: cw1: flash configuration word 1 (continued)
PIC24FJ128GC010 family ds30009312b-page 402 ? 2012-2013 microchip technology inc. register 34-2: cw2: flash configuration word 2 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 ? ? ? ? ? ? ? ? bit 23 bit 16 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 ieso vbtbor wdtcmx altcvref ( 1 ) altadref ( 1 ) fnosc2 fnosc1 fnosc0 bit 15 bit 8 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r-0 r/po-1 r/po-1 fcksm1 fcksm0 osciofcn wdtclk1 wdtclk0 r poscmd1 poscmd0 bit 7 bit 0 legend: r = reserved bit po = program once bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 23-16 unimplemented: read as ? 1 ? bit 15 ieso: internal external switchover bit 1 = ieso mode (two-speed start-up) is enabled 0 = ieso mode (two-speed start-up) is disabled bit 14 vbtbor: v bat bor enable bit 1 =v bat bor is enabled 0 =v bat bor is disabled bit 13 wdtcmx: wdt clock multiplex control bit 1 = enables wdt clock multiplexing 0 = disables clock multiplexing bit 12 altcvref: external cv ref +/cv ref - location select bit ( 1 ) 1 =cv ref +/cv ref - are mapped to ra9/ra10, respectively 0 =cv ref +/cv ref - are mapped to rb0/rb1, respectively bit 11 altadref: external av ref +/av ref - location select bit ( 1 ) 1 =av ref +/av ref - are mapped to ra9/ra10, respectively 0 =av ref +/av ref - are mapped to rb0/rb1, respectively bit 10-8 fnosc<2:0>: initial oscillator select bits 111 = fast rc oscillator with postscaler (frcdiv) 110 = reserved 101 = low-power rc oscillator (lprc) 100 = secondary oscillator (sosc) 011 = primary oscillator with pll module (xtpll, hspll, ecpll) 010 = primary oscillator (xt, hs, ec) 001 = fast rc oscillator with postscaler and pll module (frcpll) 000 = fast rc oscillator (frc) bit 7-6 fcksm<1:0>: clock switching and fail-safe clock monitor configuration bits 1x = clock switching and fail-safe clock monitor are disabled 01 = clock switching is enabled, fail-safe clock monitor is disabled 00 = clock switching is enabled, fail-safe clock monitor is enabled note 1: these bits should be treated as reserved on the 64-pin devices (pic24fj64gc006 and pic24fj128gc006) and should always be programmed to ? 0 ?. the av ref +/cv ref + and av ref -/cv ref - functions are located on rb0 and rb1 on these devices. 2: the 31 khz frc source is used when a windowed wdt mode is selected and the lprc is not being used as the system clock. the lprc is used when the device is in sleep mode and in all other cases.
? 2012-2013 microchip technology inc. ds30009312b-page 403 PIC24FJ128GC010 family bit 5 osciofcn: osco pin configuration bit if poscmd<1:0> = 11 or 00 : 1 = osco/clko/rc15 functions as clko (f osc /2) 0 = osco/clko/rc15 functions as port i/o (rc15) if poscmd<1:0> = 10 or 01 : osciofcn has no effect on osco/clko/rc15. bit 4-3 wdtclk<1:0>: wdt clock source select bits when wdtcmx = 1 : 11 =lprc 10 = either the 31 khz frc source or lprc, depending on device configuration ( 2 ) 01 = sosc input 00 = system clock when active, lprc while in sleep mode when wdtcmx = 0 : lprc is always the wdt clock source. bit 2 reserved: configure as ? 0 ? bit 1-0 poscmd<1:0>: primary oscillator configuration bits 11 = primary oscillator mode is disabled 10 = hs oscillator mode is selected (hs mode is used if crystal ? 10 mhz) 01 = xt oscillator mode is selected (xt mode is used if crystal < 10 mhz) 00 = ec oscillator mode is selected register 34-2: cw2: flash configuration word 2 (continued) note 1: these bits should be treated as reserved on the 64-pin devices (pic24fj64gc006 and pic24fj128gc006) and should always be programmed to ? 0 ?. the av ref +/cv ref + and av ref -/cv ref - functions are located on rb0 and rb1 on these devices. 2: the 31 khz frc source is used when a windowed wdt mode is selected and the lprc is not being used as the system clock. the lprc is used when the device is in sleep mode and in all other cases.
PIC24FJ128GC010 family ds30009312b-page 404 ? 2012-2013 microchip technology inc. register 34-3: cw3: flash configuration word 3 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 ? ? ? ? ? ? ? ? bit 23 bit 16 r/po-1 r/po-1 r/po-1 r/po-1 r-1 r/po-1 r/po-1 r/po-1 wpend wpcfg wpdis boren r wdtwin1 wdtwin0 soscsel bit 15 bit 8 r-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r wpfp6 ( 3 ) wpfp5 wpfp4 wpfp3 wpfp2 wpfp1 wpfp0 bit 7 bit 0 legend: po = program once bit r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 23-16 unimplemented: read as ? 1 ? bit 15 wpend: segment write protection end page select bit 1 = protected program memory segment upper boundary is at the last page of program memory; the lower boundary is the code page specified by wpfp<6:0> 0 = protected program memory segment lower boundary is at the bottom of the program memory (000000h); upper boundary is the code page specified by wpfp<6:0> bit 14 wpcfg: configuration word code page write protection select bit 1 = last page (at the top of program memory) and flash configuration words are not write-protected ( 1 ) 0 = last page and flash configuration words are write-protected provided wpdis = 0 bit 13 wpdis: segment write protection disable bit 1 = segmented program memory write protection is disabled 0 = segmented program memory write protection is enabled; protected segment is defined by the wpend, wpcfg and wpfpx configuration bits bit 12 boren: brown-out reset enable bit 1 = bor is enabled (all modes except deep sleep) 0 = bor is disabled bit 11 reserved: always maintain as ? 1 ? bit 10-9 wdtwin<1:0>: watchdog timer window width select bits 11 =25% 10 =37.5% 01 =50% 00 =75% bit 8 soscsel: sosc selection bit 1 = sosc circuit is selected 0 = digital (sclki) mode ( 2 ) bit 7 reserved: always maintain as ? 1 ? note 1: regardless of wpcfg status, if wpend = 1 or if wpfp<6:0> bits correspond to the configuration word page, the configuration word page is protected. 2: ensure that the sclki pin is made a digital input while using this configuration (see ta bl e 11 - 1 ). 3: for the 64k devices (pic24fj64gc0xx), maintain wpfp6 as ? 0 ?.
? 2012-2013 microchip technology inc. ds30009312b-page 405 PIC24FJ128GC010 family bit 6-0 wpfp<6:0>: write-protected code segment boundary page bits ( 3 ) designates the 512 instruction words page boundary of the protected code segment. if wpend = 1 : specifies the lower page boundary of the code-protected segment; the last page being the last implemented page in the device. if wpend = 0 : specifies the upper page boundary of the code-protected segment; page 0 being the lower boundary. register 34-3: cw3: flash configuration word 3 (continued) note 1: regardless of wpcfg status, if wpend = 1 or if wpfp<6:0> bits correspond to the configuration word page, the configuration word page is protected. 2: ensure that the sclki pin is made a digital input while using this configuration (see ta bl e 11 - 1 ). 3: for the 64k devices (pic24fj64gc0xx), maintain wpfp6 as ? 0 ?.
PIC24FJ128GC010 family ds30009312b-page 406 ? 2012-2013 microchip technology inc. register 34-4: cw4: flash configuration word 4 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 ? ? ? ? ? ? ? ? bit 23 bit 16 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 iol1way i2c2sel plldiv3 plldiv2 plldiv1 plldiv0 rtcbat dsswen bit 15 bit 8 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 dswdten dsboren dswdtosc dswdps4 dswdps3 dswdps2 dswdps1 dswdps0 bit 7 bit 0 legend: po = program once bit r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown bit 23-16 unimplemented: read as ? 1 ? bit 15 iol1way: iolock one-way set enable bit 1 = the iolock bit (osccon<6>) can be set once, provided the unlock sequence has been completed. once set, the peripheral pin select registers cannot be written to a second time. 0 = the iolock bit can be set and cleared as needed, provided the unlock sequence has been completed bit 14 i2c2sel: alternate i2c2 location select bit for pic24fjxxxgc010 devices: 1 = i2c2 functions; scl2 and sda2 are mapped to ra2 and ra3, respectively 0 = i2c2 functions; scl2 and sda2 are mapped to rf5 and rf4, respectively for pic24fjxxxgc006 devices: reserved, maintain as ? 1 ?. bit 13-10 plldiv<3:0:> usb 96 mhz pll prescaler select bits 1111 = pll disabled 1110 .... = reserved, do not use 1000 0111 = oscillator input divided by 12 (48 mhz input) 0110 = oscillator input divided by 8 (32 mhz input) 0101 = oscillator input divided by 6 (24 mhz input) 0100 = oscillator input divided by 5 (20 mhz input) 0011 = oscillator input divided by 4 (16 mhz input) 0010 = oscillator input divided by 3 (12 mhz input) 0001 = oscillator input divided by 2 (8 mhz input) 0000 = oscillator input used directly (4 mhz input) bit 9 rtcbat: v bat rtcc operation select bit 1 = rtcc operation continues when the device is in v bat mode 0 = rtcc operation stops when the device is in v bat mode bit 8 dsswen: deep sleep software control select bit 1 = deep sleep operation is enabled and controlled by the dsen bit 0 = deep sleep operation is disabled bit 7 dswdten: deep sleep watchdog timer enable bit 1 = deep sleep wdt is enabled 0 = deep sleep wdt is disabled
? 2012-2013 microchip technology inc. ds30009312b-page 407 PIC24FJ128GC010 family bit 6 dsboren: deep sleep brown-out reset enable bit 1 = bor is enabled in deep sleep mode 0 = bor is disabled in deep sleep mode (remains active in other sleep modes) bit 5 dswdtosc: deep sleep watchdog timer clock select bit 1 = clock source is lprc 0 = clock source is sosc bit 4-0 dswdps<4:0>: deep sleep watchdog timer postscaler select bits 11111 = 1:68,719,476,736 (25.7 days) 11110 = 1:34,359,738,368(12.8 days) 11101 = 1:17,179,869,184 (6.4 days) 11100 = 1:8,589,934592 (77.0 hours) 11011 = 1:4,294,967,296 (38.5 hours) 11010 = 1:2,147,483,648 (19.2 hours) 11001 = 1:1,073,741,824 (9.6 hours) 11000 = 1:536,870,912 (4.8 hours) 10111 = 1:268,435,456 (2.4 hours) 10110 = 1:134,217,728 (72.2 minutes) 10101 = 1:67,108,864 (36.1 minutes) 10100 = 1:33,554,432 (18.0 minutes) 10011 = 1:16,777,216 (9.0 minutes) 10010 = 1:8,388,608 (4.5 minutes) 10001 = 1:4,194,304 (135.3s) 10000 = 1:2,097,152 (67.7s) 01111 = 1:1,048,576 (33.825s) 01110 = 1:524,288 (16.912s) 01101 = 1:262,114 (8.456s) 01100 = 1:131,072 (4.228s) 01011 = 1:65,536 (2.114s) 01010 = 1:32,768 (1.057s) 01001 = 1:16,384 (528.5 ms) 01000 = 1:8,192 (264.3 ms) 00111 = 1:4,096 (132.1 ms) 00110 = 1:2,048 (66.1 ms) 00101 = 1:1,024 (33 ms) 00100 = 1:512 (16.5 ms) 00011 = 1:256 (8.3 ms) 00010 = 1:128 (4.1 ms) 00001 = 1:64 (2.1 ms) 00000 = 1:32 (1 ms) register 34-4: cw4: flash configuration word 4 (continued)
PIC24FJ128GC010 family ds30009312b-page 408 ? 2012-2013 microchip technology inc. register 34-5: devid: device id register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 ? ? ? ? ? ? ? ? bit 23 bit 16 rrrrrrrr famid7 famid6 famid5 famid4 famid3 famid2 famid1 famid0 bit 15 bit 8 rrrrrrrr dev7 dev6 dev5 dev4 dev3 dev2 dev1 dev0 bit 7 bit 0 legend: r = readable bit u = unimplemented bit bit 23-16 unimplemented: read as ? 1 ? bit 15-8 famid<7:0>: device family identifier bits 0100 1000 = PIC24FJ128GC010 family bit 7-0 dev<7:0>: individual device identifier bits 1000 1000 = pic24fj64gc006 1000 1001 = pic24fj128gc006 1000 0100 = pic24fj64gc010 1000 0101 = PIC24FJ128GC010 register 34-6: devrev: device revision register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 23 bit 16 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 ? ? ? ? ? ? ? ? bit 15 bit 8 u-0 u-0 u-0 u-0 r r r r ? ? ? ? rev3 rev2 rev1 rev0 bit 7 bit 0 legend: r = readable bit u = unimplemented bit bit 23-4 unimplemented: read as ? 0 ? bit 3-0 rev<3:0>: device revision identifier bits
? 2012-2013 microchip technology inc. ds30009312b-page 409 PIC24FJ128GC010 family 34.2 on-chip voltage regulator all PIC24FJ128GC010 family devices power their core digital logic at a nominal 1.8v. this may create an issue for designs that are required to operate at a higher typical voltage, such as 3.3v. to simplify system design, all devices in the PIC24FJ128GC010 family incorporate an on-chip regulator that allows the device to run its core logic from v dd . this regulator is always enabled. it provides a constant voltage (1.8v nominal) to the digital core logic, from a v dd of 2.0v all the way up to the device?s v ddmax . it does not have the capability to boost v dd levels. in order to prevent ?brown-out? conditions when the volt- age drops too low for the regulator, the brown-out reset occurs. then the regulator output follows v dd with a typical voltage drop of 300 mv. a low-esr capacitor (such as ceramic) must be connected to the v cap pin ( figure 34-1 ). this helps to maintain the stability of the regulator. the recommended value for the filter capacitor (c efc ) is provided in section 37.1 ?dc characteristics? . figure 34-1: conne ctions for the on-chip regulator 34.2.1 on-chip regulator and por the voltage regulator requires a small amount of time to transition from a disabled or standby state into nor- mal operating mode. during this time, designated as t vreg , code execution is disabled. t vreg is applied every time the device resumes operation after any power-down, including sleep mode. t vreg is deter- mined by the status of the pmslp bit (rcon<8>). refer to section 37.0 ?electrical characteristics? for more information on t vreg . 34.2.2 voltage regulator standby mode the on-chip regulator always consumes a small incre- mental amount of current over i dd /i pd , including when the device is in sleep mode, even though the core digital logic does not require power. to provide addi- tional savings in applications where power resources are critical, the regulator can be made to enter standby mode on its own whenever the device goes into sleep mode. this feature is controlled by the pmslp bit (rcon<8>). clearing the pmslp bit enables the standby mode. when waking up from standby mode, the regulator needs to wait for t vreg to expire before wake-up. 34.2.3 low-voltage/retention regulator when power-saving modes, such as sleep and deep sleep are used, PIC24FJ128GC010 family devices may use a separate low-power, low-voltage/retention regulator to power critical circuits. this regulator, which operates at 1.2v nominal, maintains power to data ram and the rtcc while all other core digital logic is powered down. it operates only in sleep, deep sleep and v bat modes. the low-voltage/retention regulator is described in more detail in section 10.1.3 ?low-voltage/retention regulator? . v dd v cap v ss pic24fjxxxgc0xx c efc 3.3v (1) note 1: this is a typical operating voltage. refer to section 37.0 ?electrical characteristics? for the full operating ranges of v dd . (10 ? f typ) note: for more information, see section 37.0 ?electrical characteristics? . the infor- mation in this data sheet supersedes the information in the ? pic24f family reference manual? .
PIC24FJ128GC010 family ds30009312b-page 410 ? 2012-2013 microchip technology inc. 34.3 watchdog timer (wdt) for PIC24FJ128GC010 family devices, the wdt is driven by the lprc oscillator. when the wdt is enabled, the clock source is also enabled. the nominal wdt clock source from lprc is 31 khz. this feeds a prescaler that can be configured for either 5-bit (divide-by-32) or 7-bit (divide-by-128) operation. the prescaler is set by the fwpsa configuration bit. with a 31 khz input, the prescaler yields a nominal wdt time-out period (t wdt ) of 1 ms in 5-bit mode or 4 ms in 7-bit mode. a variable postscaler divides down the wdt prescaler output and allows for a wide range of time-out periods. the postscaler is controlled by the wdtps<3:0> con- figuration bits (cw1<3:0>), which allows the selection of a total of 16 settings, from 1:1 to 1:32,768. using the prescaler and postscaler time-out periods, ranges from 1 ms to 131 seconds can be achieved. the wdt, prescaler and postscaler are reset: ? on any device reset ? on the completion of a clock switch, whether invoked by software (i.e., setting the oswen bit after changing the noscx bits) or by hardware (i.e., fail-safe clock monitor) ? when a pwrsav instruction is executed (i.e., sleep or idle mode is entered) ? when the device exits sleep or idle mode to resume normal operation ?by a clrwdt instruction during normal execution if the wdt is enabled, it will continue to run during sleep or idle modes. when the wdt time-out occurs, the device will wake the device and code execution will continue from where the pwrsav instruction was executed. the corresponding sleep or idle (rcon<3:2>) bit will need to be cleared in software after the device wakes up. the wdt flag bit, wdto (rcon<4>), is not auto- matically cleared following a wdt time-out. to detect subsequent wdt events, the flag must be cleared in software. 34.3.1 windowed operation the watchdog timer has an optional fixed window mode of operation. in this windowed mode, clrwdt instructions can only reset the wdt during the last 1/4 of the programmed wdt period. a clrwdt instruction executed before that window causes a wdt reset, similar to a wdt time-out. windowed wdt mode is enabled by programming the windis configuration bit (cw1<5>) to ? 0 ?. 34.3.2 control register the wdt is enabled or disabled by the fwdten<1:0> configuration bits. when the configuration bits, fwdten<1:0> = 11 , the wdt is always enabled. the wdt can be optionally controlled in software when the configuration bits, fwdten<1:0> = 10 . when fwdten<1:0> = 00 , the watchdog timer is always disabled. the wdt is enabled in software by setting the swdten control bit (rcon<5>). the swdten control bit is cleared on any device reset. the software wdt option allows the user to enable the wdt for critical code segments and disable the wdt during non-critical segments for maximum power savings. figure 34-2: wdt block diagram note: the clrwdt and pwrsav instructions clear the prescaler and postscaler counts when executed. lprc input wdt overflow wake from sleep 31 khz prescaler postscaler fwpsa swdten fwdten<1:0> reset all device resets sleep or idle mode lprc control clrwdt instr. pwrsav instr. (5-bit/7-bit) 1:1 to 1:32.768 wdtps<3:0> 1 ms/4 ms exit sleep or idle mode wdt counter transition to new clock source
? 2012-2013 microchip technology inc. ds30009312b-page 411 PIC24FJ128GC010 family 34.4 program verification and code protection PIC24FJ128GC010 family devices provide two compli- mentary methods to protect application code from overwrites and erasures. these also help to protect the device from inadvertent configuration changes during run time. 34.4.1 general segment protection for all devices in the PIC24FJ128GC010 family, the on-chip program memory space is treated as a single block, known as the general segment (gs). code pro- tection for this block is controlled by one configuration bit, gcp. this bit inhibits external reads and writes to the program memory space. it has no direct effect in normal execution mode. write protection is controlled by the gwrp bit in the configuration word. when gwrp is programmed to ? 0 ?, internal write and erase operations to program memory are blocked. 34.4.2 code segment protection in addition to global general segment protection, a separate subrange of the program memory space can be individually protected against writes and erases. this area can be used for many purposes where a sep- arate block of write and erase-protected code is needed, such as bootloader applications. unlike common boot block implementations, the specially protected segment in the PIC24FJ128GC010 family devices can be located by the user anywhere in the program space and configured in a wide range of sizes. code segment protection provides an added level of protection to a designated area of program memory by disabling the nvm safety interlock whenever a write or erase address falls within a specified range. it does not override general segment protection controlled by the gcp or gwrp bit. for example, if gcp and gwrp are enabled, enabling segmented code protection for the bottom half of program memory does not undo general segment protection for the top half. the size and type of protection for the segmented code range are configured by the wpfpx, wpend, wpcfg and wpdis bits in configuration word 3. code seg- ment protection is enabled by programming the wpdis bit (= 0 ). the wpfpx bits specify the size of the seg- ment to be protected by specifying the 512-word code page that is the start or end of the protected segment. the specified region is inclusive, therefore, this page will also be protected. the wpend bit determines if the protected segment uses the top or bottom of the program space as a boundary. programming wpend (= 0 ) sets the bottom of program memory (000000h) as the lower boundary of the protected segment. leaving wpend unpro- grammed (= 1 ) protects the specified page through the last page of implemented program memory, including the configuration word locations. a separate bit, wpcfg, is used to protect the last page of program space, including the flash configuration words. programming wpcfg (= 0 ) protects the last page in addition to the pages selected by the wpend and wpfp<6:0> bits? setting. this is useful in circum- stances where write protection is needed for both the code segment in the bottom of the memory and the flash configuration words. the various options for segment code protection are shown in tab l e 3 4- 2 . table 34-2: code segment prot ection configuration options segment configuration bits write/erase protection of code segment wpdis wpend wpcfg 1xx no additional protection is enabled; all program memory protection is configured by gcp and gwrp. 01x addresses from the first address of the code page are defined by wpfp<6:0> through the end of implemented program memory (inclusive); erase/write-protected, including flash configuration words. 001 address, 000000h through the last address of the code page, is defined by wpfp<6:0> (inclusive); write/erase protected. 000 address, 000000h through the last address of code page, is defined by wpfp<6:0> (inclusive); erase/write-protected and the last page, including flash configuration words, are erase/write-protected.
PIC24FJ128GC010 family ds30009312b-page 412 ? 2012-2013 microchip technology inc. 34.4.3 configuration register protection the configuration registers are protected against inadvertent or unwanted changes or reads in two ways. the primary protection method is the same as that of the rp registers ? shadow registers contain a compli- mentary value which is constantly compared with the actual value. to safeguard against unpredictable events, configura- tion bit changes resulting from individual cell level disruptions (such as esd events) will cause a parity error and trigger a device reset. the data for the configuration registers is derived from the flash configuration words in program memory. when the gcp bit is set, the source data for device configuration is also protected as a consequence. even if general segment protection is not enabled, the device configuration can be protected by using the appropriate code segment protection setting. 34.5 jtag interface PIC24FJ128GC010 family devices implement a jtag interface, which supports boundary scan device testing. 34.6 in-circuit serial programming PIC24FJ128GC010 family microcontrollers can be serially programmed while in the end application circuit. this is simply done with two lines for clock (pgecx) and data (pgedx), and three other lines for power (v dd ), ground (v ss ) and mclr . this allows customers to manufacture boards with unprogrammed devices and then program the microcontroller just before shipping the product. this also allows the most recent firmware or a custom firmware to be programmed. 34.7 in-circuit debugger when mplab ? icd 3 is selected as a debugger, the in-circuit debugging functionality is enabled. this func- tion allows simple debugging functions when used with mplab ide. debugging functionality is controlled through the pgecx (emulation/debug clock) and pgedx (emulation/debug data) pins. to use the in-circuit debugger function of the device, the design must implement icsp connections to mclr , v dd , v ss and the pgecx/pgedx pin pair, des- ignated by the icsx configuration bits. in addition, when the feature is enabled, some of the resources are not available for general use. these resources include the first 80 bytes of data ram and two i/o pins.
? 2012-2013 microchip technology inc. ds30009312b-page 413 PIC24FJ128GC010 family 35.0 development support the pic ? microcontrollers (mcu) and dspic ? digital signal controllers (dsc) are supported with a full range of software and hardware development tools: ? integrated development environment - mplab ? x ide software ? compilers/assemblers/linkers - mplab xc compiler - mpasm tm assembler -mplink tm object linker/ mplib tm object librarian - mplab assembler/linker/librarian for various device families ? simulators - mplab x sim software simulator ?emulators - mplab real ice? in-circuit emulator ? in-circuit debuggers/programmers - mplab icd 3 - pickit? 3 ? device programmers - mplab pm3 device programmer ? low-cost demonstration/development boards, evaluation kits and starter kits ? third-party development tools 35.1 mplab x integrated development environment software the mplab x ide is a single, unified graphical user interface for microchip and third-party software, and hardware development tool that runs on windows ? , linux and mac os ? x. based on the netbeans ide, mplab x ide is an entirely new ide with a host of free software components and plug-ins for high- performance application development and debugging. moving between tools and upgrading from software simulators to hardware debugging and programming tools is simple with the seamless user interface. with complete project management, visual call graphs, a configurable watch window and a feature-rich editor that includes code completion and context menus, mplab x ide is flexible and friendly enough for new users. with the ability to support multiple tools on multiple projects with simultaneous debugging, mplab x ide is also suitable for the needs of experienced users. feature-rich editor: ? color syntax highlighting ? smart code completion makes suggestions and provides hints as you type ? automatic code formatting based on user-defined rules ? live parsing user-friendly, customizable interface: ? fully customizable interface: toolbars, toolbar buttons, windows, window placement, etc. ? call graph window project-based workspaces: ? multiple projects ? multiple tools ? multiple configurations ? simultaneous debugging sessions file history and bug tracking: ? local file history feature ? built-in support for bugzilla issue tracker
PIC24FJ128GC010 family ds30009312b-page 414 ? 2012-2013 microchip technology inc. 35.2 mplab xc compilers the mplab xc compilers are complete ansi c compilers for all of microchip?s 8, 16, and 32-bit mcu and dsc devices. these compilers provide powerful integration capabilities, superior code optimization and ease of use. mplab xc compilers run on windows, linux or mac os x. for easy source level debugging, the compilers provide debug information that is optimized to the mplab x ide. the free mplab xc compiler editions support all devices and commands, with no time or memory restrictions, and offer sufficient code optimization for most applications. mplab xc compilers include an assembler, linker and utilities. the assembler generates relocatable object files that can then be archived or linked with other relo- catable object files and archives to create an execut- able file. mplab xc compiler uses the assembler to produce its object file. notable features of the assem- bler 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 x ide compatibility 35.3 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 x ide projects ? user-defined macros to streamline assembly code ? conditional assembly for multipurpose source files ? directives that allow complete control over the assembly process 35.4 mplink object linker/ mplib object librarian the mplink object linker combines relocatable objects created by the mpasm assembler. 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 35.5 mplab assembler, linker and librarian for various device families mplab assembler produces relocatable machine code from symbolic assembly language for pic24, pic32 and dspic dsc devices. mplab xc 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 x ide compatibility
? 2012-2013 microchip technology inc. ds30009312b-page 415 PIC24FJ128GC010 family 35.6 mplab x sim software simulator the mplab x 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 x sim software simulator fully supports symbolic debugging using the mplab xc 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. 35.7 mplab real ice in-circuit emulator system the 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 all 8, 16 and 32-bit mcu, and dsc devices with the easy-to-use, powerful graphical user interface of the mplab x ide. 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 (rj-11) 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 x ide. mplab real ice offers significant advantages over competitive emulators including full-speed emulation, run-time variable watches, trace analysis, complex breakpoints, logic probes, a ruggedized probe interface and long (up to three meters) interconnection cables. 35.8 mplab icd 3 in-circuit debugger system the mplab icd 3 in-circuit debugger system is microchip?s most cost-effective, high-speed hardware debugger/programmer for microchip flash dsc and mcu devices. it debugs and programs pic flash microcontrollers and dspic dscs with the powerful, yet easy-to-use graphical user interface of the mplab ide. the mplab icd 3 in-circuit debugger probe is connected 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. 35.9 pickit 3 in-circuit debugger/ programmer 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 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 tar- get via a microchip debug (rj-11) connector (compati- ble with mplab icd 3 and mplab real ice). the connector uses two device i/o pins and the reset line to implement in-circuit debugging and in-circuit serial programming? (icsp?). 35.10 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 mod- ular, 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.
PIC24FJ128GC010 family ds30009312b-page 416 ? 2012-2013 microchip technology inc. 35.11 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 functional systems. most boards include prototyping areas for adding custom circuitry and provide applica- tion 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? demonstration/development board series of circuits, microchip has a line of evaluation kits and demonstra- tion 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. 35.12 third-party development tools microchip also offers a great collection of tools from third-party vendors. these tools are carefully selected to offer good value and unique functionality. ? device programmers and gang programmers from companies, such as softlog and ccs ? software tools from companies, such as gimpel and trace systems ? protocol analyzers from companies, such as saleae and total phase ? demonstration boards from companies, such as mikroelektronika, digilent ? and olimex ? embedded ethernet solutions from companies, such as ez web lynx, wiznet and iplogika ?
? 2012-2013 microchip technology inc. ds30009312b-page 417 PIC24FJ128GC010 family 36.0 instruction set summary the pic24f instruction set adds many enhancements to the previous pic ? mcu instruction sets, while main- taining an easy migration from previous pic mcu instruction sets. most instructions are a single program memory word. only three instructions require two program memory locations. each single-word instruction is a 24-bit word divided into an 8-bit opcode, which specifies the instruction type and one or more operands, which further specify the operation of the instruction. the instruction set is highly orthogonal and is grouped into four basic categories: ? word or byte-oriented operations ? bit-oriented operations ? literal operations ? control operations table 36-1 shows the general symbols used in describing the instructions. the pic24f instruction set summary in table 36-2 lists all the instructions, along with the status flags affected by each instruction. most word or byte-oriented w register instructions (including barrel shift instructions) have three operands: ? the first source operand, which is typically a register, ?wb?, without any address modifier ? the second source operand, which is typically a register, ?ws?, with or without an address modifier ? the destination of the result, which is typically a register, ?wd?, with or without an address modifier however, word or byte-oriented file register instructions have two operands: ? the file register specified by the value, ?f? ? the destination, which could either be the file register, ?f?, or the w0 register, which is denoted as ?wreg? most bit-oriented instructions (including simple rotate/shift instructions) have two operands: ? the w register (with or without an address modifier) or file register (specified by the value of ?ws? or ?f?) ? the bit in the w register or file register (specified by a literal value or indirectly by the contents of register, ?wb?) the literal instructions that involve data movement may use some of the following operands: ? a literal value to be loaded into a w register or file register (specified by the value of ?k?) ? the w register or file register where the literal value is to be loaded (specified by ?wb? or ?f?) however, literal instructions that involve arithmetic or logical operations use some of the following operands: ? the first source operand, which is a register, ?wb?, without any address modifier ? the second source operand, which is a literal value ? the destination of the result (only if not the same as the first source operand), which is typically a register, ?wd?, with or without an address modifier the control instructions may use some of the following operands: ? a program memory address ? the mode of the table read and table write instructions all instructions are a single word, except for certain double-word instructions, which were made double-word instructions so that all the required infor- mation is available in these 48 bits. in the second word, the 8 msbs are ? 0 ?s. if this second word is executed as an instruction (by itself), it will execute as a nop . most single-word instructions are executed in a single instruction cycle, unless a conditional test is true or the program counter is changed as a result of the instruc- tion. in these cases, the execution takes two instruction cycles, with the additional instruction cycle(s) executed as a nop . notable exceptions are the bra (uncondi- tional/computed branch), indirect call/goto , all table reads and writes, and return/retfie instructions, which are single-word instructions but take two or three cycles. certain instructions that involve skipping over the sub- sequent instruction require either two or three cycles if the skip is performed, depending on whether the instruction being skipped is a single-word or two-word instruction. moreover, double-word moves require two cycles. the double-word instructions execute in two instruction cycles. note: this chapter is a brief summary of the pic24f instruction set architecture (isa) and is not intended to be a comprehensive reference source.
PIC24FJ128GC010 family ds30009312b-page 418 ? 2012-2013 microchip technology inc. table 36-1: symbols used in opcode descriptions field description #text means literal defined by ? text ? (text) means ?content of text ? [text] means ?the location addressed by text ? { } optional field or operation register bit field .b byte mode selection .d double-word mode selection .s shadow register select .w word mode selection (default) bit4 4-bit bit selection field (used in word addressed instructions) ?? {0...15} c, dc, n, ov, z mcu status bits: carry, digit carry, negative, overflow, sticky zero expr absolute address, label or expression (resolved by the linker) f file register address ?? {0000h...1fffh} lit1 1-bit unsigned literal ?? {0,1} lit4 4-bit unsigned literal ?? {0...15} lit5 5-bit unsigned literal ?? {0...31} lit8 8-bit unsigned literal ?? {0...255} lit10 10-bit unsigned literal ?? {0...255} for byte mode, {0:1023} for word mode lit14 14-bit unsigned literal ?? {0...16383} lit16 16-bit unsigned literal ?? {0...65535} lit23 23-bit unsigned literal ?? {0...8388607}; lsb must be ? 0 ? none field does not require an entry, may be blank pc program counter slit10 10-bit signed literal ?? {-512...511} slit16 16-bit signed literal ?? {-32768...32767} slit6 6-bit signed literal ?? {-16...16} wb base w register ?? {w0..w15} wd destination w register ?? { wd, [wd], [wd++], [wd--], [++wd], [--wd] } wdo destination w register ?? { wnd, [wnd], [wnd++], [wnd--], [++wnd], [--wnd], [wnd+wb] } wm,wn dividend, divisor working r egister pair (direct addressing) wn one of 16 working registers ?? {w0..w15} wnd one of 16 destination working registers ?? {w0..w15} wns one of 16 source working registers ?? {w0..w15} wreg w0 (working register used in file register instructions) ws source w register ?? { ws, [ws], [ws++], [ws--], [++ws], [--ws] } wso source w register ?? { wns, [wns], [wns++], [wns--], [++wns], [--wns], [wns+wb] }
? 2012-2013 microchip technology inc. ds30009312b-page 419 PIC24FJ128GC010 family table 36-2: instruction set overview assembly mnemonic assembly syntax description # of words # of cycles status flags affected add add f f = f + wreg 1 1 c, dc, n, ov, z add f,wreg wreg = f + wreg 1 1 c, dc, n, ov, z add #lit10,wn wd = lit10 + wd 1 1 c, dc, n, ov, z add wb,ws,wd wd = wb + ws 1 1 c, dc, n, ov, z add wb,#lit5,wd wd = wb + lit5 1 1 c, dc, n, ov, z addc addc f f = f + wreg + (c) 1 1 c, dc, n, ov, z addc f,wreg wreg = f + wreg + (c) 1 1 c, dc, n, ov, z addc #lit10,wn wd = lit10 + wd + (c) 1 1 c, dc, n, ov, z addc wb,ws,wd wd = wb + ws + (c) 1 1 c, dc, n, ov, z addc wb,#lit5,wd wd = wb + lit5 + (c) 1 1 c, dc, n, ov, z and and f f = f .and. wreg 1 1 n, z and f,wreg wreg = f .and. wreg 1 1 n, z and #lit10,wn wd = lit10 .and. wd 1 1 n, z and wb,ws,wd wd = wb .and. ws 1 1 n, z and wb,#lit5,wd wd = wb .and. lit5 1 1 n, z asr asr f f = arithmetic right shift f 1 1 c, n, ov, z asr f,wreg wreg = arithmetic right shift f 1 1 c, n, ov, z asr ws,wd wd = arithmetic right shift ws 1 1 c, n, ov, z asr wb,wns,wnd wnd = arithmetic right shift wb by wns 1 1 n, z asr wb,#lit5,wnd wnd = arithmetic right shift wb by lit5 1 1 n, z bclr bclr f,#bit4 bit clear f 1 1 none bclr ws,#bit4 bit clear ws 1 1 none bra bra c,expr branch if carry 1 1 (2) none bra ge,expr branch if greater than or equal 1 1 (2) none bra geu,expr branch if unsigned greater than or equal 1 1 (2) none bra gt,expr branch if greater than 1 1 (2) none bra gtu,expr branch if unsigned greater than 1 1 (2) none bra le,expr branch if less than or equal 1 1 (2) none bra leu,expr branch if unsigned less than or equal 1 1 (2) none bra lt,expr branch if less than 1 1 (2) none bra ltu,expr branch if unsigned less than 1 1 (2) none bra n,expr branch if negative 1 1 (2) none bra nc,expr branch if not carry 1 1 (2) none bra nn,expr branch if not negative 1 1 (2) none bra nov,expr branch if not overflow 1 1 (2) none bra nz,expr branch if not zero 1 1 (2) none bra ov,expr branch if overflow 1 1 (2) none bra expr branch unconditionally 1 2 none bra z,expr branch if zero 1 1 (2) none bra wn computed branch 1 2 none bset bset f,#bit4 bit set f 1 1 none bset ws,#bit4 bit set ws 1 1 none bsw bsw.c ws,wb write c bit to ws 1 1 none bsw.z ws,wb write z bit to ws 1 1 none btg btg f,#bit4 bit toggle f 1 1 none btg ws,#bit4 bit toggle ws 1 1 none btsc btsc f,#bit4 bit test f, skip if clear 1 1 (2 or 3) none btsc ws,#bit4 bit test ws, skip if clear 1 1 (2 or 3) none
PIC24FJ128GC010 family ds30009312b-page 420 ? 2012-2013 microchip technology inc. btss btss f,#bit4 bit test f, skip if set 1 1 (2 or 3) none btss ws,#bit4 bit test ws, skip if set 1 1 (2 or 3) none btst btst f,#bit4 bit test f 1 1 z btst.c ws,#bit4 bit test ws to c 1 1 c btst.z ws,#bit4 bit test ws to z 1 1 z btst.c ws,wb bit test ws to c 1 1 c btst.z ws,wb bit test ws to z 1 1 z btsts btsts f,#bit4 bit test then set f 1 1 z btsts.c ws,#bit4 bit test ws to c, then set 1 1 c btsts.z ws,#bit4 bit test ws to z, then set 1 1 z call call lit23 call subroutine 2 2 none call wn call indirect subroutine 1 2 none clr clr f f = 0x0000 1 1 none clr wreg wreg = 0x0000 1 1 none clr ws ws = 0x0000 1 1 none clrwdt clrwdt clear watchdog timer 1 1 wdto, sleep com com f f = f 11n, z com f,wreg wreg = f 11n, z com ws,wd wd = ws 11n, z cp cp f compare f with wreg 1 1 c, dc, n, ov, z cp wb,#lit5 compare wb with lit5 1 1 c, dc, n, ov, z cp wb,ws compare wb with ws (wb ? ws) 1 1 c, dc, n, ov, z cp0 cp0 f compare f with 0x0000 1 1 c, dc, n, ov, z cp0 ws compare ws with 0x0000 1 1 c, dc, n, ov, z cpb cpb f compare f with wreg, with borrow 1 1 c, dc, n, ov, z cpb wb,#lit5 compare wb with lit5, with borrow 1 1 c, dc, n, ov, z cpb wb,ws compare wb with ws, with borrow (wb ? ws ? c ) 1 1 c, dc, n, ov, z cpseq cpseq wb,wn compare wb with wn, skip if = 1 1 (2 or 3) none cpsgt cpsgt wb,wn compare wb with wn, skip if > 1 1 (2 or 3) none cpslt cpslt wb,wn compare wb with wn, skip if < 1 1 (2 or 3) none cpsne cpsne wb,wn compare wb with wn, skip if ? 11 (2 or 3) none daw daw.b wn wn = decimal adjust wn 1 1 c dec dec f f = f ?1 1 1 c, dc, n, ov, z dec f,wreg wreg = f ?1 1 1 c, dc, n, ov, z dec ws,wd wd = ws ? 1 1 1 c, dc, n, ov, z dec2 dec2 f f = f ? 2 1 1 c, dc, n, ov, z dec2 f,wreg wreg = f ? 2 1 1 c, dc, n, ov, z dec2 ws,wd wd = ws ? 2 1 1 c, dc, n, ov, z disi disi #lit14 disable interrupts for k instruction cycles 1 1 none div div.sw wm,wn signed 16/16-bit integer divide 1 18 n, z, c, ov div.sd wm,wn signed 32/16-bit integer divide 1 18 n, z, c, ov div.uw wm,wn unsigned 16/16-bit integer divide 1 18 n, z, c, ov div.ud wm,wn unsigned 32/16-bit integer divide 1 18 n, z, c, ov exch exch wns,wnd swap wns with wnd 1 1 none ff1l ff1l ws,wnd find first one from left (msb) side 1 1 c ff1r ff1r ws,wnd find first one from right (lsb) side 1 1 c table 36-2: instruction set overview (continued) assembly mnemonic assembly syntax description # of words # of cycles status flags affected
? 2012-2013 microchip technology inc. ds30009312b-page 421 PIC24FJ128GC010 family goto goto expr go to address 2 2 none goto wn go to indirect 1 2 none inc inc f f = f + 1 1 1 c, dc, n, ov, z inc f,wreg wreg = f + 1 1 1 c, dc, n, ov, z inc ws,wd wd = ws + 1 1 1 c, dc, n, ov, z inc2 inc2 f f = f + 2 1 1 c, dc, n, ov, z inc2 f,wreg wreg = f + 2 1 1 c, dc, n, ov, z inc2 ws,wd wd = ws + 2 1 1 c, dc, n, ov, z ior ior f f = f .ior. wreg 1 1 n, z ior f,wreg wreg = f .ior. wreg 1 1 n, z ior #lit10,wn wd = lit10 .ior. wd 1 1 n, z ior wb,ws,wd wd = wb .ior. ws 1 1 n, z ior wb,#lit5,wd wd = wb .ior. lit5 1 1 n, z lnk lnk #lit14 link frame pointer 1 1 none lsr lsr f f = logical right shift f 1 1 c, n, ov, z lsr f,wreg wreg = logical right shift f 1 1 c, n, ov, z lsr ws,wd wd = logical right shift ws 1 1 c, n, ov, z lsr wb,wns,wnd wnd = logical right shift wb by wns 1 1 n, z lsr wb,#lit5,wnd wnd = logical right shift wb by lit5 1 1 n, z mov mov f,wn move f to wn 1 1 none mov [wns+slit10],wnd move [wns+slit10] to wnd 1 1 none mov f move f to f 1 1 n, z mov f,wreg move f to wreg 1 1 n, z mov #lit16,wn move 16-bit literal to wn 1 1 none mov.b #lit8,wn move 8-bit literal to wn 1 1 none mov wn,f move wn to f 1 1 none mov wns,[wns+slit10] move wns to [wns+slit10] 1 1 mov wso,wdo move ws to wd 1 1 none mov wreg,f move wreg to f 1 1 n, z mov.d wns,wd move double from w(ns):w(ns+1) to wd 1 2 none mov.d ws,wnd move double from ws to w(nd+1):w(nd) 1 2 none mul mul.ss wb,ws,wnd {wnd+1, wnd} = signed(wb) * signed(ws) 1 1 none mul.su wb,ws,wnd {wnd+1, wnd} = signed(wb) * unsigned(ws) 1 1 none mul.us wb,ws,wnd {wnd+1, wnd} = unsigned(wb) * signed(ws) 1 1 none mul.uu wb,ws,wnd {wnd+1, wnd} = unsigned(wb) * unsigned(ws) 1 1 none mul.su wb,#lit5,wnd {wnd+1, wnd} = signed(wb) * unsigned(lit5) 1 1 none mul.uu wb,#lit5,wnd {wnd+1, wnd} = unsigned(wb) * unsigned(lit5) 1 1 none mul f w3:w2 = f * wreg 1 1 none neg neg f f = f + 1 1 1 c, dc, n, ov, z neg f,wreg wreg = f + 1 1 1 c, dc, n, ov, z neg ws,wd wd = ws + 1 1 1 c, dc, n, ov, z nop nop no operation 1 1 none nopr no operation 1 1 none pop pop f pop f from top-of-stack (tos) 1 1 none pop wdo pop from top-of-stack (tos) to wdo 1 1 none pop.d wnd pop from top-of-stack (tos) to w(nd):w(nd+1) 1 2 none pop.s pop shadow registers 1 1 all push push f push f to top-of-stack (tos) 1 1 none push wso push wso to top-of-stack (tos) 1 1 none push.d wns push w(ns):w(ns+1) to top-of-stack (tos) 1 2 none push.s push shadow registers 1 1 none table 36-2: instruction set overview (continued) assembly mnemonic assembly syntax description # of words # of cycles status flags affected
PIC24FJ128GC010 family ds30009312b-page 422 ? 2012-2013 microchip technology inc. pwrsav pwrsav #lit1 go into sleep or idle mode 1 1 wdto, sleep rcall rcall expr relative call 1 2 none rcall wn computed call 1 2 none repeat repeat #lit14 repeat next instruction lit14 + 1 times 1 1 none repeat wn repeat next instruction (wn) + 1 times 1 1 none reset reset software device reset 1 1 none retfie retfie return from interrupt 1 3 (2) none retlw retlw #lit10,wn return with literal in wn 1 3 (2) none return return return from subroutine 1 3 (2) none rlc rlc f f = rotate left through carry f 1 1 c, n, z rlc f,wreg wreg = rotate left through carry f 1 1 c, n, z rlc ws,wd wd = rotate left through carry ws 1 1 c, n, z rlnc rlnc f f = rotate left (no carry) f 1 1 n, z rlnc f,wreg wreg = rotate left (no carry) f 1 1 n, z rlnc ws,wd wd = rotate left (no carry) ws 1 1 n, z rrc rrc f f = rotate right through carry f 1 1 c, n, z rrc f,wreg wreg = rotate right through carry f 1 1 c, n, z rrc ws,wd wd = rotate right through carry ws 1 1 c, n, z rrnc rrnc f f = rotate right (no carry) f 1 1 n, z rrnc f,wreg wreg = rotate right (no carry) f 1 1 n, z rrnc ws,wd wd = rotate right (no carry) ws 1 1 n, z se se ws,wnd wnd = sign-extended ws 1 1 c, n, z setm setm f f = ffffh 1 1 none setm wreg wreg = ffffh 1 1 none setm ws ws = ffffh 1 1 none sl sl f f = left shift f 1 1 c, n, ov, z sl f,wreg wreg = left shift f 1 1 c, n, ov, z sl ws,wd wd = left shift ws 1 1 c, n, ov, z sl wb,wns,wnd wnd = left shift wb by wns 1 1 n, z sl wb,#lit5,wnd wnd = left shift wb by lit5 1 1 n, z sub sub f f = f ? wreg 1 1 c, dc, n, ov, z sub f,wreg wreg = f ? wreg 1 1 c, dc, n, ov, z sub #lit10,wn wn = wn ? lit10 1 1 c, dc, n, ov, z sub wb,ws,wd wd = wb ? ws 1 1 c, dc, n, ov, z sub wb,#lit5,wd wd = wb ? lit5 1 1 c, dc, n, ov, z subb subb f f = f ? wreg ? (c ) 1 1 c, dc, n, ov, z subb f,wreg wreg = f ? wreg ? (c ) 1 1 c, dc, n, ov, z subb #lit10,wn wn = wn ? lit10 ? (c ) 1 1 c, dc, n, ov, z subb wb,ws,wd wd = wb ? ws ? (c ) 1 1 c, dc, n, ov, z subb wb,#lit5,wd wd = wb ? lit5 ? (c ) 1 1 c, dc, n, ov, z subr subr f f = wreg ? f 1 1 c, dc, n, ov, z subr f,wreg wreg = wreg ? f 1 1 c, dc, n, ov, z subr wb,ws,wd wd = ws ? wb 1 1 c, dc, n, ov, z subr wb,#lit5,wd wd = lit5 ? wb 1 1 c, dc, n, ov, z subbr subbr f f = wreg ? f ? (c ) 1 1 c, dc, n, ov, z subbr f,wreg wreg = wreg ? f ? (c ) 1 1 c, dc, n, ov, z subbr wb,ws,wd wd = ws ? wb ? (c ) 1 1 c, dc, n, ov, z subbr wb,#lit5,wd wd = lit5 ? wb ? (c ) 1 1 c, dc, n, ov, z swap swap.b wn wn = nibble swap wn 1 1 none swap wn wn = byte swap wn 1 1 none table 36-2: instruction set overview (continued) assembly mnemonic assembly syntax description # of words # of cycles status flags affected
? 2012-2013 microchip technology inc. ds30009312b-page 423 PIC24FJ128GC010 family tblrdh tblrdh ws,wd read prog<23:16> to wd<7:0> 1 2 none tblrdl tblrdl ws,wd read prog<15:0> to wd 1 2 none tblwth tblwth ws,wd write ws<7:0> to prog<23:16> 1 2 none tblwtl tblwtl ws,wd write ws to prog<15:0> 1 2 none ulnk ulnk unlink frame pointer 1 1 none xor xor f f = f .xor. wreg 1 1 n, z xor f,wreg wreg = f .xor. wreg 1 1 n, z xor #lit10,wn wd = lit10 .xor. wd 1 1 n, z xor wb,ws,wd wd = wb .xor. ws 1 1 n, z xor wb,#lit5,wd wd = wb .xor. lit5 1 1 n, z ze ze ws,wnd wnd = zero-extend ws 1 1 c, z, n table 36-2: instruction set overview (continued) assembly mnemonic assembly syntax description # of words # of cycles status flags affected
PIC24FJ128GC010 family ds30009312b-page 424 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 425 PIC24FJ128GC010 family 37.0 electrical characteristics this section provides an overview of the PIC24FJ128GC010 family electrical characteristics. additional information will be provided in future revisions of this document as it becomes available. absolute maximum ratings for the PIC24FJ128GC010 family are listed below. exposure to these maximum rating conditions for extended periods may affect device reliability. functional operation of the device at these, or any other conditions above the parameters indicated in the operation listings of this specification, is not implied. absolute maximum ratings ( ? ) ambient temperature under bias................................................................................................. ............-40c to +100c storage temperature ............................................................................................................ .................. -65c to +150c voltage on v dd with respect to v ss ......................................................................................................... -0.3v to +4.0v voltage on any general purpose digital or analog pin (not 5.5v tolerant) with respect to v ss ....... -0.3v to (v dd + 0.3v) voltage on any general purpose digital or analog pin (5.5v tolerant, including mclr ) with respect to v ss : when v dd = 0v: ......................................................................................................................... -0.3v to + 4.0v when v dd ? 2.0v: ....................................................................................................................... -0 .3v to +6.0v voltage on av dd and sv dd with respect to v ss ..................................(v dd ? 0.3v) to (lesser of: 4.0v or (v dd + 0.3v)) voltage on av ss and sv ss with respect to v ss ........................................................................................ -0.3v to +0.3v voltage on ch0+, ch0-, ch1+ and ch1- with respect to sv ss ................................................. -0.3v to (sv dd + 0.3v) voltage on v bat with respect to v ss ........................................................................................................ . -0.3v to +4.0v voltage on v usb3v3 with respect to v ss ..................................................................................... (v cap ? 0.3v) to +4.0v voltage on v bus with respect to v ss ....................................................................................................... -0.3v to +6.0v voltage on d+ or d- with respect to v ss : (0 ? source impedance) (note 1 ) ..............................................................................-0.5v to (v usb3v3 + 0.5v) (source impedance ? 28 ? , v usb3v3 ?? 3.0v) ............................................................................... -1.0v to +4.6v maximum current out of v ss pin ........................................................................................................................... 300 ma maximum current into v dd pin (note 2 ) ................................................................................................................250 ma maximum output current sunk by any i/o pin..................................................................................... .....................25 ma maximum output current sourced by any i/o pin .................................................................................. ..................25 ma maximum current sunk by all ports .............................................................................................. .........................200 ma maximum current sourced by all ports (note 2 ) ....................................................................................................200 ma note 1: the original ?usb 2.0 specification? indicated that usb devices should withstand 24-hour short circuits of d+ or d- to v bus voltages. this requirement was later removed in an engineering change notice (ecn) supplement to the usb specifications, which supersedes the original specifications. PIC24FJ128GC010 family devices will typically be able to survive this short-circuit test, but it is recommended to adhere to the absolute maximum specified here to avoid damaging the device. 2: maximum allowable current is a function of device maximum power dissipation (see tab l e 3 7- 1 ). ? 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 to maximum rating conditions for extended periods may affect device reliability.
PIC24FJ128GC010 family ds30009312b-page 426 ? 2012-2013 microchip technology inc. 37.1 dc characteristics figure 37-1: PIC24FJ128GC010 family vo ltage-frequency graph (industrial) table 37-1: thermal operating conditions rating symbol min typ max unit PIC24FJ128GC010 family: operating junction temperature range t j -40 ? +100 c operating ambient temperature range t a -40 ? +85 c power dissipation: internal chip power dissipation: p int = v dd x (i dd ? ? i oh ) p d p int + p i / o w i/o pin power dissipation: p i / o = ? ({v dd ? v oh } x i oh ) + ? (v ol x i ol ) maximum allowed power dissipation p dmax (t jmax ? t a )/ ? ja w frequency voltage (v dd ) ( note 1 ) 32 mhz 3.6v 3.6v ( note 1 ) note 1: lower recommended operating boundary is 2.0v or v bor (when bor is enabled). for best analog performance, operation above 2.2v is suggested, but not required. pic24fjxxxgc0xx table 37-2: thermal packaging characteristics characteristic symbol typ max unit note package thermal resistance, 12x12x1 mm 100-pin tqfp ? ja 45.0 ? c/w (note 1 ) package thermal resistance, 10x10x1 mm 64-pin tqfp ? ja 48.3 ? c/w (note 1 ) package thermal resistance, 9x9x0.9 mm 64-pin qfn ? ja 28.0 ? c/w (note 1 ) package thermal resistance, 10x10x1.1 mm 121-pin bga ? ja 40.2 ? c/w (note 1 ) note 1: junction to ambient thermal resistance, theta- ja ( ? ja ) numbers are achieved by package simulations.
? 2012-2013 microchip technology inc. ds30009312b-page 427 PIC24FJ128GC010 family table 37-3: dc characteristics: temperature and voltage specifications dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ max units conditions operating voltage dc10 v dd supply voltage 2.0 ? 3.6 v bor disabled v bor ? 3.6 bor enabled dc12 v dr ram data retention voltage ( 1 ) greater of: v porrel or v bor ??vv bor used only if bor is enabled (boren = 1 ) dc16 v por v dd start voltage to ensure internal power-on reset signal v ss ??v (note 2 ) dc16a v porrel v dd power-on reset release voltage 1.80 1.88 1.95 v (note 3 ) dc17a sr vdd recommended v dd rise skew rate to ensure internal power-on reset signal 0.05 ? ? v/ms 0-3.3v in 66 ms 0-2.5v in 50 ms (note 2 ) dc17b v bor brown-out reset voltage on v dd transition, high-to-low 2.0 2.1 2.2 v (note 3 ) dc17c v batbor v bat bor threshold on v bat high-to-low ? 1.68 ? v applies when v btbor = 1 note 1: this is the limit to which v dd may be lowered and the ram contents will always be retained. 2: if the v por or sr vdd parameters are not met, or the application experiences slow power-down v dd ramp rates, it is recommended to enable and use the bor. 3: on a rising v dd power-up sequence, application firmware execution begins at the higher of the v porrel or v bor level (when boren = 1 ).
PIC24FJ128GC010 family ds30009312b-page 428 ? 2012-2013 microchip technology inc. table 37-4: dc characteristics: operating current (i dd ) dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial parameter no. typical ( 1 ) max units operating temperature v dd conditions operating current (i dd ) ( 2 ) dc19 0.20 0.28 ma -40c to +85c 2.0v 0.5 mips, f osc = 1 mhz 0.21 0.28 ma -40c to +85c 3.3v dc20 0.38 0.52 ma -40c to +85c 2.0v 1 mips, f osc = 2 mhz 0.39 0.52 ma -40c to +85c 3.3v dc23 1.5 2.0 ma -40c to +85c 2.0v 4 mips, f osc = 8 mhz 1.5 2.0 ma -40c to +85c 3.3v dc24 5.6 7.6 ma -40c to +85c 2.0v 16 mips, f osc = 32 mhz 5.7 7.6 ma -40c to +85c 3.3v dc31 23 78 ? a -40c to +85c 2.0v lprc (15.5 kips), f osc = 31 khz 25 80 ? a -40c to +85c 3.3v note 1: data in the ?typical? column is at 3.3v, +25c unless otherwise stated. typical parameters are for design guidance only and are not tested. 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. no peripheral modules are operating and all of the peripheral module disable (pmd) bits are set. table 37-5: dc characteristics: idle current (i idle ) dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial parameter no. typical ( 1 ) max units operating temperature v dd conditions idle current (i idle ) dc40 116 150 ? a -40c to +85c 2.0v 1 mips, f osc = 2 mhz 123 160 ? a -40c to +85c 3.3v dc43 0.39 0.50 ma -40c to +85c 2.0v 4 mips, f osc = 8 mhz 0.41 0.54 ma -40c to +85c 3.3v dc47 1.5 1.9 ma -40c to +85c 2.0v 16 mips, f osc = 32 mhz 1.6 2.0 ma -40c to +85c 3.3v dc50 0.54 0.61 ma -40c to +85c 2.0v 4 mips (frc), f osc = 8 mhz 0.54 0.64 ma -40c to +85c 3.3v dc51 17 78 ? a -40c to +85c 2.0v lprc (15.5 kips), f osc = 31 khz 18 80 ? a -40c to +85c 3.3v note 1: data in the ?typical? column is at 3.3v, +25c unless otherwise stated. parameters are for design guid- ance only and are not tested.
? 2012-2013 microchip technology inc. ds30009312b-page 429 PIC24FJ128GC010 family table 37-6: dc characteristics: power-down current (i pd ) dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial parameter no. typical ( 1 ) max units operating temperature v dd conditions power-down current (i pd ) dc60 2.9 ? ? a-40c 2.0v sleep ( 2 ) 4.3 17 ? a+25c 8.3 ? ? a+60c 20 27.5 ? a+85c 2.9 ? ? a-40c 3.3v 4.3 18 ? a+25c 8.4 ? ? a+60c 20.5 28 ? a+85c dc61 0.07 ? ? a-40c 2.0v low-voltage sleep ( 3 ) 0.38 ? ? a+25c 2.6 ? ? a+60c 9.0 ? ? a+85c 0.09 ? ? a-40c 3.3v 0.42 ? ? a+25c 2.75 ? ? a+60c 9.0 ? ? a+85c dc70 0.1 ? na -40c 2.0v deep sleep, capacitor on v cap is fully discharged 18 700 na +25c 230 ? na +60c 1.8 3 ? a+85c 5?na -40c3.3v 75 900 na +25c 540 ? na +60c 1.5 6.0 ? a+85c dc74 0.4 2.0 ? a -40c to +85c 0v rtcc with v bat mode (lprc/sosc) ( 4 ) note 1: data in the typical column is at 3.3v, +25c unless otherwise stated. parameters are for design guidance only and are not tested. 2: the retention low-voltage regulator is disabled; reten (rcon<12>) = 0 , lpcfg (cw1<10>) = 1 . 3: the retention low-voltage regulator is enabled; reten (rcon<12>) = 1 , lpcfg (cw1<10>) = 0 . 4: the v bat pin is connected to the battery and rtcc is running with v dd = 0 .
PIC24FJ128GC010 family ds30009312b-page 430 ? 2012-2013 microchip technology inc. table 37-7: dc characteristics: ?? current (bor, wdt, dsbor, dswdt, lcd) dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial parameter no. typical ( 1 ) max units operating temperature v dd conditions incremental current brown-out reset ( ? bor) ( 2 ) dc25 3.1 5.0 ? a -40c to +85c 2.0v ? bor ( 2 ) 4.3 6.0 ? a -40c to +85c 3.3v incremental current watchdog timer ( ? wdt) ( 2 ) dc71 0.8 1.5 ? a -40c to +85c 2.0v ? wdt (with lprc selected) ( 2 ) 0.8 1.5 ? a -40c to +85c 3.3v incremental current hlvd ( ? hlvd) ( 2 ) dc75 4.2 15 ? a -40c to +85c 2.0v ? hlvd ( 2 ) 4.2 15 ? a -40c to +85c 3.3v incremental current real-time clock and calendar ( ? rtcc) ( 2 ) dc77 0.30 1.0 ? a -40c to +85c 2.0v ? rtcc (with sosc) ( 2 ) 0.35 1.0 ? a -40c to +85c 3.3v dc77a 0.30 1.0 ? a -40c to +85c 2.0v ? rtcc (with lprc) ( 2 ) 0.35 1.0 ? a -40c to +85c 3.3v incremental current deep sleep bor ( ? dsbor) ( 2 ) dc81 0.11 0.40 ? a -40c to +85c 2.0v ? deep sleep bor ( 2 ) 0.12 0.40 ? a -40c to +85c 3.3v incremental current deep sleep watchdog timer reset ( ? dswdt) ( 2 ) dc80 0.24 0.40 ? a -40c to +85c 2.0v ? deep sleep wdt ( 2 ) 0.24 0.40 ? a -40c to +85c 3.3v incremental current lcd ( ? lcd) ( 2 ) dc82 0.8 3.0 ? a -40c to +85c 3.3v ? lcd external/internal; ( 2 , 3 ) 1/8 mux, 1/3 bias dc90 20 ? ? a -40c to +85c 2.0v ? lcd charge pump; ( 2 , 4 ) 1/8 mux, 1/3 bias 24 ? ? a -40c to +85c 3.3v v bat a/d monitor ( 5 ) dc91 1.5 ? ? a -40c to +85c 3.3v v bat = 2v 4.0 ? ? a -40c to +85c 3.3v v bat = 3.3v note 1: data in the typical column is at 3.3v, +25c unless otherwise stated. parameters are for design guidance only and are not tested. 2: incremental current while the module is enabled and running. 3: lcd is enabled and running, no glass is connected; the resistor ladder current is not included. 4: lcd is enabled and running, no glass is connected. 5: the a/d channel is connected to the v bat pin internally; this is the current during a/d v bat operation.
? 2012-2013 microchip technology inc. ds30009312b-page 431 PIC24FJ128GC010 family table 37-8: dc characteristics: i/o pin input specifications dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. sym characteristic min typ ( 1 ) max units conditions v il input low voltage ( 3 ) di10 i/o pins with st buffer v ss ? 0.2 v dd v di11 i/o pins with ttl buffer v ss ? 0.15 v dd v di15 mclr v ss ? 0.2 v dd v di16 osci (xt mode) v ss ? 0.2 v dd v di17 osci (hs mode) v ss ? 0.2 v dd v di18 i/o pins with i 2 c? buffer v ss ? 0.3 v dd v di19 i/o pins with smbus buffer v ss ? 0.8 v smbus enabled v ih input high voltage ( 3 ) di20 i/o pins with st buffer: without 5v tolerance with 5v tolerance 0.65 v dd 0.65 v dd ? ? v dd 5.5 v v di21 i/o pins with ttl buffer: without 5v tolerance with 5v tolerance 0.25 v dd + 0.8 0.25 v dd + 0.8 ? ? v dd 5.5 v v di25 mclr 0.8 v dd ?v dd v di26 osci (xt mode) 0.7 v dd ?v dd v di27 osci (hs mode) 0.7 v dd ?v dd v di28 i/o pins with i 2 c? buffer 0.7 v dd ?5.5 v di29 i/o pins with smbus buffer 2.1 ? 5.5 v smbus enabled di30 i cnpu cnxx pull-up current 150 350 550 ? av dd = 3.3v, v pin = v ss di30a i cnpd cnxx pull-down current 15 70 150 ? av dd = 3.3v, v pin = v dd i il input leakage current ( 2 ) di50 i/o ports ? ? 1 ? av ss ? v pin ? v dd , pin at high-impedance di51 analog input pins ? ? 1 ? av ss ? v pin ? v dd , pin at high-impedance di55 mclr ??1 ? av ss ?? v pin ?? v dd di56 osci/clki ? ? 1 ? av ss ?? v pin ?? v dd , ec, xt and hs modes note 1: data in the ?typ? column is at 3.3v, +25c unless otherwise stated. parameters are for design guidance only and are not tested. 2: negative current is defined as current sourced by the pin. 3: refer to table 1-3 for i/o pin buffer types.
PIC24FJ128GC010 family ds30009312b-page 432 ? 2012-2013 microchip technology inc. table 37-9: dc characteristics: i/o pin output specifications dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ ( 1 ) max units conditions v ol output low voltage do10 i/o ports ? ? 0.4 v i ol = 6.6 ma, v dd = 3.6v ??0.4vi ol = 5.0 ma, v dd = 2v do16 osco/clko ? ? 0.4 v i ol = 6.6 ma, v dd = 3.6v ??0.4vi ol = 5.0 ma, v dd = 2v v oh output high voltage do20 i/o ports 3.0 ? ? v i oh = -3.0 ma, v dd = 3.6v 2.4 ? ? v i oh = -6.0 ma, v dd = 3.6v 1.65 ? ? v i oh = -1.0 ma, v dd = 2v 1.4 ? ? v i oh = -3.0 ma, v dd = 2v do26 osco/clko 2.4 ? ? v i oh = -6.0 ma, v dd = 3.6v 1.4 ? ? v i oh = -1.0 ma, v dd = 2v note 1: data in the ?typ? column is at 3.3v, +25c unless otherwise stated. table 37-10: dc characteristics: program memory dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ ( 1 ) max units conditions program flash memory d130 e p cell endurance 20000 ? ? e/w -40 ? c to +85 ? c d131 v pr v dd for read v min ?3.6 vv min = minimum operating voltage d132b v dd for self-timed write v min ?3.6 vv min = minimum operating voltage d133a t iw self-timed word write cycle time ?20? ? s self-timed row write cycle time ?1.5?ms d133b t ie self-timed page erase time 20 ? 40 ms d134 t retd characteristic retention 20 ? ? year if no other specifications are violated d135 i ddp supply current during programming ?5?ma note 1: data in the ?typ? column is at 3.3v, +25c unless otherwise stated.
? 2012-2013 microchip technology inc. ds30009312b-page 433 PIC24FJ128GC010 family table 37-11: internal voltag e regulator specifications table 37-12: band gap reference (bgbufn) specifications operating conditions: -40c < t a < +85c (unless otherwise stated) param no. symbol characteristics min typ max units comments dvr10 v bg internal band gap reference ? 1.2 ? v dvr11 t bg band gap reference start-up time ?1?ms dvr20 v rgout regulator output voltage ? 1.8 ? v v dd > 2.0v dvr21 c efc external filter capacitor value 4.7 10 ? ? f series resistance < 3 ? recommended; < 5 ? required. dvr t vreg start-up time ? 10 ? ? spmslp = 1 with any por or bor dvr30 v lvr low-voltage regulator output voltage ?1.2?vreten = 1 , lpcfg = 0 operating conditions: -40c < t a < +85c, 2.0v < (a)v dd < 3.6v ( 1 ) param no. sym characteristics min typ max units comments dbg01 recommended output capacitance for optimal transient response ? ? 22 f bgbuf1 or bgbuf2 dbg02 output voltage 1.140 1.200 1.260 v bufref<1:0> = 00 , 2.0v < av dd < 3.6v dbg03 1.945 2.048 2.151 v bufref<1:0> = 01 ( 2 ) dbg04 2.432 2.560 2.688 v bufref<1:0> = 10 ( 2 ) dbg05 2.918 3.072 3.226 v bufref<1:0> = 11 ( 2 ) dbg07 dc output resistance 20 ? ? ? bufref<1:0> = 00 , 2.0v < av dd ? 2.5v dbg08 20 ? ? ? bufref<1:0> = 00 , 2.5v < av dd < 3.6v dbg09 20 ? ? ? bufref<1:0> = 01 , 10 or 11 ( 2 ) dbg10 maximum continuous dc output current rating ? ? 1 ma this value is not tested in production (note 3 ) dbg11 module start-up time from disabled state ? 5 ? ms time from bufen and bufoe = 1 to output stable, c load = 20 f dbg12 module start-up time from standby mode ? 100 ? s time from bufstby = 0 to output stable dbg14 av dd active current ? 100 ? a module enabled, bufoe = 1 note 1: no dc loading on module unless otherwise stated. 2: for bufref<1:0> ? 00, (reference output max + 100 mv) < av dd < 3.6v. 3: to minimize voltage error, the dc loading on the bgbuf output pins should be <100 a.
PIC24FJ128GC010 family ds30009312b-page 434 ? 2012-2013 microchip technology inc. table 37-13: v bat operating voltage specifications table 37-15: usb on-the-g o module specifications param no. symbol characteristic min typ max units comments dvb01 v bt operating voltage 1.6 ? 3.6 v battery connected to the v bat pin, v btbor = 0 dvb02 v batbor ? 3.6 v battery connected to the v bat pin, v btbor = 1 dvb10 v btadc v bat a/d monitoring voltage specification ( 1 ) 1.6 ? 3.6 v a/d monitoring the v bat pin using the internal a/d channel note 1: measuring the a/d value using the a/d is represented by the equation: measured voltage = ((v bat /2)/v dd ) * 4096) for 12-bit a/d. table 37-14: ctmu current source specifications dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. sym characteristic min typ ( 1 ) max units comments conditions dct10 i out 1 ctmu current source, base range ? 550 ? na ctmuicon<1:0> = 00 2.5v < v dd < v ddmax dct11 i out 2 ctmu current source, 10x range ?5.5? ? a ctmuicon<1:0> = 01 dct12 i out 3 ctmu current source, 100x range ?55? ? a ctmuicon<1:0> = 10 dct13 i out 4 ctmu current source, 1000x range ? 550 ? ? a ctmuicon<1:0> = 11 ( 2 ) dct21 v ? temperature diode voltage change per degree celsius ?-3?mv/c note 1: nominal value at center point of current trim range (ctmuicon<7:2> = 000000 ). 2: do not use this current range with temperature sensing diode. dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ max units conditions operating voltage dus01 v usb3v3 usb supply voltage greater of: 3.0 or (v dd ? 0.3v) 3.3 3.6 v usb module enabled (v dd ? 0.3v) ( 1 ) ? 3.6 v usb disabled, rg2/rg3 are unused and externally pulled low or left in a high-impedance state (v dd ? 0.3v) v dd 3.6 v usb disabled, rg2/rg3 are used as general purpose i/o note 1: the v usb pin may also be left in a high-impedance state under these conditions. however, if the voltage floats below (v dd ? 0.3v), this may result in higher i pd currents than specified. the preferred method is to tie the v usb pin to v dd , even if the usb module is not used.
? 2012-2013 microchip technology inc. ds30009312b-page 435 PIC24FJ128GC010 family table 37-16: high/low-voltage detect characteristics table 37-17: comparat or dc specifications table 37-18: comparator voltag e reference dc specifications operating conditions: -40c < t a < +85c (unless otherwise stated) param no. symbol characteristic min typ max units conditions dc18 v hlvd hlvd voltage on v dd transition hlvdl<3:0> = 0100 ( 1 ) 3.45 ? 3.73 v hlvdl<3:0> = 0101 3.30 ? 3.57 v hlvdl<3:0> = 0110 3.00 ? 3.25 v hlvdl<3:0> = 0111 2.80 ? 3.03 v hlvdl<3:0> = 1000 2.67 ? 2.92 v hlvdl<3:0> = 1001 2.45 ? 2.70 v hlvdl<3:0> = 1010 2.33 ? 2.60 v hlvdl<3:0> = 1011 2.21 ? 2.49 v hlvdl<3:0> = 1100 2.11 ? 2.38 v hlvdl<3:0> = 1101 2.10 ? 2.25 v hlvdl<3:0> = 1110 2.00 ? 2.15 v dc101 v thl hlvd voltage on hlvdin pin transition hlvdl<3:0> = 1111 ?1.20? v note 1: trip points for values of hlvd<3:0>, from ? 0000 ? to ? 0011 ?, are not implemented. operating conditions: 2.0v < v dd < 3.6v, -40c < t a < +85c (unless otherwise stated) param no. symbol characteristic min typ max units comments d300 v ioff input offset voltage ? 12 30 mv d301 v icm input common-mode voltage 0 ? v dd v d302 cmrr common-mode rejection ratio 55 ? ? db d306 i qcmp av dd quiescent current per comparator ? 27 ? a comparator enabled d307 t resp response time ? 300 ? ns (note 1 ) d308 t mc2ov comparator mode change to valid output ?? 10s note 1: measured with one input at v dd /2 and the other transitioning from v ss to v dd , 40 mv step, 15 mv overdrive. operating conditions: 2.0v < v dd < 3.6v, -40c < t a < +85c (unless otherwise stated) param no. symbol characteristic min typ max units comments vr310 t set settling time ? ? 10 s (note 1 ) vrd311 cvr aa absolute accuracy -100 ? 100 mv vrd312 cvr ur unit resistor value (r) ? 4.5 ? k ? note 1: measures the interval while cvr<4:0> transitions from ? 11111 ? to ? 00000 ?.
PIC24FJ128GC010 family ds30009312b-page 436 ? 2012-2013 microchip technology inc. table 37-19: operational amplifier specifications operating conditions: -40c < t a < +85c, 2.0v < (a)v dd < 3.6v param no. sym characteristics min typ max units comments op amp mode specifications cm20a s r slew rate ? 1.2 ? v/s spdsel = 1 cm20b ? 0.4 ? v/s spdsel = 0 cm23 g bw gain bandwidth product ? 2.5 ? mhz spdsel = 1 ? 0.5 ? mhz spdsel = 0 cm33 v gain dc open-loop gain ? 80 ? db cm42 v offset input offset voltage ? 2 14 mv cm40 v cmr common-mode input voltage range av ss ?av dd v cm45 i b input bias current ? ? ? na (note 1 ) cm52 v oamax maximum output voltage swing av ss + 50 ? av dd ? 50 mv 0.5v input overdrive, no output loading cm53 i oa maximum continuous output current rating (dc or rms ac) ? ? 6 ma this value is not tested in production cm54a i qoa av dd quiescent current ? 190 ? a module enabled, spdsel = 1 , no output load cm54b ? 40 ? a module enabled, spdsel = 0 , no output load comparator mode specifications cm10a t respl large signal comparator response time ? 500 ? ns spdsel = 1 , 3v step with 1.5v input overdrive ? 2.6 ? s spdsel = 0 , 3v step with 1.5v input overdrive cm10b t resps small signal comparator response time ? 1.6 ? s spdsel = 1 , 50 mv step with 15 mv input overdrive ? 4.6 ? s spdsel = 0 , 50 mv step with 15 mv input overdrive cm15 v cmcr common-mode input voltage range av ss ?av dd v note 1: the op amps use cmos input circuitry with negligible input bias current. the maximum ?effective bias current? is the i/o pin leakage specified by electrical parameter di51 .
? 2012-2013 microchip technology inc. ds30009312b-page 437 PIC24FJ128GC010 family 37.2 ac characteristics and timing parameters the information contained in this section defines the PIC24FJ128GC010 family ac characteristics and timing parameters. table 37-20: temperature and vo ltage specifications ? ac figure 37-2: load conditions for device timing specifications table 37-21: capacitiv e loading requirements on output pins ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial operating voltage v dd range as described in section 37.1 ?dc characteristics? . param no. symbol characteristic min typ ( 1 ) max units conditions do50 c osco osco/clko pin ? ? 15 pf in xt and hs modes when external clock is used to drive osci do56 c io all i/o pins and osco ? ? 50 pf ec mode do58 c b sclx, sdax ? ? 400 pf in i 2 c? mode note 1: data in the ?typ? column is at 3.3v, +25c unless otherwise stated. v dd /2 c l r l pin pin v ss v ss c l r l = 464 ? c l = 50 pf for all pins except osco 15 pf for osco output load condition 1 ? for all pins except osco load condition 2 ? for osco
PIC24FJ128GC010 family ds30009312b-page 438 ? 2012-2013 microchip technology inc. figure 37-3: external clock timing osci clko q4 q1 q2 q3 q4 q1 os20 os25 os30 os30 os40 os41 os31 os31 q1 q2 q3 q4 q2 q3 table 37-22: external clo ck timing requirements ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ ( 1 ) max units conditions os10 f osc external clki frequency (external clocks allowed only in ec mode) dc 1.97 ? ? 32 48 mhz mhz ec ecpll ( note 2 ) oscillator frequency 3.5 4 10 12 31 ? ? ? ? ? 10 8 32 32 33 mhz mhz mhz mhz khz xt xtpll hs hspll sosc os20 t osc t osc = 1/f osc ? ? ? ? see parameter os10 for f osc value os25 t cy instruction cycle time ( 3 ) 62.5 ? dc ns os30 tosl, tos h external clock in (osci) high or low time 0.45 x t osc ??nsec os31 tosr, tos f external clock in (osci) rise or fall time ? ? 20 ns ec os40 tckr clko rise time ( 4 ) ? 6 10 ns os41 tckf clko fall time ( 4 ) ? 6 10 ns note 1: data in the ?typ? column is at 3.3v, +25c unless otherwise stated. 2: represents input to the system clock prescaler. pll dividers and postscalers must still be configured so that the system clock frequency does not exceed the maximum frequency shown in figure 37-1 . 3: instruction cycle period (t cy ) equals two 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 consumption. all devices are tested to operate at ?min.? values with an external clock applied to the osci/clki pin. when an external clock input is used, the ?max.? cycle time limit is ?dc? (no clock) for all devices. 4: measurements are taken in ec mode. the clko signal is measured on the osco pin. clko is low for the q1-q2 period (1/2 t cy ) and high for the q3-q4 period (1/2 t cy ).
? 2012-2013 microchip technology inc. ds30009312b-page 439 PIC24FJ128GC010 family table 37-23: pll clock timing specifications ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ max units conditions os50 f plli pll input frequency range ( 1 ) 1.97 4 4.04 mhz ecpll, xtpll, hspll or frcpll modes os52 t lock pll start-up time (lock time) ? ? 128 ? s os53 d clk clko stability (jitter) -0.25 ? 0.25 % note 1: the pll accepts a 1.97 mhz to 4.04 mhz input frequency. higher input frequencies, up to 48 mhz, may be supplied to the pll if they are prescaled down by the plldivx configuration bits into the 1.97 mhz to 4.04 mhz range. table 37-24: internal rc accuracy ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. characteristic min typ max units conditions f20 frc accuracy @ 8 mhz ( 4 ) -1 0.15 1 % 2.0v ? v dd ?? 3.6v, 0c ? t a ?? +85c ( note 1 ) -1.5 ? 1.5 % 2.0v ? v dd ?? 3.6v, -40c ? t a < ? 0c -0.20 0.05 0.20 % 2.0v ? v dd ?? 3.6v, -40c ? t a ?? +85c, self-tune is enabled and locked ( note 2 ) f21 lprc @ 31 khz -20 ? 20 % f22 osctun step-size ? 0.05 ? %/bit f23 frc self-tune lock time ? <5 8 ms ( note 3 ) note 1: to achieve this accuracy, physical stress applied to the microcontroller package (ex., by flexing the pcb) must be kept to a minimum. 2: accuracy measured with respect to reference source accuracy. 3: time from reference clock is stable and in range until the frc is tuned within the range specified by f20 (with self-tune). 4: other frequencies that are derived from the frc (either th rough digital division by prescalers or multiplication through a pll) will also have the same accura cy tolerance specifications as provided here. table 37-25: rc oscillator start-up time ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ max units conditions fr0 t frc frc oscillator start-up time ?15? ? s fr1 t lprc low-power rc oscillator start-up time ?50? ? s
PIC24FJ128GC010 family ds30009312b-page 440 ? 2012-2013 microchip technology inc. figure 37-4: clko and i/o ti ming characteristics note: refer to figure 37-2 for load conditions. i/o pin (input) i/o pin (output) di35 old value new value di40 do31 do32 table 37-26: clko and i/ o timing requirements ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ ( 1 ) max units conditions do31 t io r port output rise time ? 5 25 ns do32 t io f port output fall time ? 5 25 ns di35 t inp intx pin high or low time (input) 20 ? ? ns di40 t rbp cnx high or low time (input) 2??t cy note 1: data in the ?typ? column is at 3.3v, +25c unless otherwise stated.
? 2012-2013 microchip technology inc. ds30009312b-page 441 PIC24FJ128GC010 family table 37-27: reset and brown-o ut reset requirements ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ max units conditions sy10 t mcl mclr pulse width (low) 2 ? ? ? s sy12 t por power-on reset delay ? 2 ? ? s sy13 t ioz i/o high-impedance from mclr low or watchdog timer reset lesser of: (3 t cy + 2) or 700 ?(3t cy + 2) ? s sy25 t bor brown-out reset pulse width 1?? ? sv dd ?? v bor sy45 t rst internal state reset time ? 50 ? ? s sy70 t dswu deep sleep wake-up time ? 200 ? ? sv cap fully discharged before wake-up sy71 t pm program memory wake-up time ?20? ? s sleep wake-up with pmslp = 0 ?1? ? s sleep wake-up with pmslp = 1 sy72 t lvr low-voltage regulator wake-up time ?90? ? s sleep wake-up with pmslp = 0 ?70? ? s sleep wake-up with pmslp = 1
PIC24FJ128GC010 family ds30009312b-page 442 ? 2012-2013 microchip technology inc. table 37-28: 12-bit pipeline a/d module specifications ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min. typ max. units conditions device supply ad01 av dd module v dd supply greater of: (v dd ? 0.3) or 2.0 ?lesser of: (v dd + 0.3) or 3.6 v ad02 av ss module v ss supply v ss ? 0.3 ? v ss + 0.3 v ad03 i qadc1 av dd current ? 0.4 ? ma v dd = av dd = 3.3v, 1 mhz a/d clock, pwrlvl = 0 , a/d active and not halted i qadc8 ?2 ?mav dd = av dd = 3.3v, 8 mhz a/d clock, pwrlvl = 1 , a/d active and not halted reference inputs ad05 v refh reference voltage high av ss + 1.8 ? av dd v ad06 v refl reference voltage low av ss ?v refh ? 1.2 v ad07 v ref absolute reference voltage av ss ? 0.3 ? av dd + 0.3 v av ss + 1.8 ? av dd + 0.3 v refpump = 0 av ss + 1.2 ? 2.0 v refpump = 1 analog input ad10 v inh -v inl full-scale input span v refl ?v refh v (note 2 ) ad11 v in absolute input voltage av ss ? 0.3 ? av dd + 0.3 v ad12 v inl absolute v inl input voltage av ss ? 0.3 ? av dd /3 v ad13 i lkg leakage current ? 1.0 610 na v inl = av ss = v refl = 0v, av dd = v refh = 3v, source impedance = 2.5 k ? a/d accuracy ad20b nr resolution ? 12 ? bits ad21b inl integral nonlinearity -6 ? +6 lsb v inl = av ss = v refl = 0v, av dd = v refh = 3v ad22b dnl differential nonlinearity -3 ? +3 lsb v inl = av ss = v refl = 0v, av dd = v refh = 3v (note 3 ) ad23b g err gain error -8 ? +8 lsb v inl = av ss = v refl = 0v, av dd = v refh = 3v ad24b e off offset error -12 ? +12 lsb v inl = av ss = v refl = 0v, av dd = v refh = 3v ad25b monotonicity ? ? ? ? ( note 1 ) note 1: the a/d conversion result never decreases with an increase in the input voltage. 2: measurements are taken with the external av ref + and av ref - used as the a/d voltage reference. 3: overall accuracy can be improved if 4 or more consecutive measurements are averaged. for details, see the ?pic24f family reference manual? , ?12-bit, high-speed pipeline a/d converter? (ds30686).
? 2012-2013 microchip technology inc. ds30009312b-page 443 PIC24FJ128GC010 family figure 37-5: 12-bit a/d dnl, 10 ms/s, av dd = 3.0v, typical figure 37-6: 12-bit a/d inl, 10 ms/s, av dd = 3.0v, typical -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 0 512 1024 1536 2048 2560 3072 3584 4096 code word d n l dnl (lsbs) 4095 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 0 512 1024 1536 2048 2560 3072 3584 4096 code word inl (lsbs) 4095
PIC24FJ128GC010 family ds30009312b-page 444 ? 2012-2013 microchip technology inc. table 37-29: 12-bit pipeline a/d conversion timing requirements ( 1 ) table 37-30: 10-bit dac specifications ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. sym characteristic min. typ max. units conditions clock parameters ad50 t ad a/d clock period 100 ? 1000 ns conversion rate ad55 t conv single conversion latency ? 9 ? t ad ad56 f cnv throughput rate ? ? 10 msps av dd > 2.7v ad57 t samp sample time 0.5 ? 31 t ad clock parameters ad61 t pss sample start delay from setting sample bit (samp) ??1t ad note 1: the 31 t ad value is the maximum set by the samcx bits. long (up to indefinite) sampling times are allowed on the channel selected by adtbl0 when the a/d is idle. ac characteristics operating conditions: -40c < t a < +85c, 2.0v < (a)v dd < 3.6v ( 1 ) param no. sym characteristic min typ max units comments dac01 resolution 10 ? ? bits dac02 dv ref + input voltage range ??av dd v dac03 dnl differential linearity error -1 ? +1 lsb dac04 inl integral linearity error -2.5 ? +2.5 lsb dac05 offset error -20 ? +20 mv code 000h dac06 gain error -2.5 ? 2.5 lsb code 3ffh, not including offset error dac07 monotonicity (note 2 ) ? dac08 maximum output voltage swing av ss + 20 ? av dd ? 20 mv no output load dac09 slew rate ? 3.8 ? v/s dac10 settling time ? 0.9 ? s within ? lsb of final value, transition from ? to ? full-scale range dac11 maximum continuous output current rating (dc or ac rms) ? ? 6 ma this value is not tested in production dac12 av dd quiescent current ?700? ? a module enabled, dac reference = av dd , no output load dac13 dv ref + quiescent current ?330? ? a module enabled, dac reference = dv ref + note 1: unless otherwise stated, test conditions are with v dd = av dd = dv ref + = 3.3v, 3 k ? load to v ss . 2: dac output voltage never decreases with an increase in the data code.
? 2012-2013 microchip technology inc. ds30009312b-page 445 PIC24FJ128GC010 family table 37-31: 16-bit sigma-delta a/d converter specifications ac characteristics operating conditions: -40c < t a < +85c, 2.0v < sv dd < 3.6v param no. sym characteristics min typ ( 1 ) max units comments sdc01 sv ref + input voltage range sv ref -? sv dd v sdc02 sv ref - input voltage range sv ss ?sv ref +v sdc03 analog channel absolute input voltage range sv ss ?sv dd v full range accepted, independent of sv ref +/sv ref - sdc04 analog channel differential input voltage range ??sv dd v limit differential input to [(sv ref + ? sv ref -)/gain] for non-saturated result sdc05 inl integral linearity error -20 6 +20 lsb see figure 37-8 sdc06a offset error -12 10 +12 mv 1x gain mode without using voscal, offset error is mostly independent of gain setting sdc06b ? 0.0 ? mv 1x gain mode, after voscal based firmware correction sdc08 unadjusted gain error -10 -6 -0.001 % 1x gain mode uncorrected sdc09b sinad ? 75 ? db osr 1024, high dithering enabled, 25 hz input sdc10 differential input impedance ? 684 ? k ? 4 mhz a/d clock, input impedance is proportional to 1/(a/d clock frequency) sdc13 a/d clock input frequency 1 ? 4 mhz sdc14 sv dd operating current ? 3.6 ? ma module enabled, 4 mhz a/d clock, sv dd /sv ss as a/d reference, pwrlvl = 1 note 1: unless otherwise stated, typical column test conditions are with v dd = av dd = sv dd = 3.3v, +25c, 1x gain mode, osr 1024, chopping enabled, sv dd /sv ss are used as a/d references.
PIC24FJ128GC010 family ds30009312b-page 446 ? 2012-2013 microchip technology inc. figure 37-7: 16-bit s/d a/d dnl, sv dd = 3.0v, typical figure 37-8: 16-bit s/d a/d inl, sv dd = 3.0v, typical -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 -32768 -22768 -12768 -2768 7232 17232 27232 code word dnl (lsbs) -12 -10 -8 -6 -4 -2 0 2 4 6 -32768 -22768 -12768 -2768 7232 17232 27232 code word inl (lsbs)
? 2012-2013 microchip technology inc. ds30009312b-page 447 PIC24FJ128GC010 family 38.0 packaging information 38.1 package marking information 64-lead tqfp (10x10x1 mm) xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx yywwnnn example pic24fj128 gc006-i/ 1320017 pt 3 e 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 xxxxxxxxxxx 64-lead qfn (9x9x0.9 mm) xxxxxxxxxxx xxxxxxxxxxx yywwnnn pic24fj128 example gc006-i/mr 1350017 3 e 100-lead tqfp (12x12x1 mm) xxxxxxxxxxxx xxxxxxxxxxxx yywwnnn example pic24fj128gc 010-i/pt 1310017 3 e
PIC24FJ128GC010 family ds30009312b-page 448 ? 2012-2013 microchip technology inc. 38.2 package marking information (continued) 121-bga (10x10x1.1 mm) xxxxxxxxxxx xxxxxxxxxxx yywwnnn example pic24fj128 gc010-i/bg 1320017 3 e xxxxxxxxxxx
? 2012-2013 microchip technology inc. ds30009312b-page 449 PIC24FJ128GC010 family 38.3 package details the following sections give the technical details of the packages. note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging
PIC24FJ128GC010 family ds30009312b-page 450 ? 2012-2013 microchip technology inc. note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging
? 2012-2013 microchip technology inc. ds30009312b-page 451 PIC24FJ128GC010 family note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging
PIC24FJ128GC010 family ds30009312b-page 452 ? 2012-2013 microchip technology inc. 
       
     !" #$  %
& '  (   !" # $% &" '  ()"&'"!&)  & #*&&  & #    + '% ! & !  
& ,!- '    ' !! #.#&"# '#% !
&"!!#% !
&"!!! & $ #/''
!#   ' !  #&   
.0/ 1+2 1 !' !  &  $ & " !**&"&&   ! .32  %   ' !("!" *&"&&   (%%' &
"
! ! ' ( 3& '!&" &
4 # * !(
 ! ! & 
 4  
% & & # & &&
255***'
'5
4  6&! 77.. ' !7'&! 8 89 : 8"') %7 #! 8 ; 7 #& /1+ 9  <  &  = =  # # 4 4 !!  /  / & #%%  / = / 3&7  & 7 / ; / 3&
& 7 .3 3&  > /> > 9  ?#& . 1+ 9  7  &  1+ # # 4 ?#& . 1+ # # 4 7  &  1+ 7 #4 !!   =  7 #?#& )    # %&  
> > > # %&  1&&' > > > d d1 e e1 e b n note 1 123 note 2 c l a1 l1 a2 a 
    * + @/1
? 2012-2013 microchip technology inc. ds30009312b-page 453 PIC24FJ128GC010 family note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging
PIC24FJ128GC010 family ds30009312b-page 454 ? 2012-2013 microchip technology inc. 
       
  ##   !" #$  %
& '  (   !" # $% &" '  ()"&'"!&)  & #*&&  & #    + '% ! & !  
& ,!- '    ' !! #.#&"# '#% !
&"!!#% !
&"!!! & $ #/''
!#   ' !  #&   
.0/ 1+2 1 !' !  &  $ & " !**&"&&   ! .32  %   ' !("!" *&"&&   (%%' &
"
! ! ' ( 3& '!&" &
4 # * !(
 ! ! & 
 4  
% & & # & &&
255***'
'5
4  6&! 77.. ' !7'&! 8 89 : 8"') %7 #! 8  7 #& 1+ 9  <  &  = =  # # 4 4 !!  /  / & #%%  / = / 3&7  & 7 / ; / 3&
& 7 .3 3&  > /> > 9  ?#& . 1+ 9  7  &  1+ # # 4 ?#& . 1+ # # 4 7  &  1+ 7 #4 !!   =  7 #?#& )  @  # %&  
> > > # %&  1&&' > > > d d1 e e1 e b n 123 note 1 note 2 c l a1 l1 a a2 
    * + 1
? 2012-2013 microchip technology inc. ds30009312b-page 455 PIC24FJ128GC010 family note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging
PIC24FJ128GC010 family ds30009312b-page 456 ? 2012-2013 microchip technology inc.
? 2012-2013 microchip technology inc. ds30009312b-page 457 PIC24FJ128GC010 family
PIC24FJ128GC010 family ds30009312b-page 458 ? 2012-2013 microchip technology inc.
? 2012-2013 microchip technology inc. ds30009312b-page 459 PIC24FJ128GC010 family appendix a: revision history revision a (july 2012) original data sheet for the PIC24FJ128GC010 family of devices. revision b (may 2013) changes descriptive title on page 1 to ?16-bit flash microcontrollers with 12-bit pipeline a/d, sigma-delta a/d, usb on-the-go and xlp technology?. adds coremark ? rating to the ?high-performance cpu? section on page 2 . removes all references to jtag device programming throughout the document. corrects the default doze mode ratio as 1:8 (previously described as 1:1) throughout the document. corrects the default frc postscaler setting to 1:2. corrects references in section 10.4.6 ?deep sleep wdt? regarding the configuration register for the dswdtosc and dswdps<4:0> bits. changes the description of the behavior of the uerrif bit in the u1ir register, from ?read-only? to ?read, write 1 to clear?, in both contexts of the register. corrects the low end of the operating range of the volt- age regulator, described in section 34.2 ?on-chip voltage regulator? , to 2.0v. updates section 37.0 ?electrical characteristics? : ? adds maximum specifications to most dc specifications ? adds systematic parameter numbers to existing dc and ac specifications that were previously not numbered ? moves dc specification for usb module from table 37-4 to a new table 37-15 ; all subsequent tables are renumbered accordingly ? updates most typical and maximum specifications in the following tables: - table 37-12 (band gap reference (bgbufn) specifications) - table 37-19 (operational amplifier specifications) - table 37-28 (12-bit pipeline a/d module specifications) - table 37-30 (10-bit dac specifications) - table 37-31 (16-bit sigma-delta a/d converter specifications ) other minor typographic changes and updates throughout.
PIC24FJ128GC010 family ds30009312b-page 460 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 461 PIC24FJ128GC010 family index a a/d operation .................................................................. 347 registers................................................................... 348 ac characteristics 10-bit dac converter ............................................... 444 12-bit pipeline a/d conversion timing requirements........................................ 444 12-bit pipeline a/d module ....................................... 442 16-bit sigma-delta a/d converter ............................ 445 clko and i/o timing requirements ........................ 440 external clock timing ............................................... 438 internal rc accuracy ................................................ 439 load conditions and requirements for specifications .............................................. 437 pll clock timing...................................................... 439 rc oscillator start-up time ...................................... 439 reset and brown-out reset requirements .............. 441 advanced analog features......................................... 14, 341 shared analog pins .................................................. 341 alternate interrupt vector table (aivt) ............................ 103 assembler mpasm assembler................................................... 414 b block diagrams 12-bit a/d converter single-ended analog input model ....................................................... 367 12-bit pipeline a/d converter ................................... 349 16-bit asynchronous timer3 and timer5 ................. 219 16-bit synchronous timer2 and timer4 ................... 219 16-bit timer1 module................................................ 215 32-bit timer2/3 and timer4/5 ................................... 218 accessing program memory using table instructions ............................................... 80 addressing for table registers................................... 91 analog block (overview) ........................................... 342 bdt mapping for endpoint buffering modes ............ 270 call stack frame...................................................... 77 comparator voltage reference ................................ 387 cpu programmer?s model .......................................... 41 crc module ............................................................. 335 crc shift engine detail............................................ 335 ctmu connections and internal configuration for capacitance measurement ............................... 390 ctmu typical connections and internal configuration for pulse delay generation ........ 391 ctmu typical connections and internal configuration for time measurement ............... 391 data access from program space address generation ............................................ 79 data signal modulator .............................................. 299 dma controller ........................................................... 83 eds address generation for read............................. 75 eds address generation for write ............................. 76 high/low-voltage detect (hlvd) ............................. 397 i 2 c module ................................................................ 250 individual comparator configurations, cref = 0..... 382 individual comparator configurations, cref = 1, cvrefp = 0 ................................... 383 individual comparator configurations, cref = 1, cvrefp = 1 ................................... 383 input capture x ......................................................... 223 lcd controller.......................................................... 315 mclr pin connections example ............................... 34 on-chip regulator connections............................... 409 output compare x (16-bit mode) ............................. 228 output compare x (double-buffered, 16-bit pwm mode) ........................................... 230 pci24fj128gc010 family (general) ........................ 18 pic24f cpu core ...................................................... 40 psv operation (lower word)..................................... 82 psv operation (upper word)..................................... 82 recommended minimum connections....................... 33 reset system ............................................................. 97 rtcc........................................................................ 323 shared i/o port structure ......................................... 183 sigma-delta a/d converter ...................................... 369 simplified single dac .............................................. 375 single operational amplifier ..................................... 377 spix master, frame master connection .................. 246 spix master, frame slave connection .................... 246 spix master/slave connection (enhanced buffer modes)................................. 245 spix master/slave connection (standard mode)..... 245 spix module (enhanced mode)................................ 239 spix module (standard mode) ................................. 238 spix slave, frame master connection .................... 246 spix slave, frame slave connection ...................... 246 system clock............................................................ 159 triple comparator module........................................ 381 uartx (simplified) ................................................... 257 usb otg bus-powered interface example............. 267 usb otg dual power mode example..................... 267 usb otg host interface example ........................... 268 usb otg interface example ................................... 268 usb otg interrupt funnel ....................................... 274 usb otg module..................................................... 266 usb otg self-power only mode ............................ 267 usb pll................................................................... 167 watchdog timer (wdt)............................................ 410 c c compilers mplab c18.............................................................. 414 charge time measurement unit. see ctmu. code examples basic clock switching .............................................. 166 configuring uart1 input/output functions (pps) ............................................... 196 eds read from program memory in assembly code .................................................. 81 eds read in assembly code..................................... 75 eds write in assembly code..................................... 76 erasing a program memory block (assembly) ........... 94 erasing a program memory block (c language)....... 95 initiating a programming sequence ........................... 95 loading the write buffers ........................................... 95 port write/read in assembly.................................... 191 port write/read in c................................................. 191 pwrsav instruction syntax .................................... 172 setting the rtcwren bit........................................ 324 single-word flash programming ............................... 96 single-word flash programming (c language) ........ 96 the repeat sequence.............................................. 175
PIC24FJ128GC010 family ds30009312b-page 462 ? 2012-2013 microchip technology inc. code protection ................................................................ 411 code segment protection ......................................... 411 configuration options ....................................... 411 configuration protection ........................................... 412 general segment protection..................................... 411 comparator voltage reference ........................................ 387 configuring................................................................ 387 configuration bits.............................................................. 399 core features ..................................................................... 13 cpu arithmetic logic unit (alu)......................................... 44 clocking scheme ...................................................... 160 control registers ........................................................ 42 core registers ............................................................ 40 programmer?s model................................................... 39 crc polynomials............................................................... 336 setup examples for 16 and 32-bit polynomials ........ 336 user interface ........................................................... 336 ctmu measuring capacitance ............................................ 389 measuring time ........................................................ 390 pulse delay and generation ..................................... 390 customer change notification service ............................. 467 customer notification service........................................... 467 customer support ............................................................. 467 d data memory address space............................................................ 47 extended data space (eds) ...................................... 74 memory map ............................................................... 47 near data space ........................................................ 48 sfr space.................................................................. 48 software stack............................................................ 77 space organization, alignment .................................. 48 data signal modulator....................................................... 299 data signal modulator (dsm) ........................................... 299 dc characteristics comparator ............................................................... 435 comparator voltage reference ................................ 435 ctmu current source .............................................. 434 delta current (bor, wdt, dsbor, dswdt, lcd) .................................................. 430 i/o pin input specifications ....................................... 431 i/o pin output specifications .................................... 432 idle current (i idle ) .................................................... 428 operating current (i dd )............................................. 428 power-down current (i pd ) ........................................ 429 program memory ...................................................... 432 temperature and voltage specifications .................. 427 deep sleep wdt .............................................................. 176 development support ....................................................... 413 device features 100/121-pin................................................................. 17 64-pin.......................................................................... 16 direct memory access (dma) controller ............................ 14 direct memory access controller. see dma. dma .................................................................................... 83 channel trigger sources ............................................ 90 peripheral module disable (pmd) .............................. 86 summary of operations .............................................. 84 types of data transfers ............................................. 85 typical setup .............................................................. 86 dual operational amplifier ................................................ 377 e electrical characteristics absolute maximum ratings ...................................... 425 band gap (bgbufn) reference .............................. 433 capacitive loading on output pins .......................... 437 high/low-voltage detect .......................................... 435 internal voltage regulator ........................................ 433 operational amplifier ................................................ 436 thermal operating conditions.................................. 426 thermal packaging characteristics .......................... 426 v/f graph ................................................................. 426 v bat operating voltage............................................ 434 enhanced parallel master port (epmp) ........................... 303 enhanced parallel master port. see epmp. epmp key features ............................................................ 303 package variations................................................... 303 equations 16-bit, 32-bit crc polynomials................................ 336 baud rate reload calculation.................................. 251 calculating the pwm period..................................... 230 calculation for maximum pwm resolution .............. 231 estimating usb transceiver current consumption ....................................... 269 relationship between device and spix clock speed ..................................................... 247 uartx baud rate with brgh = 0 ........................... 258 uartx baud rate with brgh = 1 ........................... 258 errata .................................................................................. 12 extended data space (eds) ............................................ 303 f flash configuration word locations................................. 399 flash configuration words ................................................. 46 flash program memory ...................................................... 91 and table instructions ................................................ 91 enhanced icsp operation ......................................... 92 programming algorithm .............................................. 94 programming operations............................................ 94 rtsp operation ......................................................... 92 single-word programming ......................................... 96 g getting started basic connection requirements ................................ 33 external oscillator pins............................................... 37 icsp operation analog and digital pin configuration.................. 38 pins..................................................................... 36 master clear reset (mclr ) pin ................................. 34 power supply pins...................................................... 34 voltage regulator (v cap ) ........................................... 35 h high/low-voltage detect (hlvd) ..................................... 397
? 2012-2013 microchip technology inc. ds30009312b-page 463 PIC24FJ128GC010 family i i/o ports analog port pins configuration (ansx) .................... 184 analog/digital function of an i/o pin ........................ 184 input change notification (icn) ................................ 191 input voltage levels for port/pin tolerated description input............................... 185 open-drain configuration ......................................... 184 parallel (pio) ............................................................ 183 peripheral pin select ................................................ 192 pull-ups and pull-downs........................................... 191 selectable input sources .......................................... 193 selectable output sources ....................................... 194 i 2 c clock rates............................................................... 251 communicating as master in single master environment.......................................... 249 reserved addresses................................................. 251 setting baud rate as bus master............................. 251 slave address masking ............................................ 251 input capture 32-bit cascaded mode ............................................. 224 operations ................................................................ 224 synchronous and trigger modes.............................. 223 input capture with dedicated timers................................ 223 instruction set overview ................................................................... 419 summary................................................................... 417 symbols used in opcode descriptions..................... 418 interfacing program and data spaces ................................ 78 inter-integrated circuit. see i 2 c. internal band gap references ......................................... 341 internet address................................................................ 467 interrupt controller ............................................................ 103 interrupt vector table (ivt) .............................................. 103 interrupts control and status registers .................................... 107 implemented vectors ................................................ 105 reset sequence ....................................................... 103 setup and service procedures ................................. 158 trap vectors ............................................................. 104 vector table.............................................................. 104 j jtag interface .................................................................. 412 k key features..................................................................... 399 l lcd controller .................................................................... 14 liquid crystal display (lcd) controller ............................ 315 low-voltage/retention regulator ..................................... 173 m memory organization.......................................................... 45 microchip internet web site .............................................. 467 modulator. see data signal modulator. mplab asm30 assembler, linker, librarian ................... 414 mplab integrated development environment software............................................... 413 mplab pm3 device programmer .................................... 415 mplab real ice in-circuit emulator system................. 415 mplink object linker/mplib object librarian ................ 414 n near data space ................................................................ 48 o on-chip voltage regulator............................................... 409 por.......................................................................... 409 standby mode .......................................................... 409 oscillator configuration clock switching ........................................................ 165 sequence ......................................................... 165 configuration bit values for clock selection ............ 160 frc self-tuning....................................................... 166 initial configuration on por ..................................... 160 usb operation ......................................................... 167 special considerations..................................... 168 output compare 32-bit cascaded mode ............................................. 227 operations ................................................................ 228 synchronous and trigger modes ............................. 227 output compare with dedicated timers........................... 227 p packaging ......................................................................... 447 details....................................................................... 449 marking..................................................................... 447 peripheral pin select (pps).............................................. 192 available peripherals and pins................................. 192 configuration control................................................ 195 considerations for use ............................................. 196 input mapping........................................................... 193 mapping exceptions ................................................. 195 output mapping ........................................................ 194 peripheral priority ..................................................... 192 registers .................................................................. 197 pin descriptions 100-pin devices ........................................................... 6 121-pin devices (bga) ................................................ 9 64-pin devices ............................................................. 4 pinout descriptions....................................................... 19?31 power-saving features .................................................... 171 clock frequency and clock switching ..................... 181 doze mode ............................................................... 181 hardware-based modes........................................... 173 instruction-based modes.......................................... 172 deep sleep....................................................... 174 i/o pins..................................................... 175 retention mode ........................................ 174 idle.................................................................... 173 sleep ................................................................ 173 low-voltage/retention sleep ................... 173 power-on resets (pors) ......................................... 176 selective peripheral control ..................................... 181 vbat mode ................................................................ 177 i/o pins............................................................. 177 with no rtcc .................................................. 177 product identification system ........................................... 469 program memory access using table instructions ................................ 80 address construction ................................................. 78 address space ........................................................... 45 flash configuration words ......................................... 46 hard memory vectors................................................. 46 memory maps............................................................. 45 organization ............................................................... 46 reading from program memory using eds ............. 81
PIC24FJ128GC010 family ds30009312b-page 464 ? 2012-2013 microchip technology inc. program verification.......................................................... 411 pulse-width modulation (pwm) mode .............................. 229 pulse-width modulation. see pwm. pwm duty cycle and period .............................................. 230 r reader response ............................................................. 468 real-time clock and calendar (rtcc)............................ 323 reference clock output.................................................... 168 register maps 12-bit pipeline a/d converter ..................................... 61 analog configuration .................................................. 60 band gap buffer interface .......................................... 70 comparators ............................................................... 70 cpu core.................................................................... 49 ctmu.......................................................................... 59 cyclic redundancy check (crc) ............................... 70 dac ............................................................................ 60 data signal modulator (dsm) ..................................... 69 deep sleep ................................................................. 73 dma ............................................................................ 65 i 2 c ............................................................................... 55 icn .............................................................................. 50 input capture .............................................................. 53 interrupt controller ...................................................... 51 lcd controller ............................................................ 67 nvm ............................................................................ 73 op amp ....................................................................... 57 output compare ......................................................... 54 padcfg1 (pad configuration)................................... 59 parallel master/slave port .......................................... 69 peripheral module disable (pmd) .............................. 73 peripheral pin select (pps) ........................................ 71 porta........................................................................ 57 portb........................................................................ 57 portc ....................................................................... 58 portd ....................................................................... 58 porte........................................................................ 58 portf ........................................................................ 59 portg ....................................................................... 59 real-time clock and calendar (rtcc)...................... 69 sigma-delta a/d ......................................................... 60 spi .............................................................................. 56 system control (clock and reset).............................. 72 timers ......................................................................... 52 uart .......................................................................... 56 usb otg .................................................................... 66 registers acconh (a/d accumulator control high) ............... 362 acconl (a/d accumulator control low) ................ 362 adchith (a/d match hit high) ................................ 363 adchitl (a/d match hit low) ................................. 363 adcon1 (a/d control 1) .......................................... 350 adcon2 (a/d control 2) .......................................... 351 adcon3 (a/d control 3) .......................................... 352 adlnconh (a/d sample list n control high) ......... 355 adlnconl (a/d sample list n control low)........... 357 adlnmsel0 (a/d sample list n multi-channel select 0)............................................................ 366 adlnmsel1 (a/d sample list n multi-channel select 1)............................................................ 366 adlnmsel2 (a/d sample list n multi-channel select 2)............................................................ 365 adlnmsel3 (a/d sample list n multi-channel select 3)............................................................ 365 adlnptr (a/d sample list n pointer) ..................... 360 adlnstat (a/d sample list n status) .................... 359 adstath (a/d status high) .................................... 353 adstatl (a/d status low) ..................................... 354 adtbln (a/d sample table entry n) ....................... 360 adthnh (a/d sample table n threshold value high)....................................................... 364 adthnl (a/d sample table n threshold value low)........................................................ 364 alcfgrpt (alarm configuration) ........................... 328 alminsec (alarm minutes and seconds value) ................................................ 332 almthdy (alarm month and day value) ................ 331 alwdhr (alarm weekday and hours value).......... 331 ampxcon (op amp x control) ................................ 378 ansa (porta analog function selection) ............. 186 ansb (portb analog function selection) ............. 187 ansc (portc analog function selection) ............. 187 ansd (portd analog function selection) ............. 188 anse (porte analog function selection) ............. 188 ansf (portf analog function selection).............. 189 ansg (portg analog function selection)............. 190 bdnstat prototype (buffer descriptor n status, cpu mode)....................................................... 273 bdnstat prototype (buffer descriptor n status, usb mode) ....................................................... 272 bufcon0 (internal voltage reference control)...... 344 bufconx (band gap buffers 1, 2 control) ............. 345 clkdiv (clock divider) ............................................ 163 cmstat (comparator status) ................................. 385 cmxcon (comparator x control, comparators 1-3) ............................................. 384 corcon (cpu control) .......................................... 109 corcon (cpu core control) ................................... 43 crccon1 (crc control 1) ..................................... 338 crccon2 (crc control 2) ..................................... 339 crcxorh (crc xor polynomial, high byte) ....... 340 crcxorl (crc xor polynomial, low byte)......... 339 ctmucon1 (ctmu control 1) ................................ 392 ctmucon2 (ctmu control 2) ................................ 393 ctmuicon (ctmu current control) ....................... 395 cvrcon (comparator voltage reference control) ........................................... 388 cw1 (flash configuration word 1)........................... 400 cw2 (flash configuration word 2)........................... 402 cw3 (flash configuration word 3)........................... 404 cw4 (flash configuration word 4)........................... 406 dacxcon (dacx control) ....................................... 376 devid (device id).................................................... 408 devrev (device revision)...................................... 408 dmachn (dma channel n control) ........................... 88 dmacon (dma engine control)................................ 87 dmaintn (dma channel n interrupt)......................... 89 dscon (deep sleep control) .................................. 178 dswake (deep sleep wake-up source) ................ 179 hlvdcon (high/low-voltage detect control) ........ 398 i2cxcon (i2cx control) ........................................... 252 i2cxmsk (i2cx slave mode address mask) ............ 255 i2cxstat (i2cx status) ........................................... 254 icxcon1 (input capture x control 1)....................... 225 icxcon2 (input capture x control 2)....................... 226 iec0 (interrupt enable control 0) ............................. 122 iec1 (interrupt enable control 1) ............................. 124 iec2 (interrupt enable control 2) ............................. 126 iec3 (interrupt enable control 3) ............................. 127
? 2012-2013 microchip technology inc. ds30009312b-page 465 PIC24FJ128GC010 family iec4 (interrupt enable control 4) ............................. 128 iec5 (interrupt enable control 5) ............................. 129 iec6 (interrupt enable control 6) ............................. 130 iec7 (interrupt enable control 7) ............................. 131 ifs0 (interrupt flag status 0) ................................... 112 ifs1 (interrupt flag status 1) ................................... 114 ifs2 (interrupt flag status 2) ................................... 116 ifs3 (interrupt flag status 3) ................................... 117 ifs4 (interrupt flag status 4) ................................... 118 ifs5 (interrupt flag status 5) ................................... 119 ifs6 (interrupt flag status 6) ................................... 120 ifs7 (interrupt flag status 7) ................................... 121 intcon1 (interrupt control 1).................................. 110 intcon2 (interrupt control 2).................................. 111 inttreg (interrupt controller test)......................... 157 ipc0 (interrupt priority control 0) ............................. 132 ipc1 (interrupt priority control 1) ............................. 133 ipc10 (interrupt priority control 10) ......................... 142 ipc11 (interrupt priority control 11) ......................... 143 ipc12 (interrupt priority control 12) ......................... 144 ipc13 (interrupt priority control 13) ......................... 145 ipc15 (interrupt priority control 15) ......................... 146 ipc16 (interrupt priority control 16) ......................... 147 ipc18 (interrupt priority control 18) ......................... 148 ipc19 (interrupt priority control 19) ......................... 149 ipc2 (interrupt priority control 2) ............................. 134 ipc20 (interrupt priority control 20) ......................... 150 ipc21 (interrupt priority control 21) ......................... 151 ipc22 (interrupt priority control 22) ......................... 152 ipc23 (interrupt priority control 23) ......................... 153 ipc25 (interrupt priority control 25) ......................... 154 ipc26 (interrupt priority control 26) ......................... 155 ipc29 (interrupt priority control 29) ......................... 156 ipc3 (interrupt priority control 3) ............................. 135 ipc4 (interrupt priority control 4) ............................. 136 ipc5 (interrupt priority control 5) ............................. 137 ipc6 (interrupt priority control 6) ............................. 138 ipc7 (interrupt priority control 7) ............................. 139 ipc8 (interrupt priority control 8) ............................. 140 ipc9 (interrupt priority control 9) ............................. 141 lcdcon (lcd control)............................................ 316 lcddatax (lcd data x) ......................................... 319 lcdps (lcd phase) ................................................ 318 lcdref (lcd reference ladder control)............... 321 lcdreg (lcd charge pump control)..................... 317 lcdsex (lcd segment x enable) ........................... 319 mdcar (data signal modulator carrier control) ................................................. 302 mdcon (data signal modulator control)................. 300 mdsrc (data signal modulator source control)..... 301 minsec (rtcc minutes and seconds value)......... 330 mthdy (rtcc month and day value) .................... 329 nvmcon (flash memory control) ............................. 93 ocxcon1 (output compare x control 1) ................ 232 ocxcon2 (output compare x control 2) ................ 234 osccon (oscillator control) ................................... 161 osctun (frc oscillator tune)............................... 164 padcfg1 (pad configuration control) .................... 313 pmcon1 (epmp control 1) ..................................... 305 pmcon2 (epmp control 2) ..................................... 306 pmcon3 (epmp control 3) ..................................... 307 pmcon4 (epmp control 4) ..................................... 308 pmcsxbs (epmp chip select x base address)...... 310 pmcsxcf (epmp chip select x configuration)....... 309 pmcsxmd (epmp chip select x mode) .................. 311 pmstat (epmp status, slave mode) ..................... 312 rcfgcal (rtcc calibration and configuration) ............................................ 325 rcon (reset control)................................................ 98 rcon2 (reset and system control 2)..................... 180 rcon2 (reset control 2)......................................... 100 refocon (reference oscillator control) ............... 169 rpinr0 (pps input 0).............................................. 197 rpinr1 (pps input 1).............................................. 197 rpinr10 (pps input 10).......................................... 200 rpinr11 (pps input 11).......................................... 200 rpinr15 (pps input 15).......................................... 201 rpinr17 (pps input 17).......................................... 201 rpinr18 (pps input 18).......................................... 202 rpinr19 (pps input 19).......................................... 202 rpinr2 (pps input 2).............................................. 198 rpinr20 (pps input 20).......................................... 203 rpinr21 (pps input 21).......................................... 203 rpinr22 (pps input 22).......................................... 204 rpinr23 (pps input 23).......................................... 204 rpinr27 (pps input 27).......................................... 205 rpinr30 (pps input 30).......................................... 205 rpinr31 (pps input 31).......................................... 206 rpinr7 (pps input 7).............................................. 198 rpinr8 (pps input 8).............................................. 199 rpinr9 (pps input 9).............................................. 199 rpor0 (pps output 0)............................................ 207 rpor1 (pps output 1)............................................ 207 rpor10 (pps output 10)........................................ 212 rpor11 (pps output 11)........................................ 212 rpor12 (pps output 12)........................................ 213 rpor13 (pps output 13)........................................ 213 rpor14 (pps output 14)........................................ 214 rpor15 (pps output 15)........................................ 214 rpor2 (pps output 2)............................................ 208 rpor3 (pps output 3)............................................ 208 rpor4 (pps output 4)............................................ 209 rpor5 (pps output 5)............................................ 209 rpor6 (pps output 6)............................................ 210 rpor7 (pps output 7)............................................ 210 rpor8 (pps output 8)............................................ 211 rpor9 (pps output 9)............................................ 211 rtcpwc (rtcc power control)............................. 327 sd1con1 (s/d control 1)........................................ 371 sd1con2 (s/d control 2)........................................ 372 sd1con3 (s/d control 3)........................................ 373 spixcon1 (spix control 1) ..................................... 242 spixcon2 (spix control 2) ..................................... 244 spixstat (spix status and control) ....................... 240 sr (alu status) ............................................. 42, 108 t1con (timer1 control) .......................................... 216 txcon (timer2 and timer4 control) ....................... 220 tycon (timer3 and timer5 control) ....................... 222 u1addr (usb address) .......................................... 287 u1cnfg1 (usb configuration 1)............................. 289 u1cnfg2 (usb configuration 2)............................. 290 u1con (usb control, device mode)....................... 285 u1con (usb control, host mode) .......................... 286 u1eie (usb error interrupt enable)......................... 297 u1eir (usb error interrupt status).......................... 296 u1epn (usb endpoint n control)............................. 298 u1ie (usb interrupt enable, all modes) .................. 295 u1ir (usb interrupt status, device mode) .............. 293 u1ir (usb interrupt status, host mode).................. 294 u1otgcon (usb otg control) ............................. 282
PIC24FJ128GC010 family ds30009312b-page 466 ? 2012-2013 microchip technology inc. u1otgie (usb otg interrupt enable, host mode) ....................................................... 292 u1otgir (usb otg interrupt status, host mode) ....................................................... 291 u1otgstat (usb otg status, host mode) .......... 281 u1pwrc (usb power control)................................ 283 u1sof (usb otg start-of-token threshold, host mode) ....................................................... 288 u1stat (usb status) .............................................. 284 u1tok (usb token, host mode)............................. 287 uxmode (uartx mode) .......................................... 260 uxsta (uartx status and control) ......................... 262 wkdyhr (rtcc weekday and hours value) ......... 330 year (rtcc year value) ........................................ 329 resets bor (brown-out reset) .............................................. 97 brown-out reset (bor) ............................................ 101 clock source selection ............................................. 101 cm (configuration mismatch reset)........................... 97 delay times .............................................................. 102 device times ............................................................ 101 iopuwr (illegal opcode reset) ................................ 97 mclr (pin reset)....................................................... 97 por (power-on reset) ............................................... 97 rcon flags, operation ............................................ 100 sfr states................................................................ 101 swr (reset instruction)........................................... 97 trapr (trap conflict reset)...................................... 97 uwr (uninitialized w register reset)........................ 97 wdt (watchdog timer reset).................................... 97 revision history ................................................................ 459 rtcc alarm configuration .................................................. 333 alarm mask settings (figure)..................................... 334 calibration ................................................................. 333 clock source selection ............................................. 324 power control ........................................................... 334 register mapping ...................................................... 324 source clock............................................................. 323 v bat o peration ........................................................ 334 write lock ................................................................. 324 s secondary oscillator operation ........................................ 168 serial peripheral interface (spi) ....................................... 237 serial peripheral interface. see spi. sfr space.......................................................................... 48 sigma-delta a/d differences compared to conventional a/ds ........... 370 sigma-delta a/d converter required connections ................................................ 38 software simulator (mplab sim)..................................... 415 software stack .................................................................... 77 special features ................................................................. 15 spi .................................................................................... 237 t timer1............................................................................... 215 timer2/3 and timer4/5 ..................................................... 217 timing diagrams 12-bit a/d dnl ......................................................... 443 12-bit a/d inl........................................................... 443 16-bit s/d a/d dnl .................................................. 446 16-bit s/d a/d inl.................................................... 446 clko and i/o timing ............................................... 440 external clock........................................................... 438 triple comparator............................................................. 381 triple comparator module ................................................ 381 u uart ................................................................................ 257 uartx baud rate generator (brg) .................................... 258 infrared support........................................................ 259 operation of uxcts and uxrts pins...................... 259 receiving 8-bit or 9-bit data mode ................................... 259 transmitting 8-bit data mode................................................ 259 9-bit data mode................................................ 259 break and sync sequence ............................... 259 universal asynchronous receiver transmitter. see uart. universal serial bus interrupts and usb transactions...................................... 275 universal serial bus. see usb otg. unused i/os........................................................................ 38 usb on-the-go (otg) ...................................................... 14 usb otg.......................................................................... 265 buffer descriptors assignment in different buffering modes ......... 271 buffer descriptors and bdt...................................... 270 device mode operation ............................................ 275 dma interface........................................................... 271 hardware calculating transceiver power requirements ............ 269 hardware configuration............................................ 267 device mode..................................................... 267 external interface ............................................. 269 host and otg modes....................................... 268 v bus voltage generation ................................. 269 host mode operation................................................ 276 interrupts .................................................................. 274 operation .................................................................. 278 hnp .................................................................. 279 srp .................................................................. 278 registers .................................................................. 280 v bus voltage generation ......................................... 269 w watchdog timer (wdt).................................................... 410 control register........................................................ 410 windowed operation ................................................ 410 www address ................................................................. 467 www, on-line support ....... .............................................. 12
? 2012-2013 microchip technology inc. ds30009312b-page 467 PIC24FJ128GC010 family 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
PIC24FJ128GC010 family ds30009312b-page 468 ? 2012-2013 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: (______) _________ - _________ ds30009312b PIC24FJ128GC010 family 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?
? 2012-2013 microchip technology inc. ds30009312b-page 469 PIC24FJ128GC010 family product identification system to order or obtain information, e. g., on pricing or delivery, refer to the factory or the listed sales office . architecture 24 = 16-bit modified harvard without dsp flash memory family fj = flash program memory product group gc0 = advanced analog microcontrollers with usb otg, lcd controller and xlp technology pin count 06 = 64-pin 10 = 100-pin (tqfp) and 121-pin (bga) temperature range i = -40 ? c to +85 ? c (industrial) package bg = 121-pin (10x10x1.10 mm) bga package pt = 100-lead (12x12x1 mm) tqfp (thin quad flatpack) pt = 64-lead (10x10x1 mm) tqfp (thin quad flatpack) mr = 64-lead (9x9x0.9 mm) qfn (quad flatpack, no lead) pattern three-digit qtp, sqtp, code or special requirements (blank otherwise) es = engineering sample examples: a) pic24fj64gc006-i/mr: pic24f device with advanced analog, lcd controller and xlp technology, 64-kbyte program memory, 64-pin, industrial temp., qfn package. b) PIC24FJ128GC010-i/pt: pic24f device with advanced analog, lcd controller and xlp technology, 128-kbyte program memory, 100-pin, industrial temp., tqfp package. c) PIC24FJ128GC010-i/bg: pic24f device with advanced analog, lcd controller and xlp technology, 128-kbyte program memory, 121-pin, industrial temp., bga package. microchip trademark architecture flash memory family program memory size (kb) product group pin count temperature range package pattern pic 24 fj 128 gc0 10 t - i / pt - xxx tape and reel flag (if applicable)
PIC24FJ128GC010 family ds30009312b-page 470 ? 2012-2013 microchip technology inc. notes:
? 2012-2013 microchip technology inc. ds30009312b-page 471 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, flashflex, k ee l oq , k ee l oq logo, mplab, pic, picmicro, picstart, pic 32 logo, rfpic, sst, sst logo, superflash 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, mtp, seeval and the embedded control solutions company are registered trademarks of microchip technology incorporated in the u.s.a. silicon storage technology is a registered trademark of microchip technology inc. in other countries. analog-for-the-digital age, app lication maestro, bodycom, chipkit, chipkit logo, codeguard, dspicdem, dspicdem.net, dspicworks, dsspeak, ecan, economonitor, fansense, hi-tide, in-circuit serial programming, icsp, mindi, miwi, mpasm, mpf, mplab certified logo, mplib, mplink, mtouch, omniscient code generation, picc, picc-18, picdem, picdem.net, pickit, pictail, real ice, rflab, select mode, sqi, serial quad i/o, total endurance, tsharc, uniwindriver, wiperlock, zena and z-scale 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. gestic and ulpp are registered trademarks of microchip technology germany ii gmbh & co. kg, a subsidiary of microchip technology inc., in other countries. all other trademarks mentioned herein are property of their respective companies. ? 2012-2013, microchip technology incorporated, printed in the u.s.a., all rights reserved. printed on recycled paper. isbn: 978-1-62077-224-9 note the following details of the code protection feature on microchip devices: ? microchip products meet the specification contai ned in their particular microchip data sheet. ? microchip believes that its family of products is one of the most 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 specif ications 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 semiconduc tor manufacturer can 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 improvin g the code protection features of our products. attempts to break microchip?s code 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:2009 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. quality management s ystem certified by dnv == iso/ts 16949 ==
ds30009312b-page 472 ? 2012-2013 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-3187 fax: 86-571-2819-3189 china - hong kong sar tel: 852-2943-5100 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-8864-2200 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 - osaka tel: 81-6-6152-7160 fax: 81-6-6152-9310 japan - tokyo tel: 81-3-6880- 3770 fax: 81-3-6880-3771 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-5778-366 fax: 886-3-5770-955 taiwan - kaohsiung tel: 886-7-213-7828 fax: 886-7-330-9305 taiwan - taipei tel: 886-2-2508-8600 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 11/29/12


▲Up To Search▲   

 
Price & Availability of PIC24FJ128GC010

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