1 /* 2 * This declarations of the PIC16LF767 MCU. 3 * 4 * This file is part of the GNU PIC library for SDCC, originally 5 * created by Molnar Karoly <molnarkaroly@users.sf.net> 2016. 6 * 7 * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:22:59 UTC. 8 * 9 * SDCC is licensed under the GNU Public license (GPL) v2. Note that 10 * this license covers the code to the compiler and other executables, 11 * but explicitly does not cover any code or objects generated by sdcc. 12 * 13 * For pic device libraries and header files which are derived from 14 * Microchip header (.inc) and linker script (.lkr) files Microchip 15 * requires that "The header files should state that they are only to be 16 * used with authentic Microchip devices" which makes them incompatible 17 * with the GPL. Pic device libraries and header files are located at 18 * non-free/lib and non-free/include directories respectively. 19 * Sdcc should be run with the --use-non-free command line option in 20 * order to include non-free header files and libraries. 21 * 22 * See http://sdcc.sourceforge.net/ for the latest information on sdcc. 23 */ 24 25 #ifndef __PIC16LF767_H__ 26 #define __PIC16LF767_H__ 27 28 //============================================================================== 29 // 30 // Register Addresses 31 // 32 //============================================================================== 33 34 #ifndef NO_ADDR_DEFINES 35 36 #define INDF_ADDR 0x0000 37 #define TMR0_ADDR 0x0001 38 #define PCL_ADDR 0x0002 39 #define STATUS_ADDR 0x0003 40 #define FSR_ADDR 0x0004 41 #define PORTA_ADDR 0x0005 42 #define PORTB_ADDR 0x0006 43 #define PORTC_ADDR 0x0007 44 #define PORTE_ADDR 0x0009 45 #define PCLATH_ADDR 0x000A 46 #define INTCON_ADDR 0x000B 47 #define PIR1_ADDR 0x000C 48 #define PIR2_ADDR 0x000D 49 #define TMR1_ADDR 0x000E 50 #define TMR1L_ADDR 0x000E 51 #define TMR1H_ADDR 0x000F 52 #define T1CON_ADDR 0x0010 53 #define TMR2_ADDR 0x0011 54 #define T2CON_ADDR 0x0012 55 #define SSPBUF_ADDR 0x0013 56 #define SSPCON_ADDR 0x0014 57 #define CCPR1_ADDR 0x0015 58 #define CCPR1L_ADDR 0x0015 59 #define CCPR1H_ADDR 0x0016 60 #define CCP1CON_ADDR 0x0017 61 #define RCSTA_ADDR 0x0018 62 #define TXREG_ADDR 0x0019 63 #define RCREG_ADDR 0x001A 64 #define CCPR2_ADDR 0x001B 65 #define CCPR2L_ADDR 0x001B 66 #define CCPR2H_ADDR 0x001C 67 #define CCP2CON_ADDR 0x001D 68 #define ADRESH_ADDR 0x001E 69 #define ADCON0_ADDR 0x001F 70 #define OPTION_REG_ADDR 0x0081 71 #define TRISA_ADDR 0x0085 72 #define TRISB_ADDR 0x0086 73 #define TRISC_ADDR 0x0087 74 #define PIE1_ADDR 0x008C 75 #define PIE2_ADDR 0x008D 76 #define PCON_ADDR 0x008E 77 #define OSCCON_ADDR 0x008F 78 #define OSCTUNE_ADDR 0x0090 79 #define SSPCON2_ADDR 0x0091 80 #define PR2_ADDR 0x0092 81 #define SSPADD_ADDR 0x0093 82 #define SSPSTAT_ADDR 0x0094 83 #define CCPR3_ADDR 0x0095 84 #define CCPR3L_ADDR 0x0095 85 #define CCPR3H_ADDR 0x0096 86 #define CCP3CON_ADDR 0x0097 87 #define TXSTA_ADDR 0x0098 88 #define SPBRG_ADDR 0x0099 89 #define ADCON2_ADDR 0x009B 90 #define CMCON_ADDR 0x009C 91 #define CVRCON_ADDR 0x009D 92 #define ADRESL_ADDR 0x009E 93 #define ADCON1_ADDR 0x009F 94 #define WDTCON_ADDR 0x0105 95 #define LVDCON_ADDR 0x0109 96 #define PMDATA_ADDR 0x010C 97 #define PMADR_ADDR 0x010D 98 #define PMDATH_ADDR 0x010E 99 #define PMADRH_ADDR 0x010F 100 #define PMCON1_ADDR 0x018C 101 102 #endif // #ifndef NO_ADDR_DEFINES 103 104 //============================================================================== 105 // 106 // Register Definitions 107 // 108 //============================================================================== 109 110 extern __at(0x0000) __sfr INDF; 111 extern __at(0x0001) __sfr TMR0; 112 extern __at(0x0002) __sfr PCL; 113 114 //============================================================================== 115 // STATUS Bits 116 117 extern __at(0x0003) __sfr STATUS; 118 119 typedef union 120 { 121 struct 122 { 123 unsigned C : 1; 124 unsigned DC : 1; 125 unsigned Z : 1; 126 unsigned NOT_PD : 1; 127 unsigned NOT_TO : 1; 128 unsigned RP0 : 1; 129 unsigned RP1 : 1; 130 unsigned IRP : 1; 131 }; 132 133 struct 134 { 135 unsigned : 5; 136 unsigned RP : 2; 137 unsigned : 1; 138 }; 139 } __STATUSbits_t; 140 141 extern __at(0x0003) volatile __STATUSbits_t STATUSbits; 142 143 #define _C 0x01 144 #define _DC 0x02 145 #define _Z 0x04 146 #define _NOT_PD 0x08 147 #define _NOT_TO 0x10 148 #define _RP0 0x20 149 #define _RP1 0x40 150 #define _IRP 0x80 151 152 //============================================================================== 153 154 extern __at(0x0004) __sfr FSR; 155 156 //============================================================================== 157 // PORTA Bits 158 159 extern __at(0x0005) __sfr PORTA; 160 161 typedef struct 162 { 163 unsigned RA0 : 1; 164 unsigned RA1 : 1; 165 unsigned RA2 : 1; 166 unsigned RA3 : 1; 167 unsigned RA4 : 1; 168 unsigned RA5 : 1; 169 unsigned RA6 : 1; 170 unsigned RA7 : 1; 171 } __PORTAbits_t; 172 173 extern __at(0x0005) volatile __PORTAbits_t PORTAbits; 174 175 #define _RA0 0x01 176 #define _RA1 0x02 177 #define _RA2 0x04 178 #define _RA3 0x08 179 #define _RA4 0x10 180 #define _RA5 0x20 181 #define _RA6 0x40 182 #define _RA7 0x80 183 184 //============================================================================== 185 186 187 //============================================================================== 188 // PORTB Bits 189 190 extern __at(0x0006) __sfr PORTB; 191 192 typedef struct 193 { 194 unsigned RB0 : 1; 195 unsigned RB1 : 1; 196 unsigned RB2 : 1; 197 unsigned RB3 : 1; 198 unsigned RB4 : 1; 199 unsigned RB5 : 1; 200 unsigned RB6 : 1; 201 unsigned RB7 : 1; 202 } __PORTBbits_t; 203 204 extern __at(0x0006) volatile __PORTBbits_t PORTBbits; 205 206 #define _RB0 0x01 207 #define _RB1 0x02 208 #define _RB2 0x04 209 #define _RB3 0x08 210 #define _RB4 0x10 211 #define _RB5 0x20 212 #define _RB6 0x40 213 #define _RB7 0x80 214 215 //============================================================================== 216 217 218 //============================================================================== 219 // PORTC Bits 220 221 extern __at(0x0007) __sfr PORTC; 222 223 typedef struct 224 { 225 unsigned RC0 : 1; 226 unsigned RC1 : 1; 227 unsigned RC2 : 1; 228 unsigned RC3 : 1; 229 unsigned RC4 : 1; 230 unsigned RC5 : 1; 231 unsigned RC6 : 1; 232 unsigned RC7 : 1; 233 } __PORTCbits_t; 234 235 extern __at(0x0007) volatile __PORTCbits_t PORTCbits; 236 237 #define _RC0 0x01 238 #define _RC1 0x02 239 #define _RC2 0x04 240 #define _RC3 0x08 241 #define _RC4 0x10 242 #define _RC5 0x20 243 #define _RC6 0x40 244 #define _RC7 0x80 245 246 //============================================================================== 247 248 249 //============================================================================== 250 // PORTE Bits 251 252 extern __at(0x0009) __sfr PORTE; 253 254 typedef struct 255 { 256 unsigned : 1; 257 unsigned : 1; 258 unsigned : 1; 259 unsigned RE3 : 1; 260 unsigned : 1; 261 unsigned : 1; 262 unsigned : 1; 263 unsigned : 1; 264 } __PORTEbits_t; 265 266 extern __at(0x0009) volatile __PORTEbits_t PORTEbits; 267 268 #define _RE3 0x08 269 270 //============================================================================== 271 272 extern __at(0x000A) __sfr PCLATH; 273 274 //============================================================================== 275 // INTCON Bits 276 277 extern __at(0x000B) __sfr INTCON; 278 279 typedef union 280 { 281 struct 282 { 283 unsigned RBIF : 1; 284 unsigned INTF : 1; 285 unsigned TMR0IF : 1; 286 unsigned RBIE : 1; 287 unsigned INTE : 1; 288 unsigned TMR0IE : 1; 289 unsigned PEIE : 1; 290 unsigned GIE : 1; 291 }; 292 293 struct 294 { 295 unsigned : 1; 296 unsigned INT0IF : 1; 297 unsigned T0IF : 1; 298 unsigned : 1; 299 unsigned INT0IE : 1; 300 unsigned T0IE : 1; 301 unsigned : 1; 302 unsigned : 1; 303 }; 304 } __INTCONbits_t; 305 306 extern __at(0x000B) volatile __INTCONbits_t INTCONbits; 307 308 #define _RBIF 0x01 309 #define _INTF 0x02 310 #define _INT0IF 0x02 311 #define _TMR0IF 0x04 312 #define _T0IF 0x04 313 #define _RBIE 0x08 314 #define _INTE 0x10 315 #define _INT0IE 0x10 316 #define _TMR0IE 0x20 317 #define _T0IE 0x20 318 #define _PEIE 0x40 319 #define _GIE 0x80 320 321 //============================================================================== 322 323 324 //============================================================================== 325 // PIR1 Bits 326 327 extern __at(0x000C) __sfr PIR1; 328 329 typedef struct 330 { 331 unsigned TMR1IF : 1; 332 unsigned TMR2IF : 1; 333 unsigned CCP1IF : 1; 334 unsigned SSPIF : 1; 335 unsigned TXIF : 1; 336 unsigned RCIF : 1; 337 unsigned ADIF : 1; 338 unsigned PSPIF : 1; 339 } __PIR1bits_t; 340 341 extern __at(0x000C) volatile __PIR1bits_t PIR1bits; 342 343 #define _TMR1IF 0x01 344 #define _TMR2IF 0x02 345 #define _CCP1IF 0x04 346 #define _SSPIF 0x08 347 #define _TXIF 0x10 348 #define _RCIF 0x20 349 #define _ADIF 0x40 350 #define _PSPIF 0x80 351 352 //============================================================================== 353 354 355 //============================================================================== 356 // PIR2 Bits 357 358 extern __at(0x000D) __sfr PIR2; 359 360 typedef struct 361 { 362 unsigned CCP2IF : 1; 363 unsigned CCP3IF : 1; 364 unsigned : 1; 365 unsigned BCLIF : 1; 366 unsigned : 1; 367 unsigned LVDIF : 1; 368 unsigned CMIF : 1; 369 unsigned OSFIF : 1; 370 } __PIR2bits_t; 371 372 extern __at(0x000D) volatile __PIR2bits_t PIR2bits; 373 374 #define _CCP2IF 0x01 375 #define _CCP3IF 0x02 376 #define _BCLIF 0x08 377 #define _LVDIF 0x20 378 #define _CMIF 0x40 379 #define _OSFIF 0x80 380 381 //============================================================================== 382 383 extern __at(0x000E) __sfr TMR1; 384 extern __at(0x000E) __sfr TMR1L; 385 extern __at(0x000F) __sfr TMR1H; 386 387 //============================================================================== 388 // T1CON Bits 389 390 extern __at(0x0010) __sfr T1CON; 391 392 typedef union 393 { 394 struct 395 { 396 unsigned TMR1ON : 1; 397 unsigned TMR1CS : 1; 398 unsigned NOT_T1SYNC : 1; 399 unsigned T1OSCEN : 1; 400 unsigned T1CKPS0 : 1; 401 unsigned T1CKPS1 : 1; 402 unsigned T1RUN : 1; 403 unsigned : 1; 404 }; 405 406 struct 407 { 408 unsigned : 1; 409 unsigned : 1; 410 unsigned T1SYNC : 1; 411 unsigned : 1; 412 unsigned : 1; 413 unsigned : 1; 414 unsigned : 1; 415 unsigned : 1; 416 }; 417 418 struct 419 { 420 unsigned : 1; 421 unsigned : 1; 422 unsigned T1INSYNC : 1; 423 unsigned : 1; 424 unsigned : 1; 425 unsigned : 1; 426 unsigned : 1; 427 unsigned : 1; 428 }; 429 430 struct 431 { 432 unsigned : 4; 433 unsigned T1CKPS : 2; 434 unsigned : 2; 435 }; 436 } __T1CONbits_t; 437 438 extern __at(0x0010) volatile __T1CONbits_t T1CONbits; 439 440 #define _TMR1ON 0x01 441 #define _TMR1CS 0x02 442 #define _NOT_T1SYNC 0x04 443 #define _T1SYNC 0x04 444 #define _T1INSYNC 0x04 445 #define _T1OSCEN 0x08 446 #define _T1CKPS0 0x10 447 #define _T1CKPS1 0x20 448 #define _T1RUN 0x40 449 450 //============================================================================== 451 452 extern __at(0x0011) __sfr TMR2; 453 454 //============================================================================== 455 // T2CON Bits 456 457 extern __at(0x0012) __sfr T2CON; 458 459 typedef union 460 { 461 struct 462 { 463 unsigned T2CKPS0 : 1; 464 unsigned T2CKPS1 : 1; 465 unsigned TMR2ON : 1; 466 unsigned TOUTPS0 : 1; 467 unsigned TOUTPS1 : 1; 468 unsigned TOUTPS2 : 1; 469 unsigned TOUTPS3 : 1; 470 unsigned : 1; 471 }; 472 473 struct 474 { 475 unsigned T2CKPS : 2; 476 unsigned : 6; 477 }; 478 479 struct 480 { 481 unsigned : 3; 482 unsigned TOUTPS : 4; 483 unsigned : 1; 484 }; 485 } __T2CONbits_t; 486 487 extern __at(0x0012) volatile __T2CONbits_t T2CONbits; 488 489 #define _T2CKPS0 0x01 490 #define _T2CKPS1 0x02 491 #define _TMR2ON 0x04 492 #define _TOUTPS0 0x08 493 #define _TOUTPS1 0x10 494 #define _TOUTPS2 0x20 495 #define _TOUTPS3 0x40 496 497 //============================================================================== 498 499 extern __at(0x0013) __sfr SSPBUF; 500 501 //============================================================================== 502 // SSPCON Bits 503 504 extern __at(0x0014) __sfr SSPCON; 505 506 typedef union 507 { 508 struct 509 { 510 unsigned SSPM0 : 1; 511 unsigned SSPM1 : 1; 512 unsigned SSPM2 : 1; 513 unsigned SSPM3 : 1; 514 unsigned CKP : 1; 515 unsigned SSPEN : 1; 516 unsigned SSPOV : 1; 517 unsigned WCOL : 1; 518 }; 519 520 struct 521 { 522 unsigned SSPM : 4; 523 unsigned : 4; 524 }; 525 } __SSPCONbits_t; 526 527 extern __at(0x0014) volatile __SSPCONbits_t SSPCONbits; 528 529 #define _SSPM0 0x01 530 #define _SSPM1 0x02 531 #define _SSPM2 0x04 532 #define _SSPM3 0x08 533 #define _CKP 0x10 534 #define _SSPEN 0x20 535 #define _SSPOV 0x40 536 #define _WCOL 0x80 537 538 //============================================================================== 539 540 extern __at(0x0015) __sfr CCPR1; 541 extern __at(0x0015) __sfr CCPR1L; 542 extern __at(0x0016) __sfr CCPR1H; 543 544 //============================================================================== 545 // CCP1CON Bits 546 547 extern __at(0x0017) __sfr CCP1CON; 548 549 typedef union 550 { 551 struct 552 { 553 unsigned CCP1M0 : 1; 554 unsigned CCP1M1 : 1; 555 unsigned CCP1M2 : 1; 556 unsigned CCP1M3 : 1; 557 unsigned CCP1Y : 1; 558 unsigned CCP1X : 1; 559 unsigned : 1; 560 unsigned : 1; 561 }; 562 563 struct 564 { 565 unsigned CCP1M : 4; 566 unsigned : 4; 567 }; 568 } __CCP1CONbits_t; 569 570 extern __at(0x0017) volatile __CCP1CONbits_t CCP1CONbits; 571 572 #define _CCP1M0 0x01 573 #define _CCP1M1 0x02 574 #define _CCP1M2 0x04 575 #define _CCP1M3 0x08 576 #define _CCP1Y 0x10 577 #define _CCP1X 0x20 578 579 //============================================================================== 580 581 582 //============================================================================== 583 // RCSTA Bits 584 585 extern __at(0x0018) __sfr RCSTA; 586 587 typedef union 588 { 589 struct 590 { 591 unsigned RX9D : 1; 592 unsigned OERR : 1; 593 unsigned FERR : 1; 594 unsigned ADDEN : 1; 595 unsigned CREN : 1; 596 unsigned SREN : 1; 597 unsigned RX9 : 1; 598 unsigned SPEN : 1; 599 }; 600 601 struct 602 { 603 unsigned RCD8 : 1; 604 unsigned : 1; 605 unsigned : 1; 606 unsigned : 1; 607 unsigned : 1; 608 unsigned : 1; 609 unsigned RC9 : 1; 610 unsigned : 1; 611 }; 612 613 struct 614 { 615 unsigned : 1; 616 unsigned : 1; 617 unsigned : 1; 618 unsigned : 1; 619 unsigned : 1; 620 unsigned : 1; 621 unsigned NOT_RC8 : 1; 622 unsigned : 1; 623 }; 624 625 struct 626 { 627 unsigned : 1; 628 unsigned : 1; 629 unsigned : 1; 630 unsigned : 1; 631 unsigned : 1; 632 unsigned : 1; 633 unsigned RC8_9 : 1; 634 unsigned : 1; 635 }; 636 } __RCSTAbits_t; 637 638 extern __at(0x0018) volatile __RCSTAbits_t RCSTAbits; 639 640 #define _RX9D 0x01 641 #define _RCD8 0x01 642 #define _OERR 0x02 643 #define _FERR 0x04 644 #define _ADDEN 0x08 645 #define _CREN 0x10 646 #define _SREN 0x20 647 #define _RX9 0x40 648 #define _RC9 0x40 649 #define _NOT_RC8 0x40 650 #define _RC8_9 0x40 651 #define _SPEN 0x80 652 653 //============================================================================== 654 655 extern __at(0x0019) __sfr TXREG; 656 extern __at(0x001A) __sfr RCREG; 657 extern __at(0x001B) __sfr CCPR2; 658 extern __at(0x001B) __sfr CCPR2L; 659 extern __at(0x001C) __sfr CCPR2H; 660 661 //============================================================================== 662 // CCP2CON Bits 663 664 extern __at(0x001D) __sfr CCP2CON; 665 666 typedef union 667 { 668 struct 669 { 670 unsigned CCP2M0 : 1; 671 unsigned CCP2M1 : 1; 672 unsigned CCP2M2 : 1; 673 unsigned CCP2M3 : 1; 674 unsigned CCP2Y : 1; 675 unsigned CCP2X : 1; 676 unsigned : 1; 677 unsigned : 1; 678 }; 679 680 struct 681 { 682 unsigned CCP2M : 4; 683 unsigned : 4; 684 }; 685 } __CCP2CONbits_t; 686 687 extern __at(0x001D) volatile __CCP2CONbits_t CCP2CONbits; 688 689 #define _CCP2M0 0x01 690 #define _CCP2M1 0x02 691 #define _CCP2M2 0x04 692 #define _CCP2M3 0x08 693 #define _CCP2Y 0x10 694 #define _CCP2X 0x20 695 696 //============================================================================== 697 698 extern __at(0x001E) __sfr ADRESH; 699 700 //============================================================================== 701 // ADCON0 Bits 702 703 extern __at(0x001F) __sfr ADCON0; 704 705 typedef union 706 { 707 struct 708 { 709 unsigned ADON : 1; 710 unsigned CHS3 : 1; 711 unsigned GO_NOT_DONE : 1; 712 unsigned CHS0 : 1; 713 unsigned CHS1 : 1; 714 unsigned CHS2 : 1; 715 unsigned ADCS0 : 1; 716 unsigned ADCS1 : 1; 717 }; 718 719 struct 720 { 721 unsigned : 1; 722 unsigned : 1; 723 unsigned GO : 1; 724 unsigned : 1; 725 unsigned : 1; 726 unsigned : 1; 727 unsigned : 1; 728 unsigned : 1; 729 }; 730 731 struct 732 { 733 unsigned : 1; 734 unsigned : 1; 735 unsigned NOT_DONE : 1; 736 unsigned : 1; 737 unsigned : 1; 738 unsigned : 1; 739 unsigned : 1; 740 unsigned : 1; 741 }; 742 743 struct 744 { 745 unsigned : 1; 746 unsigned : 1; 747 unsigned GO_DONE : 1; 748 unsigned : 1; 749 unsigned : 1; 750 unsigned : 1; 751 unsigned : 1; 752 unsigned : 1; 753 }; 754 755 struct 756 { 757 unsigned : 6; 758 unsigned ADCS : 2; 759 }; 760 } __ADCON0bits_t; 761 762 extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits; 763 764 #define _ADON 0x01 765 #define _CHS3 0x02 766 #define _GO_NOT_DONE 0x04 767 #define _GO 0x04 768 #define _NOT_DONE 0x04 769 #define _GO_DONE 0x04 770 #define _CHS0 0x08 771 #define _CHS1 0x10 772 #define _CHS2 0x20 773 #define _ADCS0 0x40 774 #define _ADCS1 0x80 775 776 //============================================================================== 777 778 779 //============================================================================== 780 // OPTION_REG Bits 781 782 extern __at(0x0081) __sfr OPTION_REG; 783 784 typedef union 785 { 786 struct 787 { 788 unsigned PS0 : 1; 789 unsigned PS1 : 1; 790 unsigned PS2 : 1; 791 unsigned PSA : 1; 792 unsigned T0SE : 1; 793 unsigned T0CS : 1; 794 unsigned INTEDG : 1; 795 unsigned NOT_RBPU : 1; 796 }; 797 798 struct 799 { 800 unsigned PS : 3; 801 unsigned : 5; 802 }; 803 } __OPTION_REGbits_t; 804 805 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits; 806 807 #define _PS0 0x01 808 #define _PS1 0x02 809 #define _PS2 0x04 810 #define _PSA 0x08 811 #define _T0SE 0x10 812 #define _T0CS 0x20 813 #define _INTEDG 0x40 814 #define _NOT_RBPU 0x80 815 816 //============================================================================== 817 818 819 //============================================================================== 820 // TRISA Bits 821 822 extern __at(0x0085) __sfr TRISA; 823 824 typedef struct 825 { 826 unsigned TRISA0 : 1; 827 unsigned TRISA1 : 1; 828 unsigned TRISA2 : 1; 829 unsigned TRISA3 : 1; 830 unsigned TRISA4 : 1; 831 unsigned TRISA5 : 1; 832 unsigned TRISA6 : 1; 833 unsigned TRISA7 : 1; 834 } __TRISAbits_t; 835 836 extern __at(0x0085) volatile __TRISAbits_t TRISAbits; 837 838 #define _TRISA0 0x01 839 #define _TRISA1 0x02 840 #define _TRISA2 0x04 841 #define _TRISA3 0x08 842 #define _TRISA4 0x10 843 #define _TRISA5 0x20 844 #define _TRISA6 0x40 845 #define _TRISA7 0x80 846 847 //============================================================================== 848 849 850 //============================================================================== 851 // TRISB Bits 852 853 extern __at(0x0086) __sfr TRISB; 854 855 typedef struct 856 { 857 unsigned TRISB0 : 1; 858 unsigned TRISB1 : 1; 859 unsigned TRISB2 : 1; 860 unsigned TRISB3 : 1; 861 unsigned TRISB4 : 1; 862 unsigned TRISB5 : 1; 863 unsigned TRISB6 : 1; 864 unsigned TRISB7 : 1; 865 } __TRISBbits_t; 866 867 extern __at(0x0086) volatile __TRISBbits_t TRISBbits; 868 869 #define _TRISB0 0x01 870 #define _TRISB1 0x02 871 #define _TRISB2 0x04 872 #define _TRISB3 0x08 873 #define _TRISB4 0x10 874 #define _TRISB5 0x20 875 #define _TRISB6 0x40 876 #define _TRISB7 0x80 877 878 //============================================================================== 879 880 881 //============================================================================== 882 // TRISC Bits 883 884 extern __at(0x0087) __sfr TRISC; 885 886 typedef struct 887 { 888 unsigned TRISC0 : 1; 889 unsigned TRISC1 : 1; 890 unsigned TRISC2 : 1; 891 unsigned TRISC3 : 1; 892 unsigned TRISC4 : 1; 893 unsigned TRISC5 : 1; 894 unsigned TRISC6 : 1; 895 unsigned TRISC7 : 1; 896 } __TRISCbits_t; 897 898 extern __at(0x0087) volatile __TRISCbits_t TRISCbits; 899 900 #define _TRISC0 0x01 901 #define _TRISC1 0x02 902 #define _TRISC2 0x04 903 #define _TRISC3 0x08 904 #define _TRISC4 0x10 905 #define _TRISC5 0x20 906 #define _TRISC6 0x40 907 #define _TRISC7 0x80 908 909 //============================================================================== 910 911 912 //============================================================================== 913 // PIE1 Bits 914 915 extern __at(0x008C) __sfr PIE1; 916 917 typedef struct 918 { 919 unsigned TMR1IE : 1; 920 unsigned TMR2IE : 1; 921 unsigned CCP1IE : 1; 922 unsigned SSPIE : 1; 923 unsigned TXIE : 1; 924 unsigned RCIE : 1; 925 unsigned ADIE : 1; 926 unsigned PSPIE : 1; 927 } __PIE1bits_t; 928 929 extern __at(0x008C) volatile __PIE1bits_t PIE1bits; 930 931 #define _TMR1IE 0x01 932 #define _TMR2IE 0x02 933 #define _CCP1IE 0x04 934 #define _SSPIE 0x08 935 #define _TXIE 0x10 936 #define _RCIE 0x20 937 #define _ADIE 0x40 938 #define _PSPIE 0x80 939 940 //============================================================================== 941 942 943 //============================================================================== 944 // PIE2 Bits 945 946 extern __at(0x008D) __sfr PIE2; 947 948 typedef struct 949 { 950 unsigned CCP2IE : 1; 951 unsigned CCP3IE : 1; 952 unsigned : 1; 953 unsigned BCLIE : 1; 954 unsigned : 1; 955 unsigned LVDIE : 1; 956 unsigned CMIE : 1; 957 unsigned OSFIE : 1; 958 } __PIE2bits_t; 959 960 extern __at(0x008D) volatile __PIE2bits_t PIE2bits; 961 962 #define _CCP2IE 0x01 963 #define _CCP3IE 0x02 964 #define _BCLIE 0x08 965 #define _LVDIE 0x20 966 #define _CMIE 0x40 967 #define _OSFIE 0x80 968 969 //============================================================================== 970 971 972 //============================================================================== 973 // PCON Bits 974 975 extern __at(0x008E) __sfr PCON; 976 977 typedef union 978 { 979 struct 980 { 981 unsigned NOT_BOR : 1; 982 unsigned NOT_POR : 1; 983 unsigned SBOREN : 1; 984 unsigned : 1; 985 unsigned : 1; 986 unsigned : 1; 987 unsigned : 1; 988 unsigned : 1; 989 }; 990 991 struct 992 { 993 unsigned NOT_BO : 1; 994 unsigned : 1; 995 unsigned : 1; 996 unsigned : 1; 997 unsigned : 1; 998 unsigned : 1; 999 unsigned : 1; 1000 unsigned : 1; 1001 }; 1002 } __PCONbits_t; 1003 1004 extern __at(0x008E) volatile __PCONbits_t PCONbits; 1005 1006 #define _NOT_BOR 0x01 1007 #define _NOT_BO 0x01 1008 #define _NOT_POR 0x02 1009 #define _SBOREN 0x04 1010 1011 //============================================================================== 1012 1013 1014 //============================================================================== 1015 // OSCCON Bits 1016 1017 extern __at(0x008F) __sfr OSCCON; 1018 1019 typedef union 1020 { 1021 struct 1022 { 1023 unsigned SCS0 : 1; 1024 unsigned SCS1 : 1; 1025 unsigned IOFS : 1; 1026 unsigned OSTS : 1; 1027 unsigned IRCF0 : 1; 1028 unsigned IRCF1 : 1; 1029 unsigned IRCF2 : 1; 1030 unsigned : 1; 1031 }; 1032 1033 struct 1034 { 1035 unsigned SCS : 2; 1036 unsigned : 6; 1037 }; 1038 1039 struct 1040 { 1041 unsigned : 4; 1042 unsigned IRCF : 3; 1043 unsigned : 1; 1044 }; 1045 } __OSCCONbits_t; 1046 1047 extern __at(0x008F) volatile __OSCCONbits_t OSCCONbits; 1048 1049 #define _SCS0 0x01 1050 #define _SCS1 0x02 1051 #define _IOFS 0x04 1052 #define _OSTS 0x08 1053 #define _IRCF0 0x10 1054 #define _IRCF1 0x20 1055 #define _IRCF2 0x40 1056 1057 //============================================================================== 1058 1059 1060 //============================================================================== 1061 // OSCTUNE Bits 1062 1063 extern __at(0x0090) __sfr OSCTUNE; 1064 1065 typedef union 1066 { 1067 struct 1068 { 1069 unsigned TUN0 : 1; 1070 unsigned TUN1 : 1; 1071 unsigned TUN2 : 1; 1072 unsigned TUN3 : 1; 1073 unsigned TUN4 : 1; 1074 unsigned TUN5 : 1; 1075 unsigned : 1; 1076 unsigned : 1; 1077 }; 1078 1079 struct 1080 { 1081 unsigned TUN : 6; 1082 unsigned : 2; 1083 }; 1084 } __OSCTUNEbits_t; 1085 1086 extern __at(0x0090) volatile __OSCTUNEbits_t OSCTUNEbits; 1087 1088 #define _TUN0 0x01 1089 #define _TUN1 0x02 1090 #define _TUN2 0x04 1091 #define _TUN3 0x08 1092 #define _TUN4 0x10 1093 #define _TUN5 0x20 1094 1095 //============================================================================== 1096 1097 1098 //============================================================================== 1099 // SSPCON2 Bits 1100 1101 extern __at(0x0091) __sfr SSPCON2; 1102 1103 typedef struct 1104 { 1105 unsigned SEN : 1; 1106 unsigned RSEN : 1; 1107 unsigned PEN : 1; 1108 unsigned RCEN : 1; 1109 unsigned ACKEN : 1; 1110 unsigned ACKDT : 1; 1111 unsigned ACKSTAT : 1; 1112 unsigned GCEN : 1; 1113 } __SSPCON2bits_t; 1114 1115 extern __at(0x0091) volatile __SSPCON2bits_t SSPCON2bits; 1116 1117 #define _SEN 0x01 1118 #define _RSEN 0x02 1119 #define _PEN 0x04 1120 #define _RCEN 0x08 1121 #define _ACKEN 0x10 1122 #define _ACKDT 0x20 1123 #define _ACKSTAT 0x40 1124 #define _GCEN 0x80 1125 1126 //============================================================================== 1127 1128 extern __at(0x0092) __sfr PR2; 1129 extern __at(0x0093) __sfr SSPADD; 1130 1131 //============================================================================== 1132 // SSPSTAT Bits 1133 1134 extern __at(0x0094) __sfr SSPSTAT; 1135 1136 typedef union 1137 { 1138 struct 1139 { 1140 unsigned BF : 1; 1141 unsigned UA : 1; 1142 unsigned R_NOT_W : 1; 1143 unsigned S : 1; 1144 unsigned P : 1; 1145 unsigned D_NOT_A : 1; 1146 unsigned CKE : 1; 1147 unsigned SMP : 1; 1148 }; 1149 1150 struct 1151 { 1152 unsigned : 1; 1153 unsigned : 1; 1154 unsigned R : 1; 1155 unsigned I2C_START : 1; 1156 unsigned I2C_STOP : 1; 1157 unsigned D : 1; 1158 unsigned : 1; 1159 unsigned : 1; 1160 }; 1161 1162 struct 1163 { 1164 unsigned : 1; 1165 unsigned : 1; 1166 unsigned I2C_READ : 1; 1167 unsigned : 1; 1168 unsigned : 1; 1169 unsigned I2C_DATA : 1; 1170 unsigned : 1; 1171 unsigned : 1; 1172 }; 1173 1174 struct 1175 { 1176 unsigned : 1; 1177 unsigned : 1; 1178 unsigned NOT_W : 1; 1179 unsigned : 1; 1180 unsigned : 1; 1181 unsigned NOT_A : 1; 1182 unsigned : 1; 1183 unsigned : 1; 1184 }; 1185 1186 struct 1187 { 1188 unsigned : 1; 1189 unsigned : 1; 1190 unsigned NOT_WRITE : 1; 1191 unsigned : 1; 1192 unsigned : 1; 1193 unsigned NOT_ADDRESS : 1; 1194 unsigned : 1; 1195 unsigned : 1; 1196 }; 1197 1198 struct 1199 { 1200 unsigned : 1; 1201 unsigned : 1; 1202 unsigned R_W : 1; 1203 unsigned : 1; 1204 unsigned : 1; 1205 unsigned D_A : 1; 1206 unsigned : 1; 1207 unsigned : 1; 1208 }; 1209 1210 struct 1211 { 1212 unsigned : 1; 1213 unsigned : 1; 1214 unsigned READ_WRITE : 1; 1215 unsigned : 1; 1216 unsigned : 1; 1217 unsigned DATA_ADDRESS : 1; 1218 unsigned : 1; 1219 unsigned : 1; 1220 }; 1221 } __SSPSTATbits_t; 1222 1223 extern __at(0x0094) volatile __SSPSTATbits_t SSPSTATbits; 1224 1225 #define _BF 0x01 1226 #define _UA 0x02 1227 #define _R_NOT_W 0x04 1228 #define _R 0x04 1229 #define _I2C_READ 0x04 1230 #define _NOT_W 0x04 1231 #define _NOT_WRITE 0x04 1232 #define _R_W 0x04 1233 #define _READ_WRITE 0x04 1234 #define _S 0x08 1235 #define _I2C_START 0x08 1236 #define _P 0x10 1237 #define _I2C_STOP 0x10 1238 #define _D_NOT_A 0x20 1239 #define _D 0x20 1240 #define _I2C_DATA 0x20 1241 #define _NOT_A 0x20 1242 #define _NOT_ADDRESS 0x20 1243 #define _D_A 0x20 1244 #define _DATA_ADDRESS 0x20 1245 #define _CKE 0x40 1246 #define _SMP 0x80 1247 1248 //============================================================================== 1249 1250 extern __at(0x0095) __sfr CCPR3; 1251 extern __at(0x0095) __sfr CCPR3L; 1252 extern __at(0x0096) __sfr CCPR3H; 1253 1254 //============================================================================== 1255 // CCP3CON Bits 1256 1257 extern __at(0x0097) __sfr CCP3CON; 1258 1259 typedef union 1260 { 1261 struct 1262 { 1263 unsigned CCP3M0 : 1; 1264 unsigned CCP3M1 : 1; 1265 unsigned CCP3M2 : 1; 1266 unsigned CCP3M3 : 1; 1267 unsigned CCP3Y : 1; 1268 unsigned CCP3X : 1; 1269 unsigned : 1; 1270 unsigned : 1; 1271 }; 1272 1273 struct 1274 { 1275 unsigned CCP3M : 4; 1276 unsigned : 4; 1277 }; 1278 } __CCP3CONbits_t; 1279 1280 extern __at(0x0097) volatile __CCP3CONbits_t CCP3CONbits; 1281 1282 #define _CCP3M0 0x01 1283 #define _CCP3M1 0x02 1284 #define _CCP3M2 0x04 1285 #define _CCP3M3 0x08 1286 #define _CCP3Y 0x10 1287 #define _CCP3X 0x20 1288 1289 //============================================================================== 1290 1291 1292 //============================================================================== 1293 // TXSTA Bits 1294 1295 extern __at(0x0098) __sfr TXSTA; 1296 1297 typedef union 1298 { 1299 struct 1300 { 1301 unsigned TX9D : 1; 1302 unsigned TRMT : 1; 1303 unsigned BRGH : 1; 1304 unsigned : 1; 1305 unsigned SYNC : 1; 1306 unsigned TXEN : 1; 1307 unsigned TX9 : 1; 1308 unsigned CSRC : 1; 1309 }; 1310 1311 struct 1312 { 1313 unsigned TXD8 : 1; 1314 unsigned : 1; 1315 unsigned : 1; 1316 unsigned : 1; 1317 unsigned : 1; 1318 unsigned : 1; 1319 unsigned NOT_TX8 : 1; 1320 unsigned : 1; 1321 }; 1322 1323 struct 1324 { 1325 unsigned : 1; 1326 unsigned : 1; 1327 unsigned : 1; 1328 unsigned : 1; 1329 unsigned : 1; 1330 unsigned : 1; 1331 unsigned TX8_9 : 1; 1332 unsigned : 1; 1333 }; 1334 } __TXSTAbits_t; 1335 1336 extern __at(0x0098) volatile __TXSTAbits_t TXSTAbits; 1337 1338 #define _TX9D 0x01 1339 #define _TXD8 0x01 1340 #define _TRMT 0x02 1341 #define _BRGH 0x04 1342 #define _SYNC 0x10 1343 #define _TXEN 0x20 1344 #define _TX9 0x40 1345 #define _NOT_TX8 0x40 1346 #define _TX8_9 0x40 1347 #define _CSRC 0x80 1348 1349 //============================================================================== 1350 1351 extern __at(0x0099) __sfr SPBRG; 1352 1353 //============================================================================== 1354 // ADCON2 Bits 1355 1356 extern __at(0x009B) __sfr ADCON2; 1357 1358 typedef union 1359 { 1360 struct 1361 { 1362 unsigned : 1; 1363 unsigned : 1; 1364 unsigned : 1; 1365 unsigned ACQT0 : 1; 1366 unsigned ACQT1 : 1; 1367 unsigned ACQT2 : 1; 1368 unsigned : 1; 1369 unsigned : 1; 1370 }; 1371 1372 struct 1373 { 1374 unsigned : 3; 1375 unsigned ACQT : 3; 1376 unsigned : 2; 1377 }; 1378 } __ADCON2bits_t; 1379 1380 extern __at(0x009B) volatile __ADCON2bits_t ADCON2bits; 1381 1382 #define _ACQT0 0x08 1383 #define _ACQT1 0x10 1384 #define _ACQT2 0x20 1385 1386 //============================================================================== 1387 1388 1389 //============================================================================== 1390 // CMCON Bits 1391 1392 extern __at(0x009C) __sfr CMCON; 1393 1394 typedef union 1395 { 1396 struct 1397 { 1398 unsigned CM0 : 1; 1399 unsigned CM1 : 1; 1400 unsigned CM2 : 1; 1401 unsigned CIS : 1; 1402 unsigned C1INV : 1; 1403 unsigned C2INV : 1; 1404 unsigned C1OUT : 1; 1405 unsigned C2OUT : 1; 1406 }; 1407 1408 struct 1409 { 1410 unsigned CM : 3; 1411 unsigned : 5; 1412 }; 1413 } __CMCONbits_t; 1414 1415 extern __at(0x009C) volatile __CMCONbits_t CMCONbits; 1416 1417 #define _CM0 0x01 1418 #define _CM1 0x02 1419 #define _CM2 0x04 1420 #define _CIS 0x08 1421 #define _C1INV 0x10 1422 #define _C2INV 0x20 1423 #define _C1OUT 0x40 1424 #define _C2OUT 0x80 1425 1426 //============================================================================== 1427 1428 1429 //============================================================================== 1430 // CVRCON Bits 1431 1432 extern __at(0x009D) __sfr CVRCON; 1433 1434 typedef union 1435 { 1436 struct 1437 { 1438 unsigned CVR0 : 1; 1439 unsigned CVR1 : 1; 1440 unsigned CVR2 : 1; 1441 unsigned CVR3 : 1; 1442 unsigned : 1; 1443 unsigned CVRR : 1; 1444 unsigned CVROE : 1; 1445 unsigned CVREN : 1; 1446 }; 1447 1448 struct 1449 { 1450 unsigned CVR : 4; 1451 unsigned : 4; 1452 }; 1453 } __CVRCONbits_t; 1454 1455 extern __at(0x009D) volatile __CVRCONbits_t CVRCONbits; 1456 1457 #define _CVR0 0x01 1458 #define _CVR1 0x02 1459 #define _CVR2 0x04 1460 #define _CVR3 0x08 1461 #define _CVRR 0x20 1462 #define _CVROE 0x40 1463 #define _CVREN 0x80 1464 1465 //============================================================================== 1466 1467 extern __at(0x009E) __sfr ADRESL; 1468 1469 //============================================================================== 1470 // ADCON1 Bits 1471 1472 extern __at(0x009F) __sfr ADCON1; 1473 1474 typedef union 1475 { 1476 struct 1477 { 1478 unsigned PCFG0 : 1; 1479 unsigned PCFG1 : 1; 1480 unsigned PCFG2 : 1; 1481 unsigned PCFG3 : 1; 1482 unsigned VCFG0 : 1; 1483 unsigned VCFG1 : 1; 1484 unsigned ADCS2 : 1; 1485 unsigned ADFM : 1; 1486 }; 1487 1488 struct 1489 { 1490 unsigned PCFG : 4; 1491 unsigned : 4; 1492 }; 1493 1494 struct 1495 { 1496 unsigned : 4; 1497 unsigned VCFG : 2; 1498 unsigned : 2; 1499 }; 1500 } __ADCON1bits_t; 1501 1502 extern __at(0x009F) volatile __ADCON1bits_t ADCON1bits; 1503 1504 #define _PCFG0 0x01 1505 #define _PCFG1 0x02 1506 #define _PCFG2 0x04 1507 #define _PCFG3 0x08 1508 #define _VCFG0 0x10 1509 #define _VCFG1 0x20 1510 #define _ADCS2 0x40 1511 #define _ADFM 0x80 1512 1513 //============================================================================== 1514 1515 1516 //============================================================================== 1517 // WDTCON Bits 1518 1519 extern __at(0x0105) __sfr WDTCON; 1520 1521 typedef union 1522 { 1523 struct 1524 { 1525 unsigned SWDTEN : 1; 1526 unsigned WDTPS0 : 1; 1527 unsigned WDTPS1 : 1; 1528 unsigned WDTPS2 : 1; 1529 unsigned WDTPS3 : 1; 1530 unsigned : 1; 1531 unsigned : 1; 1532 unsigned : 1; 1533 }; 1534 1535 struct 1536 { 1537 unsigned SWDTE : 1; 1538 unsigned : 1; 1539 unsigned : 1; 1540 unsigned : 1; 1541 unsigned : 1; 1542 unsigned : 1; 1543 unsigned : 1; 1544 unsigned : 1; 1545 }; 1546 1547 struct 1548 { 1549 unsigned : 1; 1550 unsigned WDTPS : 4; 1551 unsigned : 3; 1552 }; 1553 } __WDTCONbits_t; 1554 1555 extern __at(0x0105) volatile __WDTCONbits_t WDTCONbits; 1556 1557 #define _SWDTEN 0x01 1558 #define _SWDTE 0x01 1559 #define _WDTPS0 0x02 1560 #define _WDTPS1 0x04 1561 #define _WDTPS2 0x08 1562 #define _WDTPS3 0x10 1563 1564 //============================================================================== 1565 1566 1567 //============================================================================== 1568 // LVDCON Bits 1569 1570 extern __at(0x0109) __sfr LVDCON; 1571 1572 typedef union 1573 { 1574 struct 1575 { 1576 unsigned LVDL0 : 1; 1577 unsigned LVDL1 : 1; 1578 unsigned LVDL2 : 1; 1579 unsigned LVDL3 : 1; 1580 unsigned LVDEN : 1; 1581 unsigned IRVST : 1; 1582 unsigned : 1; 1583 unsigned : 1; 1584 }; 1585 1586 struct 1587 { 1588 unsigned LVDL : 4; 1589 unsigned : 4; 1590 }; 1591 } __LVDCONbits_t; 1592 1593 extern __at(0x0109) volatile __LVDCONbits_t LVDCONbits; 1594 1595 #define _LVDL0 0x01 1596 #define _LVDL1 0x02 1597 #define _LVDL2 0x04 1598 #define _LVDL3 0x08 1599 #define _LVDEN 0x10 1600 #define _IRVST 0x20 1601 1602 //============================================================================== 1603 1604 extern __at(0x010C) __sfr PMDATA; 1605 extern __at(0x010D) __sfr PMADR; 1606 extern __at(0x010E) __sfr PMDATH; 1607 extern __at(0x010F) __sfr PMADRH; 1608 1609 //============================================================================== 1610 // PMCON1 Bits 1611 1612 extern __at(0x018C) __sfr PMCON1; 1613 1614 typedef struct 1615 { 1616 unsigned RD : 1; 1617 unsigned : 1; 1618 unsigned : 1; 1619 unsigned : 1; 1620 unsigned : 1; 1621 unsigned : 1; 1622 unsigned : 1; 1623 unsigned : 1; 1624 } __PMCON1bits_t; 1625 1626 extern __at(0x018C) volatile __PMCON1bits_t PMCON1bits; 1627 1628 #define _RD 0x01 1629 1630 //============================================================================== 1631 1632 1633 //============================================================================== 1634 // 1635 // Configuration Bits 1636 // 1637 //============================================================================== 1638 1639 #define _CONFIG1 0x2007 1640 #define _CONFIG2 0x2008 1641 1642 //----------------------------- CONFIG1 Options ------------------------------- 1643 1644 #define _FOSC_LP 0x3FEC // LP oscillator. 1645 #define _LP_OSC 0x3FEC // LP oscillator. 1646 #define _FOSC_XT 0x3FED // XT oscillator. 1647 #define _XT_OSC 0x3FED // XT oscillator. 1648 #define _FOSC_HS 0x3FEE // HS oscillator. 1649 #define _HS_OSC 0x3FEE // HS oscillator. 1650 #define _FOSC_EC 0x3FEF // EXTCLK; port I/O function on OSC2/CLKO/RA6. 1651 #define _EXTCLK 0x3FEF // EXTCLK; port I/O function on OSC2/CLKO/RA6. 1652 #define _FOSC_INTOSCIO 0x3FFC // INTRC oscillator; port I/O function on OSC1/CLKI/RA7 and OSC2/CLKO/RA6. 1653 #define _INTRC_IO 0x3FFC // INTRC oscillator; port I/O function on OSC1/CLKI/RA7 and OSC2/CLKO/RA6. 1654 #define _FOSC_INTOSCCLK 0x3FFD // INTRC oscillator; CLKO function on OSC2/CLKO/RA6 and port I/O function on OSC1/CLKI/RA7. 1655 #define _INTRC_CLKOUT 0x3FFD // INTRC oscillator; CLKO function on OSC2/CLKO/RA6 and port I/O function on OSC1/CLKI/RA7. 1656 #define _FOSC_EXTRCIO 0x3FFE // EXTRC oscillator; port I/O function on OSC2/CLKO/RA6. 1657 #define _EXTRC_IO 0x3FFE // EXTRC oscillator; port I/O function on OSC2/CLKO/RA6. 1658 #define _FOSC_EXTRCCLK 0x3FFF // EXTRC oscillator; CLKO function on OSC2/CLKO/RA6. 1659 #define _EXTRC_CLKOUT 0x3FFF // EXTRC oscillator; CLKO function on OSC2/CLKO/RA6. 1660 #define _WDTE_OFF 0x3FFB // WDT disabled. 1661 #define _WDT_OFF 0x3FFB // WDT disabled. 1662 #define _WDTE_ON 0x3FFF // WDT enabled. 1663 #define _WDT_ON 0x3FFF // WDT enabled. 1664 #define _PWRTE_ON 0x3FF7 // PWRT enabled. 1665 #define _PWRTE_OFF 0x3FFF // PWRT disabled. 1666 #define _MCLRE_OFF 0x3FDF // MCLR/VPP/RE3 pin function is digital input only, MCLR gated to '1'. 1667 #define _MCLR_OFF 0x3FDF // MCLR/VPP/RE3 pin function is digital input only, MCLR gated to '1'. 1668 #define _MCLRE_ON 0x3FFF // MCLR/VPP/RE3 pin function is MCLR. 1669 #define _MCLR_ON 0x3FFF // MCLR/VPP/RE3 pin function is MCLR. 1670 #define _BOREN_OFF 0x3FBF // Disabled. 1671 #define _BOREN_0 0x3FBF // Disabled. 1672 #define _BOREN_ON 0x3FFF // Enabled. 1673 #define _BOREN_1 0x3FFF // Enabled. 1674 #define _BORV_45 0x3E7F // VBOR set to 4.5V. 1675 #define _VBOR_4_5 0x3E7F // VBOR set to 4.5V. 1676 #define _BORV_42 0x3EFF // VBOR set to 4.2V. 1677 #define _VBOR_4_2 0x3EFF // VBOR set to 4.2V. 1678 #define _BORV_27 0x3F7F // VBOR set to 2.7V. 1679 #define _VBOR_2_7 0x3F7F // VBOR set to 2.7V. 1680 #define _BORV_20 0x3FFF // VBOR set to 2.0V. 1681 #define _VBOR_2_0 0x3FFF // VBOR set to 2.0V. 1682 #define _DEBUG_ON 0x37FF // In-Circuit Debugger enabled, RB6 and RB7 are dedicated to the debugger. 1683 #define _DEBUG_OFF 0x3FFF // In-Circuit Debugger disabled, RB6 and RB7 are general purpose I/O pins. 1684 #define _CCP2MX_RB3 0x2FFF // CCP2 is on RB3. 1685 #define _CCP2_RB3 0x2FFF // CCP2 is on RB3. 1686 #define _CCP2MX_RC1 0x3FFF // CCP2 is on RC1. 1687 #define _CCP2_RC1 0x3FFF // CCP2 is on RC1. 1688 #define _CP_ON 0x1FFF // 0000h to 1FFFh code-protected. 1689 #define _CP_ALL 0x1FFF // 0000h to 1FFFh code-protected. 1690 #define _CP_OFF 0x3FFF // Code protection off. 1691 1692 //----------------------------- CONFIG2 Options ------------------------------- 1693 1694 #define _FCMEN_OFF 0x3FFE // Fail-Safe Clock Monitor disabled. 1695 #define _FCMEN_ON 0x3FFF // Fail-Safe Clock Monitor enabled. 1696 #define _IESO_OFF 0x3FFD // Internal External Switchover mode disabled. 1697 #define _IESO_ON 0x3FFF // Internal External Switchover mode enabled. 1698 #define _BORSEN_OFF 0x3FBF // Disabled. 1699 #define _BORSEN_0 0x3FBF // Disabled. 1700 #define _BORSEN_ON 0x3FFF // Enabled. 1701 #define _BORSEN_1 0x3FFF // Enabled. 1702 1703 //============================================================================== 1704 1705 #define _DEVID1 0x2006 1706 1707 #define _IDLOC0 0x2000 1708 #define _IDLOC1 0x2001 1709 #define _IDLOC2 0x2002 1710 #define _IDLOC3 0x2003 1711 1712 //============================================================================== 1713 1714 #ifndef NO_BIT_DEFINES 1715 1716 #define ADON ADCON0bits.ADON // bit 0 1717 #define CHS3 ADCON0bits.CHS3 // bit 1 1718 #define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 2, shadows bit in ADCON0bits 1719 #define GO ADCON0bits.GO // bit 2, shadows bit in ADCON0bits 1720 #define NOT_DONE ADCON0bits.NOT_DONE // bit 2, shadows bit in ADCON0bits 1721 #define GO_DONE ADCON0bits.GO_DONE // bit 2, shadows bit in ADCON0bits 1722 #define CHS0 ADCON0bits.CHS0 // bit 3 1723 #define CHS1 ADCON0bits.CHS1 // bit 4 1724 #define CHS2 ADCON0bits.CHS2 // bit 5 1725 #define ADCS0 ADCON0bits.ADCS0 // bit 6 1726 #define ADCS1 ADCON0bits.ADCS1 // bit 7 1727 1728 #define PCFG0 ADCON1bits.PCFG0 // bit 0 1729 #define PCFG1 ADCON1bits.PCFG1 // bit 1 1730 #define PCFG2 ADCON1bits.PCFG2 // bit 2 1731 #define PCFG3 ADCON1bits.PCFG3 // bit 3 1732 #define VCFG0 ADCON1bits.VCFG0 // bit 4 1733 #define VCFG1 ADCON1bits.VCFG1 // bit 5 1734 #define ADCS2 ADCON1bits.ADCS2 // bit 6 1735 #define ADFM ADCON1bits.ADFM // bit 7 1736 1737 #define ACQT0 ADCON2bits.ACQT0 // bit 3 1738 #define ACQT1 ADCON2bits.ACQT1 // bit 4 1739 #define ACQT2 ADCON2bits.ACQT2 // bit 5 1740 1741 #define CCP1M0 CCP1CONbits.CCP1M0 // bit 0 1742 #define CCP1M1 CCP1CONbits.CCP1M1 // bit 1 1743 #define CCP1M2 CCP1CONbits.CCP1M2 // bit 2 1744 #define CCP1M3 CCP1CONbits.CCP1M3 // bit 3 1745 #define CCP1Y CCP1CONbits.CCP1Y // bit 4 1746 #define CCP1X CCP1CONbits.CCP1X // bit 5 1747 1748 #define CCP2M0 CCP2CONbits.CCP2M0 // bit 0 1749 #define CCP2M1 CCP2CONbits.CCP2M1 // bit 1 1750 #define CCP2M2 CCP2CONbits.CCP2M2 // bit 2 1751 #define CCP2M3 CCP2CONbits.CCP2M3 // bit 3 1752 #define CCP2Y CCP2CONbits.CCP2Y // bit 4 1753 #define CCP2X CCP2CONbits.CCP2X // bit 5 1754 1755 #define CCP3M0 CCP3CONbits.CCP3M0 // bit 0 1756 #define CCP3M1 CCP3CONbits.CCP3M1 // bit 1 1757 #define CCP3M2 CCP3CONbits.CCP3M2 // bit 2 1758 #define CCP3M3 CCP3CONbits.CCP3M3 // bit 3 1759 #define CCP3Y CCP3CONbits.CCP3Y // bit 4 1760 #define CCP3X CCP3CONbits.CCP3X // bit 5 1761 1762 #define CM0 CMCONbits.CM0 // bit 0 1763 #define CM1 CMCONbits.CM1 // bit 1 1764 #define CM2 CMCONbits.CM2 // bit 2 1765 #define CIS CMCONbits.CIS // bit 3 1766 #define C1INV CMCONbits.C1INV // bit 4 1767 #define C2INV CMCONbits.C2INV // bit 5 1768 #define C1OUT CMCONbits.C1OUT // bit 6 1769 #define C2OUT CMCONbits.C2OUT // bit 7 1770 1771 #define CVR0 CVRCONbits.CVR0 // bit 0 1772 #define CVR1 CVRCONbits.CVR1 // bit 1 1773 #define CVR2 CVRCONbits.CVR2 // bit 2 1774 #define CVR3 CVRCONbits.CVR3 // bit 3 1775 #define CVRR CVRCONbits.CVRR // bit 5 1776 #define CVROE CVRCONbits.CVROE // bit 6 1777 #define CVREN CVRCONbits.CVREN // bit 7 1778 1779 #define RBIF INTCONbits.RBIF // bit 0 1780 #define INTF INTCONbits.INTF // bit 1, shadows bit in INTCONbits 1781 #define INT0IF INTCONbits.INT0IF // bit 1, shadows bit in INTCONbits 1782 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits 1783 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits 1784 #define RBIE INTCONbits.RBIE // bit 3 1785 #define INTE INTCONbits.INTE // bit 4, shadows bit in INTCONbits 1786 #define INT0IE INTCONbits.INT0IE // bit 4, shadows bit in INTCONbits 1787 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits 1788 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits 1789 #define PEIE INTCONbits.PEIE // bit 6 1790 #define GIE INTCONbits.GIE // bit 7 1791 1792 #define LVDL0 LVDCONbits.LVDL0 // bit 0 1793 #define LVDL1 LVDCONbits.LVDL1 // bit 1 1794 #define LVDL2 LVDCONbits.LVDL2 // bit 2 1795 #define LVDL3 LVDCONbits.LVDL3 // bit 3 1796 #define LVDEN LVDCONbits.LVDEN // bit 4 1797 #define IRVST LVDCONbits.IRVST // bit 5 1798 1799 #define PS0 OPTION_REGbits.PS0 // bit 0 1800 #define PS1 OPTION_REGbits.PS1 // bit 1 1801 #define PS2 OPTION_REGbits.PS2 // bit 2 1802 #define PSA OPTION_REGbits.PSA // bit 3 1803 #define T0SE OPTION_REGbits.T0SE // bit 4 1804 #define T0CS OPTION_REGbits.T0CS // bit 5 1805 #define INTEDG OPTION_REGbits.INTEDG // bit 6 1806 #define NOT_RBPU OPTION_REGbits.NOT_RBPU // bit 7 1807 1808 #define SCS0 OSCCONbits.SCS0 // bit 0 1809 #define SCS1 OSCCONbits.SCS1 // bit 1 1810 #define IOFS OSCCONbits.IOFS // bit 2 1811 #define OSTS OSCCONbits.OSTS // bit 3 1812 #define IRCF0 OSCCONbits.IRCF0 // bit 4 1813 #define IRCF1 OSCCONbits.IRCF1 // bit 5 1814 #define IRCF2 OSCCONbits.IRCF2 // bit 6 1815 1816 #define TUN0 OSCTUNEbits.TUN0 // bit 0 1817 #define TUN1 OSCTUNEbits.TUN1 // bit 1 1818 #define TUN2 OSCTUNEbits.TUN2 // bit 2 1819 #define TUN3 OSCTUNEbits.TUN3 // bit 3 1820 #define TUN4 OSCTUNEbits.TUN4 // bit 4 1821 #define TUN5 OSCTUNEbits.TUN5 // bit 5 1822 1823 #define NOT_BOR PCONbits.NOT_BOR // bit 0, shadows bit in PCONbits 1824 #define NOT_BO PCONbits.NOT_BO // bit 0, shadows bit in PCONbits 1825 #define NOT_POR PCONbits.NOT_POR // bit 1 1826 #define SBOREN PCONbits.SBOREN // bit 2 1827 1828 #define TMR1IE PIE1bits.TMR1IE // bit 0 1829 #define TMR2IE PIE1bits.TMR2IE // bit 1 1830 #define CCP1IE PIE1bits.CCP1IE // bit 2 1831 #define SSPIE PIE1bits.SSPIE // bit 3 1832 #define TXIE PIE1bits.TXIE // bit 4 1833 #define RCIE PIE1bits.RCIE // bit 5 1834 #define ADIE PIE1bits.ADIE // bit 6 1835 #define PSPIE PIE1bits.PSPIE // bit 7 1836 1837 #define CCP2IE PIE2bits.CCP2IE // bit 0 1838 #define CCP3IE PIE2bits.CCP3IE // bit 1 1839 #define BCLIE PIE2bits.BCLIE // bit 3 1840 #define LVDIE PIE2bits.LVDIE // bit 5 1841 #define CMIE PIE2bits.CMIE // bit 6 1842 #define OSFIE PIE2bits.OSFIE // bit 7 1843 1844 #define TMR1IF PIR1bits.TMR1IF // bit 0 1845 #define TMR2IF PIR1bits.TMR2IF // bit 1 1846 #define CCP1IF PIR1bits.CCP1IF // bit 2 1847 #define SSPIF PIR1bits.SSPIF // bit 3 1848 #define TXIF PIR1bits.TXIF // bit 4 1849 #define RCIF PIR1bits.RCIF // bit 5 1850 #define ADIF PIR1bits.ADIF // bit 6 1851 #define PSPIF PIR1bits.PSPIF // bit 7 1852 1853 #define CCP2IF PIR2bits.CCP2IF // bit 0 1854 #define CCP3IF PIR2bits.CCP3IF // bit 1 1855 #define BCLIF PIR2bits.BCLIF // bit 3 1856 #define LVDIF PIR2bits.LVDIF // bit 5 1857 #define CMIF PIR2bits.CMIF // bit 6 1858 #define OSFIF PIR2bits.OSFIF // bit 7 1859 1860 #define RD PMCON1bits.RD // bit 0 1861 1862 #define RA0 PORTAbits.RA0 // bit 0 1863 #define RA1 PORTAbits.RA1 // bit 1 1864 #define RA2 PORTAbits.RA2 // bit 2 1865 #define RA3 PORTAbits.RA3 // bit 3 1866 #define RA4 PORTAbits.RA4 // bit 4 1867 #define RA5 PORTAbits.RA5 // bit 5 1868 #define RA6 PORTAbits.RA6 // bit 6 1869 #define RA7 PORTAbits.RA7 // bit 7 1870 1871 #define RB0 PORTBbits.RB0 // bit 0 1872 #define RB1 PORTBbits.RB1 // bit 1 1873 #define RB2 PORTBbits.RB2 // bit 2 1874 #define RB3 PORTBbits.RB3 // bit 3 1875 #define RB4 PORTBbits.RB4 // bit 4 1876 #define RB5 PORTBbits.RB5 // bit 5 1877 #define RB6 PORTBbits.RB6 // bit 6 1878 #define RB7 PORTBbits.RB7 // bit 7 1879 1880 #define RC0 PORTCbits.RC0 // bit 0 1881 #define RC1 PORTCbits.RC1 // bit 1 1882 #define RC2 PORTCbits.RC2 // bit 2 1883 #define RC3 PORTCbits.RC3 // bit 3 1884 #define RC4 PORTCbits.RC4 // bit 4 1885 #define RC5 PORTCbits.RC5 // bit 5 1886 #define RC6 PORTCbits.RC6 // bit 6 1887 #define RC7 PORTCbits.RC7 // bit 7 1888 1889 #define RE3 PORTEbits.RE3 // bit 3 1890 1891 #define RX9D RCSTAbits.RX9D // bit 0, shadows bit in RCSTAbits 1892 #define RCD8 RCSTAbits.RCD8 // bit 0, shadows bit in RCSTAbits 1893 #define OERR RCSTAbits.OERR // bit 1 1894 #define FERR RCSTAbits.FERR // bit 2 1895 #define ADDEN RCSTAbits.ADDEN // bit 3 1896 #define CREN RCSTAbits.CREN // bit 4 1897 #define SREN RCSTAbits.SREN // bit 5 1898 #define RX9 RCSTAbits.RX9 // bit 6, shadows bit in RCSTAbits 1899 #define RC9 RCSTAbits.RC9 // bit 6, shadows bit in RCSTAbits 1900 #define NOT_RC8 RCSTAbits.NOT_RC8 // bit 6, shadows bit in RCSTAbits 1901 #define RC8_9 RCSTAbits.RC8_9 // bit 6, shadows bit in RCSTAbits 1902 #define SPEN RCSTAbits.SPEN // bit 7 1903 1904 #define SSPM0 SSPCONbits.SSPM0 // bit 0 1905 #define SSPM1 SSPCONbits.SSPM1 // bit 1 1906 #define SSPM2 SSPCONbits.SSPM2 // bit 2 1907 #define SSPM3 SSPCONbits.SSPM3 // bit 3 1908 #define CKP SSPCONbits.CKP // bit 4 1909 #define SSPEN SSPCONbits.SSPEN // bit 5 1910 #define SSPOV SSPCONbits.SSPOV // bit 6 1911 #define WCOL SSPCONbits.WCOL // bit 7 1912 1913 #define SEN SSPCON2bits.SEN // bit 0 1914 #define RSEN SSPCON2bits.RSEN // bit 1 1915 #define PEN SSPCON2bits.PEN // bit 2 1916 #define RCEN SSPCON2bits.RCEN // bit 3 1917 #define ACKEN SSPCON2bits.ACKEN // bit 4 1918 #define ACKDT SSPCON2bits.ACKDT // bit 5 1919 #define ACKSTAT SSPCON2bits.ACKSTAT // bit 6 1920 #define GCEN SSPCON2bits.GCEN // bit 7 1921 1922 #define BF SSPSTATbits.BF // bit 0 1923 #define UA SSPSTATbits.UA // bit 1 1924 #define R_NOT_W SSPSTATbits.R_NOT_W // bit 2, shadows bit in SSPSTATbits 1925 #define R SSPSTATbits.R // bit 2, shadows bit in SSPSTATbits 1926 #define I2C_READ SSPSTATbits.I2C_READ // bit 2, shadows bit in SSPSTATbits 1927 #define NOT_W SSPSTATbits.NOT_W // bit 2, shadows bit in SSPSTATbits 1928 #define NOT_WRITE SSPSTATbits.NOT_WRITE // bit 2, shadows bit in SSPSTATbits 1929 #define R_W SSPSTATbits.R_W // bit 2, shadows bit in SSPSTATbits 1930 #define READ_WRITE SSPSTATbits.READ_WRITE // bit 2, shadows bit in SSPSTATbits 1931 #define S SSPSTATbits.S // bit 3, shadows bit in SSPSTATbits 1932 #define I2C_START SSPSTATbits.I2C_START // bit 3, shadows bit in SSPSTATbits 1933 #define P SSPSTATbits.P // bit 4, shadows bit in SSPSTATbits 1934 #define I2C_STOP SSPSTATbits.I2C_STOP // bit 4, shadows bit in SSPSTATbits 1935 #define D_NOT_A SSPSTATbits.D_NOT_A // bit 5, shadows bit in SSPSTATbits 1936 #define D SSPSTATbits.D // bit 5, shadows bit in SSPSTATbits 1937 #define I2C_DATA SSPSTATbits.I2C_DATA // bit 5, shadows bit in SSPSTATbits 1938 #define NOT_A SSPSTATbits.NOT_A // bit 5, shadows bit in SSPSTATbits 1939 #define NOT_ADDRESS SSPSTATbits.NOT_ADDRESS // bit 5, shadows bit in SSPSTATbits 1940 #define D_A SSPSTATbits.D_A // bit 5, shadows bit in SSPSTATbits 1941 #define DATA_ADDRESS SSPSTATbits.DATA_ADDRESS // bit 5, shadows bit in SSPSTATbits 1942 #define CKE SSPSTATbits.CKE // bit 6 1943 #define SMP SSPSTATbits.SMP // bit 7 1944 1945 #define C STATUSbits.C // bit 0 1946 #define DC STATUSbits.DC // bit 1 1947 #define Z STATUSbits.Z // bit 2 1948 #define NOT_PD STATUSbits.NOT_PD // bit 3 1949 #define NOT_TO STATUSbits.NOT_TO // bit 4 1950 #define RP0 STATUSbits.RP0 // bit 5 1951 #define RP1 STATUSbits.RP1 // bit 6 1952 #define IRP STATUSbits.IRP // bit 7 1953 1954 #define TMR1ON T1CONbits.TMR1ON // bit 0 1955 #define TMR1CS T1CONbits.TMR1CS // bit 1 1956 #define NOT_T1SYNC T1CONbits.NOT_T1SYNC // bit 2, shadows bit in T1CONbits 1957 #define T1SYNC T1CONbits.T1SYNC // bit 2, shadows bit in T1CONbits 1958 #define T1INSYNC T1CONbits.T1INSYNC // bit 2, shadows bit in T1CONbits 1959 #define T1OSCEN T1CONbits.T1OSCEN // bit 3 1960 #define T1CKPS0 T1CONbits.T1CKPS0 // bit 4 1961 #define T1CKPS1 T1CONbits.T1CKPS1 // bit 5 1962 #define T1RUN T1CONbits.T1RUN // bit 6 1963 1964 #define T2CKPS0 T2CONbits.T2CKPS0 // bit 0 1965 #define T2CKPS1 T2CONbits.T2CKPS1 // bit 1 1966 #define TMR2ON T2CONbits.TMR2ON // bit 2 1967 #define TOUTPS0 T2CONbits.TOUTPS0 // bit 3 1968 #define TOUTPS1 T2CONbits.TOUTPS1 // bit 4 1969 #define TOUTPS2 T2CONbits.TOUTPS2 // bit 5 1970 #define TOUTPS3 T2CONbits.TOUTPS3 // bit 6 1971 1972 #define TRISA0 TRISAbits.TRISA0 // bit 0 1973 #define TRISA1 TRISAbits.TRISA1 // bit 1 1974 #define TRISA2 TRISAbits.TRISA2 // bit 2 1975 #define TRISA3 TRISAbits.TRISA3 // bit 3 1976 #define TRISA4 TRISAbits.TRISA4 // bit 4 1977 #define TRISA5 TRISAbits.TRISA5 // bit 5 1978 #define TRISA6 TRISAbits.TRISA6 // bit 6 1979 #define TRISA7 TRISAbits.TRISA7 // bit 7 1980 1981 #define TRISB0 TRISBbits.TRISB0 // bit 0 1982 #define TRISB1 TRISBbits.TRISB1 // bit 1 1983 #define TRISB2 TRISBbits.TRISB2 // bit 2 1984 #define TRISB3 TRISBbits.TRISB3 // bit 3 1985 #define TRISB4 TRISBbits.TRISB4 // bit 4 1986 #define TRISB5 TRISBbits.TRISB5 // bit 5 1987 #define TRISB6 TRISBbits.TRISB6 // bit 6 1988 #define TRISB7 TRISBbits.TRISB7 // bit 7 1989 1990 #define TRISC0 TRISCbits.TRISC0 // bit 0 1991 #define TRISC1 TRISCbits.TRISC1 // bit 1 1992 #define TRISC2 TRISCbits.TRISC2 // bit 2 1993 #define TRISC3 TRISCbits.TRISC3 // bit 3 1994 #define TRISC4 TRISCbits.TRISC4 // bit 4 1995 #define TRISC5 TRISCbits.TRISC5 // bit 5 1996 #define TRISC6 TRISCbits.TRISC6 // bit 6 1997 #define TRISC7 TRISCbits.TRISC7 // bit 7 1998 1999 #define TX9D TXSTAbits.TX9D // bit 0, shadows bit in TXSTAbits 2000 #define TXD8 TXSTAbits.TXD8 // bit 0, shadows bit in TXSTAbits 2001 #define TRMT TXSTAbits.TRMT // bit 1 2002 #define BRGH TXSTAbits.BRGH // bit 2 2003 #define SYNC TXSTAbits.SYNC // bit 4 2004 #define TXEN TXSTAbits.TXEN // bit 5 2005 #define TX9 TXSTAbits.TX9 // bit 6, shadows bit in TXSTAbits 2006 #define NOT_TX8 TXSTAbits.NOT_TX8 // bit 6, shadows bit in TXSTAbits 2007 #define TX8_9 TXSTAbits.TX8_9 // bit 6, shadows bit in TXSTAbits 2008 #define CSRC TXSTAbits.CSRC // bit 7 2009 2010 #define SWDTEN WDTCONbits.SWDTEN // bit 0, shadows bit in WDTCONbits 2011 #define SWDTE WDTCONbits.SWDTE // bit 0, shadows bit in WDTCONbits 2012 #define WDTPS0 WDTCONbits.WDTPS0 // bit 1 2013 #define WDTPS1 WDTCONbits.WDTPS1 // bit 2 2014 #define WDTPS2 WDTCONbits.WDTPS2 // bit 3 2015 #define WDTPS3 WDTCONbits.WDTPS3 // bit 4 2016 2017 #endif // #ifndef NO_BIT_DEFINES 2018 2019 #endif // #ifndef __PIC16LF767_H__ 2020