Advertisement
capatow

PIC24F16KA102.h

May 5th, 2011
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 97.75 KB | None | 0 0
  1. /*-------------------------------------------------------------------------
  2.  * MPLAB-Cxx  PIC24F16KA102 processor header
  3.  *
  4.  * (c) Copyright 1999-2010 Microchip Technology, All rights reserved
  5.  *-------------------------------------------------------------------------*/
  6.  
  7. #ifndef __PIC24F16KA102__
  8. #error "Include file does not match processor setting"
  9. #endif
  10.  
  11. #ifndef __24F16KA102_H
  12. #define __24F16KA102_H
  13.  
  14. extern volatile unsigned int  WREG0 __attribute__((__sfr__,__deprecated__,__unsafe__));
  15. extern volatile unsigned int  WREG1 __attribute__((__sfr__,__deprecated__,__unsafe__));
  16. extern volatile unsigned int  WREG2 __attribute__((__sfr__,__deprecated__,__unsafe__));
  17. extern volatile unsigned int  WREG3 __attribute__((__sfr__,__deprecated__,__unsafe__));
  18. extern volatile unsigned int  WREG4 __attribute__((__sfr__,__deprecated__,__unsafe__));
  19. extern volatile unsigned int  WREG5 __attribute__((__sfr__,__deprecated__,__unsafe__));
  20. extern volatile unsigned int  WREG6 __attribute__((__sfr__,__deprecated__,__unsafe__));
  21. extern volatile unsigned int  WREG7 __attribute__((__sfr__,__deprecated__,__unsafe__));
  22. extern volatile unsigned int  WREG8 __attribute__((__sfr__,__deprecated__,__unsafe__));
  23. extern volatile unsigned int  WREG9 __attribute__((__sfr__,__deprecated__,__unsafe__));
  24. extern volatile unsigned int  WREG10 __attribute__((__sfr__,__deprecated__,__unsafe__));
  25. extern volatile unsigned int  WREG11 __attribute__((__sfr__,__deprecated__,__unsafe__));
  26. extern volatile unsigned int  WREG12 __attribute__((__sfr__,__deprecated__,__unsafe__));
  27. extern volatile unsigned int  WREG13 __attribute__((__sfr__,__deprecated__,__unsafe__));
  28. extern volatile unsigned int  WREG14 __attribute__((__sfr__,__deprecated__,__unsafe__));
  29. extern volatile unsigned int  WREG15 __attribute__((__sfr__,__deprecated__,__unsafe__));
  30. /* SPLIM: Stack Pointer Limit */
  31. extern volatile unsigned int  SPLIM __attribute__((__sfr__));
  32. extern volatile unsigned int  PCL __attribute__((__sfr__));
  33. extern volatile unsigned int  PCH __attribute__((__sfr__));
  34. extern volatile unsigned int  TBLPAG __attribute__((__sfr__));
  35. extern volatile unsigned int  PSVPAG __attribute__((__sfr__));
  36. extern volatile unsigned int  RCOUNT __attribute__((__sfr__));
  37. extern volatile unsigned int  SR __attribute__((__sfr__));
  38. __extension__ typedef struct tagSRBITS {
  39.   union {
  40.     struct {
  41.       unsigned C:1;
  42.       unsigned Z:1; /* Sticky Zero flag */
  43.       unsigned OV:1;
  44.       unsigned N:1;
  45.       unsigned RA:1;
  46.       unsigned IPL0:1;
  47.       unsigned IPL1:1;
  48.       unsigned IPL2:1;
  49.       unsigned DC:1;
  50.     };
  51.     struct {
  52.       unsigned :5;
  53.       unsigned IPL:3;
  54.     };
  55.   };
  56. } SRBITS;
  57. extern volatile SRBITS SRbits __attribute__((__sfr__));
  58.  
  59. extern volatile unsigned int  CORCON __attribute__((__sfr__));
  60. typedef struct tagCORCONBITS {
  61.   unsigned :2;
  62.   unsigned PSV:1;
  63.   unsigned IPL3:1;
  64. } CORCONBITS;
  65. extern volatile CORCONBITS CORCONbits __attribute__((__sfr__));
  66.  
  67. extern volatile unsigned int  DISICNT __attribute__((__sfr__));
  68. extern volatile unsigned int  CNEN1 __attribute__((__sfr__));
  69. typedef struct tagCNEN1BITS {
  70.   unsigned CN0IE:1;
  71.   unsigned CN1IE:1;
  72.   unsigned CN2IE:1;
  73.   unsigned CN3IE:1;
  74.   unsigned CN4IE:1;
  75.   unsigned CN5IE:1;
  76.   unsigned CN6IE:1;
  77.   unsigned CN7IE:1;
  78.   unsigned CN8IE:1;
  79.   unsigned CN9IE:1;
  80.   unsigned :1;
  81.   unsigned CN11IE:1;
  82.   unsigned CN12IE:1;
  83.   unsigned CN13IE:1;
  84.   unsigned CN14IE:1;
  85.   unsigned CN15IE:1;
  86. } CNEN1BITS;
  87. extern volatile CNEN1BITS CNEN1bits __attribute__((__sfr__));
  88.  
  89. extern volatile unsigned int  CNEN2 __attribute__((__sfr__));
  90. typedef struct tagCNEN2BITS {
  91.   unsigned CN16IE:1;
  92.   unsigned :4;
  93.   unsigned CN21IE:1;
  94.   unsigned CN22IE:1;
  95.   unsigned CN23IE:1;
  96.   unsigned CN24IE:1;
  97.   unsigned :2;
  98.   unsigned CN27IE:1;
  99.   unsigned :1;
  100.   unsigned CN29IE:1;
  101.   unsigned CN30IE:1;
  102. } CNEN2BITS;
  103. extern volatile CNEN2BITS CNEN2bits __attribute__((__sfr__));
  104.  
  105. extern volatile unsigned int  CNPU1 __attribute__((__sfr__));
  106. typedef struct tagCNPU1BITS {
  107.   unsigned CN0PUE:1;
  108.   unsigned CN1PUE:1;
  109.   unsigned CN2PUE:1;
  110.   unsigned CN3PUE:1;
  111.   unsigned CN4PUE:1;
  112.   unsigned CN5PUE:1;
  113.   unsigned CN6PUE:1;
  114.   unsigned CN7PUE:1;
  115.   unsigned CN8PUE:1;
  116.   unsigned CN9PUE:1;
  117.   unsigned :1;
  118.   unsigned CN11PUE:1;
  119.   unsigned CN12PUE:1;
  120.   unsigned CN13PUE:1;
  121.   unsigned CN14PUE:1;
  122.   unsigned CN15PUE:1;
  123. } CNPU1BITS;
  124. extern volatile CNPU1BITS CNPU1bits __attribute__((__sfr__));
  125.  
  126. extern volatile unsigned int  CNPU2 __attribute__((__sfr__));
  127. typedef struct tagCNPU2BITS {
  128.   unsigned CN16PUE:1;
  129.   unsigned :4;
  130.   unsigned CN21PUE:1;
  131.   unsigned CN22PUE:1;
  132.   unsigned CN23PUE:1;
  133.   unsigned CN24PUE:1;
  134.   unsigned :2;
  135.   unsigned CN27PUE:1;
  136.   unsigned :1;
  137.   unsigned CN29PUE:1;
  138.   unsigned CN30PUE:1;
  139. } CNPU2BITS;
  140. extern volatile CNPU2BITS CNPU2bits __attribute__((__sfr__));
  141.  
  142. extern volatile unsigned int  CNPD1 __attribute__((__sfr__));
  143. typedef struct tagCNPD1BITS {
  144.   unsigned CN0PDE:1;
  145.   unsigned CN1PDE:1;
  146.   unsigned CN2PDE:1;
  147.   unsigned CN3PDE:1;
  148.   unsigned CN4PDE:1;
  149.   unsigned CN5PDE:1;
  150.   unsigned CN6PDE:1;
  151.   unsigned CN7PDE:1;
  152.   unsigned CN8PDE:1;
  153.   unsigned CN9PDE:1;
  154.   unsigned :1;
  155.   unsigned CN11PDE:1;
  156.   unsigned CN12PDE:1;
  157.   unsigned CN13PDE:1;
  158.   unsigned CN14PDE:1;
  159.   unsigned CN15PDE:1;
  160. } CNPD1BITS;
  161. extern volatile CNPD1BITS CNPD1bits __attribute__((__sfr__));
  162.  
  163. extern volatile unsigned int  CNPD2 __attribute__((__sfr__));
  164. typedef struct tagCNPD2BITS {
  165.   unsigned CN16PDE:1;
  166.   unsigned :4;
  167.   unsigned CN21PDE:1;
  168.   unsigned CN22PDE:1;
  169.   unsigned CN23PDE:1;
  170.   unsigned CN24PDE:1;
  171.   unsigned :2;
  172.   unsigned CN27PDE:1;
  173.   unsigned :1;
  174.   unsigned CN29PDE:1;
  175.   unsigned CN30PDE:1;
  176. } CNPD2BITS;
  177. extern volatile CNPD2BITS CNPD2bits __attribute__((__sfr__));
  178.  
  179. extern volatile unsigned int  INTCON1 __attribute__((__sfr__));
  180. typedef struct tagINTCON1BITS {
  181.   unsigned :1;
  182.   unsigned OSCFAIL:1;
  183.   unsigned STKERR:1;
  184.   unsigned ADDRERR:1;
  185.   unsigned MATHERR:1;
  186.   unsigned :10;
  187.   unsigned NSTDIS:1;
  188. } INTCON1BITS;
  189. extern volatile INTCON1BITS INTCON1bits __attribute__((__sfr__));
  190.  
  191. extern volatile unsigned int  INTCON2 __attribute__((__sfr__));
  192. typedef struct tagINTCON2BITS {
  193.   unsigned INT0EP:1;
  194.   unsigned INT1EP:1;
  195.   unsigned INT2EP:1;
  196.   unsigned :11;
  197.   unsigned DISI:1;
  198.   unsigned ALTIVT:1;
  199. } INTCON2BITS;
  200. extern volatile INTCON2BITS INTCON2bits __attribute__((__sfr__));
  201.  
  202. extern volatile unsigned int  IFS0 __attribute__((__sfr__));
  203. typedef struct tagIFS0BITS {
  204.   unsigned INT0IF:1;
  205.   unsigned IC1IF:1;
  206.   unsigned OC1IF:1;
  207.   unsigned T1IF:1;
  208.   unsigned :3;
  209.   unsigned T2IF:1;
  210.   unsigned T3IF:1;
  211.   unsigned SPF1IF:1;
  212.   unsigned SPI1IF:1;
  213.   unsigned U1RXIF:1;
  214.   unsigned U1TXIF:1;
  215.   unsigned AD1IF:1;
  216.   unsigned :1;
  217.   unsigned NVMIF:1;
  218. } IFS0BITS;
  219. extern volatile IFS0BITS IFS0bits __attribute__((__sfr__));
  220.  
  221. extern volatile unsigned int  IFS1 __attribute__((__sfr__));
  222. typedef struct tagIFS1BITS {
  223.   unsigned SI2C1IF:1;
  224.   unsigned MI2C1IF:1;
  225.   unsigned CMIF:1;
  226.   unsigned CNIF:1;
  227.   unsigned INT1IF:1;
  228.   unsigned :8;
  229.   unsigned INT2IF:1;
  230.   unsigned U2RXIF:1;
  231.   unsigned U2TXIF:1;
  232. } IFS1BITS;
  233. extern volatile IFS1BITS IFS1bits __attribute__((__sfr__));
  234.  
  235. extern volatile unsigned int  IFS3 __attribute__((__sfr__));
  236. typedef struct tagIFS3BITS {
  237.   unsigned :14;
  238.   unsigned RTCIF:1;
  239. } IFS3BITS;
  240. extern volatile IFS3BITS IFS3bits __attribute__((__sfr__));
  241.  
  242. extern volatile unsigned int  IFS4 __attribute__((__sfr__));
  243. typedef struct tagIFS4BITS {
  244.   unsigned :1;
  245.   unsigned U1ERIF:1;
  246.   unsigned U2ERIF:1;
  247.   unsigned CRCIF:1;
  248.   unsigned :4;
  249.   unsigned HLVDIF:1;
  250.   unsigned :4;
  251.   unsigned CTMUIF:1;
  252. } IFS4BITS;
  253. extern volatile IFS4BITS IFS4bits __attribute__((__sfr__));
  254.  
  255. extern volatile unsigned int  IEC0 __attribute__((__sfr__));
  256. typedef struct tagIEC0BITS {
  257.   unsigned INT0IE:1;
  258.   unsigned IC1IE:1;
  259.   unsigned OC1IE:1;
  260.   unsigned T1IE:1;
  261.   unsigned :3;
  262.   unsigned T2IE:1;
  263.   unsigned T3IE:1;
  264.   unsigned SPF1IE:1;
  265.   unsigned SPI1IE:1;
  266.   unsigned U1RXIE:1;
  267.   unsigned U1TXIE:1;
  268.   unsigned AD1IE:1;
  269.   unsigned :1;
  270.   unsigned NVMIE:1;
  271. } IEC0BITS;
  272. extern volatile IEC0BITS IEC0bits __attribute__((__sfr__));
  273.  
  274. extern volatile unsigned int  IEC1 __attribute__((__sfr__));
  275. typedef struct tagIEC1BITS {
  276.   unsigned SI2C1IE:1;
  277.   unsigned MI2C1IE:1;
  278.   unsigned CMIE:1;
  279.   unsigned CNIE:1;
  280.   unsigned INT1IE:1;
  281.   unsigned :8;
  282.   unsigned INT2IE:1;
  283.   unsigned U2RXIE:1;
  284.   unsigned U2TXIE:1;
  285. } IEC1BITS;
  286. extern volatile IEC1BITS IEC1bits __attribute__((__sfr__));
  287.  
  288. extern volatile unsigned int  IEC3 __attribute__((__sfr__));
  289. typedef struct tagIEC3BITS {
  290.   unsigned :14;
  291.   unsigned RTCIE:1;
  292. } IEC3BITS;
  293. extern volatile IEC3BITS IEC3bits __attribute__((__sfr__));
  294.  
  295. extern volatile unsigned int  IEC4 __attribute__((__sfr__));
  296. typedef struct tagIEC4BITS {
  297.   unsigned :1;
  298.   unsigned U1ERIE:1;
  299.   unsigned U2ERIE:1;
  300.   unsigned CRCIE:1;
  301.   unsigned :4;
  302.   unsigned HLVDIE:1;
  303.   unsigned :4;
  304.   unsigned CTMUIE:1;
  305. } IEC4BITS;
  306. extern volatile IEC4BITS IEC4bits __attribute__((__sfr__));
  307.  
  308. extern volatile unsigned int  IPC0 __attribute__((__sfr__));
  309. __extension__ typedef struct tagIPC0BITS {
  310.   union {
  311.     struct {
  312.       unsigned INT0IP0:1;
  313.       unsigned INT0IP1:1;
  314.       unsigned INT0IP2:1;
  315.       unsigned :1;
  316.       unsigned IC1IP0:1;
  317.       unsigned IC1IP1:1;
  318.       unsigned IC1IP2:1;
  319.       unsigned :1;
  320.       unsigned OC1IP0:1;
  321.       unsigned OC1IP1:1;
  322.       unsigned OC1IP2:1;
  323.       unsigned :1;
  324.       unsigned T1IP0:1;
  325.       unsigned T1IP1:1;
  326.       unsigned T1IP2:1;
  327.     };
  328.     struct {
  329.       unsigned INT0IP:3;
  330.       unsigned :1;
  331.       unsigned IC1IP:3;
  332.       unsigned :1;
  333.       unsigned OC1IP:3;
  334.       unsigned :1;
  335.       unsigned T1IP:3;
  336.     };
  337.   };
  338. } IPC0BITS;
  339. extern volatile IPC0BITS IPC0bits __attribute__((__sfr__));
  340.  
  341. extern volatile unsigned int  IPC1 __attribute__((__sfr__));
  342. __extension__ typedef struct tagIPC1BITS {
  343.   union {
  344.     struct {
  345.       unsigned :12;
  346.       unsigned T2IP0:1;
  347.       unsigned T2IP1:1;
  348.       unsigned T2IP2:1;
  349.     };
  350.     struct {
  351.       unsigned :12;
  352.       unsigned T2IP:3;
  353.     };
  354.   };
  355. } IPC1BITS;
  356. extern volatile IPC1BITS IPC1bits __attribute__((__sfr__));
  357.  
  358. extern volatile unsigned int  IPC2 __attribute__((__sfr__));
  359. __extension__ typedef struct tagIPC2BITS {
  360.   union {
  361.     struct {
  362.       unsigned T3IP0:1;
  363.       unsigned T3IP1:1;
  364.       unsigned T3IP2:1;
  365.       unsigned :1;
  366.       unsigned SPF1IP0:1;
  367.       unsigned SPF1IP1:1;
  368.       unsigned SPF1IP2:1;
  369.       unsigned :1;
  370.       unsigned SPI1IP0:1;
  371.       unsigned SPI1IP1:1;
  372.       unsigned SPI1IP2:1;
  373.       unsigned :1;
  374.       unsigned U1RXIP0:1;
  375.       unsigned U1RXIP1:1;
  376.       unsigned U1RXIP2:1;
  377.     };
  378.     struct {
  379.       unsigned T3IP:3;
  380.       unsigned :1;
  381.       unsigned SPF1IP:3;
  382.       unsigned :1;
  383.       unsigned SPI1IP:3;
  384.       unsigned :1;
  385.       unsigned U1RXIP:3;
  386.     };
  387.   };
  388. } IPC2BITS;
  389. extern volatile IPC2BITS IPC2bits __attribute__((__sfr__));
  390.  
  391. extern volatile unsigned int  IPC3 __attribute__((__sfr__));
  392. __extension__ typedef struct tagIPC3BITS {
  393.   union {
  394.     struct {
  395.       unsigned U1TXIP0:1;
  396.       unsigned U1TXIP1:1;
  397.       unsigned U1TXIP2:1;
  398.       unsigned :1;
  399.       unsigned AD1IP0:1;
  400.       unsigned AD1IP1:1;
  401.       unsigned AD1IP2:1;
  402.       unsigned :5;
  403.       unsigned NVMIP0:1;
  404.       unsigned NVMIP1:1;
  405.       unsigned NVMIP2:1;
  406.     };
  407.     struct {
  408.       unsigned U1TXIP:3;
  409.       unsigned :1;
  410.       unsigned AD1IP:3;
  411.     };
  412.   };
  413. } IPC3BITS;
  414. extern volatile IPC3BITS IPC3bits __attribute__((__sfr__));
  415.  
  416. extern volatile unsigned int  IPC4 __attribute__((__sfr__));
  417. __extension__ typedef struct tagIPC4BITS {
  418.   union {
  419.     struct {
  420.       unsigned SI2C1IP0:1;
  421.       unsigned SI2C1IP1:1;
  422.       unsigned SI2C1IP2:1;
  423.       unsigned :1;
  424.       unsigned MI2C1IP0:1;
  425.       unsigned MI2C1IP1:1;
  426.       unsigned MI2C1IP2:1;
  427.       unsigned :1;
  428.       unsigned CMIP0:1;
  429.       unsigned CMIP1:1;
  430.       unsigned CMIP2:1;
  431.       unsigned :1;
  432.       unsigned CNIP0:1;
  433.       unsigned CNIP1:1;
  434.       unsigned CNIP2:1;
  435.     };
  436.     struct {
  437.       unsigned SI2C1IP:3;
  438.       unsigned :1;
  439.       unsigned MI2C1IP:3;
  440.       unsigned :1;
  441.       unsigned CMIP:3;
  442.       unsigned :1;
  443.       unsigned CNIP:3;
  444.     };
  445.     struct {
  446.       unsigned SI2C1P0:1;
  447.       unsigned SI2C1P1:1;
  448.       unsigned SI2C1P2:1;
  449.       unsigned :1;
  450.       unsigned MI2C1P0:1;
  451.       unsigned MI2C1P1:1;
  452.       unsigned MI2C1P2:1;
  453.     };
  454.     struct {
  455.       unsigned SI2C1P:3;
  456.       unsigned :1;
  457.       unsigned MI2C1P:3;
  458.     };
  459.   };
  460. } IPC4BITS;
  461. extern volatile IPC4BITS IPC4bits __attribute__((__sfr__));
  462.  
  463. extern volatile unsigned int  IPC5 __attribute__((__sfr__));
  464. __extension__ typedef struct tagIPC5BITS {
  465.   union {
  466.     struct {
  467.       unsigned INT1IP0:1;
  468.       unsigned INT1IP1:1;
  469.       unsigned INT1IP2:1;
  470.     };
  471.     struct {
  472.       unsigned INT1IP:3;
  473.     };
  474.   };
  475. } IPC5BITS;
  476. extern volatile IPC5BITS IPC5bits __attribute__((__sfr__));
  477.  
  478. extern volatile unsigned int  IPC7 __attribute__((__sfr__));
  479. __extension__ typedef struct tagIPC7BITS {
  480.   union {
  481.     struct {
  482.       unsigned :4;
  483.       unsigned INT2IP0:1;
  484.       unsigned INT2IP1:1;
  485.       unsigned INT2IP2:1;
  486.       unsigned :1;
  487.       unsigned U2RXIP0:1;
  488.       unsigned U2RXIP1:1;
  489.       unsigned U2RXIP2:1;
  490.       unsigned :1;
  491.       unsigned U2TXIP0:1;
  492.       unsigned U2TXIP1:1;
  493.       unsigned U2TXIP2:1;
  494.     };
  495.     struct {
  496.       unsigned :4;
  497.       unsigned INT2IP:3;
  498.       unsigned :1;
  499.       unsigned U2RXIP:3;
  500.       unsigned :1;
  501.       unsigned U2TXIP:3;
  502.     };
  503.   };
  504. } IPC7BITS;
  505. extern volatile IPC7BITS IPC7bits __attribute__((__sfr__));
  506.  
  507. extern volatile unsigned int  IPC15 __attribute__((__sfr__));
  508. __extension__ typedef struct tagIPC15BITS {
  509.   union {
  510.     struct {
  511.       unsigned :8;
  512.       unsigned RTCIP0:1;
  513.       unsigned RTCIP1:1;
  514.       unsigned RTCIP2:1;
  515.     };
  516.     struct {
  517.       unsigned :8;
  518.       unsigned RTCIP:3;
  519.     };
  520.   };
  521. } IPC15BITS;
  522. extern volatile IPC15BITS IPC15bits __attribute__((__sfr__));
  523.  
  524. extern volatile unsigned int  IPC16 __attribute__((__sfr__));
  525. __extension__ typedef struct tagIPC16BITS {
  526.   union {
  527.     struct {
  528.       unsigned :4;
  529.       unsigned U1ERIP0:1;
  530.       unsigned U1ERIP1:1;
  531.       unsigned U1ERIP2:1;
  532.       unsigned :1;
  533.       unsigned U2ERIP0:1;
  534.       unsigned U2ERIP1:1;
  535.       unsigned U2ERIP2:1;
  536.       unsigned :1;
  537.       unsigned CRCIP0:1;
  538.       unsigned CRCIP1:1;
  539.       unsigned CRCIP2:1;
  540.     };
  541.     struct {
  542.       unsigned :4;
  543.       unsigned U1ERIP:3;
  544.       unsigned :1;
  545.       unsigned U2ERIP:3;
  546.       unsigned :1;
  547.       unsigned CRCIP:3;
  548.     };
  549.   };
  550. } IPC16BITS;
  551. extern volatile IPC16BITS IPC16bits __attribute__((__sfr__));
  552.  
  553. extern volatile unsigned int  IPC18 __attribute__((__sfr__));
  554. __extension__ typedef struct tagIPC18BITS {
  555.   union {
  556.     struct {
  557.       unsigned HLVDIP0:1;
  558.       unsigned HLVDIP1:1;
  559.       unsigned HLVDIP2:1;
  560.     };
  561.     struct {
  562.       unsigned HLVDIP:3;
  563.     };
  564.   };
  565. } IPC18BITS;
  566. extern volatile IPC18BITS IPC18bits __attribute__((__sfr__));
  567.  
  568. extern volatile unsigned int  IPC19 __attribute__((__sfr__));
  569. __extension__ typedef struct tagIPC19BITS {
  570.   union {
  571.     struct {
  572.       unsigned :4;
  573.       unsigned CTMUIP0:1;
  574.       unsigned CTMUIP1:1;
  575.       unsigned CTMUIP2:1;
  576.     };
  577.     struct {
  578.       unsigned :4;
  579.       unsigned CTMUIP:3;
  580.     };
  581.   };
  582. } IPC19BITS;
  583. extern volatile IPC19BITS IPC19bits __attribute__((__sfr__));
  584.  
  585. extern volatile unsigned int  INTTREG __attribute__((__sfr__));
  586. typedef struct tagINTTREGBITS {
  587.   unsigned VECNUM0:1;
  588.   unsigned VECNUM1:1;
  589.   unsigned VECNUM2:1;
  590.   unsigned VECNUM3:1;
  591.   unsigned VECNUM4:1;
  592.   unsigned VECNUM5:1;
  593.   unsigned VECNUM6:1;
  594.   unsigned :1;
  595.   unsigned ILR0:1;
  596.   unsigned ILR1:1;
  597.   unsigned ILR2:1;
  598.   unsigned ILR3:1;
  599.   unsigned :1;
  600.   unsigned VHOLD:1;
  601.   unsigned :1;
  602.   unsigned CPUIRQ:1;
  603. } INTTREGBITS;
  604. extern volatile INTTREGBITS INTTREGbits __attribute__((__sfr__));
  605.  
  606. extern volatile unsigned int  TMR1 __attribute__((__sfr__));
  607. extern volatile unsigned int  PR1 __attribute__((__sfr__));
  608. extern volatile unsigned int  T1CON __attribute__((__sfr__));
  609. __extension__ typedef struct tagT1CONBITS {
  610.   union {
  611.     struct {
  612.       unsigned :1;
  613.       unsigned TCS:1;
  614.       unsigned TSYNC:1;
  615.       unsigned :1;
  616.       unsigned TCKPS0:1;
  617.       unsigned TCKPS1:1;
  618.       unsigned TGATE:1;
  619.       unsigned :6;
  620.       unsigned TSIDL:1;
  621.       unsigned :1;
  622.       unsigned TON:1;
  623.     };
  624.     struct {
  625.       unsigned :4;
  626.       unsigned TCKPS:2;
  627.     };
  628.   };
  629. } T1CONBITS;
  630. extern volatile T1CONBITS T1CONbits __attribute__((__sfr__));
  631.  
  632. extern volatile unsigned int  TMR2 __attribute__((__sfr__));
  633. extern volatile unsigned int  TMR3HLD __attribute__((__sfr__));
  634. extern volatile unsigned int  TMR3 __attribute__((__sfr__));
  635. extern volatile unsigned int  PR2 __attribute__((__sfr__));
  636. extern volatile unsigned int  PR3 __attribute__((__sfr__));
  637. extern volatile unsigned int  T2CON __attribute__((__sfr__));
  638. __extension__ typedef struct tagT2CONBITS {
  639.   union {
  640.     struct {
  641.       unsigned :1;
  642.       unsigned TCS:1;
  643.       unsigned :1;
  644.       unsigned T32:1;
  645.       unsigned TCKPS0:1;
  646.       unsigned TCKPS1:1;
  647.       unsigned TGATE:1;
  648.       unsigned :6;
  649.       unsigned TSIDL:1;
  650.       unsigned :1;
  651.       unsigned TON:1;
  652.     };
  653.     struct {
  654.       unsigned :4;
  655.       unsigned TCKPS:2;
  656.     };
  657.   };
  658. } T2CONBITS;
  659. extern volatile T2CONBITS T2CONbits __attribute__((__sfr__));
  660.  
  661. extern volatile unsigned int  T3CON __attribute__((__sfr__));
  662. __extension__ typedef struct tagT3CONBITS {
  663.   union {
  664.     struct {
  665.       unsigned :1;
  666.       unsigned TCS:1;
  667.       unsigned :2;
  668.       unsigned TCKPS0:1;
  669.       unsigned TCKPS1:1;
  670.       unsigned TGATE:1;
  671.       unsigned :6;
  672.       unsigned TSIDL:1;
  673.       unsigned :1;
  674.       unsigned TON:1;
  675.     };
  676.     struct {
  677.       unsigned :4;
  678.       unsigned TCKPS:2;
  679.     };
  680.   };
  681. } T3CONBITS;
  682. extern volatile T3CONBITS T3CONbits __attribute__((__sfr__));
  683.  
  684.  
  685. /* Generic structure of entire SFR area for Input Capture modules */
  686. typedef struct tagIC {
  687.         unsigned int icxbuf;
  688.         unsigned int icxcon;
  689. } IC, *PIC;
  690.  
  691. /* SFR blocks for Input Capture modules */
  692. extern volatile IC IC1 __attribute__((__sfr__));
  693. extern volatile IC IC2 __attribute__((__sfr__));
  694. extern volatile IC IC3 __attribute__((__sfr__));
  695. extern volatile IC IC4 __attribute__((__sfr__));
  696. extern volatile IC IC5 __attribute__((__sfr__));
  697.  
  698. extern volatile unsigned int  IC1BUF __attribute__((__sfr__));
  699. extern volatile unsigned int  IC1CON __attribute__((__sfr__));
  700. __extension__ typedef struct tagIC1CONBITS {
  701.   union {
  702.     struct {
  703.       unsigned ICM0:1;
  704.       unsigned ICM1:1;
  705.       unsigned ICM2:1;
  706.       unsigned ICBNE:1;
  707.       unsigned ICOV:1;
  708.       unsigned ICI0:1;
  709.       unsigned ICI1:1;
  710.       unsigned ICTMR:1;
  711.       unsigned :5;
  712.       unsigned ICSIDL:1;
  713.     };
  714.     struct {
  715.       unsigned ICM:3;
  716.       unsigned :2;
  717.       unsigned ICI:2;
  718.     };
  719.   };
  720. } IC1CONBITS;
  721. extern volatile IC1CONBITS IC1CONbits __attribute__((__sfr__));
  722.  
  723.  
  724. /* Generic structure of entire SFR area for Output Compare modules */
  725. typedef struct tagOC {
  726.         unsigned int ocxrs;
  727.         unsigned int ocxr;
  728.         unsigned int ocxcon;
  729. } OC, *POC;
  730.  
  731. /* SFR blocks for Output Compare modules */
  732. extern volatile OC OC1 __attribute__((__sfr__));
  733. extern volatile OC OC2 __attribute__((__sfr__));
  734. extern volatile OC OC3 __attribute__((__sfr__));
  735. extern volatile OC OC4 __attribute__((__sfr__));
  736. extern volatile OC OC5 __attribute__((__sfr__));
  737.  
  738. extern volatile unsigned int  OC1RS __attribute__((__sfr__));
  739. extern volatile unsigned int  OC1R __attribute__((__sfr__));
  740. extern volatile unsigned int  OC1CON __attribute__((__sfr__));
  741. __extension__ typedef struct tagOC1CONBITS {
  742.   union {
  743.     struct {
  744.       unsigned OCM:3;
  745.       unsigned OCTSEL:1;
  746.       unsigned OCFLT:1;
  747.       unsigned :8;
  748.       unsigned OCSIDL:1;
  749.     };
  750.     struct {
  751.       unsigned OCM0:1;
  752.       unsigned OCM1:1;
  753.       unsigned OCM2:1;
  754.     };
  755.   };
  756. } OC1CONBITS;
  757. extern volatile OC1CONBITS OC1CONbits __attribute__((__sfr__));
  758.  
  759. extern volatile unsigned int  I2C1RCV __attribute__((__sfr__));
  760. extern volatile unsigned int  I2C1TRN __attribute__((__sfr__));
  761. extern volatile unsigned int  I2C1BRG __attribute__((__sfr__));
  762. extern volatile unsigned int  I2C1CON __attribute__((__sfr__));
  763. typedef struct tagI2C1CONBITS {
  764.   unsigned SEN:1;
  765.   unsigned RSEN:1;
  766.   unsigned PEN:1;
  767.   unsigned RCEN:1;
  768.   unsigned ACKEN:1;
  769.   unsigned ACKDT:1;
  770.   unsigned STREN:1;
  771.   unsigned GCEN:1;
  772.   unsigned SMEN:1;
  773.   unsigned DISSLW:1;
  774.   unsigned A10M:1;
  775.   unsigned IPMIEN:1;
  776.   unsigned SCLREL:1;
  777.   unsigned I2CSIDL:1;
  778.   unsigned :1;
  779.   unsigned I2CEN:1;
  780. } I2C1CONBITS;
  781. extern volatile I2C1CONBITS I2C1CONbits __attribute__((__sfr__));
  782.  
  783. extern volatile unsigned int  I2C1STAT __attribute__((__sfr__));
  784. typedef struct tagI2C1STATBITS {
  785.   unsigned TBF:1;
  786.   unsigned RBF:1;
  787.   unsigned R_W:1;
  788.   unsigned S:1;
  789.   unsigned P:1;
  790.   unsigned D_A:1;
  791.   unsigned I2COV:1;
  792.   unsigned IWCOL:1;
  793.   unsigned ADD10:1;
  794.   unsigned GCSTAT:1;
  795.   unsigned BCL:1;
  796.   unsigned :3;
  797.   unsigned TRSTAT:1;
  798.   unsigned ACKSTAT:1;
  799. } I2C1STATBITS;
  800. extern volatile I2C1STATBITS I2C1STATbits __attribute__((__sfr__));
  801.  
  802. extern volatile unsigned int  I2C1ADD __attribute__((__sfr__));
  803. extern volatile unsigned int  I2C1MSK __attribute__((__sfr__));
  804.  
  805. /* Generic structure of entire SFR area for each UART module */
  806. typedef struct tagUART {
  807.         unsigned int uxmode;
  808.         unsigned int uxsta;
  809.         unsigned int uxtxreg;
  810.         unsigned int uxrxreg;
  811.         unsigned int uxbrg;
  812. } UART, *PUART;
  813.  
  814. #define UxMODEBITS U1MODEBITS
  815. #define UxSTABITS U1STABITS
  816. #define UxTXREGBITS U1TXREGBITS
  817. #define UxRXREGBITS U1RXREGBITS
  818. #define UxBRGBITS U1BRGBITS
  819.  
  820. /* SFR blocks for each UART module */
  821. extern volatile UART UART1 __attribute__((__sfr__));
  822. extern volatile UART UART2 __attribute__((__sfr__));
  823.  
  824. extern volatile unsigned int  U1MODE __attribute__((__sfr__));
  825. __extension__ typedef struct tagU1MODEBITS {
  826.   union {
  827.     struct {
  828.       unsigned STSEL:1;
  829.       unsigned PDSEL0:1;
  830.       unsigned PDSEL1:1;
  831.       unsigned BRGH:1;
  832.       unsigned RXINV:1;
  833.       unsigned ABAUD:1;
  834.       unsigned LPBACK:1;
  835.       unsigned WAKE:1;
  836.       unsigned UEN0:1;
  837.       unsigned UEN1:1;
  838.       unsigned :1;
  839.       unsigned RTSMD:1;
  840.       unsigned IREN:1;
  841.       unsigned USIDL:1;
  842.       unsigned :1;
  843.       unsigned UARTEN:1;
  844.     };
  845.     struct {
  846.       unsigned :1;
  847.       unsigned PDSEL:2;
  848.       unsigned :5;
  849.       unsigned UEN:2;
  850.     };
  851.   };
  852. } U1MODEBITS;
  853. extern volatile U1MODEBITS U1MODEbits __attribute__((__sfr__));
  854.  
  855. extern volatile unsigned int  U1STA __attribute__((__sfr__));
  856. __extension__ typedef struct tagU1STABITS {
  857.   union {
  858.     struct {
  859.       unsigned URXDA:1;
  860.       unsigned OERR:1;
  861.       unsigned FERR:1;
  862.       unsigned PERR:1;
  863.       unsigned RIDLE:1;
  864.       unsigned ADDEN:1;
  865.       unsigned URXISEL0:1;
  866.       unsigned URXISEL1:1;
  867.       unsigned TRMT:1;
  868.       unsigned UTXBF:1;
  869.       unsigned UTXEN:1;
  870.       unsigned UTXBRK:1;
  871.       unsigned :1;
  872.       unsigned UTXISEL0:1;
  873.       unsigned UTXINV:1;
  874.       unsigned UTXISEL1:1;
  875.     };
  876.     struct {
  877.       unsigned :6;
  878.       unsigned URXISEL:2;
  879.     };
  880.   };
  881. } U1STABITS;
  882. extern volatile U1STABITS U1STAbits __attribute__((__sfr__));
  883.  
  884. extern volatile unsigned int  U1TXREG __attribute__((__sfr__));
  885. extern volatile unsigned int  U1RXREG __attribute__((__sfr__));
  886. extern volatile unsigned int  U1BRG __attribute__((__sfr__));
  887. extern volatile unsigned int  U2MODE __attribute__((__sfr__));
  888. __extension__ typedef struct tagU2MODEBITS {
  889.   union {
  890.     struct {
  891.       unsigned STSEL:1;
  892.       unsigned PDSEL0:1;
  893.       unsigned PDSEL1:1;
  894.       unsigned BRGH:1;
  895.       unsigned RXINV:1;
  896.       unsigned ABAUD:1;
  897.       unsigned LPBACK:1;
  898.       unsigned WAKE:1;
  899.       unsigned UEN0:1;
  900.       unsigned UEN1:1;
  901.       unsigned :1;
  902.       unsigned RTSMD:1;
  903.       unsigned IREN:1;
  904.       unsigned USIDL:1;
  905.       unsigned :1;
  906.       unsigned UARTEN:1;
  907.     };
  908.     struct {
  909.       unsigned :1;
  910.       unsigned PDSEL:2;
  911.       unsigned :5;
  912.       unsigned UEN:2;
  913.     };
  914.   };
  915. } U2MODEBITS;
  916. extern volatile U2MODEBITS U2MODEbits __attribute__((__sfr__));
  917.  
  918. extern volatile unsigned int  U2STA __attribute__((__sfr__));
  919. __extension__ typedef struct tagU2STABITS {
  920.   union {
  921.     struct {
  922.       unsigned URXDA:1;
  923.       unsigned OERR:1;
  924.       unsigned FERR:1;
  925.       unsigned PERR:1;
  926.       unsigned RIDLE:1;
  927.       unsigned ADDEN:1;
  928.       unsigned URXISEL0:1;
  929.       unsigned URXISEL1:1;
  930.       unsigned TRMT:1;
  931.       unsigned UTXBF:1;
  932.       unsigned UTXEN:1;
  933.       unsigned UTXBRK:1;
  934.       unsigned :1;
  935.       unsigned UTXISEL0:1;
  936.       unsigned UTXINV:1;
  937.       unsigned UTXISEL1:1;
  938.     };
  939.     struct {
  940.       unsigned :6;
  941.       unsigned URXISEL:2;
  942.     };
  943.   };
  944. } U2STABITS;
  945. extern volatile U2STABITS U2STAbits __attribute__((__sfr__));
  946.  
  947. extern volatile unsigned int  U2TXREG __attribute__((__sfr__));
  948. extern volatile unsigned int  U2RXREG __attribute__((__sfr__));
  949. extern volatile unsigned int  U2BRG __attribute__((__sfr__));
  950.  
  951. /* Generic structure of entire SFR area for each SPI module */
  952. typedef struct tagSPI {
  953.         unsigned int spixstat;
  954.         unsigned int spixcon1;
  955.         unsigned int spixcon2;
  956.         unsigned int unused;
  957.         unsigned int spixbuf;
  958. } SPI, *PSPI;
  959.  
  960. #define SPIxSTATBITS SPI1STATBITS
  961. #define SPIxCONBITS SPI1CONBITS
  962.  
  963. /* SFR blocks for each SPI module */
  964. extern volatile SPI SPI1 __attribute__((__sfr__));
  965. extern volatile SPI SPI2 __attribute__((__sfr__));
  966.  
  967. extern volatile unsigned int  SPI1STAT __attribute__((__sfr__));
  968. __extension__ typedef struct tagSPI1STATBITS {
  969.   union {
  970.     struct {
  971.       unsigned SPIRBF:1;
  972.       unsigned SPITBF:1;
  973.       unsigned SISEL:3;
  974.       unsigned SR1MPT:1;
  975.       unsigned SPIROV:1;
  976.       unsigned SRMPT:1;
  977.       unsigned SPIBEC:3;
  978.       unsigned :2;
  979.       unsigned SPISIDL:1;
  980.       unsigned :1;
  981.       unsigned SPIEN:1;
  982.     };
  983.     struct {
  984.       unsigned :2;
  985.       unsigned SISEL0:1;
  986.       unsigned SISEL1:1;
  987.       unsigned SISEL2:1;
  988.       unsigned :3;
  989.       unsigned SPIBEC0:1;
  990.       unsigned SPIBEC1:1;
  991.       unsigned SPIBEC2:1;
  992.     };
  993.   };
  994. } SPI1STATBITS;
  995. extern volatile SPI1STATBITS SPI1STATbits __attribute__((__sfr__));
  996.  
  997. extern volatile unsigned int  SPI1CON1 __attribute__((__sfr__));
  998. __extension__ typedef struct tagSPI1CON1BITS {
  999.   union {
  1000.     struct {
  1001.       unsigned PPRE0:1;
  1002.       unsigned PPRE1:1;
  1003.       unsigned SPRE:3;
  1004.       unsigned MSTEN:1;
  1005.       unsigned CKP:1;
  1006.       unsigned SSEN:1;
  1007.       unsigned CKE:1;
  1008.       unsigned SMP:1;
  1009.       unsigned MODE16:1;
  1010.       unsigned DISSDO:1;
  1011.       unsigned DISSCK:1;
  1012.     };
  1013.     struct {
  1014.       unsigned PPRE:2;
  1015.       unsigned SPRE0:1;
  1016.       unsigned SPRE1:1;
  1017.       unsigned SPRE2:1;
  1018.     };
  1019.   };
  1020. } SPI1CON1BITS;
  1021. extern volatile SPI1CON1BITS SPI1CON1bits __attribute__((__sfr__));
  1022.  
  1023. extern volatile unsigned int  SPI1CON2 __attribute__((__sfr__));
  1024. typedef struct tagSPI1CON2BITS {
  1025.   unsigned SPIBEN:1;
  1026.   unsigned SPIFE:1;
  1027.   unsigned :11;
  1028.   unsigned SPIFPOL:1;
  1029.   unsigned SPIFSD:1;
  1030.   unsigned FRMEN:1;
  1031. } SPI1CON2BITS;
  1032. extern volatile SPI1CON2BITS SPI1CON2bits __attribute__((__sfr__));
  1033.  
  1034. extern volatile unsigned int  SPI1BUF __attribute__((__sfr__));
  1035. extern volatile unsigned int  TRISA __attribute__((__sfr__));
  1036. typedef struct tagTRISABITS {
  1037.   unsigned TRISA0:1;
  1038.   unsigned TRISA1:1;
  1039.   unsigned TRISA2:1;
  1040.   unsigned TRISA3:1;
  1041.   unsigned TRISA4:1;
  1042.   unsigned TRISA5:1;
  1043.   unsigned TRISA6:1;
  1044.   unsigned TRISA7:1;
  1045. } TRISABITS;
  1046. extern volatile TRISABITS TRISAbits __attribute__((__sfr__));
  1047.  
  1048. extern volatile unsigned int  PORTA __attribute__((__sfr__));
  1049. typedef struct tagPORTABITS {
  1050.   unsigned RA0:1;
  1051.   unsigned RA1:1;
  1052.   unsigned RA2:1;
  1053.   unsigned RA3:1;
  1054.   unsigned RA4:1;
  1055.   unsigned RA5:1;
  1056.   unsigned RA6:1;
  1057.   unsigned RA7:1;
  1058. } PORTABITS;
  1059. extern volatile PORTABITS PORTAbits __attribute__((__sfr__));
  1060.  
  1061. extern volatile unsigned int  LATA __attribute__((__sfr__));
  1062. typedef struct tagLATABITS {
  1063.   unsigned LATA0:1;
  1064.   unsigned LATA1:1;
  1065.   unsigned LATA2:1;
  1066.   unsigned LATA3:1;
  1067.   unsigned LATA4:1;
  1068.   unsigned LATA5:1;
  1069.   unsigned LATA6:1;
  1070.   unsigned LATA7:1;
  1071. } LATABITS;
  1072. extern volatile LATABITS LATAbits __attribute__((__sfr__));
  1073.  
  1074. extern volatile unsigned int  ODCA __attribute__((__sfr__));
  1075. typedef struct tagODCABITS {
  1076.   unsigned ODA0:1;
  1077.   unsigned ODA1:1;
  1078.   unsigned ODA2:1;
  1079.   unsigned ODA3:1;
  1080.   unsigned ODA4:1;
  1081.   unsigned ODA5:1;
  1082.   unsigned ODA6:1;
  1083.   unsigned ODA7:1;
  1084. } ODCABITS;
  1085. extern volatile ODCABITS ODCAbits __attribute__((__sfr__));
  1086.  
  1087. extern volatile unsigned int  TRISB __attribute__((__sfr__));
  1088. typedef struct tagTRISBBITS {
  1089.   unsigned TRISB0:1;
  1090.   unsigned TRISB1:1;
  1091.   unsigned TRISB2:1;
  1092.   unsigned TRISB3:1;
  1093.   unsigned TRISB4:1;
  1094.   unsigned TRISB5:1;
  1095.   unsigned TRISB6:1;
  1096.   unsigned TRISB7:1;
  1097.   unsigned TRISB8:1;
  1098.   unsigned TRISB9:1;
  1099.   unsigned TRISB10:1;
  1100.   unsigned TRISB11:1;
  1101.   unsigned TRISB12:1;
  1102.   unsigned TRISB13:1;
  1103.   unsigned TRISB14:1;
  1104.   unsigned TRISB15:1;
  1105. } TRISBBITS;
  1106. extern volatile TRISBBITS TRISBbits __attribute__((__sfr__));
  1107.  
  1108. extern volatile unsigned int  PORTB __attribute__((__sfr__));
  1109. typedef struct tagPORTBBITS {
  1110.   unsigned RB0:1;
  1111.   unsigned RB1:1;
  1112.   unsigned RB2:1;
  1113.   unsigned RB3:1;
  1114.   unsigned RB4:1;
  1115.   unsigned RB5:1;
  1116.   unsigned RB6:1;
  1117.   unsigned RB7:1;
  1118.   unsigned RB8:1;
  1119.   unsigned RB9:1;
  1120.   unsigned RB10:1;
  1121.   unsigned RB11:1;
  1122.   unsigned RB12:1;
  1123.   unsigned RB13:1;
  1124.   unsigned RB14:1;
  1125.   unsigned RB15:1;
  1126. } PORTBBITS;
  1127. extern volatile PORTBBITS PORTBbits __attribute__((__sfr__));
  1128.  
  1129. extern volatile unsigned int  LATB __attribute__((__sfr__));
  1130. typedef struct tagLATBBITS {
  1131.   unsigned LATB0:1;
  1132.   unsigned LATB1:1;
  1133.   unsigned LATB2:1;
  1134.   unsigned LATB3:1;
  1135.   unsigned LATB4:1;
  1136.   unsigned LATB5:1;
  1137.   unsigned LATB6:1;
  1138.   unsigned LATB7:1;
  1139.   unsigned LATB8:1;
  1140.   unsigned LATB9:1;
  1141.   unsigned LATB10:1;
  1142.   unsigned LATB11:1;
  1143.   unsigned LATB12:1;
  1144.   unsigned LATB13:1;
  1145.   unsigned LATB14:1;
  1146.   unsigned LATB15:1;
  1147. } LATBBITS;
  1148. extern volatile LATBBITS LATBbits __attribute__((__sfr__));
  1149.  
  1150. extern volatile unsigned int  ODCB __attribute__((__sfr__));
  1151. typedef struct tagODCBBITS {
  1152.   unsigned ODB0:1;
  1153.   unsigned ODB1:1;
  1154.   unsigned ODB2:1;
  1155.   unsigned ODB3:1;
  1156.   unsigned ODB4:1;
  1157.   unsigned ODB5:1;
  1158.   unsigned ODB6:1;
  1159.   unsigned ODB7:1;
  1160.   unsigned ODB8:1;
  1161.   unsigned ODB9:1;
  1162.   unsigned ODB10:1;
  1163.   unsigned ODB11:1;
  1164.   unsigned ODB12:1;
  1165.   unsigned ODB13:1;
  1166.   unsigned ODB14:1;
  1167.   unsigned ODB15:1;
  1168. } ODCBBITS;
  1169. extern volatile ODCBBITS ODCBbits __attribute__((__sfr__));
  1170.  
  1171. extern volatile unsigned int  PADCFG1 __attribute__((__sfr__));
  1172. __extension__ typedef struct tagPADCFG1BITS {
  1173.   union {
  1174.     struct {
  1175.       unsigned :1;
  1176.       unsigned RTSECSEL:2;
  1177.       unsigned OC1TRIS:1;
  1178.       unsigned SMBUSDEL:1;
  1179.     };
  1180.     struct {
  1181.       unsigned :1;
  1182.       unsigned RTSECSEL0:1;
  1183.       unsigned RTSECSEL1:1;
  1184.     };
  1185.   };
  1186. } PADCFG1BITS;
  1187. extern volatile PADCFG1BITS PADCFG1bits __attribute__((__sfr__));
  1188.  
  1189. extern volatile unsigned int  ADC1BUF0 __attribute__((__sfr__));
  1190. extern volatile unsigned int  ADC1BUF1 __attribute__((__sfr__));
  1191. extern volatile unsigned int  ADC1BUF2 __attribute__((__sfr__));
  1192. extern volatile unsigned int  ADC1BUF3 __attribute__((__sfr__));
  1193. extern volatile unsigned int  ADC1BUF4 __attribute__((__sfr__));
  1194. extern volatile unsigned int  ADC1BUF5 __attribute__((__sfr__));
  1195. extern volatile unsigned int  ADC1BUF6 __attribute__((__sfr__));
  1196. extern volatile unsigned int  ADC1BUF7 __attribute__((__sfr__));
  1197. extern volatile unsigned int  ADC1BUF8 __attribute__((__sfr__));
  1198. extern volatile unsigned int  ADC1BUF9 __attribute__((__sfr__));
  1199. extern volatile unsigned int  ADC1BUFA __attribute__((__sfr__));
  1200. extern volatile unsigned int  ADC1BUFB __attribute__((__sfr__));
  1201. extern volatile unsigned int  ADC1BUFC __attribute__((__sfr__));
  1202. extern volatile unsigned int  ADC1BUFD __attribute__((__sfr__));
  1203. extern volatile unsigned int  ADC1BUFE __attribute__((__sfr__));
  1204. extern volatile unsigned int  ADC1BUFF __attribute__((__sfr__));
  1205. extern volatile unsigned int  AD1CON1 __attribute__((__sfr__));
  1206. __extension__ typedef struct tagAD1CON1BITS {
  1207.   union {
  1208.     struct {
  1209.       unsigned DONE:1;
  1210.       unsigned SAMP:1;
  1211.       unsigned ASAM:1;
  1212.       unsigned :2;
  1213.       unsigned SSRC:3;
  1214.       unsigned FORM0:1;
  1215.       unsigned FORM1:1;
  1216.       unsigned :3;
  1217.       unsigned ADSIDL:1;
  1218.       unsigned :1;
  1219.       unsigned ADON:1;
  1220.     };
  1221.     struct {
  1222.       unsigned :5;
  1223.       unsigned SSRC0:1;
  1224.       unsigned SSRC1:1;
  1225.       unsigned SSRC2:1;
  1226.       unsigned FORM:2;
  1227.     };
  1228.   };
  1229. } AD1CON1BITS;
  1230. extern volatile AD1CON1BITS AD1CON1bits __attribute__((__sfr__));
  1231.  
  1232. extern volatile unsigned int  AD1CON2 __attribute__((__sfr__));
  1233. __extension__ typedef struct tagAD1CON2BITS {
  1234.   union {
  1235.     struct {
  1236.       unsigned ALTS:1;
  1237.       unsigned BUFM:1;
  1238.       unsigned SMPI:4;
  1239.       unsigned :1;
  1240.       unsigned BUFS:1;
  1241.       unsigned :2;
  1242.       unsigned CSCNA:1;
  1243.       unsigned :1;
  1244.       unsigned OFFCAL:1;
  1245.       unsigned VCFG:3;
  1246.     };
  1247.     struct {
  1248.       unsigned :2;
  1249.       unsigned SMPI0:1;
  1250.       unsigned SMPI1:1;
  1251.       unsigned SMPI2:1;
  1252.       unsigned SMPI3:1;
  1253.       unsigned :7;
  1254.       unsigned VCFG0:1;
  1255.       unsigned VCFG1:1;
  1256.       unsigned VCFG2:1;
  1257.     };
  1258.   };
  1259. } AD1CON2BITS;
  1260. extern volatile AD1CON2BITS AD1CON2bits __attribute__((__sfr__));
  1261.  
  1262. extern volatile unsigned int  AD1CON3 __attribute__((__sfr__));
  1263. __extension__ typedef struct tagAD1CON3BITS {
  1264.   union {
  1265.     struct {
  1266.       unsigned ADCS:8;
  1267.       unsigned SAMC:5;
  1268.       unsigned PUMPEN:1;
  1269.       unsigned EXTSAM:1;
  1270.       unsigned ADRC:1;
  1271.     };
  1272.     struct {
  1273.       unsigned ADCS0:1;
  1274.       unsigned ADCS1:1;
  1275.       unsigned ADCS2:1;
  1276.       unsigned ADCS3:1;
  1277.       unsigned ADCS4:1;
  1278.       unsigned ADCS5:1;
  1279.       unsigned ADCS6:1;
  1280.       unsigned ADCS7:1;
  1281.       unsigned SAMC0:1;
  1282.       unsigned SAMC1:1;
  1283.       unsigned SAMC2:1;
  1284.       unsigned SAMC3:1;
  1285.       unsigned SAMC4:1;
  1286.     };
  1287.   };
  1288. } AD1CON3BITS;
  1289. extern volatile AD1CON3BITS AD1CON3bits __attribute__((__sfr__));
  1290.  
  1291. extern volatile unsigned int  AD1CHS __attribute__((__sfr__));
  1292. __extension__ typedef struct tagAD1CHSBITS {
  1293.   union {
  1294.     struct {
  1295.       unsigned CH0SA:5;
  1296.       unsigned :2;
  1297.       unsigned CH0NA:1;
  1298.       unsigned CH0SB:4;
  1299.       unsigned :3;
  1300.       unsigned CH0NB:1;
  1301.     };
  1302.     struct {
  1303.       unsigned CH0SA0:1;
  1304.       unsigned CH0SA1:1;
  1305.       unsigned CH0SA2:1;
  1306.       unsigned CH0SA3:1;
  1307.       unsigned CH0SA4:1;
  1308.       unsigned :3;
  1309.       unsigned CH0SB0:1;
  1310.       unsigned CH0SB1:1;
  1311.       unsigned CH0SB2:1;
  1312.       unsigned CH0SB3:1;
  1313.     };
  1314.   };
  1315. } AD1CHSBITS;
  1316. extern volatile AD1CHSBITS AD1CHSbits __attribute__((__sfr__));
  1317.  
  1318. extern volatile unsigned int  AD1PCFG __attribute__((__sfr__));
  1319. typedef struct tagAD1PCFGBITS {
  1320.   unsigned PCFG0:1;
  1321.   unsigned PCFG1:1;
  1322.   unsigned PCFG2:1;
  1323.   unsigned PCFG3:1;
  1324.   unsigned PCFG4:1;
  1325.   unsigned PCFG5:1;
  1326.   unsigned :4;
  1327.   unsigned PCFG10:1;
  1328.   unsigned PCFG11:1;
  1329.   unsigned PCFG12:1;
  1330. } AD1PCFGBITS;
  1331. extern volatile AD1PCFGBITS AD1PCFGbits __attribute__((__sfr__));
  1332.  
  1333. extern volatile unsigned int  AD1CSSL __attribute__((__sfr__));
  1334. typedef struct tagAD1CSSLBITS {
  1335.   unsigned CSSL0:1;
  1336.   unsigned CSSL1:1;
  1337.   unsigned CSSL2:1;
  1338.   unsigned CSSL3:1;
  1339.   unsigned CSSL4:1;
  1340.   unsigned CSSL5:1;
  1341.   unsigned :4;
  1342.   unsigned CSSL10:1;
  1343.   unsigned CSSL11:1;
  1344.   unsigned CSSL12:1;
  1345. } AD1CSSLBITS;
  1346. extern volatile AD1CSSLBITS AD1CSSLbits __attribute__((__sfr__));
  1347.  
  1348. extern volatile unsigned int  CTMUCON __attribute__((__sfr__));
  1349. __extension__ typedef struct tagCTMUCONBITS {
  1350.   union {
  1351.     struct {
  1352.       unsigned EDG1STAT:1;
  1353.       unsigned EDG2STAT:1;
  1354.       unsigned EDG1SEL:2;
  1355.       unsigned EDG1POL:1;
  1356.       unsigned EDG2SEL:2;
  1357.       unsigned EDG2POL:1;
  1358.       unsigned CTTRIG:1;
  1359.       unsigned IDISSEN:1;
  1360.       unsigned EDGSEQEN:1;
  1361.       unsigned EDGEN:1;
  1362.       unsigned TGEN:1;
  1363.       unsigned CTMUSIDL:1;
  1364.       unsigned :1;
  1365.       unsigned CTMUEN:1;
  1366.     };
  1367.     struct {
  1368.       unsigned :2;
  1369.       unsigned EDG1SEL0:1;
  1370.       unsigned EDG1SEL1:1;
  1371.       unsigned :1;
  1372.       unsigned EDG2SEL0:1;
  1373.       unsigned EDG2SEL1:1;
  1374.     };
  1375.   };
  1376. } CTMUCONBITS;
  1377. extern volatile CTMUCONBITS CTMUCONbits __attribute__((__sfr__));
  1378.  
  1379. extern volatile unsigned int  CTMUICON __attribute__((__sfr__));
  1380. __extension__ typedef struct tagCTMUICONBITS {
  1381.   union {
  1382.     struct {
  1383.       unsigned :8;
  1384.       unsigned IRNG:2;
  1385.       unsigned ITRIM:6;
  1386.     };
  1387.     struct {
  1388.       unsigned :8;
  1389.       unsigned IRNG0:1;
  1390.       unsigned IRNG1:1;
  1391.       unsigned ITRIM0:1;
  1392.       unsigned ITRIM1:1;
  1393.       unsigned ITRIM2:1;
  1394.       unsigned ITRIM3:1;
  1395.       unsigned ITRIM4:1;
  1396.       unsigned ITRIM5:1;
  1397.     };
  1398.   };
  1399. } CTMUICONBITS;
  1400. extern volatile CTMUICONBITS CTMUICONbits __attribute__((__sfr__));
  1401.  
  1402. extern volatile unsigned int  ALRMVAL __attribute__((__sfr__));
  1403. extern volatile unsigned int  ALCFGRPT __attribute__((__sfr__));
  1404. __extension__ typedef struct tagALCFGRPTBITS {
  1405.   union {
  1406.     struct {
  1407.       unsigned ARPT:8;
  1408.       unsigned ALRMPTR0:1;
  1409.       unsigned ALRMPTR1:1;
  1410.       unsigned AMASK:4;
  1411.       unsigned CHIME:1;
  1412.       unsigned ALRMEN:1;
  1413.     };
  1414.     struct {
  1415.       unsigned ARPT0:1;
  1416.       unsigned ARPT1:1;
  1417.       unsigned ARPT2:1;
  1418.       unsigned ARPT3:1;
  1419.       unsigned ARPT4:1;
  1420.       unsigned ARPT5:1;
  1421.       unsigned ARPT6:1;
  1422.       unsigned ARPT7:1;
  1423.       unsigned ALRMPTR:2;
  1424.       unsigned AMASK0:1;
  1425.       unsigned AMASK1:1;
  1426.       unsigned AMASK2:1;
  1427.       unsigned AMASK3:1;
  1428.     };
  1429.   };
  1430. } ALCFGRPTBITS;
  1431. extern volatile ALCFGRPTBITS ALCFGRPTbits __attribute__((__sfr__));
  1432.  
  1433. extern volatile unsigned int  RTCVAL __attribute__((__sfr__));
  1434. extern volatile unsigned int  RCFGCAL __attribute__((__sfr__));
  1435. __extension__ typedef struct tagRCFGCALBITS {
  1436.   union {
  1437.     struct {
  1438.       unsigned CAL:8;
  1439.       unsigned RTCPTR0:1;
  1440.       unsigned RTCPTR1:1;
  1441.       unsigned RTCOE:1;
  1442.       unsigned HALFSEC:1;
  1443.       unsigned RTCSYNC:1;
  1444.       unsigned RTCWREN:1;
  1445.       unsigned :1;
  1446.       unsigned RTCEN:1;
  1447.     };
  1448.     struct {
  1449.       unsigned CAL0:1;
  1450.       unsigned CAL1:1;
  1451.       unsigned CAL2:1;
  1452.       unsigned CAL3:1;
  1453.       unsigned CAL4:1;
  1454.       unsigned CAL5:1;
  1455.       unsigned CAL6:1;
  1456.       unsigned CAL7:1;
  1457.       unsigned RTCPTR:2;
  1458.     };
  1459.   };
  1460. } RCFGCALBITS;
  1461. extern volatile RCFGCALBITS RCFGCALbits __attribute__((__sfr__));
  1462.  
  1463. extern volatile unsigned int  CMSTAT __attribute__((__sfr__));
  1464. typedef struct tagCMSTATBITS {
  1465.   unsigned C1OUT:1;
  1466.   unsigned C2OUT:1;
  1467.   unsigned :6;
  1468.   unsigned C1EVT:1;
  1469.   unsigned C2EVT:1;
  1470.   unsigned :5;
  1471.   unsigned CMIDL:1;
  1472. } CMSTATBITS;
  1473. extern volatile CMSTATBITS CMSTATbits __attribute__((__sfr__));
  1474.  
  1475. extern volatile unsigned int  CVRCON __attribute__((__sfr__));
  1476. __extension__ typedef struct tagCVRCONBITS {
  1477.   union {
  1478.     struct {
  1479.       unsigned CVR:4;
  1480.       unsigned CVRSS:1;
  1481.       unsigned CVRR:1;
  1482.       unsigned CVROE:1;
  1483.       unsigned CVREN:1;
  1484.     };
  1485.     struct {
  1486.       unsigned CVR0:1;
  1487.       unsigned CVR1:1;
  1488.       unsigned CVR2:1;
  1489.       unsigned CVR3:1;
  1490.     };
  1491.   };
  1492. } CVRCONBITS;
  1493. extern volatile CVRCONBITS CVRCONbits __attribute__((__sfr__));
  1494.  
  1495. extern volatile unsigned int  CM1CON __attribute__((__sfr__));
  1496. __extension__ typedef struct tagCM1CONBITS {
  1497.   union {
  1498.     struct {
  1499.       unsigned CCH:2;
  1500.       unsigned :2;
  1501.       unsigned CREF:1;
  1502.       unsigned :1;
  1503.       unsigned EVPOL:2;
  1504.       unsigned COUT:1;
  1505.       unsigned CEVT:1;
  1506.       unsigned :2;
  1507.       unsigned CLPWR:1;
  1508.       unsigned CPOL:1;
  1509.       unsigned COE:1;
  1510.       unsigned CON:1;
  1511.     };
  1512.     struct {
  1513.       unsigned CCH0:1;
  1514.       unsigned CCH1:1;
  1515.       unsigned :4;
  1516.       unsigned EVPOL0:1;
  1517.       unsigned EVPOL1:1;
  1518.     };
  1519.   };
  1520. } CM1CONBITS;
  1521. extern volatile CM1CONBITS CM1CONbits __attribute__((__sfr__));
  1522.  
  1523. extern volatile unsigned int  CM2CON __attribute__((__sfr__));
  1524. __extension__ typedef struct tagCM2CONBITS {
  1525.   union {
  1526.     struct {
  1527.       unsigned CCH:2;
  1528.       unsigned :2;
  1529.       unsigned CREF:1;
  1530.       unsigned :1;
  1531.       unsigned EVPOL:2;
  1532.       unsigned COUT:1;
  1533.       unsigned CEVT:1;
  1534.       unsigned :2;
  1535.       unsigned CLPWR:1;
  1536.       unsigned CPOL:1;
  1537.       unsigned COE:1;
  1538.       unsigned CON:1;
  1539.     };
  1540.     struct {
  1541.       unsigned CCH0:1;
  1542.       unsigned CCH1:1;
  1543.       unsigned :4;
  1544.       unsigned EVPOL0:1;
  1545.       unsigned EVPOL1:1;
  1546.     };
  1547.   };
  1548. } CM2CONBITS;
  1549. extern volatile CM2CONBITS CM2CONbits __attribute__((__sfr__));
  1550.  
  1551. extern volatile unsigned int  CRCCON __attribute__((__sfr__));
  1552. __extension__ typedef struct tagCRCCONBITS {
  1553.   union {
  1554.     struct {
  1555.       unsigned PLEN:4;
  1556.       unsigned CRCGO:1;
  1557.       unsigned :1;
  1558.       unsigned CRCMPT:1;
  1559.       unsigned CRCFUL:1;
  1560.       unsigned VWORD:5;
  1561.       unsigned CSIDL:1;
  1562.     };
  1563.     struct {
  1564.       unsigned PLEN0:1;
  1565.       unsigned PLEN1:1;
  1566.       unsigned PLEN2:1;
  1567.       unsigned PLEN3:1;
  1568.       unsigned :4;
  1569.       unsigned VWORD0:1;
  1570.       unsigned VWORD1:1;
  1571.       unsigned VWORD2:1;
  1572.       unsigned VWORD3:1;
  1573.       unsigned VWORD4:1;
  1574.     };
  1575.   };
  1576. } CRCCONBITS;
  1577. extern volatile CRCCONBITS CRCCONbits __attribute__((__sfr__));
  1578.  
  1579. extern volatile unsigned int  CRCXOR __attribute__((__sfr__));
  1580. extern volatile unsigned int  CRCDAT __attribute__((__sfr__));
  1581. extern volatile unsigned int  CRCWDAT __attribute__((__sfr__));
  1582. extern volatile unsigned int  RCON __attribute__((__sfr__));
  1583. __extension__ typedef struct tagRCONBITS {
  1584.   union {
  1585.     struct {
  1586.       unsigned POR:1;
  1587.       unsigned BOR:1;
  1588.       unsigned IDLE:1;
  1589.       unsigned SLEEP:1;
  1590.       unsigned WDTO:1;
  1591.       unsigned SWDTEN:1;
  1592.       unsigned SWR:1;
  1593.       unsigned EXTR:1;
  1594.       unsigned PMSLP:1;
  1595.       unsigned :1;
  1596.       unsigned DPSLP:1;
  1597.       unsigned :2;
  1598.       unsigned SBOREN:1;
  1599.       unsigned IOPUWR:1;
  1600.       unsigned TRAPR:1;
  1601.     };
  1602.     struct {
  1603.       unsigned :8;
  1604.       unsigned VREGS:1;
  1605.     };
  1606.   };
  1607. } RCONBITS;
  1608. extern volatile RCONBITS RCONbits __attribute__((__sfr__));
  1609.  
  1610. extern volatile unsigned int  OSCCON __attribute__((__sfr__));
  1611. __extension__ typedef struct tagOSCCONBITS {
  1612.   union {
  1613.     struct {
  1614.       unsigned OSWEN:1;
  1615.       unsigned SOSCEN:1;
  1616.       unsigned :1;
  1617.       unsigned CF:1;
  1618.       unsigned :1;
  1619.       unsigned LOCK:1;
  1620.       unsigned :1;
  1621.       unsigned CLKLOCK:1;
  1622.       unsigned NOSC:3;
  1623.       unsigned :1;
  1624.       unsigned COSC:3;
  1625.     };
  1626.     struct {
  1627.       unsigned :8;
  1628.       unsigned NOSC0:1;
  1629.       unsigned NOSC1:1;
  1630.       unsigned NOSC2:1;
  1631.       unsigned :1;
  1632.       unsigned COSC0:1;
  1633.       unsigned COSC1:1;
  1634.       unsigned COSC2:1;
  1635.     };
  1636.   };
  1637. } OSCCONBITS;
  1638. extern volatile OSCCONBITS OSCCONbits __attribute__((__sfr__));
  1639.  
  1640. extern volatile unsigned int  CLKDIV __attribute__((__sfr__));
  1641. __extension__ typedef struct tagCLKDIVBITS {
  1642.   union {
  1643.     struct {
  1644.       unsigned :8;
  1645.       unsigned RCDIV:3;
  1646.       unsigned DOZEN:1;
  1647.       unsigned DOZE:3;
  1648.       unsigned ROI:1;
  1649.     };
  1650.     struct {
  1651.       unsigned :8;
  1652.       unsigned RCDIV0:1;
  1653.       unsigned RCDIV1:1;
  1654.       unsigned RCDIV2:1;
  1655.       unsigned :1;
  1656.       unsigned DOZE0:1;
  1657.       unsigned DOZE1:1;
  1658.       unsigned DOZE2:1;
  1659.     };
  1660.   };
  1661. } CLKDIVBITS;
  1662. extern volatile CLKDIVBITS CLKDIVbits __attribute__((__sfr__));
  1663.  
  1664. extern volatile unsigned int  OSCTUN __attribute__((__sfr__));
  1665. __extension__ typedef struct tagOSCTUNBITS {
  1666.   union {
  1667.     struct {
  1668.       unsigned TUN:6;
  1669.     };
  1670.     struct {
  1671.       unsigned TUN0:1;
  1672.       unsigned TUN1:1;
  1673.       unsigned TUN2:1;
  1674.       unsigned TUN3:1;
  1675.       unsigned TUN4:1;
  1676.       unsigned TUN5:1;
  1677.     };
  1678.   };
  1679. } OSCTUNBITS;
  1680. extern volatile OSCTUNBITS OSCTUNbits __attribute__((__sfr__));
  1681.  
  1682. extern volatile unsigned int  REFOCON __attribute__((__sfr__));
  1683. __extension__ typedef struct tagREFOCONBITS {
  1684.   union {
  1685.     struct {
  1686.       unsigned :8;
  1687.       unsigned RODIV:4;
  1688.       unsigned ROSEL:1;
  1689.       unsigned ROSSLP:1;
  1690.       unsigned :1;
  1691.       unsigned ROEN:1;
  1692.     };
  1693.     struct {
  1694.       unsigned :8;
  1695.       unsigned RODIV0:1;
  1696.       unsigned RODIV1:1;
  1697.       unsigned RODIV2:1;
  1698.       unsigned RODIV3:1;
  1699.     };
  1700.   };
  1701. } REFOCONBITS;
  1702. extern volatile REFOCONBITS REFOCONbits __attribute__((__sfr__));
  1703.  
  1704. extern volatile unsigned int  HLVDCON __attribute__((__sfr__));
  1705. __extension__ typedef struct tagHLVDCONBITS {
  1706.   union {
  1707.     struct {
  1708.       unsigned HLVDL:4;
  1709.       unsigned :1;
  1710.       unsigned IRVST:1;
  1711.       unsigned BGVST:1;
  1712.       unsigned VDIR:1;
  1713.       unsigned :5;
  1714.       unsigned HLSIDL:1;
  1715.       unsigned :1;
  1716.       unsigned HLVDEN:1;
  1717.     };
  1718.     struct {
  1719.       unsigned :8;
  1720.       unsigned HLVDL0:1;
  1721.       unsigned HLVDL1:1;
  1722.       unsigned HLVDL2:1;
  1723.       unsigned HLVDL3:1;
  1724.     };
  1725.   };
  1726. } HLVDCONBITS;
  1727. extern volatile HLVDCONBITS HLVDCONbits __attribute__((__sfr__));
  1728.  
  1729. extern volatile unsigned int  DSCON __attribute__((__sfr__));
  1730. typedef struct tagDSCONBITS {
  1731.   unsigned RELEASE:1;
  1732.   unsigned DSBOR:1;
  1733.   unsigned :13;
  1734.   unsigned DSEN:1;
  1735. } DSCONBITS;
  1736. extern volatile DSCONBITS DSCONbits __attribute__((__sfr__));
  1737.  
  1738. extern volatile unsigned int  DSWSRC __attribute__((__sfr__));
  1739. typedef struct tagDSWSRCBITS {
  1740.   unsigned DSPOR:1;
  1741.   unsigned :1;
  1742.   unsigned DSMCLR:1;
  1743.   unsigned DSRTCC:1;
  1744.   unsigned DSWDT:1;
  1745.   unsigned :2;
  1746.   unsigned DSFLT:1;
  1747.   unsigned DSINT0:1;
  1748. } DSWSRCBITS;
  1749. extern volatile DSWSRCBITS DSWSRCbits __attribute__((__sfr__));
  1750.  
  1751. extern volatile unsigned int  DSGPR0 __attribute__((__sfr__));
  1752. extern volatile unsigned int  DSGPR1 __attribute__((__sfr__));
  1753. extern volatile unsigned int  NVMCON __attribute__((__sfr__));
  1754. __extension__ typedef struct tagNVMCONBITS {
  1755.   union {
  1756.     struct {
  1757.       unsigned NVMOP:6;
  1758.       unsigned ERASE:1;
  1759.       unsigned :5;
  1760.       unsigned PGMONLY:1;
  1761.       unsigned WRERR:1;
  1762.       unsigned WREN:1;
  1763.       unsigned WR:1;
  1764.     };
  1765.     struct {
  1766.       unsigned NVMOP0:1;
  1767.       unsigned NVMOP1:1;
  1768.       unsigned NVMOP2:1;
  1769.       unsigned NVMOP3:1;
  1770.       unsigned NVMOP4:1;
  1771.       unsigned NVMOP5:1;
  1772.     };
  1773.   };
  1774. } NVMCONBITS;
  1775. extern volatile NVMCONBITS NVMCONbits __attribute__((__sfr__));
  1776.  
  1777. extern volatile unsigned int  NVMKEY __attribute__((__sfr__));
  1778. __extension__ typedef struct tagNVMKEYBITS {
  1779.   union {
  1780.     struct {
  1781.       unsigned NVMKEY:8;
  1782.     };
  1783.     struct {
  1784.       unsigned NVMKEY0:1;
  1785.       unsigned NVMKEY1:1;
  1786.       unsigned NVMKEY2:1;
  1787.       unsigned NVMKEY3:1;
  1788.       unsigned NVMKEY4:1;
  1789.       unsigned NVMKEY5:1;
  1790.       unsigned NVMKEY6:1;
  1791.       unsigned NVMKEY7:1;
  1792.     };
  1793.   };
  1794. } NVMKEYBITS;
  1795. extern volatile NVMKEYBITS NVMKEYbits __attribute__((__sfr__));
  1796.  
  1797. extern volatile unsigned int  PMD1 __attribute__((__sfr__));
  1798. typedef struct tagPMD1BITS {
  1799.   unsigned ADC1MD:1;
  1800.   unsigned :2;
  1801.   unsigned SPI1MD:1;
  1802.   unsigned :1;
  1803.   unsigned U1MD:1;
  1804.   unsigned U2MD:1;
  1805.   unsigned I2C1MD:1;
  1806.   unsigned :3;
  1807.   unsigned T1MD:1;
  1808.   unsigned T2MD:1;
  1809.   unsigned T3MD:1;
  1810. } PMD1BITS;
  1811. extern volatile PMD1BITS PMD1bits __attribute__((__sfr__));
  1812.  
  1813. extern volatile unsigned int  PMD2 __attribute__((__sfr__));
  1814. typedef struct tagPMD2BITS {
  1815.   unsigned OC1MD:1;
  1816.   unsigned :7;
  1817.   unsigned IC1MD:1;
  1818. } PMD2BITS;
  1819. extern volatile PMD2BITS PMD2bits __attribute__((__sfr__));
  1820.  
  1821. extern volatile unsigned int  PMD3 __attribute__((__sfr__));
  1822. typedef struct tagPMD3BITS {
  1823.   unsigned :7;
  1824.   unsigned CRCPMD:1;
  1825.   unsigned :1;
  1826.   unsigned RTCCMD:1;
  1827.   unsigned CMPMD:1;
  1828. } PMD3BITS;
  1829. extern volatile PMD3BITS PMD3bits __attribute__((__sfr__));
  1830.  
  1831. extern volatile unsigned int  PMD4 __attribute__((__sfr__));
  1832. typedef struct tagPMD4BITS {
  1833.   unsigned :1;
  1834.   unsigned HLVDMD:1;
  1835.   unsigned CTMUMD:1;
  1836.   unsigned REFOMD:1;
  1837.   unsigned EEMD:1;
  1838. } PMD4BITS;
  1839. extern volatile PMD4BITS PMD4bits __attribute__((__sfr__));
  1840.  
  1841.  
  1842.  
  1843. /* ---------------------------------------------------------- */
  1844. /* Defines for unique SFR bit names                           */
  1845. /* ---------------------------------------------------------- */
  1846.  
  1847. /* SR */
  1848. #define _C SRbits.C
  1849. #define _Z SRbits.Z
  1850. #define _OV SRbits.OV
  1851. #define _N SRbits.N
  1852. #define _RA SRbits.RA
  1853. #define _IPL0 SRbits.IPL0
  1854. #define _IPL1 SRbits.IPL1
  1855. #define _IPL2 SRbits.IPL2
  1856. #define _DC SRbits.DC
  1857. #define _IPL SRbits.IPL
  1858.  
  1859. /* CORCON */
  1860. #define _PSV CORCONbits.PSV
  1861. #define _IPL3 CORCONbits.IPL3
  1862.  
  1863. /* CNEN1 */
  1864. #define _CN0IE CNEN1bits.CN0IE
  1865. #define _CN1IE CNEN1bits.CN1IE
  1866. #define _CN2IE CNEN1bits.CN2IE
  1867. #define _CN3IE CNEN1bits.CN3IE
  1868. #define _CN4IE CNEN1bits.CN4IE
  1869. #define _CN5IE CNEN1bits.CN5IE
  1870. #define _CN6IE CNEN1bits.CN6IE
  1871. #define _CN7IE CNEN1bits.CN7IE
  1872. #define _CN8IE CNEN1bits.CN8IE
  1873. #define _CN9IE CNEN1bits.CN9IE
  1874. #define _CN11IE CNEN1bits.CN11IE
  1875. #define _CN12IE CNEN1bits.CN12IE
  1876. #define _CN13IE CNEN1bits.CN13IE
  1877. #define _CN14IE CNEN1bits.CN14IE
  1878. #define _CN15IE CNEN1bits.CN15IE
  1879.  
  1880. /* CNEN2 */
  1881. #define _CN16IE CNEN2bits.CN16IE
  1882. #define _CN21IE CNEN2bits.CN21IE
  1883. #define _CN22IE CNEN2bits.CN22IE
  1884. #define _CN23IE CNEN2bits.CN23IE
  1885. #define _CN24IE CNEN2bits.CN24IE
  1886. #define _CN27IE CNEN2bits.CN27IE
  1887. #define _CN29IE CNEN2bits.CN29IE
  1888. #define _CN30IE CNEN2bits.CN30IE
  1889.  
  1890. /* CNPU1 */
  1891. #define _CN0PUE CNPU1bits.CN0PUE
  1892. #define _CN1PUE CNPU1bits.CN1PUE
  1893. #define _CN2PUE CNPU1bits.CN2PUE
  1894. #define _CN3PUE CNPU1bits.CN3PUE
  1895. #define _CN4PUE CNPU1bits.CN4PUE
  1896. #define _CN5PUE CNPU1bits.CN5PUE
  1897. #define _CN6PUE CNPU1bits.CN6PUE
  1898. #define _CN7PUE CNPU1bits.CN7PUE
  1899. #define _CN8PUE CNPU1bits.CN8PUE
  1900. #define _CN9PUE CNPU1bits.CN9PUE
  1901. #define _CN11PUE CNPU1bits.CN11PUE
  1902. #define _CN12PUE CNPU1bits.CN12PUE
  1903. #define _CN13PUE CNPU1bits.CN13PUE
  1904. #define _CN14PUE CNPU1bits.CN14PUE
  1905. #define _CN15PUE CNPU1bits.CN15PUE
  1906.  
  1907. /* CNPU2 */
  1908. #define _CN16PUE CNPU2bits.CN16PUE
  1909. #define _CN21PUE CNPU2bits.CN21PUE
  1910. #define _CN22PUE CNPU2bits.CN22PUE
  1911. #define _CN23PUE CNPU2bits.CN23PUE
  1912. #define _CN24PUE CNPU2bits.CN24PUE
  1913. #define _CN27PUE CNPU2bits.CN27PUE
  1914. #define _CN29PUE CNPU2bits.CN29PUE
  1915. #define _CN30PUE CNPU2bits.CN30PUE
  1916.  
  1917. /* CNPD1 */
  1918. #define _CN0PDE CNPD1bits.CN0PDE
  1919. #define _CN1PDE CNPD1bits.CN1PDE
  1920. #define _CN2PDE CNPD1bits.CN2PDE
  1921. #define _CN3PDE CNPD1bits.CN3PDE
  1922. #define _CN4PDE CNPD1bits.CN4PDE
  1923. #define _CN5PDE CNPD1bits.CN5PDE
  1924. #define _CN6PDE CNPD1bits.CN6PDE
  1925. #define _CN7PDE CNPD1bits.CN7PDE
  1926. #define _CN8PDE CNPD1bits.CN8PDE
  1927. #define _CN9PDE CNPD1bits.CN9PDE
  1928. #define _CN11PDE CNPD1bits.CN11PDE
  1929. #define _CN12PDE CNPD1bits.CN12PDE
  1930. #define _CN13PDE CNPD1bits.CN13PDE
  1931. #define _CN14PDE CNPD1bits.CN14PDE
  1932. #define _CN15PDE CNPD1bits.CN15PDE
  1933.  
  1934. /* CNPD2 */
  1935. #define _CN16PDE CNPD2bits.CN16PDE
  1936. #define _CN21PDE CNPD2bits.CN21PDE
  1937. #define _CN22PDE CNPD2bits.CN22PDE
  1938. #define _CN23PDE CNPD2bits.CN23PDE
  1939. #define _CN24PDE CNPD2bits.CN24PDE
  1940. #define _CN27PDE CNPD2bits.CN27PDE
  1941. #define _CN29PDE CNPD2bits.CN29PDE
  1942. #define _CN30PDE CNPD2bits.CN30PDE
  1943.  
  1944. /* INTCON1 */
  1945. #define _OSCFAIL INTCON1bits.OSCFAIL
  1946. #define _STKERR INTCON1bits.STKERR
  1947. #define _ADDRERR INTCON1bits.ADDRERR
  1948. #define _MATHERR INTCON1bits.MATHERR
  1949. #define _NSTDIS INTCON1bits.NSTDIS
  1950.  
  1951. /* INTCON2 */
  1952. #define _INT0EP INTCON2bits.INT0EP
  1953. #define _INT1EP INTCON2bits.INT1EP
  1954. #define _INT2EP INTCON2bits.INT2EP
  1955. #define _DISI INTCON2bits.DISI
  1956. #define _ALTIVT INTCON2bits.ALTIVT
  1957.  
  1958. /* IFS0 */
  1959. #define _INT0IF IFS0bits.INT0IF
  1960. #define _IC1IF IFS0bits.IC1IF
  1961. #define _OC1IF IFS0bits.OC1IF
  1962. #define _T1IF IFS0bits.T1IF
  1963. #define _T2IF IFS0bits.T2IF
  1964. #define _T3IF IFS0bits.T3IF
  1965. #define _SPF1IF IFS0bits.SPF1IF
  1966. #define _SPI1IF IFS0bits.SPI1IF
  1967. #define _U1RXIF IFS0bits.U1RXIF
  1968. #define _U1TXIF IFS0bits.U1TXIF
  1969. #define _AD1IF IFS0bits.AD1IF
  1970. #define _NVMIF IFS0bits.NVMIF
  1971.  
  1972. /* IFS1 */
  1973. #define _SI2C1IF IFS1bits.SI2C1IF
  1974. #define _MI2C1IF IFS1bits.MI2C1IF
  1975. #define _CMIF IFS1bits.CMIF
  1976. #define _CNIF IFS1bits.CNIF
  1977. #define _INT1IF IFS1bits.INT1IF
  1978. #define _INT2IF IFS1bits.INT2IF
  1979. #define _U2RXIF IFS1bits.U2RXIF
  1980. #define _U2TXIF IFS1bits.U2TXIF
  1981.  
  1982. /* IFS3 */
  1983. #define _RTCIF IFS3bits.RTCIF
  1984.  
  1985. /* IFS4 */
  1986. #define _U1ERIF IFS4bits.U1ERIF
  1987. #define _U2ERIF IFS4bits.U2ERIF
  1988. #define _CRCIF IFS4bits.CRCIF
  1989. #define _HLVDIF IFS4bits.HLVDIF
  1990. #define _CTMUIF IFS4bits.CTMUIF
  1991.  
  1992. /* IEC0 */
  1993. #define _INT0IE IEC0bits.INT0IE
  1994. #define _IC1IE IEC0bits.IC1IE
  1995. #define _OC1IE IEC0bits.OC1IE
  1996. #define _T1IE IEC0bits.T1IE
  1997. #define _T2IE IEC0bits.T2IE
  1998. #define _T3IE IEC0bits.T3IE
  1999. #define _SPF1IE IEC0bits.SPF1IE
  2000. #define _SPI1IE IEC0bits.SPI1IE
  2001. #define _U1RXIE IEC0bits.U1RXIE
  2002. #define _U1TXIE IEC0bits.U1TXIE
  2003. #define _AD1IE IEC0bits.AD1IE
  2004. #define _NVMIE IEC0bits.NVMIE
  2005.  
  2006. /* IEC1 */
  2007. #define _SI2C1IE IEC1bits.SI2C1IE
  2008. #define _MI2C1IE IEC1bits.MI2C1IE
  2009. #define _CMIE IEC1bits.CMIE
  2010. #define _CNIE IEC1bits.CNIE
  2011. #define _INT1IE IEC1bits.INT1IE
  2012. #define _INT2IE IEC1bits.INT2IE
  2013. #define _U2RXIE IEC1bits.U2RXIE
  2014. #define _U2TXIE IEC1bits.U2TXIE
  2015.  
  2016. /* IEC3 */
  2017. #define _RTCIE IEC3bits.RTCIE
  2018.  
  2019. /* IEC4 */
  2020. #define _U1ERIE IEC4bits.U1ERIE
  2021. #define _U2ERIE IEC4bits.U2ERIE
  2022. #define _CRCIE IEC4bits.CRCIE
  2023. #define _HLVDIE IEC4bits.HLVDIE
  2024. #define _CTMUIE IEC4bits.CTMUIE
  2025.  
  2026. /* IPC0 */
  2027. #define _INT0IP0 IPC0bits.INT0IP0
  2028. #define _INT0IP1 IPC0bits.INT0IP1
  2029. #define _INT0IP2 IPC0bits.INT0IP2
  2030. #define _IC1IP0 IPC0bits.IC1IP0
  2031. #define _IC1IP1 IPC0bits.IC1IP1
  2032. #define _IC1IP2 IPC0bits.IC1IP2
  2033. #define _OC1IP0 IPC0bits.OC1IP0
  2034. #define _OC1IP1 IPC0bits.OC1IP1
  2035. #define _OC1IP2 IPC0bits.OC1IP2
  2036. #define _T1IP0 IPC0bits.T1IP0
  2037. #define _T1IP1 IPC0bits.T1IP1
  2038. #define _T1IP2 IPC0bits.T1IP2
  2039. #define _INT0IP IPC0bits.INT0IP
  2040. #define _IC1IP IPC0bits.IC1IP
  2041. #define _OC1IP IPC0bits.OC1IP
  2042. #define _T1IP IPC0bits.T1IP
  2043.  
  2044. /* IPC1 */
  2045. #define _T2IP0 IPC1bits.T2IP0
  2046. #define _T2IP1 IPC1bits.T2IP1
  2047. #define _T2IP2 IPC1bits.T2IP2
  2048. #define _T2IP IPC1bits.T2IP
  2049.  
  2050. /* IPC2 */
  2051. #define _T3IP0 IPC2bits.T3IP0
  2052. #define _T3IP1 IPC2bits.T3IP1
  2053. #define _T3IP2 IPC2bits.T3IP2
  2054. #define _SPF1IP0 IPC2bits.SPF1IP0
  2055. #define _SPF1IP1 IPC2bits.SPF1IP1
  2056. #define _SPF1IP2 IPC2bits.SPF1IP2
  2057. #define _SPI1IP0 IPC2bits.SPI1IP0
  2058. #define _SPI1IP1 IPC2bits.SPI1IP1
  2059. #define _SPI1IP2 IPC2bits.SPI1IP2
  2060. #define _U1RXIP0 IPC2bits.U1RXIP0
  2061. #define _U1RXIP1 IPC2bits.U1RXIP1
  2062. #define _U1RXIP2 IPC2bits.U1RXIP2
  2063. #define _T3IP IPC2bits.T3IP
  2064. #define _SPF1IP IPC2bits.SPF1IP
  2065. #define _SPI1IP IPC2bits.SPI1IP
  2066. #define _U1RXIP IPC2bits.U1RXIP
  2067.  
  2068. /* IPC3 */
  2069. #define _U1TXIP0 IPC3bits.U1TXIP0
  2070. #define _U1TXIP1 IPC3bits.U1TXIP1
  2071. #define _U1TXIP2 IPC3bits.U1TXIP2
  2072. #define _AD1IP0 IPC3bits.AD1IP0
  2073. #define _AD1IP1 IPC3bits.AD1IP1
  2074. #define _AD1IP2 IPC3bits.AD1IP2
  2075. #define _NVMIP0 IPC3bits.NVMIP0
  2076. #define _NVMIP1 IPC3bits.NVMIP1
  2077. #define _NVMIP2 IPC3bits.NVMIP2
  2078. #define _U1TXIP IPC3bits.U1TXIP
  2079. #define _AD1IP IPC3bits.AD1IP
  2080.  
  2081. /* IPC4 */
  2082. #define _SI2C1IP0 IPC4bits.SI2C1IP0
  2083. #define _SI2C1IP1 IPC4bits.SI2C1IP1
  2084. #define _SI2C1IP2 IPC4bits.SI2C1IP2
  2085. #define _MI2C1IP0 IPC4bits.MI2C1IP0
  2086. #define _MI2C1IP1 IPC4bits.MI2C1IP1
  2087. #define _MI2C1IP2 IPC4bits.MI2C1IP2
  2088. #define _CMIP0 IPC4bits.CMIP0
  2089. #define _CMIP1 IPC4bits.CMIP1
  2090. #define _CMIP2 IPC4bits.CMIP2
  2091. #define _CNIP0 IPC4bits.CNIP0
  2092. #define _CNIP1 IPC4bits.CNIP1
  2093. #define _CNIP2 IPC4bits.CNIP2
  2094. #define _SI2C1IP IPC4bits.SI2C1IP
  2095. #define _MI2C1IP IPC4bits.MI2C1IP
  2096. #define _CMIP IPC4bits.CMIP
  2097. #define _CNIP IPC4bits.CNIP
  2098. #define _SI2C1P0 IPC4bits.SI2C1P0
  2099. #define _SI2C1P1 IPC4bits.SI2C1P1
  2100. #define _SI2C1P2 IPC4bits.SI2C1P2
  2101. #define _MI2C1P0 IPC4bits.MI2C1P0
  2102. #define _MI2C1P1 IPC4bits.MI2C1P1
  2103. #define _MI2C1P2 IPC4bits.MI2C1P2
  2104. #define _SI2C1P IPC4bits.SI2C1P
  2105. #define _MI2C1P IPC4bits.MI2C1P
  2106.  
  2107. /* IPC5 */
  2108. #define _INT1IP0 IPC5bits.INT1IP0
  2109. #define _INT1IP1 IPC5bits.INT1IP1
  2110. #define _INT1IP2 IPC5bits.INT1IP2
  2111. #define _INT1IP IPC5bits.INT1IP
  2112.  
  2113. /* IPC7 */
  2114. #define _INT2IP0 IPC7bits.INT2IP0
  2115. #define _INT2IP1 IPC7bits.INT2IP1
  2116. #define _INT2IP2 IPC7bits.INT2IP2
  2117. #define _U2RXIP0 IPC7bits.U2RXIP0
  2118. #define _U2RXIP1 IPC7bits.U2RXIP1
  2119. #define _U2RXIP2 IPC7bits.U2RXIP2
  2120. #define _U2TXIP0 IPC7bits.U2TXIP0
  2121. #define _U2TXIP1 IPC7bits.U2TXIP1
  2122. #define _U2TXIP2 IPC7bits.U2TXIP2
  2123. #define _INT2IP IPC7bits.INT2IP
  2124. #define _U2RXIP IPC7bits.U2RXIP
  2125. #define _U2TXIP IPC7bits.U2TXIP
  2126.  
  2127. /* IPC15 */
  2128. #define _RTCIP0 IPC15bits.RTCIP0
  2129. #define _RTCIP1 IPC15bits.RTCIP1
  2130. #define _RTCIP2 IPC15bits.RTCIP2
  2131. #define _RTCIP IPC15bits.RTCIP
  2132.  
  2133. /* IPC16 */
  2134. #define _U1ERIP0 IPC16bits.U1ERIP0
  2135. #define _U1ERIP1 IPC16bits.U1ERIP1
  2136. #define _U1ERIP2 IPC16bits.U1ERIP2
  2137. #define _U2ERIP0 IPC16bits.U2ERIP0
  2138. #define _U2ERIP1 IPC16bits.U2ERIP1
  2139. #define _U2ERIP2 IPC16bits.U2ERIP2
  2140. #define _CRCIP0 IPC16bits.CRCIP0
  2141. #define _CRCIP1 IPC16bits.CRCIP1
  2142. #define _CRCIP2 IPC16bits.CRCIP2
  2143. #define _U1ERIP IPC16bits.U1ERIP
  2144. #define _U2ERIP IPC16bits.U2ERIP
  2145. #define _CRCIP IPC16bits.CRCIP
  2146.  
  2147. /* IPC18 */
  2148. #define _HLVDIP0 IPC18bits.HLVDIP0
  2149. #define _HLVDIP1 IPC18bits.HLVDIP1
  2150. #define _HLVDIP2 IPC18bits.HLVDIP2
  2151. #define _HLVDIP IPC18bits.HLVDIP
  2152.  
  2153. /* IPC19 */
  2154. #define _CTMUIP0 IPC19bits.CTMUIP0
  2155. #define _CTMUIP1 IPC19bits.CTMUIP1
  2156. #define _CTMUIP2 IPC19bits.CTMUIP2
  2157. #define _CTMUIP IPC19bits.CTMUIP
  2158.  
  2159. /* INTTREG */
  2160. #define _VECNUM0 INTTREGbits.VECNUM0
  2161. #define _VECNUM1 INTTREGbits.VECNUM1
  2162. #define _VECNUM2 INTTREGbits.VECNUM2
  2163. #define _VECNUM3 INTTREGbits.VECNUM3
  2164. #define _VECNUM4 INTTREGbits.VECNUM4
  2165. #define _VECNUM5 INTTREGbits.VECNUM5
  2166. #define _VECNUM6 INTTREGbits.VECNUM6
  2167. #define _ILR0 INTTREGbits.ILR0
  2168. #define _ILR1 INTTREGbits.ILR1
  2169. #define _ILR2 INTTREGbits.ILR2
  2170. #define _ILR3 INTTREGbits.ILR3
  2171. #define _VHOLD INTTREGbits.VHOLD
  2172. #define _CPUIRQ INTTREGbits.CPUIRQ
  2173.  
  2174. /* T1CON */
  2175. #define _TCS T1CONbits.TCS
  2176. #define _TSYNC T1CONbits.TSYNC
  2177. #define _TCKPS0 T1CONbits.TCKPS0
  2178. #define _TCKPS1 T1CONbits.TCKPS1
  2179. #define _TGATE T1CONbits.TGATE
  2180. #define _TSIDL T1CONbits.TSIDL
  2181. #define _TON T1CONbits.TON
  2182. #define _TCKPS T1CONbits.TCKPS
  2183.  
  2184. /* T2CON */
  2185. /* Bitname _TCS cannot be defined because it is used by more than one SFR */
  2186. #define _T32 T2CONbits.T32
  2187. /* Bitname _TCKPS0 cannot be defined because it is used by more than one SFR */
  2188. /* Bitname _TCKPS1 cannot be defined because it is used by more than one SFR */
  2189. /* Bitname _TGATE cannot be defined because it is used by more than one SFR */
  2190. /* Bitname _TSIDL cannot be defined because it is used by more than one SFR */
  2191. /* Bitname _TON cannot be defined because it is used by more than one SFR */
  2192. /* Bitname _TCKPS cannot be defined because it is used by more than one SFR */
  2193.  
  2194. /* T3CON */
  2195. /* Bitname _TCS cannot be defined because it is used by more than one SFR */
  2196. /* Bitname _TCKPS0 cannot be defined because it is used by more than one SFR */
  2197. /* Bitname _TCKPS1 cannot be defined because it is used by more than one SFR */
  2198. /* Bitname _TGATE cannot be defined because it is used by more than one SFR */
  2199. /* Bitname _TSIDL cannot be defined because it is used by more than one SFR */
  2200. /* Bitname _TON cannot be defined because it is used by more than one SFR */
  2201. /* Bitname _TCKPS cannot be defined because it is used by more than one SFR */
  2202.  
  2203. /* IC1CON */
  2204. #define _ICM0 IC1CONbits.ICM0
  2205. #define _ICM1 IC1CONbits.ICM1
  2206. #define _ICM2 IC1CONbits.ICM2
  2207. #define _ICBNE IC1CONbits.ICBNE
  2208. #define _ICOV IC1CONbits.ICOV
  2209. #define _ICI0 IC1CONbits.ICI0
  2210. #define _ICI1 IC1CONbits.ICI1
  2211. #define _ICTMR IC1CONbits.ICTMR
  2212. #define _ICSIDL IC1CONbits.ICSIDL
  2213. #define _ICM IC1CONbits.ICM
  2214. #define _ICI IC1CONbits.ICI
  2215.  
  2216. /* OC1CON */
  2217. #define _OCM OC1CONbits.OCM
  2218. #define _OCTSEL OC1CONbits.OCTSEL
  2219. #define _OCFLT OC1CONbits.OCFLT
  2220. #define _OCSIDL OC1CONbits.OCSIDL
  2221. #define _OCM0 OC1CONbits.OCM0
  2222. #define _OCM1 OC1CONbits.OCM1
  2223. #define _OCM2 OC1CONbits.OCM2
  2224.  
  2225. /* I2C1CON */
  2226. #define _SEN I2C1CONbits.SEN
  2227. #define _RSEN I2C1CONbits.RSEN
  2228. #define _PEN I2C1CONbits.PEN
  2229. #define _RCEN I2C1CONbits.RCEN
  2230. #define _ACKEN I2C1CONbits.ACKEN
  2231. #define _ACKDT I2C1CONbits.ACKDT
  2232. #define _STREN I2C1CONbits.STREN
  2233. #define _GCEN I2C1CONbits.GCEN
  2234. #define _SMEN I2C1CONbits.SMEN
  2235. #define _DISSLW I2C1CONbits.DISSLW
  2236. #define _A10M I2C1CONbits.A10M
  2237. #define _IPMIEN I2C1CONbits.IPMIEN
  2238. #define _SCLREL I2C1CONbits.SCLREL
  2239. #define _I2CSIDL I2C1CONbits.I2CSIDL
  2240. #define _I2CEN I2C1CONbits.I2CEN
  2241.  
  2242. /* I2C1STAT */
  2243. #define _TBF I2C1STATbits.TBF
  2244. #define _RBF I2C1STATbits.RBF
  2245. #define _R_W I2C1STATbits.R_W
  2246. #define _S I2C1STATbits.S
  2247. #define _P I2C1STATbits.P
  2248. #define _D_A I2C1STATbits.D_A
  2249. #define _I2COV I2C1STATbits.I2COV
  2250. #define _IWCOL I2C1STATbits.IWCOL
  2251. #define _ADD10 I2C1STATbits.ADD10
  2252. #define _GCSTAT I2C1STATbits.GCSTAT
  2253. #define _BCL I2C1STATbits.BCL
  2254. #define _TRSTAT I2C1STATbits.TRSTAT
  2255. #define _ACKSTAT I2C1STATbits.ACKSTAT
  2256.  
  2257. /* U1MODE */
  2258. #define _STSEL U1MODEbits.STSEL
  2259. #define _PDSEL0 U1MODEbits.PDSEL0
  2260. #define _PDSEL1 U1MODEbits.PDSEL1
  2261. #define _BRGH U1MODEbits.BRGH
  2262. #define _RXINV U1MODEbits.RXINV
  2263. #define _ABAUD U1MODEbits.ABAUD
  2264. #define _LPBACK U1MODEbits.LPBACK
  2265. #define _WAKE U1MODEbits.WAKE
  2266. #define _UEN0 U1MODEbits.UEN0
  2267. #define _UEN1 U1MODEbits.UEN1
  2268. #define _RTSMD U1MODEbits.RTSMD
  2269. #define _IREN U1MODEbits.IREN
  2270. #define _USIDL U1MODEbits.USIDL
  2271. #define _UARTEN U1MODEbits.UARTEN
  2272. #define _PDSEL U1MODEbits.PDSEL
  2273. #define _UEN U1MODEbits.UEN
  2274.  
  2275. /* U1STA */
  2276. #define _URXDA U1STAbits.URXDA
  2277. #define _OERR U1STAbits.OERR
  2278. #define _FERR U1STAbits.FERR
  2279. #define _PERR U1STAbits.PERR
  2280. #define _RIDLE U1STAbits.RIDLE
  2281. #define _ADDEN U1STAbits.ADDEN
  2282. #define _URXISEL0 U1STAbits.URXISEL0
  2283. #define _URXISEL1 U1STAbits.URXISEL1
  2284. #define _TRMT U1STAbits.TRMT
  2285. #define _UTXBF U1STAbits.UTXBF
  2286. #define _UTXEN U1STAbits.UTXEN
  2287. #define _UTXBRK U1STAbits.UTXBRK
  2288. #define _UTXISEL0 U1STAbits.UTXISEL0
  2289. #define _UTXINV U1STAbits.UTXINV
  2290. #define _UTXISEL1 U1STAbits.UTXISEL1
  2291. #define _URXISEL U1STAbits.URXISEL
  2292.  
  2293. /* U2MODE */
  2294. /* Bitname _STSEL cannot be defined because it is used by more than one SFR */
  2295. /* Bitname _PDSEL0 cannot be defined because it is used by more than one SFR */
  2296. /* Bitname _PDSEL1 cannot be defined because it is used by more than one SFR */
  2297. /* Bitname _BRGH cannot be defined because it is used by more than one SFR */
  2298. /* Bitname _RXINV cannot be defined because it is used by more than one SFR */
  2299. /* Bitname _ABAUD cannot be defined because it is used by more than one SFR */
  2300. /* Bitname _LPBACK cannot be defined because it is used by more than one SFR */
  2301. /* Bitname _WAKE cannot be defined because it is used by more than one SFR */
  2302. /* Bitname _UEN0 cannot be defined because it is used by more than one SFR */
  2303. /* Bitname _UEN1 cannot be defined because it is used by more than one SFR */
  2304. /* Bitname _RTSMD cannot be defined because it is used by more than one SFR */
  2305. /* Bitname _IREN cannot be defined because it is used by more than one SFR */
  2306. /* Bitname _USIDL cannot be defined because it is used by more than one SFR */
  2307. /* Bitname _UARTEN cannot be defined because it is used by more than one SFR */
  2308. /* Bitname _PDSEL cannot be defined because it is used by more than one SFR */
  2309. /* Bitname _UEN cannot be defined because it is used by more than one SFR */
  2310.  
  2311. /* U2STA */
  2312. /* Bitname _URXDA cannot be defined because it is used by more than one SFR */
  2313. /* Bitname _OERR cannot be defined because it is used by more than one SFR */
  2314. /* Bitname _FERR cannot be defined because it is used by more than one SFR */
  2315. /* Bitname _PERR cannot be defined because it is used by more than one SFR */
  2316. /* Bitname _RIDLE cannot be defined because it is used by more than one SFR */
  2317. /* Bitname _ADDEN cannot be defined because it is used by more than one SFR */
  2318. /* Bitname _URXISEL0 cannot be defined because it is used by more than one SFR */
  2319. /* Bitname _URXISEL1 cannot be defined because it is used by more than one SFR */
  2320. /* Bitname _TRMT cannot be defined because it is used by more than one SFR */
  2321. /* Bitname _UTXBF cannot be defined because it is used by more than one SFR */
  2322. /* Bitname _UTXEN cannot be defined because it is used by more than one SFR */
  2323. /* Bitname _UTXBRK cannot be defined because it is used by more than one SFR */
  2324. /* Bitname _UTXISEL0 cannot be defined because it is used by more than one SFR */
  2325. /* Bitname _UTXINV cannot be defined because it is used by more than one SFR */
  2326. /* Bitname _UTXISEL1 cannot be defined because it is used by more than one SFR */
  2327. /* Bitname _URXISEL cannot be defined because it is used by more than one SFR */
  2328.  
  2329. /* SPI1STAT */
  2330. #define _SPIRBF SPI1STATbits.SPIRBF
  2331. #define _SPITBF SPI1STATbits.SPITBF
  2332. #define _SISEL SPI1STATbits.SISEL
  2333. #define _SR1MPT SPI1STATbits.SR1MPT
  2334. #define _SPIROV SPI1STATbits.SPIROV
  2335. #define _SRMPT SPI1STATbits.SRMPT
  2336. #define _SPIBEC SPI1STATbits.SPIBEC
  2337. #define _SPISIDL SPI1STATbits.SPISIDL
  2338. #define _SPIEN SPI1STATbits.SPIEN
  2339. #define _SISEL0 SPI1STATbits.SISEL0
  2340. #define _SISEL1 SPI1STATbits.SISEL1
  2341. #define _SISEL2 SPI1STATbits.SISEL2
  2342. #define _SPIBEC0 SPI1STATbits.SPIBEC0
  2343. #define _SPIBEC1 SPI1STATbits.SPIBEC1
  2344. #define _SPIBEC2 SPI1STATbits.SPIBEC2
  2345.  
  2346. /* SPI1CON1 */
  2347. #define _PPRE0 SPI1CON1bits.PPRE0
  2348. #define _PPRE1 SPI1CON1bits.PPRE1
  2349. #define _SPRE SPI1CON1bits.SPRE
  2350. #define _MSTEN SPI1CON1bits.MSTEN
  2351. #define _CKP SPI1CON1bits.CKP
  2352. #define _SSEN SPI1CON1bits.SSEN
  2353. #define _CKE SPI1CON1bits.CKE
  2354. #define _SMP SPI1CON1bits.SMP
  2355. #define _MODE16 SPI1CON1bits.MODE16
  2356. #define _DISSDO SPI1CON1bits.DISSDO
  2357. #define _DISSCK SPI1CON1bits.DISSCK
  2358. #define _PPRE SPI1CON1bits.PPRE
  2359. #define _SPRE0 SPI1CON1bits.SPRE0
  2360. #define _SPRE1 SPI1CON1bits.SPRE1
  2361. #define _SPRE2 SPI1CON1bits.SPRE2
  2362.  
  2363. /* SPI1CON2 */
  2364. #define _SPIBEN SPI1CON2bits.SPIBEN
  2365. #define _SPIFE SPI1CON2bits.SPIFE
  2366. #define _SPIFPOL SPI1CON2bits.SPIFPOL
  2367. #define _SPIFSD SPI1CON2bits.SPIFSD
  2368. #define _FRMEN SPI1CON2bits.FRMEN
  2369.  
  2370. /* TRISA */
  2371. #define _TRISA0 TRISAbits.TRISA0
  2372. #define _TRISA1 TRISAbits.TRISA1
  2373. #define _TRISA2 TRISAbits.TRISA2
  2374. #define _TRISA3 TRISAbits.TRISA3
  2375. #define _TRISA4 TRISAbits.TRISA4
  2376. #define _TRISA5 TRISAbits.TRISA5
  2377. #define _TRISA6 TRISAbits.TRISA6
  2378. #define _TRISA7 TRISAbits.TRISA7
  2379.  
  2380. /* PORTA */
  2381. #define _RA0 PORTAbits.RA0
  2382. #define _RA1 PORTAbits.RA1
  2383. #define _RA2 PORTAbits.RA2
  2384. #define _RA3 PORTAbits.RA3
  2385. #define _RA4 PORTAbits.RA4
  2386. #define _RA5 PORTAbits.RA5
  2387. #define _RA6 PORTAbits.RA6
  2388. #define _RA7 PORTAbits.RA7
  2389.  
  2390. /* LATA */
  2391. #define _LATA0 LATAbits.LATA0
  2392. #define _LATA1 LATAbits.LATA1
  2393. #define _LATA2 LATAbits.LATA2
  2394. #define _LATA3 LATAbits.LATA3
  2395. #define _LATA4 LATAbits.LATA4
  2396. #define _LATA5 LATAbits.LATA5
  2397. #define _LATA6 LATAbits.LATA6
  2398. #define _LATA7 LATAbits.LATA7
  2399.  
  2400. /* ODCA */
  2401. #define _ODA0 ODCAbits.ODA0
  2402. #define _ODA1 ODCAbits.ODA1
  2403. #define _ODA2 ODCAbits.ODA2
  2404. #define _ODA3 ODCAbits.ODA3
  2405. #define _ODA4 ODCAbits.ODA4
  2406. #define _ODA5 ODCAbits.ODA5
  2407. #define _ODA6 ODCAbits.ODA6
  2408. #define _ODA7 ODCAbits.ODA7
  2409.  
  2410. /* TRISB */
  2411. #define _TRISB0 TRISBbits.TRISB0
  2412. #define _TRISB1 TRISBbits.TRISB1
  2413. #define _TRISB2 TRISBbits.TRISB2
  2414. #define _TRISB3 TRISBbits.TRISB3
  2415. #define _TRISB4 TRISBbits.TRISB4
  2416. #define _TRISB5 TRISBbits.TRISB5
  2417. #define _TRISB6 TRISBbits.TRISB6
  2418. #define _TRISB7 TRISBbits.TRISB7
  2419. #define _TRISB8 TRISBbits.TRISB8
  2420. #define _TRISB9 TRISBbits.TRISB9
  2421. #define _TRISB10 TRISBbits.TRISB10
  2422. #define _TRISB11 TRISBbits.TRISB11
  2423. #define _TRISB12 TRISBbits.TRISB12
  2424. #define _TRISB13 TRISBbits.TRISB13
  2425. #define _TRISB14 TRISBbits.TRISB14
  2426. #define _TRISB15 TRISBbits.TRISB15
  2427.  
  2428. /* PORTB */
  2429. #define _RB0 PORTBbits.RB0
  2430. #define _RB1 PORTBbits.RB1
  2431. #define _RB2 PORTBbits.RB2
  2432. #define _RB3 PORTBbits.RB3
  2433. #define _RB4 PORTBbits.RB4
  2434. #define _RB5 PORTBbits.RB5
  2435. #define _RB6 PORTBbits.RB6
  2436. #define _RB7 PORTBbits.RB7
  2437. #define _RB8 PORTBbits.RB8
  2438. #define _RB9 PORTBbits.RB9
  2439. #define _RB10 PORTBbits.RB10
  2440. #define _RB11 PORTBbits.RB11
  2441. #define _RB12 PORTBbits.RB12
  2442. #define _RB13 PORTBbits.RB13
  2443. #define _RB14 PORTBbits.RB14
  2444. #define _RB15 PORTBbits.RB15
  2445.  
  2446. /* LATB */
  2447. #define _LATB0 LATBbits.LATB0
  2448. #define _LATB1 LATBbits.LATB1
  2449. #define _LATB2 LATBbits.LATB2
  2450. #define _LATB3 LATBbits.LATB3
  2451. #define _LATB4 LATBbits.LATB4
  2452. #define _LATB5 LATBbits.LATB5
  2453. #define _LATB6 LATBbits.LATB6
  2454. #define _LATB7 LATBbits.LATB7
  2455. #define _LATB8 LATBbits.LATB8
  2456. #define _LATB9 LATBbits.LATB9
  2457. #define _LATB10 LATBbits.LATB10
  2458. #define _LATB11 LATBbits.LATB11
  2459. #define _LATB12 LATBbits.LATB12
  2460. #define _LATB13 LATBbits.LATB13
  2461. #define _LATB14 LATBbits.LATB14
  2462. #define _LATB15 LATBbits.LATB15
  2463.  
  2464. /* ODCB */
  2465. #define _ODB0 ODCBbits.ODB0
  2466. #define _ODB1 ODCBbits.ODB1
  2467. #define _ODB2 ODCBbits.ODB2
  2468. #define _ODB3 ODCBbits.ODB3
  2469. #define _ODB4 ODCBbits.ODB4
  2470. #define _ODB5 ODCBbits.ODB5
  2471. #define _ODB6 ODCBbits.ODB6
  2472. #define _ODB7 ODCBbits.ODB7
  2473. #define _ODB8 ODCBbits.ODB8
  2474. #define _ODB9 ODCBbits.ODB9
  2475. #define _ODB10 ODCBbits.ODB10
  2476. #define _ODB11 ODCBbits.ODB11
  2477. #define _ODB12 ODCBbits.ODB12
  2478. #define _ODB13 ODCBbits.ODB13
  2479. #define _ODB14 ODCBbits.ODB14
  2480. #define _ODB15 ODCBbits.ODB15
  2481.  
  2482. /* PADCFG1 */
  2483. #define _RTSECSEL PADCFG1bits.RTSECSEL
  2484. #define _OC1TRIS PADCFG1bits.OC1TRIS
  2485. #define _SMBUSDEL PADCFG1bits.SMBUSDEL
  2486. #define _RTSECSEL0 PADCFG1bits.RTSECSEL0
  2487. #define _RTSECSEL1 PADCFG1bits.RTSECSEL1
  2488.  
  2489. /* AD1CON1 */
  2490. #define _DONE AD1CON1bits.DONE
  2491. #define _SAMP AD1CON1bits.SAMP
  2492. #define _ASAM AD1CON1bits.ASAM
  2493. #define _SSRC AD1CON1bits.SSRC
  2494. #define _FORM0 AD1CON1bits.FORM0
  2495. #define _FORM1 AD1CON1bits.FORM1
  2496. #define _ADSIDL AD1CON1bits.ADSIDL
  2497. #define _ADON AD1CON1bits.ADON
  2498. #define _SSRC0 AD1CON1bits.SSRC0
  2499. #define _SSRC1 AD1CON1bits.SSRC1
  2500. #define _SSRC2 AD1CON1bits.SSRC2
  2501. #define _FORM AD1CON1bits.FORM
  2502.  
  2503. /* AD1CON2 */
  2504. #define _ALTS AD1CON2bits.ALTS
  2505. #define _BUFM AD1CON2bits.BUFM
  2506. #define _SMPI AD1CON2bits.SMPI
  2507. #define _BUFS AD1CON2bits.BUFS
  2508. #define _CSCNA AD1CON2bits.CSCNA
  2509. #define _OFFCAL AD1CON2bits.OFFCAL
  2510. #define _VCFG AD1CON2bits.VCFG
  2511. #define _SMPI0 AD1CON2bits.SMPI0
  2512. #define _SMPI1 AD1CON2bits.SMPI1
  2513. #define _SMPI2 AD1CON2bits.SMPI2
  2514. #define _SMPI3 AD1CON2bits.SMPI3
  2515. #define _VCFG0 AD1CON2bits.VCFG0
  2516. #define _VCFG1 AD1CON2bits.VCFG1
  2517. #define _VCFG2 AD1CON2bits.VCFG2
  2518.  
  2519. /* AD1CON3 */
  2520. #define _ADCS AD1CON3bits.ADCS
  2521. #define _SAMC AD1CON3bits.SAMC
  2522. #define _PUMPEN AD1CON3bits.PUMPEN
  2523. #define _EXTSAM AD1CON3bits.EXTSAM
  2524. #define _ADRC AD1CON3bits.ADRC
  2525. #define _ADCS0 AD1CON3bits.ADCS0
  2526. #define _ADCS1 AD1CON3bits.ADCS1
  2527. #define _ADCS2 AD1CON3bits.ADCS2
  2528. #define _ADCS3 AD1CON3bits.ADCS3
  2529. #define _ADCS4 AD1CON3bits.ADCS4
  2530. #define _ADCS5 AD1CON3bits.ADCS5
  2531. #define _ADCS6 AD1CON3bits.ADCS6
  2532. #define _ADCS7 AD1CON3bits.ADCS7
  2533. #define _SAMC0 AD1CON3bits.SAMC0
  2534. #define _SAMC1 AD1CON3bits.SAMC1
  2535. #define _SAMC2 AD1CON3bits.SAMC2
  2536. #define _SAMC3 AD1CON3bits.SAMC3
  2537. #define _SAMC4 AD1CON3bits.SAMC4
  2538.  
  2539. /* AD1CHS */
  2540. #define _CH0SA AD1CHSbits.CH0SA
  2541. #define _CH0NA AD1CHSbits.CH0NA
  2542. #define _CH0SB AD1CHSbits.CH0SB
  2543. #define _CH0NB AD1CHSbits.CH0NB
  2544. #define _CH0SA0 AD1CHSbits.CH0SA0
  2545. #define _CH0SA1 AD1CHSbits.CH0SA1
  2546. #define _CH0SA2 AD1CHSbits.CH0SA2
  2547. #define _CH0SA3 AD1CHSbits.CH0SA3
  2548. #define _CH0SA4 AD1CHSbits.CH0SA4
  2549. #define _CH0SB0 AD1CHSbits.CH0SB0
  2550. #define _CH0SB1 AD1CHSbits.CH0SB1
  2551. #define _CH0SB2 AD1CHSbits.CH0SB2
  2552. #define _CH0SB3 AD1CHSbits.CH0SB3
  2553.  
  2554. /* AD1PCFG */
  2555. #define _PCFG0 AD1PCFGbits.PCFG0
  2556. #define _PCFG1 AD1PCFGbits.PCFG1
  2557. #define _PCFG2 AD1PCFGbits.PCFG2
  2558. #define _PCFG3 AD1PCFGbits.PCFG3
  2559. #define _PCFG4 AD1PCFGbits.PCFG4
  2560. #define _PCFG5 AD1PCFGbits.PCFG5
  2561. #define _PCFG10 AD1PCFGbits.PCFG10
  2562. #define _PCFG11 AD1PCFGbits.PCFG11
  2563. #define _PCFG12 AD1PCFGbits.PCFG12
  2564.  
  2565. /* AD1CSSL */
  2566. #define _CSSL0 AD1CSSLbits.CSSL0
  2567. #define _CSSL1 AD1CSSLbits.CSSL1
  2568. #define _CSSL2 AD1CSSLbits.CSSL2
  2569. #define _CSSL3 AD1CSSLbits.CSSL3
  2570. #define _CSSL4 AD1CSSLbits.CSSL4
  2571. #define _CSSL5 AD1CSSLbits.CSSL5
  2572. #define _CSSL10 AD1CSSLbits.CSSL10
  2573. #define _CSSL11 AD1CSSLbits.CSSL11
  2574. #define _CSSL12 AD1CSSLbits.CSSL12
  2575.  
  2576. /* CTMUCON */
  2577. #define _EDG1STAT CTMUCONbits.EDG1STAT
  2578. #define _EDG2STAT CTMUCONbits.EDG2STAT
  2579. #define _EDG1SEL CTMUCONbits.EDG1SEL
  2580. #define _EDG1POL CTMUCONbits.EDG1POL
  2581. #define _EDG2SEL CTMUCONbits.EDG2SEL
  2582. #define _EDG2POL CTMUCONbits.EDG2POL
  2583. #define _CTTRIG CTMUCONbits.CTTRIG
  2584. #define _IDISSEN CTMUCONbits.IDISSEN
  2585. #define _EDGSEQEN CTMUCONbits.EDGSEQEN
  2586. #define _EDGEN CTMUCONbits.EDGEN
  2587. #define _TGEN CTMUCONbits.TGEN
  2588. #define _CTMUSIDL CTMUCONbits.CTMUSIDL
  2589. #define _CTMUEN CTMUCONbits.CTMUEN
  2590. #define _EDG1SEL0 CTMUCONbits.EDG1SEL0
  2591. #define _EDG1SEL1 CTMUCONbits.EDG1SEL1
  2592. #define _EDG2SEL0 CTMUCONbits.EDG2SEL0
  2593. #define _EDG2SEL1 CTMUCONbits.EDG2SEL1
  2594.  
  2595. /* CTMUICON */
  2596. #define _IRNG CTMUICONbits.IRNG
  2597. #define _ITRIM CTMUICONbits.ITRIM
  2598. #define _IRNG0 CTMUICONbits.IRNG0
  2599. #define _IRNG1 CTMUICONbits.IRNG1
  2600. #define _ITRIM0 CTMUICONbits.ITRIM0
  2601. #define _ITRIM1 CTMUICONbits.ITRIM1
  2602. #define _ITRIM2 CTMUICONbits.ITRIM2
  2603. #define _ITRIM3 CTMUICONbits.ITRIM3
  2604. #define _ITRIM4 CTMUICONbits.ITRIM4
  2605. #define _ITRIM5 CTMUICONbits.ITRIM5
  2606.  
  2607. /* ALCFGRPT */
  2608. #define _ARPT ALCFGRPTbits.ARPT
  2609. #define _ALRMPTR0 ALCFGRPTbits.ALRMPTR0
  2610. #define _ALRMPTR1 ALCFGRPTbits.ALRMPTR1
  2611. #define _AMASK ALCFGRPTbits.AMASK
  2612. #define _CHIME ALCFGRPTbits.CHIME
  2613. #define _ALRMEN ALCFGRPTbits.ALRMEN
  2614. #define _ARPT0 ALCFGRPTbits.ARPT0
  2615. #define _ARPT1 ALCFGRPTbits.ARPT1
  2616. #define _ARPT2 ALCFGRPTbits.ARPT2
  2617. #define _ARPT3 ALCFGRPTbits.ARPT3
  2618. #define _ARPT4 ALCFGRPTbits.ARPT4
  2619. #define _ARPT5 ALCFGRPTbits.ARPT5
  2620. #define _ARPT6 ALCFGRPTbits.ARPT6
  2621. #define _ARPT7 ALCFGRPTbits.ARPT7
  2622. #define _ALRMPTR ALCFGRPTbits.ALRMPTR
  2623. #define _AMASK0 ALCFGRPTbits.AMASK0
  2624. #define _AMASK1 ALCFGRPTbits.AMASK1
  2625. #define _AMASK2 ALCFGRPTbits.AMASK2
  2626. #define _AMASK3 ALCFGRPTbits.AMASK3
  2627.  
  2628. /* RCFGCAL */
  2629. #define _CAL RCFGCALbits.CAL
  2630. #define _RTCPTR0 RCFGCALbits.RTCPTR0
  2631. #define _RTCPTR1 RCFGCALbits.RTCPTR1
  2632. #define _RTCOE RCFGCALbits.RTCOE
  2633. #define _HALFSEC RCFGCALbits.HALFSEC
  2634. #define _RTCSYNC RCFGCALbits.RTCSYNC
  2635. #define _RTCWREN RCFGCALbits.RTCWREN
  2636. #define _RTCEN RCFGCALbits.RTCEN
  2637. #define _CAL0 RCFGCALbits.CAL0
  2638. #define _CAL1 RCFGCALbits.CAL1
  2639. #define _CAL2 RCFGCALbits.CAL2
  2640. #define _CAL3 RCFGCALbits.CAL3
  2641. #define _CAL4 RCFGCALbits.CAL4
  2642. #define _CAL5 RCFGCALbits.CAL5
  2643. #define _CAL6 RCFGCALbits.CAL6
  2644. #define _CAL7 RCFGCALbits.CAL7
  2645. #define _RTCPTR RCFGCALbits.RTCPTR
  2646.  
  2647. /* CMSTAT */
  2648. #define _C1OUT CMSTATbits.C1OUT
  2649. #define _C2OUT CMSTATbits.C2OUT
  2650. #define _C1EVT CMSTATbits.C1EVT
  2651. #define _C2EVT CMSTATbits.C2EVT
  2652. #define _CMIDL CMSTATbits.CMIDL
  2653.  
  2654. /* CVRCON */
  2655. #define _CVR CVRCONbits.CVR
  2656. #define _CVRSS CVRCONbits.CVRSS
  2657. #define _CVRR CVRCONbits.CVRR
  2658. #define _CVROE CVRCONbits.CVROE
  2659. #define _CVREN CVRCONbits.CVREN
  2660. #define _CVR0 CVRCONbits.CVR0
  2661. #define _CVR1 CVRCONbits.CVR1
  2662. #define _CVR2 CVRCONbits.CVR2
  2663. #define _CVR3 CVRCONbits.CVR3
  2664.  
  2665. /* CM1CON */
  2666. /* Bitname _CCH cannot be defined because it is used by more than one SFR */
  2667. /* Bitname _CREF cannot be defined because it is used by more than one SFR */
  2668. /* Bitname _EVPOL cannot be defined because it is used by more than one SFR */
  2669. /* Bitname _COUT cannot be defined because it is used by more than one SFR */
  2670. /* Bitname _CEVT cannot be defined because it is used by more than one SFR */
  2671. /* Bitname _CLPWR cannot be defined because it is used by more than one SFR */
  2672. /* Bitname _CPOL cannot be defined because it is used by more than one SFR */
  2673. /* Bitname _COE cannot be defined because it is used by more than one SFR */
  2674. /* Bitname _CON cannot be defined because it is used by more than one SFR */
  2675. /* Bitname _CCH0 cannot be defined because it is used by more than one SFR */
  2676. /* Bitname _CCH1 cannot be defined because it is used by more than one SFR */
  2677. /* Bitname _EVPOL0 cannot be defined because it is used by more than one SFR */
  2678. /* Bitname _EVPOL1 cannot be defined because it is used by more than one SFR */
  2679.  
  2680. /* CM2CON */
  2681. /* Bitname _CCH cannot be defined because it is used by more than one SFR */
  2682. /* Bitname _CREF cannot be defined because it is used by more than one SFR */
  2683. /* Bitname _EVPOL cannot be defined because it is used by more than one SFR */
  2684. /* Bitname _COUT cannot be defined because it is used by more than one SFR */
  2685. /* Bitname _CEVT cannot be defined because it is used by more than one SFR */
  2686. /* Bitname _CLPWR cannot be defined because it is used by more than one SFR */
  2687. /* Bitname _CPOL cannot be defined because it is used by more than one SFR */
  2688. /* Bitname _COE cannot be defined because it is used by more than one SFR */
  2689. /* Bitname _CON cannot be defined because it is used by more than one SFR */
  2690. /* Bitname _CCH0 cannot be defined because it is used by more than one SFR */
  2691. /* Bitname _CCH1 cannot be defined because it is used by more than one SFR */
  2692. /* Bitname _EVPOL0 cannot be defined because it is used by more than one SFR */
  2693. /* Bitname _EVPOL1 cannot be defined because it is used by more than one SFR */
  2694.  
  2695. /* CRCCON */
  2696. #define _PLEN CRCCONbits.PLEN
  2697. #define _CRCGO CRCCONbits.CRCGO
  2698. #define _CRCMPT CRCCONbits.CRCMPT
  2699. #define _CRCFUL CRCCONbits.CRCFUL
  2700. #define _VWORD CRCCONbits.VWORD
  2701. #define _CSIDL CRCCONbits.CSIDL
  2702. #define _PLEN0 CRCCONbits.PLEN0
  2703. #define _PLEN1 CRCCONbits.PLEN1
  2704. #define _PLEN2 CRCCONbits.PLEN2
  2705. #define _PLEN3 CRCCONbits.PLEN3
  2706. #define _VWORD0 CRCCONbits.VWORD0
  2707. #define _VWORD1 CRCCONbits.VWORD1
  2708. #define _VWORD2 CRCCONbits.VWORD2
  2709. #define _VWORD3 CRCCONbits.VWORD3
  2710. #define _VWORD4 CRCCONbits.VWORD4
  2711.  
  2712. /* RCON */
  2713. #define _POR RCONbits.POR
  2714. #define _BOR RCONbits.BOR
  2715. #define _IDLE RCONbits.IDLE
  2716. #define _SLEEP RCONbits.SLEEP
  2717. #define _WDTO RCONbits.WDTO
  2718. #define _SWDTEN RCONbits.SWDTEN
  2719. #define _SWR RCONbits.SWR
  2720. #define _EXTR RCONbits.EXTR
  2721. #define _PMSLP RCONbits.PMSLP
  2722. #define _DPSLP RCONbits.DPSLP
  2723. #define _SBOREN RCONbits.SBOREN
  2724. #define _IOPUWR RCONbits.IOPUWR
  2725. #define _TRAPR RCONbits.TRAPR
  2726. #define _VREGS RCONbits.VREGS
  2727.  
  2728. /* OSCCON */
  2729. #define _OSWEN OSCCONbits.OSWEN
  2730. #define _SOSCEN OSCCONbits.SOSCEN
  2731. #define _CF OSCCONbits.CF
  2732. #define _LOCK OSCCONbits.LOCK
  2733. #define _CLKLOCK OSCCONbits.CLKLOCK
  2734. #define _NOSC OSCCONbits.NOSC
  2735. #define _COSC OSCCONbits.COSC
  2736. #define _NOSC0 OSCCONbits.NOSC0
  2737. #define _NOSC1 OSCCONbits.NOSC1
  2738. #define _NOSC2 OSCCONbits.NOSC2
  2739. #define _COSC0 OSCCONbits.COSC0
  2740. #define _COSC1 OSCCONbits.COSC1
  2741. #define _COSC2 OSCCONbits.COSC2
  2742.  
  2743. /* CLKDIV */
  2744. #define _RCDIV CLKDIVbits.RCDIV
  2745. #define _DOZEN CLKDIVbits.DOZEN
  2746. #define _DOZE CLKDIVbits.DOZE
  2747. #define _ROI CLKDIVbits.ROI
  2748. #define _RCDIV0 CLKDIVbits.RCDIV0
  2749. #define _RCDIV1 CLKDIVbits.RCDIV1
  2750. #define _RCDIV2 CLKDIVbits.RCDIV2
  2751. #define _DOZE0 CLKDIVbits.DOZE0
  2752. #define _DOZE1 CLKDIVbits.DOZE1
  2753. #define _DOZE2 CLKDIVbits.DOZE2
  2754.  
  2755. /* OSCTUN */
  2756. #define _TUN OSCTUNbits.TUN
  2757. #define _TUN0 OSCTUNbits.TUN0
  2758. #define _TUN1 OSCTUNbits.TUN1
  2759. #define _TUN2 OSCTUNbits.TUN2
  2760. #define _TUN3 OSCTUNbits.TUN3
  2761. #define _TUN4 OSCTUNbits.TUN4
  2762. #define _TUN5 OSCTUNbits.TUN5
  2763.  
  2764. /* REFOCON */
  2765. #define _RODIV REFOCONbits.RODIV
  2766. #define _ROSEL REFOCONbits.ROSEL
  2767. #define _ROSSLP REFOCONbits.ROSSLP
  2768. #define _ROEN REFOCONbits.ROEN
  2769. #define _RODIV0 REFOCONbits.RODIV0
  2770. #define _RODIV1 REFOCONbits.RODIV1
  2771. #define _RODIV2 REFOCONbits.RODIV2
  2772. #define _RODIV3 REFOCONbits.RODIV3
  2773.  
  2774. /* HLVDCON */
  2775. #define _HLVDL HLVDCONbits.HLVDL
  2776. #define _IRVST HLVDCONbits.IRVST
  2777. #define _BGVST HLVDCONbits.BGVST
  2778. #define _VDIR HLVDCONbits.VDIR
  2779. #define _HLSIDL HLVDCONbits.HLSIDL
  2780. #define _HLVDEN HLVDCONbits.HLVDEN
  2781. #define _HLVDL0 HLVDCONbits.HLVDL0
  2782. #define _HLVDL1 HLVDCONbits.HLVDL1
  2783. #define _HLVDL2 HLVDCONbits.HLVDL2
  2784. #define _HLVDL3 HLVDCONbits.HLVDL3
  2785.  
  2786. /* DSCON */
  2787. #define _RELEASE DSCONbits.RELEASE
  2788. #define _DSBOR DSCONbits.DSBOR
  2789. #define _DSEN DSCONbits.DSEN
  2790.  
  2791. /* DSWSRC */
  2792. #define _DSPOR DSWSRCbits.DSPOR
  2793. #define _DSMCLR DSWSRCbits.DSMCLR
  2794. #define _DSRTCC DSWSRCbits.DSRTCC
  2795. #define _DSWDT DSWSRCbits.DSWDT
  2796. #define _DSFLT DSWSRCbits.DSFLT
  2797. #define _DSINT0 DSWSRCbits.DSINT0
  2798.  
  2799. /* NVMCON */
  2800. #define _NVMOP NVMCONbits.NVMOP
  2801. #define _ERASE NVMCONbits.ERASE
  2802. #define _PGMONLY NVMCONbits.PGMONLY
  2803. #define _WRERR NVMCONbits.WRERR
  2804. #define _WREN NVMCONbits.WREN
  2805. #define _WR NVMCONbits.WR
  2806. #define _NVMOP0 NVMCONbits.NVMOP0
  2807. #define _NVMOP1 NVMCONbits.NVMOP1
  2808. #define _NVMOP2 NVMCONbits.NVMOP2
  2809. #define _NVMOP3 NVMCONbits.NVMOP3
  2810. #define _NVMOP4 NVMCONbits.NVMOP4
  2811. #define _NVMOP5 NVMCONbits.NVMOP5
  2812.  
  2813. /* NVMKEY */
  2814. #define _NVMKEY NVMKEYbits.NVMKEY
  2815. #define _NVMKEY0 NVMKEYbits.NVMKEY0
  2816. #define _NVMKEY1 NVMKEYbits.NVMKEY1
  2817. #define _NVMKEY2 NVMKEYbits.NVMKEY2
  2818. #define _NVMKEY3 NVMKEYbits.NVMKEY3
  2819. #define _NVMKEY4 NVMKEYbits.NVMKEY4
  2820. #define _NVMKEY5 NVMKEYbits.NVMKEY5
  2821. #define _NVMKEY6 NVMKEYbits.NVMKEY6
  2822. #define _NVMKEY7 NVMKEYbits.NVMKEY7
  2823.  
  2824. /* PMD1 */
  2825. #define _ADC1MD PMD1bits.ADC1MD
  2826. #define _SPI1MD PMD1bits.SPI1MD
  2827. #define _U1MD PMD1bits.U1MD
  2828. #define _U2MD PMD1bits.U2MD
  2829. #define _I2C1MD PMD1bits.I2C1MD
  2830. #define _T1MD PMD1bits.T1MD
  2831. #define _T2MD PMD1bits.T2MD
  2832. #define _T3MD PMD1bits.T3MD
  2833.  
  2834. /* PMD2 */
  2835. #define _OC1MD PMD2bits.OC1MD
  2836. #define _IC1MD PMD2bits.IC1MD
  2837.  
  2838. /* PMD3 */
  2839. #define _CRCPMD PMD3bits.CRCPMD
  2840. #define _RTCCMD PMD3bits.RTCCMD
  2841. #define _CMPMD PMD3bits.CMPMD
  2842.  
  2843. /* PMD4 */
  2844. #define _HLVDMD PMD4bits.HLVDMD
  2845. #define _CTMUMD PMD4bits.CTMUMD
  2846. #define _REFOMD PMD4bits.REFOMD
  2847. #define _EEMD PMD4bits.EEMD
  2848.  
  2849.  
  2850. /* ---------------------------------------------------------- */
  2851. /* Some useful macros for inline assembler instructions       */
  2852. /* ---------------------------------------------------------- */
  2853.  
  2854. #define Nop()    __builtin_nop()
  2855. #define ClrWdt() {__asm__ volatile ("clrwdt");}
  2856. #define Sleep()  {__asm__ volatile ("pwrsav #0");}
  2857. #define Idle()   {__asm__ volatile ("pwrsav #1");}
  2858.  
  2859. /*----------------------------------------------------------- */
  2860. /* Some useful macros for allocating data memory              */
  2861. /*----------------------------------------------------------- */
  2862.  
  2863. /* The following macros require an argument N that specifies  */
  2864. /* alignment. N must a power of two, minimum value = 2.       */
  2865. /* For example, to declare an uninitialized array that is     */
  2866. /* aligned to a 32 byte address:                              */
  2867. /*                                                            */
  2868. /* int _BSS(32) buf[16];                                      */
  2869. /*                                                            */
  2870. /* To declare an initialized array without special            */
  2871. /* alignment:                                                 */
  2872. /*                                                            */
  2873. /* int _DATA(2) table1[] = {0, 1, 1, 2, 3, 5, 8, 13, 21};     */
  2874. /*                                                            */
  2875. #define _BSS(N)    __attribute__((aligned(N)))
  2876. #define _DATA(N)   __attribute__((aligned(N)))
  2877.  
  2878. /* The following macros do not require an argument. They can  */
  2879. /* be used to locate a variable in persistent data memory or  */
  2880. /* in near data memory. For example, to declare two variables */
  2881. /* that retain their values across a device reset:            */
  2882. /*                                                            */
  2883. /* int _PERSISTENT var1,var2;                                 */
  2884. /*                                                            */
  2885. #define _PERSISTENT __attribute__((persistent))
  2886. #define _NEAR       __attribute__((near))
  2887.  
  2888. /* ---------------------------------------------------------- */
  2889. /* Some useful macros for declaring functions                 */
  2890. /* ---------------------------------------------------------- */
  2891.  
  2892. /* The following macros can be used to declare interrupt      */
  2893. /* service routines (ISRs). For example, to declare an ISR    */
  2894. /* for the timer1 interrupt:                                  */
  2895. /*                                                            */
  2896. /* void _ISR _T1Interrupt(void);                              */
  2897. /*                                                            */
  2898. /* To declare an ISR for the SPI1 interrupt with fast         */
  2899. /* context save:                                              */
  2900. /*                                                            */
  2901. /* void _ISRFAST _SPI1Interrupt(void);                        */
  2902. /*                                                            */
  2903. /* Note: ISRs will be installed into the interrupt vector     */
  2904. /* tables automatically if the reserved names listed in the   */
  2905. /* MPLAB C30 Compiler User's Guide (DS51284) are used.        */
  2906. /*                                                            */
  2907. #define _ISR __attribute__((interrupt))
  2908. #define _ISRFAST __attribute__((interrupt, shadow))
  2909.  
  2910. /* ---------------------------------------------------------- */
  2911. /* Some useful macros for changing the CPU IPL                */
  2912. /* ---------------------------------------------------------- */
  2913.  
  2914. /* The following macros can be used to modify the current CPU */
  2915. /* IPL. The definition of the macro may vary from device to   */
  2916. /* device.                                                    */
  2917. /*                                                            */
  2918. /* To safely set the CPU IPL, use SET_CPU_IPL(ipl); the       */
  2919. /* valid range of ipl is 0-7, it may be any expression.       */
  2920. /*                                                            */
  2921. /* SET_CPU_IPL(7);                                            */
  2922. /*                                                            */
  2923. /* To preserve the current IPL and save it use                */
  2924. /* SET_AND_SAVE_CPU_IPL(save_to, ipl); the valid range of ipl */
  2925. /* is 0-7 and may be any expression, save_to should denote    */
  2926. /* some temporary storage.                                    */
  2927. /*                                                            */
  2928. /* int old_ipl;                                               */
  2929. /*                                                            */
  2930. /* SET_AND_SAVE_CPU_IPL(old_ipl, 7);                          */
  2931. /*                                                            */
  2932. /* The IPL can be restored with RESTORE_CPU_IPL(saved_to)     */
  2933. /*                                                            */
  2934. /* RESTORE_CPU_IPL(old_ipl);                                  */
  2935.  
  2936. #define SET_CPU_IPL(ipl) {       \
  2937.   int DISI_save;                 \
  2938.                                  \
  2939.   DISI_save = DISICNT;           \
  2940.   asm volatile ("disi #0x3FFF"); \
  2941.   SRbits.IPL = ipl;              \
  2942.   DISICNT = DISI_save; } (void) 0;
  2943.  
  2944. #define SET_AND_SAVE_CPU_IPL(save_to, ipl) { \
  2945.   save_to = SRbits.IPL; \
  2946.   SET_CPU_IPL(ipl); } (void) 0;
  2947.  
  2948. #define RESTORE_CPU_IPL(saved_to) SET_CPU_IPL(saved_to)
  2949.  
  2950.  
  2951.  
  2952. /* -------------------------------------------------------- */
  2953. /* Macros for setting device configuration registers        */
  2954. /* -------------------------------------------------------- */
  2955.  
  2956. /* Register FBS (0xf80000)                               */
  2957.  
  2958. extern __attribute__((space(prog))) int _FBS;
  2959. #define _FBS(x) __attribute__((section("__FBS.sec"),space(prog))) int _FBS = (x);
  2960.  
  2961. /*
  2962. ** Only one invocation of FBS should appear in a project,
  2963. ** at the top of a C source file (outside of any function).
  2964. **
  2965. ** The following constants can be used to set FBS.
  2966. ** Multiple options may be combined, as shown:
  2967. **
  2968. ** _FBS( OPT1_ON & OPT2_OFF & OPT3_PLL )
  2969. **
  2970. **   Boot Segment Code Protect:
  2971. **     BSS_HI2K             High Security Boot Protect 000000 - 002BFE
  2972. **     BSS_HI1K             High Security Boot Protect 000000 - 000AFE
  2973. **     BSS_STD2K            Standard Security Boot Protect 000000 - 002BFE
  2974. **     BSS_STD1K            Standard Security Boot Protect 000000 - 000AFE
  2975. **     BSS_OFF              Disabled
  2976. **
  2977. **   Boot Segment Write Protect Enable:
  2978. **     BWRP_ON              Enabled
  2979. **     BWRP_OFF             Disabled
  2980. **
  2981. */
  2982.  
  2983. #define BSS_HI2K             0xFFF3
  2984. #define BSS_HI1K             0xFFF5
  2985. #define BSS_STD2K            0xFFFB
  2986. #define BSS_STD1K            0xFFFD
  2987. #define BSS_OFF              0xFFFF
  2988.  
  2989. #define BWRP_ON              0xFFFE
  2990. #define BWRP_OFF             0xFFFF
  2991.  
  2992. /* Register FGS (0xf80004)                               */
  2993.  
  2994. extern __attribute__((space(prog))) int _FGS;
  2995. #define _FGS(x) __attribute__((section("__FGS.sec"),space(prog))) int _FGS = (x);
  2996.  
  2997. /*
  2998. ** Only one invocation of FGS should appear in a project,
  2999. ** at the top of a C source file (outside of any function).
  3000. **
  3001. ** The following constants can be used to set FGS.
  3002. ** Multiple options may be combined, as shown:
  3003. **
  3004. ** _FGS( OPT1_ON & OPT2_OFF & OPT3_PLL )
  3005. **
  3006. **   General Segment Code Protect:
  3007. **     GCP_ON               Enabled
  3008. **     GCP_OFF              Disabled
  3009. **
  3010. **   General Segment Write Protect Enable:
  3011. **     GWRP_ON              Enabled
  3012. **     GWRP_OFF             Disabled
  3013. **
  3014. */
  3015.  
  3016. #define GCP_ON               0xFFFD
  3017. #define GCP_OFF              0xFFFF
  3018.  
  3019. #define GWRP_ON              0xFFFE
  3020. #define GWRP_OFF             0xFFFF
  3021.  
  3022. /* Register FOSCSEL (0xf80006)                               */
  3023.  
  3024. extern __attribute__((space(prog))) int _FOSCSEL;
  3025. #define _FOSCSEL(x) __attribute__((section("__FOSCSEL.sec"),space(prog))) int _FOSCSEL = (x);
  3026.  
  3027. /*
  3028. ** Only one invocation of FOSCSEL should appear in a project,
  3029. ** at the top of a C source file (outside of any function).
  3030. **
  3031. ** The following constants can be used to set FOSCSEL.
  3032. ** Multiple options may be combined, as shown:
  3033. **
  3034. ** _FOSCSEL( OPT1_ON & OPT2_OFF & OPT3_PLL )
  3035. **
  3036. **   Initial Oscillator Select:
  3037. **     FNOSC_FRC            Fast RC Oscillator (FRC)
  3038. **     FNOSC_FRCPLL         Fast RC Oscillator with PLL Module (FRCPLL)
  3039. **     FNOSC_PRI            Primary Oscillator (MS, HS, EC)
  3040. **     FNOSC_PRIPLL         Primary Oscillator with PLL Module (MSPLL, HSPLL, ECPLL)
  3041. **     FNOSC_SOSC           Secondary Oscillator (SOSC)
  3042. **     FNOSC_LPRC           Low Power RC Oscillator (LPRC)
  3043. **     FNOSC_LPFRC          Low Power Fast RC Oscillator With Postscaler - 500kHz (LPFRC)
  3044. **     FNOSC_FRCDIV         Fast RC Oscillator With Postscaler (FRCDIV)
  3045. **
  3046. **   Two Speed Start-up:
  3047. **     IESO_OFF             Disabled
  3048. **     IESO_ON              Enabled
  3049. **
  3050. */
  3051.  
  3052. #define FNOSC_FRC            0xFFF8
  3053. #define FNOSC_FRCPLL         0xFFF9
  3054. #define FNOSC_PRI            0xFFFA
  3055. #define FNOSC_PRIPLL         0xFFFB
  3056. #define FNOSC_SOSC           0xFFFC
  3057. #define FNOSC_LPRC           0xFFFD
  3058. #define FNOSC_LPFRC          0xFFFE
  3059. #define FNOSC_FRCDIV         0xFFFF
  3060.  
  3061. #define IESO_OFF             0xFF7F
  3062. #define IESO_ON              0xFFFF
  3063.  
  3064. /* Register FOSC (0xf80008)                               */
  3065.  
  3066. extern __attribute__((space(prog))) int _FOSC;
  3067. #define _FOSC(x) __attribute__((section("__FOSC.sec"),space(prog))) int _FOSC = (x);
  3068.  
  3069. /*
  3070. ** Only one invocation of FOSC should appear in a project,
  3071. ** at the top of a C source file (outside of any function).
  3072. **
  3073. ** The following constants can be used to set FOSC.
  3074. ** Multiple options may be combined, as shown:
  3075. **
  3076. ** _FOSC( OPT1_ON & OPT2_OFF & OPT3_PLL )
  3077. **
  3078. **   Clock switching and Fail-Safe Clock monitor:
  3079. **     FCKSM_CSECME         Both Clock Switching and Monitor Enabled
  3080. **     FCKSM_CSECMD         Clock Switching Enabled, Clock Monitor Disabled
  3081. **     FCKSM_CSDCMD         Both Clock Switching and Monitor Disabled
  3082. **
  3083. **   Secondary Oscillator Select:
  3084. **     SOSCSEL_SOSCLP       Low Power Secondary Oscillator
  3085. **     SOSCSEL_SOSCHP       High Power Secondary Oscillator
  3086. **
  3087. **   Primary Oscillator Frequency Range:
  3088. **     POSCFREQ_LS          Low Speed (< 100kHz)
  3089. **     POSCFREQ_MS          Mid Speed (100kHz - 8MHz)
  3090. **     POSCFREQ_HS          High Speed (> 8MHz)
  3091. **
  3092. **   OSCO Pin Configuration:
  3093. **     OSCIOFNC_ON          OSCO Pin Has Digital I/O Function (RA3)
  3094. **     OSCIOFNC_OFF         OSCO Pin Has Clock Out Function (CLKO)
  3095. **
  3096. **   Oscillator Selection:
  3097. **     POSCMOD_EC           External clock
  3098. **     POSCMOD_XT           XT oscillator
  3099. **     POSCMOD_HS           HS oscillator
  3100. **     POSCMOD_NONE         Primary disabled
  3101. **
  3102. */
  3103.  
  3104. #define FCKSM_CSECME         0xFF3F
  3105. #define FCKSM_CSECMD         0xFF7F
  3106. #define FCKSM_CSDCMD         0xFFBF
  3107.  
  3108. #define SOSCSEL_SOSCLP       0xFFDF
  3109. #define SOSCSEL_SOSCHP       0xFFFF
  3110.  
  3111. #define POSCFREQ_LS          0xFFEF
  3112. #define POSCFREQ_MS          0xFFF7
  3113. #define POSCFREQ_HS          0xFFFF
  3114.  
  3115. #define OSCIOFNC_ON          0xFFFB
  3116. #define OSCIOFNC_OFF         0xFFFF
  3117.  
  3118. #define POSCMOD_EC           0xFFFC
  3119. #define POSCMOD_XT           0xFFFD
  3120. #define POSCMOD_HS           0xFFFE
  3121. #define POSCMOD_NONE         0xFFFF
  3122.  
  3123. /* Register FWDT (0xf8000a)                               */
  3124.  
  3125. extern __attribute__((space(prog))) int _FWDT;
  3126. #define _FWDT(x) __attribute__((section("__FWDT.sec"),space(prog))) int _FWDT = (x);
  3127.  
  3128. /*
  3129. ** Only one invocation of FWDT should appear in a project,
  3130. ** at the top of a C source file (outside of any function).
  3131. **
  3132. ** The following constants can be used to set FWDT.
  3133. ** Multiple options may be combined, as shown:
  3134. **
  3135. ** _FWDT( OPT1_ON & OPT2_OFF & OPT3_PLL )
  3136. **
  3137. **   Watchdog Timer:
  3138. **     FWDTEN_OFF           Disabled
  3139. **     FWDTEN_ON            Enabled
  3140. **
  3141. **   Windowed WDT:
  3142. **     WINDIS_ON            Window Mode
  3143. **     WINDIS_OFF           Non-Window Mode
  3144. **
  3145. **   Watchdog prescaler:
  3146. **     FWPSA_PR32           1:32
  3147. **     FWPSA_PR128          1:128
  3148. **
  3149. **   Watchdog postscale:
  3150. **     WDTPS_PS1            1:1
  3151. **     WDTPS_PS2            1:2
  3152. **     WDTPS_PS4            1:4
  3153. **     WDTPS_PS8            1:8
  3154. **     WDTPS_PS16           1:16
  3155. **     WDTPS_PS32           1:32
  3156. **     WDTPS_PS64           1:64
  3157. **     WDTPS_PS128          1:128
  3158. **     WDTPS_PS256          1:256
  3159. **     WDTPS_PS512          1:512
  3160. **     WDTPS_PS1024         1:1,024
  3161. **     WDTPS_PS2048         1:2,048
  3162. **     WDTPS_PS4096         1:4,096
  3163. **     WDTPS_PS8192         1:8,192
  3164. **     WDTPS_PS16384        1:16,384
  3165. **     WDTPS_PS32768        1:32,768
  3166. **
  3167. */
  3168.  
  3169. #define FWDTEN_OFF           0xFF7F
  3170. #define FWDTEN_ON            0xFFFF
  3171.  
  3172. #define WINDIS_ON            0xFFBF
  3173. #define WINDIS_OFF           0xFFFF
  3174.  
  3175. #define FWPSA_PR32           0xFFEF
  3176. #define FWPSA_PR128          0xFFFF
  3177.  
  3178. #define WDTPS_PS1            0xFFF0
  3179. #define WDTPS_PS2            0xFFF1
  3180. #define WDTPS_PS4            0xFFF2
  3181. #define WDTPS_PS8            0xFFF3
  3182. #define WDTPS_PS16           0xFFF4
  3183. #define WDTPS_PS32           0xFFF5
  3184. #define WDTPS_PS64           0xFFF6
  3185. #define WDTPS_PS128          0xFFF7
  3186. #define WDTPS_PS256          0xFFF8
  3187. #define WDTPS_PS512          0xFFF9
  3188. #define WDTPS_PS1024         0xFFFA
  3189. #define WDTPS_PS2048         0xFFFB
  3190. #define WDTPS_PS4096         0xFFFC
  3191. #define WDTPS_PS8192         0xFFFD
  3192. #define WDTPS_PS16384        0xFFFE
  3193. #define WDTPS_PS32768        0xFFFF
  3194.  
  3195. /* Register FPOR (0xf8000c)                               */
  3196.  
  3197. extern __attribute__((space(prog))) int _FPOR;
  3198. #define _FPOR(x) __attribute__((section("__FPOR.sec"),space(prog))) int _FPOR = (x);
  3199.  
  3200. /*
  3201. ** Only one invocation of FPOR should appear in a project,
  3202. ** at the top of a C source file (outside of any function).
  3203. **
  3204. ** The following constants can be used to set FPOR.
  3205. ** Multiple options may be combined, as shown:
  3206. **
  3207. ** _FPOR( OPT1_ON & OPT2_OFF & OPT3_PLL )
  3208. **
  3209. **   Master Clear Enable:
  3210. **     MCLRE_OFF            MCLR Disaled, RA5 Enabled
  3211. **     MCLRE_ON             MCLR Enabled, RA5 Disabled
  3212. **
  3213. **   Brown Out Voltage:
  3214. **     BORV_LPBOR           Low Power BOR
  3215. **     BORV_V27             2.7V
  3216. **     BORV_V20             2.0V
  3217. **     BORV_V18             1.8V
  3218. **
  3219. **   I2C1 pins Select:
  3220. **     I2C1SEL_SEC          Use ASCL1/ASDA1 Pins For I2C1
  3221. **     I2C1SEL_PRI          Use SCL1/SDA1 Pins For I2C1
  3222. **
  3223. **   Power Up Timer:
  3224. **     PWRTEN_OFF           Disabled
  3225. **     PWRTEN_ON            Enabled
  3226. **
  3227. **   Brown Out Reset:
  3228. **     BOREN_BOR0           Disabled in hardware, SBOREN bit disabled
  3229. **     BOREN_BOR1           Software controlled by SBOREN bit
  3230. **     BOREN_BOR2           Disabled only when in SLEEP, SBOREN bit disabled
  3231. **     BOREN_BOR3           Enabled in hardware, SBOREN bit disabled
  3232. **
  3233. */
  3234.  
  3235. #define MCLRE_OFF            0xFF7F
  3236. #define MCLRE_ON             0xFFFF
  3237.  
  3238. #define BORV_LPBOR           0xFF9F
  3239. #define BORV_V27             0xFFBF
  3240. #define BORV_V20             0xFFDF
  3241. #define BORV_V18             0xFFFF
  3242.  
  3243. #define I2C1SEL_SEC          0xFFEF
  3244. #define I2C1SEL_PRI          0xFFFF
  3245.  
  3246. #define PWRTEN_OFF           0xFFF7
  3247. #define PWRTEN_ON            0xFFFF
  3248.  
  3249. #define BOREN_BOR0           0xFFFC
  3250. #define BOREN_BOR1           0xFFFD
  3251. #define BOREN_BOR2           0xFFFE
  3252. #define BOREN_BOR3           0xFFFF
  3253.  
  3254. /* Register FICD (0xf8000e)                               */
  3255.  
  3256. extern __attribute__((space(prog))) int _FICD;
  3257. #define _FICD(x) __attribute__((section("__FICD.sec"),space(prog))) int _FICD = (x);
  3258.  
  3259. /*
  3260. ** Only one invocation of FICD should appear in a project,
  3261. ** at the top of a C source file (outside of any function).
  3262. **
  3263. ** The following constants can be used to set FICD.
  3264. ** Multiple options may be combined, as shown:
  3265. **
  3266. ** _FICD( OPT1_ON & OPT2_OFF & OPT3_PLL )
  3267. **
  3268. **   Background Debugger:
  3269. **     BKBUG_ON             Enabled
  3270. **     BKBUG_OFF            Disabled
  3271. **
  3272. **   ICD pins select:
  3273. **     ICS_PGx3             EMUC/EMUD share PGC3/PGD3
  3274. **     ICS_PGx2             EMUC/EMUD share PGC2/PGD2
  3275. **     ICS_PGx1             EMUC/EMUD share PGC1/PGD1
  3276. **
  3277. */
  3278.  
  3279. #define BKBUG_ON             0xFF7F
  3280. #define BKBUG_OFF            0xFFFF
  3281.  
  3282. #define ICS_PGx3             0xFFFD
  3283. #define ICS_PGx2             0xFFFE
  3284. #define ICS_PGx1             0xFFFF
  3285.  
  3286. /* Register FDS (0xf80010)                               */
  3287.  
  3288. extern __attribute__((space(prog))) int _FDS;
  3289. #define _FDS(x) __attribute__((section("__FDS.sec"),space(prog))) int _FDS = (x);
  3290.  
  3291. /*
  3292. ** Only one invocation of FDS should appear in a project,
  3293. ** at the top of a C source file (outside of any function).
  3294. **
  3295. ** The following constants can be used to set FDS.
  3296. ** Multiple options may be combined, as shown:
  3297. **
  3298. ** _FDS( OPT1_ON & OPT2_OFF & OPT3_PLL )
  3299. **
  3300. **   Deep Sleep Watchdog Timer:
  3301. **     DSWDTEN_OFF          Disabled
  3302. **     DSWDTEN_ON           Enabled
  3303. **
  3304. **   Deep Sleep BOR:
  3305. **     DSBOREN_OFF          Disabled
  3306. **     DSBOREN_ON           Enabled
  3307. **
  3308. **   RTCC Reference Oscillator Select:
  3309. **     RTCOSC_LPRC          Low Power RC Oscillator (LPRC)
  3310. **     RTCOSC_SOSC          Secondary Oscillator (SOSC)
  3311. **
  3312. **   Deep Sleep Watchdog Oscillator Clock Select:
  3313. **     DSWDTOSC_LPRC        Secondary Oscillator (SOSC)
  3314. **     DSWDTOSC_SOSC        Low Power RC Oscillator (LPRC)
  3315. **
  3316. **   Deep Sleep Watchdog Postscale Select Bits:
  3317. **     DSWDTPS_DSWDTPS0     1:2 (2.1 ms)
  3318. **     DSWDTPS_DSWDTPS1     1:8 (8.3 ms)
  3319. **     DSWDTPS_DSWDTPS2     1:32 (33 ms)
  3320. **     DSWDTPS_DSWDTPS3     1:128 (132 ms)
  3321. **     DSWDTPS_DSWDTPS4     1:512 (528 ms)
  3322. **     DSWDTPS_DSWDTPS5     1:2048 (2.1 Seconds)
  3323. **     DSWDTPS_DSWDTPS6     1:8192 (8.5 Seconds)
  3324. **     DSWDTPS_DSWDTPS7     1:32,768 (34 Seconds)
  3325. **     DSWDTPS_DSWDTPS8     1:131,072 (135 Seconds)
  3326. **     DSWDTPS_DSWDTPS9     1:524,288 (9 Minutes)
  3327. **     DSWDTPS_DSWDTPSA     1:2,097,152 (36 Minutes)
  3328. **     DSWDTPS_DSWDTPSB     1:8,388,608 (2.4 Hours)
  3329. **     DSWDTPS_DSWDTPSC     1:33,554,432 (9.6 Hours)
  3330. **     DSWDTPS_DSWDTPSD     1:134,217,728 (38.5 Hours)
  3331. **     DSWDTPS_DSWDTPSE     1:536,870,912 (6.4 Days)
  3332. **     DSWDTPS_DSWDTPSF     1:2,147,483,648 (25.7 Days)
  3333. **
  3334. */
  3335.  
  3336. #define DSWDTEN_OFF          0xFF7F
  3337. #define DSWDTEN_ON           0xFFFF
  3338.  
  3339. #define DSBOREN_OFF          0xFFBF
  3340. #define DSBOREN_ON           0xFFFF
  3341.  
  3342. #define RTCOSC_LPRC          0xFFDF
  3343. #define RTCOSC_SOSC          0xFFFF
  3344.  
  3345. #define DSWDTOSC_LPRC        0xFFEF
  3346. #define DSWDTOSC_SOSC        0xFFFF
  3347.  
  3348. #define DSWDTPS_DSWDTPS0     0xFFF0
  3349. #define DSWDTPS_DSWDTPS1     0xFFF1
  3350. #define DSWDTPS_DSWDTPS2     0xFFF2
  3351. #define DSWDTPS_DSWDTPS3     0xFFF3
  3352. #define DSWDTPS_DSWDTPS4     0xFFF4
  3353. #define DSWDTPS_DSWDTPS5     0xFFF5
  3354. #define DSWDTPS_DSWDTPS6     0xFFF6
  3355. #define DSWDTPS_DSWDTPS7     0xFFF7
  3356. #define DSWDTPS_DSWDTPS8     0xFFF8
  3357. #define DSWDTPS_DSWDTPS9     0xFFF9
  3358. #define DSWDTPS_DSWDTPSA     0xFFFA
  3359. #define DSWDTPS_DSWDTPSB     0xFFFB
  3360. #define DSWDTPS_DSWDTPSC     0xFFFC
  3361. #define DSWDTPS_DSWDTPSD     0xFFFD
  3362. #define DSWDTPS_DSWDTPSE     0xFFFE
  3363. #define DSWDTPS_DSWDTPSF     0xFFFF
  3364.  
  3365.  
  3366. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement