1 /* 2 * This declarations of the PIC18LF4523 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:24:04 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 __PIC18LF4523_H__ 26 #define __PIC18LF4523_H__ 27 28 //============================================================================== 29 30 //============================================================================== 31 // 32 // Register Definitions 33 // 34 //============================================================================== 35 36 37 //============================================================================== 38 // PORTA Bits 39 40 extern __at(0x0F80) __sfr PORTA; 41 42 typedef union 43 { 44 struct 45 { 46 unsigned RA0 : 1; 47 unsigned RA1 : 1; 48 unsigned RA2 : 1; 49 unsigned RA3 : 1; 50 unsigned RA4 : 1; 51 unsigned RA5 : 1; 52 unsigned RA6 : 1; 53 unsigned RA7 : 1; 54 }; 55 56 struct 57 { 58 unsigned AN0 : 1; 59 unsigned AN1 : 1; 60 unsigned AN2 : 1; 61 unsigned AN3 : 1; 62 unsigned T0CKI : 1; 63 unsigned AN4 : 1; 64 unsigned OSC2 : 1; 65 unsigned OSC1 : 1; 66 }; 67 68 struct 69 { 70 unsigned : 1; 71 unsigned : 1; 72 unsigned VREFN : 1; 73 unsigned VREFP : 1; 74 unsigned C1OUT : 1; 75 unsigned SS : 1; 76 unsigned CLKO : 1; 77 unsigned CLKI : 1; 78 }; 79 80 struct 81 { 82 unsigned : 1; 83 unsigned : 1; 84 unsigned CVREF : 1; 85 unsigned : 1; 86 unsigned : 1; 87 unsigned NOT_SS : 1; 88 unsigned : 1; 89 unsigned : 1; 90 }; 91 92 struct 93 { 94 unsigned : 1; 95 unsigned : 1; 96 unsigned : 1; 97 unsigned : 1; 98 unsigned : 1; 99 unsigned LVDIN : 1; 100 unsigned : 1; 101 unsigned : 1; 102 }; 103 104 struct 105 { 106 unsigned : 1; 107 unsigned : 1; 108 unsigned : 1; 109 unsigned : 1; 110 unsigned : 1; 111 unsigned HLVDIN : 1; 112 unsigned : 1; 113 unsigned : 1; 114 }; 115 116 struct 117 { 118 unsigned : 1; 119 unsigned : 1; 120 unsigned : 1; 121 unsigned : 1; 122 unsigned : 1; 123 unsigned C2OUT : 1; 124 unsigned : 1; 125 unsigned : 1; 126 }; 127 } __PORTAbits_t; 128 129 extern __at(0x0F80) volatile __PORTAbits_t PORTAbits; 130 131 #define _PORTA_RA0 0x01 132 #define _PORTA_AN0 0x01 133 #define _PORTA_RA1 0x02 134 #define _PORTA_AN1 0x02 135 #define _PORTA_RA2 0x04 136 #define _PORTA_AN2 0x04 137 #define _PORTA_VREFN 0x04 138 #define _PORTA_CVREF 0x04 139 #define _PORTA_RA3 0x08 140 #define _PORTA_AN3 0x08 141 #define _PORTA_VREFP 0x08 142 #define _PORTA_RA4 0x10 143 #define _PORTA_T0CKI 0x10 144 #define _PORTA_C1OUT 0x10 145 #define _PORTA_RA5 0x20 146 #define _PORTA_AN4 0x20 147 #define _PORTA_SS 0x20 148 #define _PORTA_NOT_SS 0x20 149 #define _PORTA_LVDIN 0x20 150 #define _PORTA_HLVDIN 0x20 151 #define _PORTA_C2OUT 0x20 152 #define _PORTA_RA6 0x40 153 #define _PORTA_OSC2 0x40 154 #define _PORTA_CLKO 0x40 155 #define _PORTA_RA7 0x80 156 #define _PORTA_OSC1 0x80 157 #define _PORTA_CLKI 0x80 158 159 //============================================================================== 160 161 162 //============================================================================== 163 // PORTB Bits 164 165 extern __at(0x0F81) __sfr PORTB; 166 167 typedef union 168 { 169 struct 170 { 171 unsigned RB0 : 1; 172 unsigned RB1 : 1; 173 unsigned RB2 : 1; 174 unsigned RB3 : 1; 175 unsigned RB4 : 1; 176 unsigned RB5 : 1; 177 unsigned RB6 : 1; 178 unsigned RB7 : 1; 179 }; 180 181 struct 182 { 183 unsigned INT0 : 1; 184 unsigned INT1 : 1; 185 unsigned INT2 : 1; 186 unsigned CCP2 : 1; 187 unsigned KBI0 : 1; 188 unsigned KBI1 : 1; 189 unsigned KBI2 : 1; 190 unsigned KBI3 : 1; 191 }; 192 193 struct 194 { 195 unsigned AN12 : 1; 196 unsigned AN10 : 1; 197 unsigned AN8 : 1; 198 unsigned AN9 : 1; 199 unsigned AN11 : 1; 200 unsigned PGM : 1; 201 unsigned PGC : 1; 202 unsigned PGD : 1; 203 }; 204 205 struct 206 { 207 unsigned FLT0 : 1; 208 unsigned : 1; 209 unsigned : 1; 210 unsigned : 1; 211 unsigned : 1; 212 unsigned : 1; 213 unsigned : 1; 214 unsigned : 1; 215 }; 216 217 struct 218 { 219 unsigned INT : 3; 220 unsigned : 5; 221 }; 222 223 struct 224 { 225 unsigned : 4; 226 unsigned KBI : 4; 227 }; 228 } __PORTBbits_t; 229 230 extern __at(0x0F81) volatile __PORTBbits_t PORTBbits; 231 232 #define _PORTB_RB0 0x01 233 #define _PORTB_INT0 0x01 234 #define _PORTB_AN12 0x01 235 #define _PORTB_FLT0 0x01 236 #define _PORTB_RB1 0x02 237 #define _PORTB_INT1 0x02 238 #define _PORTB_AN10 0x02 239 #define _PORTB_RB2 0x04 240 #define _PORTB_INT2 0x04 241 #define _PORTB_AN8 0x04 242 #define _PORTB_RB3 0x08 243 #define _PORTB_CCP2 0x08 244 #define _PORTB_AN9 0x08 245 #define _PORTB_RB4 0x10 246 #define _PORTB_KBI0 0x10 247 #define _PORTB_AN11 0x10 248 #define _PORTB_RB5 0x20 249 #define _PORTB_KBI1 0x20 250 #define _PORTB_PGM 0x20 251 #define _PORTB_RB6 0x40 252 #define _PORTB_KBI2 0x40 253 #define _PORTB_PGC 0x40 254 #define _PORTB_RB7 0x80 255 #define _PORTB_KBI3 0x80 256 #define _PORTB_PGD 0x80 257 258 //============================================================================== 259 260 261 //============================================================================== 262 // PORTC Bits 263 264 extern __at(0x0F82) __sfr PORTC; 265 266 typedef union 267 { 268 struct 269 { 270 unsigned RC0 : 1; 271 unsigned RC1 : 1; 272 unsigned RC2 : 1; 273 unsigned RC3 : 1; 274 unsigned RC4 : 1; 275 unsigned RC5 : 1; 276 unsigned RC6 : 1; 277 unsigned RC7 : 1; 278 }; 279 280 struct 281 { 282 unsigned T1OSO : 1; 283 unsigned T1OSI : 1; 284 unsigned CCP1 : 1; 285 unsigned SCK : 1; 286 unsigned SDI : 1; 287 unsigned SDO : 1; 288 unsigned TX : 1; 289 unsigned RX : 1; 290 }; 291 292 struct 293 { 294 unsigned T13CKI : 1; 295 unsigned CCP2 : 1; 296 unsigned P1A : 1; 297 unsigned SCL : 1; 298 unsigned SDA : 1; 299 unsigned : 1; 300 unsigned CK : 1; 301 unsigned : 1; 302 }; 303 304 struct 305 { 306 unsigned T1CKI : 1; 307 unsigned : 1; 308 unsigned : 1; 309 unsigned : 1; 310 unsigned : 1; 311 unsigned : 1; 312 unsigned : 1; 313 unsigned : 1; 314 }; 315 } __PORTCbits_t; 316 317 extern __at(0x0F82) volatile __PORTCbits_t PORTCbits; 318 319 #define _PORTC_RC0 0x01 320 #define _PORTC_T1OSO 0x01 321 #define _PORTC_T13CKI 0x01 322 #define _PORTC_T1CKI 0x01 323 #define _PORTC_RC1 0x02 324 #define _PORTC_T1OSI 0x02 325 #define _PORTC_CCP2 0x02 326 #define _PORTC_RC2 0x04 327 #define _PORTC_CCP1 0x04 328 #define _PORTC_P1A 0x04 329 #define _PORTC_RC3 0x08 330 #define _PORTC_SCK 0x08 331 #define _PORTC_SCL 0x08 332 #define _PORTC_RC4 0x10 333 #define _PORTC_SDI 0x10 334 #define _PORTC_SDA 0x10 335 #define _PORTC_RC5 0x20 336 #define _PORTC_SDO 0x20 337 #define _PORTC_RC6 0x40 338 #define _PORTC_TX 0x40 339 #define _PORTC_CK 0x40 340 #define _PORTC_RC7 0x80 341 #define _PORTC_RX 0x80 342 343 //============================================================================== 344 345 346 //============================================================================== 347 // PORTD Bits 348 349 extern __at(0x0F83) __sfr PORTD; 350 351 typedef union 352 { 353 struct 354 { 355 unsigned RD0 : 1; 356 unsigned RD1 : 1; 357 unsigned RD2 : 1; 358 unsigned RD3 : 1; 359 unsigned RD4 : 1; 360 unsigned RD5 : 1; 361 unsigned RD6 : 1; 362 unsigned RD7 : 1; 363 }; 364 365 struct 366 { 367 unsigned PSP0 : 1; 368 unsigned PSP1 : 1; 369 unsigned PSP2 : 1; 370 unsigned PSP3 : 1; 371 unsigned PSP4 : 1; 372 unsigned PSP5 : 1; 373 unsigned PSP6 : 1; 374 unsigned PSP7 : 1; 375 }; 376 377 struct 378 { 379 unsigned : 1; 380 unsigned : 1; 381 unsigned : 1; 382 unsigned : 1; 383 unsigned : 1; 384 unsigned P1B : 1; 385 unsigned P1C : 1; 386 unsigned P1D : 1; 387 }; 388 } __PORTDbits_t; 389 390 extern __at(0x0F83) volatile __PORTDbits_t PORTDbits; 391 392 #define _PORTD_RD0 0x01 393 #define _PORTD_PSP0 0x01 394 #define _PORTD_RD1 0x02 395 #define _PORTD_PSP1 0x02 396 #define _PORTD_RD2 0x04 397 #define _PORTD_PSP2 0x04 398 #define _PORTD_RD3 0x08 399 #define _PORTD_PSP3 0x08 400 #define _PORTD_RD4 0x10 401 #define _PORTD_PSP4 0x10 402 #define _PORTD_RD5 0x20 403 #define _PORTD_PSP5 0x20 404 #define _PORTD_P1B 0x20 405 #define _PORTD_RD6 0x40 406 #define _PORTD_PSP6 0x40 407 #define _PORTD_P1C 0x40 408 #define _PORTD_RD7 0x80 409 #define _PORTD_PSP7 0x80 410 #define _PORTD_P1D 0x80 411 412 //============================================================================== 413 414 415 //============================================================================== 416 // PORTE Bits 417 418 extern __at(0x0F84) __sfr PORTE; 419 420 typedef union 421 { 422 struct 423 { 424 unsigned RE0 : 1; 425 unsigned RE1 : 1; 426 unsigned RE2 : 1; 427 unsigned RE3 : 1; 428 unsigned : 1; 429 unsigned : 1; 430 unsigned : 1; 431 unsigned : 1; 432 }; 433 434 struct 435 { 436 unsigned RD : 1; 437 unsigned WR : 1; 438 unsigned CS : 1; 439 unsigned MCLR : 1; 440 unsigned : 1; 441 unsigned : 1; 442 unsigned : 1; 443 unsigned : 1; 444 }; 445 446 struct 447 { 448 unsigned NOT_RD : 1; 449 unsigned NOT_WR : 1; 450 unsigned NOT_CS : 1; 451 unsigned NOT_MCLR : 1; 452 unsigned : 1; 453 unsigned : 1; 454 unsigned : 1; 455 unsigned : 1; 456 }; 457 458 struct 459 { 460 unsigned AN5 : 1; 461 unsigned AN6 : 1; 462 unsigned AN7 : 1; 463 unsigned VPP : 1; 464 unsigned : 1; 465 unsigned : 1; 466 unsigned : 1; 467 unsigned : 1; 468 }; 469 470 struct 471 { 472 unsigned RE : 4; 473 unsigned : 4; 474 }; 475 } __PORTEbits_t; 476 477 extern __at(0x0F84) volatile __PORTEbits_t PORTEbits; 478 479 #define _PORTE_RE0 0x01 480 #define _PORTE_RD 0x01 481 #define _PORTE_NOT_RD 0x01 482 #define _PORTE_AN5 0x01 483 #define _PORTE_RE1 0x02 484 #define _PORTE_WR 0x02 485 #define _PORTE_NOT_WR 0x02 486 #define _PORTE_AN6 0x02 487 #define _PORTE_RE2 0x04 488 #define _PORTE_CS 0x04 489 #define _PORTE_NOT_CS 0x04 490 #define _PORTE_AN7 0x04 491 #define _PORTE_RE3 0x08 492 #define _PORTE_MCLR 0x08 493 #define _PORTE_NOT_MCLR 0x08 494 #define _PORTE_VPP 0x08 495 496 //============================================================================== 497 498 499 //============================================================================== 500 // LATA Bits 501 502 extern __at(0x0F89) __sfr LATA; 503 504 typedef struct 505 { 506 unsigned LATA0 : 1; 507 unsigned LATA1 : 1; 508 unsigned LATA2 : 1; 509 unsigned LATA3 : 1; 510 unsigned LATA4 : 1; 511 unsigned LATA5 : 1; 512 unsigned LATA6 : 1; 513 unsigned LATA7 : 1; 514 } __LATAbits_t; 515 516 extern __at(0x0F89) volatile __LATAbits_t LATAbits; 517 518 #define _LATA0 0x01 519 #define _LATA1 0x02 520 #define _LATA2 0x04 521 #define _LATA3 0x08 522 #define _LATA4 0x10 523 #define _LATA5 0x20 524 #define _LATA6 0x40 525 #define _LATA7 0x80 526 527 //============================================================================== 528 529 530 //============================================================================== 531 // LATB Bits 532 533 extern __at(0x0F8A) __sfr LATB; 534 535 typedef struct 536 { 537 unsigned LATB0 : 1; 538 unsigned LATB1 : 1; 539 unsigned LATB2 : 1; 540 unsigned LATB3 : 1; 541 unsigned LATB4 : 1; 542 unsigned LATB5 : 1; 543 unsigned LATB6 : 1; 544 unsigned LATB7 : 1; 545 } __LATBbits_t; 546 547 extern __at(0x0F8A) volatile __LATBbits_t LATBbits; 548 549 #define _LATB0 0x01 550 #define _LATB1 0x02 551 #define _LATB2 0x04 552 #define _LATB3 0x08 553 #define _LATB4 0x10 554 #define _LATB5 0x20 555 #define _LATB6 0x40 556 #define _LATB7 0x80 557 558 //============================================================================== 559 560 561 //============================================================================== 562 // LATC Bits 563 564 extern __at(0x0F8B) __sfr LATC; 565 566 typedef struct 567 { 568 unsigned LATC0 : 1; 569 unsigned LATC1 : 1; 570 unsigned LATC2 : 1; 571 unsigned LATC3 : 1; 572 unsigned LATC4 : 1; 573 unsigned LATC5 : 1; 574 unsigned LATC6 : 1; 575 unsigned LATC7 : 1; 576 } __LATCbits_t; 577 578 extern __at(0x0F8B) volatile __LATCbits_t LATCbits; 579 580 #define _LATC0 0x01 581 #define _LATC1 0x02 582 #define _LATC2 0x04 583 #define _LATC3 0x08 584 #define _LATC4 0x10 585 #define _LATC5 0x20 586 #define _LATC6 0x40 587 #define _LATC7 0x80 588 589 //============================================================================== 590 591 592 //============================================================================== 593 // LATD Bits 594 595 extern __at(0x0F8C) __sfr LATD; 596 597 typedef struct 598 { 599 unsigned LATD0 : 1; 600 unsigned LATD1 : 1; 601 unsigned LATD2 : 1; 602 unsigned LATD3 : 1; 603 unsigned LATD4 : 1; 604 unsigned LATD5 : 1; 605 unsigned LATD6 : 1; 606 unsigned LATD7 : 1; 607 } __LATDbits_t; 608 609 extern __at(0x0F8C) volatile __LATDbits_t LATDbits; 610 611 #define _LATD0 0x01 612 #define _LATD1 0x02 613 #define _LATD2 0x04 614 #define _LATD3 0x08 615 #define _LATD4 0x10 616 #define _LATD5 0x20 617 #define _LATD6 0x40 618 #define _LATD7 0x80 619 620 //============================================================================== 621 622 623 //============================================================================== 624 // LATE Bits 625 626 extern __at(0x0F8D) __sfr LATE; 627 628 typedef union 629 { 630 struct 631 { 632 unsigned LATE0 : 1; 633 unsigned LATE1 : 1; 634 unsigned LATE2 : 1; 635 unsigned : 1; 636 unsigned : 1; 637 unsigned : 1; 638 unsigned : 1; 639 unsigned : 1; 640 }; 641 642 struct 643 { 644 unsigned LATE : 3; 645 unsigned : 5; 646 }; 647 } __LATEbits_t; 648 649 extern __at(0x0F8D) volatile __LATEbits_t LATEbits; 650 651 #define _LATE0 0x01 652 #define _LATE1 0x02 653 #define _LATE2 0x04 654 655 //============================================================================== 656 657 658 //============================================================================== 659 // DDRA Bits 660 661 extern __at(0x0F92) __sfr DDRA; 662 663 typedef union 664 { 665 struct 666 { 667 unsigned TRISA0 : 1; 668 unsigned TRISA1 : 1; 669 unsigned TRISA2 : 1; 670 unsigned TRISA3 : 1; 671 unsigned TRISA4 : 1; 672 unsigned TRISA5 : 1; 673 unsigned TRISA6 : 1; 674 unsigned TRISA7 : 1; 675 }; 676 677 struct 678 { 679 unsigned RA0 : 1; 680 unsigned RA1 : 1; 681 unsigned RA2 : 1; 682 unsigned RA3 : 1; 683 unsigned RA4 : 1; 684 unsigned RA5 : 1; 685 unsigned RA6 : 1; 686 unsigned RA7 : 1; 687 }; 688 } __DDRAbits_t; 689 690 extern __at(0x0F92) volatile __DDRAbits_t DDRAbits; 691 692 #define _TRISA0 0x01 693 #define _RA0 0x01 694 #define _TRISA1 0x02 695 #define _RA1 0x02 696 #define _TRISA2 0x04 697 #define _RA2 0x04 698 #define _TRISA3 0x08 699 #define _RA3 0x08 700 #define _TRISA4 0x10 701 #define _RA4 0x10 702 #define _TRISA5 0x20 703 #define _RA5 0x20 704 #define _TRISA6 0x40 705 #define _RA6 0x40 706 #define _TRISA7 0x80 707 #define _RA7 0x80 708 709 //============================================================================== 710 711 712 //============================================================================== 713 // TRISA Bits 714 715 extern __at(0x0F92) __sfr TRISA; 716 717 typedef union 718 { 719 struct 720 { 721 unsigned TRISA0 : 1; 722 unsigned TRISA1 : 1; 723 unsigned TRISA2 : 1; 724 unsigned TRISA3 : 1; 725 unsigned TRISA4 : 1; 726 unsigned TRISA5 : 1; 727 unsigned TRISA6 : 1; 728 unsigned TRISA7 : 1; 729 }; 730 731 struct 732 { 733 unsigned RA0 : 1; 734 unsigned RA1 : 1; 735 unsigned RA2 : 1; 736 unsigned RA3 : 1; 737 unsigned RA4 : 1; 738 unsigned RA5 : 1; 739 unsigned RA6 : 1; 740 unsigned RA7 : 1; 741 }; 742 } __TRISAbits_t; 743 744 extern __at(0x0F92) volatile __TRISAbits_t TRISAbits; 745 746 #define _TRISA_TRISA0 0x01 747 #define _TRISA_RA0 0x01 748 #define _TRISA_TRISA1 0x02 749 #define _TRISA_RA1 0x02 750 #define _TRISA_TRISA2 0x04 751 #define _TRISA_RA2 0x04 752 #define _TRISA_TRISA3 0x08 753 #define _TRISA_RA3 0x08 754 #define _TRISA_TRISA4 0x10 755 #define _TRISA_RA4 0x10 756 #define _TRISA_TRISA5 0x20 757 #define _TRISA_RA5 0x20 758 #define _TRISA_TRISA6 0x40 759 #define _TRISA_RA6 0x40 760 #define _TRISA_TRISA7 0x80 761 #define _TRISA_RA7 0x80 762 763 //============================================================================== 764 765 766 //============================================================================== 767 // DDRB Bits 768 769 extern __at(0x0F93) __sfr DDRB; 770 771 typedef union 772 { 773 struct 774 { 775 unsigned TRISB0 : 1; 776 unsigned TRISB1 : 1; 777 unsigned TRISB2 : 1; 778 unsigned TRISB3 : 1; 779 unsigned TRISB4 : 1; 780 unsigned TRISB5 : 1; 781 unsigned TRISB6 : 1; 782 unsigned TRISB7 : 1; 783 }; 784 785 struct 786 { 787 unsigned RB0 : 1; 788 unsigned RB1 : 1; 789 unsigned RB2 : 1; 790 unsigned RB3 : 1; 791 unsigned RB4 : 1; 792 unsigned RB5 : 1; 793 unsigned RB6 : 1; 794 unsigned RB7 : 1; 795 }; 796 } __DDRBbits_t; 797 798 extern __at(0x0F93) volatile __DDRBbits_t DDRBbits; 799 800 #define _TRISB0 0x01 801 #define _RB0 0x01 802 #define _TRISB1 0x02 803 #define _RB1 0x02 804 #define _TRISB2 0x04 805 #define _RB2 0x04 806 #define _TRISB3 0x08 807 #define _RB3 0x08 808 #define _TRISB4 0x10 809 #define _RB4 0x10 810 #define _TRISB5 0x20 811 #define _RB5 0x20 812 #define _TRISB6 0x40 813 #define _RB6 0x40 814 #define _TRISB7 0x80 815 #define _RB7 0x80 816 817 //============================================================================== 818 819 820 //============================================================================== 821 // TRISB Bits 822 823 extern __at(0x0F93) __sfr TRISB; 824 825 typedef union 826 { 827 struct 828 { 829 unsigned TRISB0 : 1; 830 unsigned TRISB1 : 1; 831 unsigned TRISB2 : 1; 832 unsigned TRISB3 : 1; 833 unsigned TRISB4 : 1; 834 unsigned TRISB5 : 1; 835 unsigned TRISB6 : 1; 836 unsigned TRISB7 : 1; 837 }; 838 839 struct 840 { 841 unsigned RB0 : 1; 842 unsigned RB1 : 1; 843 unsigned RB2 : 1; 844 unsigned RB3 : 1; 845 unsigned RB4 : 1; 846 unsigned RB5 : 1; 847 unsigned RB6 : 1; 848 unsigned RB7 : 1; 849 }; 850 } __TRISBbits_t; 851 852 extern __at(0x0F93) volatile __TRISBbits_t TRISBbits; 853 854 #define _TRISB_TRISB0 0x01 855 #define _TRISB_RB0 0x01 856 #define _TRISB_TRISB1 0x02 857 #define _TRISB_RB1 0x02 858 #define _TRISB_TRISB2 0x04 859 #define _TRISB_RB2 0x04 860 #define _TRISB_TRISB3 0x08 861 #define _TRISB_RB3 0x08 862 #define _TRISB_TRISB4 0x10 863 #define _TRISB_RB4 0x10 864 #define _TRISB_TRISB5 0x20 865 #define _TRISB_RB5 0x20 866 #define _TRISB_TRISB6 0x40 867 #define _TRISB_RB6 0x40 868 #define _TRISB_TRISB7 0x80 869 #define _TRISB_RB7 0x80 870 871 //============================================================================== 872 873 874 //============================================================================== 875 // DDRC Bits 876 877 extern __at(0x0F94) __sfr DDRC; 878 879 typedef union 880 { 881 struct 882 { 883 unsigned TRISC0 : 1; 884 unsigned TRISC1 : 1; 885 unsigned TRISC2 : 1; 886 unsigned TRISC3 : 1; 887 unsigned TRISC4 : 1; 888 unsigned TRISC5 : 1; 889 unsigned TRISC6 : 1; 890 unsigned TRISC7 : 1; 891 }; 892 893 struct 894 { 895 unsigned RC0 : 1; 896 unsigned RC1 : 1; 897 unsigned RC2 : 1; 898 unsigned RC3 : 1; 899 unsigned RC4 : 1; 900 unsigned RC5 : 1; 901 unsigned RC6 : 1; 902 unsigned RC7 : 1; 903 }; 904 } __DDRCbits_t; 905 906 extern __at(0x0F94) volatile __DDRCbits_t DDRCbits; 907 908 #define _TRISC0 0x01 909 #define _RC0 0x01 910 #define _TRISC1 0x02 911 #define _RC1 0x02 912 #define _TRISC2 0x04 913 #define _RC2 0x04 914 #define _TRISC3 0x08 915 #define _RC3 0x08 916 #define _TRISC4 0x10 917 #define _RC4 0x10 918 #define _TRISC5 0x20 919 #define _RC5 0x20 920 #define _TRISC6 0x40 921 #define _RC6 0x40 922 #define _TRISC7 0x80 923 #define _RC7 0x80 924 925 //============================================================================== 926 927 928 //============================================================================== 929 // TRISC Bits 930 931 extern __at(0x0F94) __sfr TRISC; 932 933 typedef union 934 { 935 struct 936 { 937 unsigned TRISC0 : 1; 938 unsigned TRISC1 : 1; 939 unsigned TRISC2 : 1; 940 unsigned TRISC3 : 1; 941 unsigned TRISC4 : 1; 942 unsigned TRISC5 : 1; 943 unsigned TRISC6 : 1; 944 unsigned TRISC7 : 1; 945 }; 946 947 struct 948 { 949 unsigned RC0 : 1; 950 unsigned RC1 : 1; 951 unsigned RC2 : 1; 952 unsigned RC3 : 1; 953 unsigned RC4 : 1; 954 unsigned RC5 : 1; 955 unsigned RC6 : 1; 956 unsigned RC7 : 1; 957 }; 958 } __TRISCbits_t; 959 960 extern __at(0x0F94) volatile __TRISCbits_t TRISCbits; 961 962 #define _TRISC_TRISC0 0x01 963 #define _TRISC_RC0 0x01 964 #define _TRISC_TRISC1 0x02 965 #define _TRISC_RC1 0x02 966 #define _TRISC_TRISC2 0x04 967 #define _TRISC_RC2 0x04 968 #define _TRISC_TRISC3 0x08 969 #define _TRISC_RC3 0x08 970 #define _TRISC_TRISC4 0x10 971 #define _TRISC_RC4 0x10 972 #define _TRISC_TRISC5 0x20 973 #define _TRISC_RC5 0x20 974 #define _TRISC_TRISC6 0x40 975 #define _TRISC_RC6 0x40 976 #define _TRISC_TRISC7 0x80 977 #define _TRISC_RC7 0x80 978 979 //============================================================================== 980 981 982 //============================================================================== 983 // DDRD Bits 984 985 extern __at(0x0F95) __sfr DDRD; 986 987 typedef union 988 { 989 struct 990 { 991 unsigned TRISD0 : 1; 992 unsigned TRISD1 : 1; 993 unsigned TRISD2 : 1; 994 unsigned TRISD3 : 1; 995 unsigned TRISD4 : 1; 996 unsigned TRISD5 : 1; 997 unsigned TRISD6 : 1; 998 unsigned TRISD7 : 1; 999 }; 1000 1001 struct 1002 { 1003 unsigned RD0 : 1; 1004 unsigned RD1 : 1; 1005 unsigned RD2 : 1; 1006 unsigned RD3 : 1; 1007 unsigned RD4 : 1; 1008 unsigned RD5 : 1; 1009 unsigned RD6 : 1; 1010 unsigned RD7 : 1; 1011 }; 1012 } __DDRDbits_t; 1013 1014 extern __at(0x0F95) volatile __DDRDbits_t DDRDbits; 1015 1016 #define _TRISD0 0x01 1017 #define _RD0 0x01 1018 #define _TRISD1 0x02 1019 #define _RD1 0x02 1020 #define _TRISD2 0x04 1021 #define _RD2 0x04 1022 #define _TRISD3 0x08 1023 #define _RD3 0x08 1024 #define _TRISD4 0x10 1025 #define _RD4 0x10 1026 #define _TRISD5 0x20 1027 #define _RD5 0x20 1028 #define _TRISD6 0x40 1029 #define _RD6 0x40 1030 #define _TRISD7 0x80 1031 #define _RD7 0x80 1032 1033 //============================================================================== 1034 1035 1036 //============================================================================== 1037 // TRISD Bits 1038 1039 extern __at(0x0F95) __sfr TRISD; 1040 1041 typedef union 1042 { 1043 struct 1044 { 1045 unsigned TRISD0 : 1; 1046 unsigned TRISD1 : 1; 1047 unsigned TRISD2 : 1; 1048 unsigned TRISD3 : 1; 1049 unsigned TRISD4 : 1; 1050 unsigned TRISD5 : 1; 1051 unsigned TRISD6 : 1; 1052 unsigned TRISD7 : 1; 1053 }; 1054 1055 struct 1056 { 1057 unsigned RD0 : 1; 1058 unsigned RD1 : 1; 1059 unsigned RD2 : 1; 1060 unsigned RD3 : 1; 1061 unsigned RD4 : 1; 1062 unsigned RD5 : 1; 1063 unsigned RD6 : 1; 1064 unsigned RD7 : 1; 1065 }; 1066 } __TRISDbits_t; 1067 1068 extern __at(0x0F95) volatile __TRISDbits_t TRISDbits; 1069 1070 #define _TRISD_TRISD0 0x01 1071 #define _TRISD_RD0 0x01 1072 #define _TRISD_TRISD1 0x02 1073 #define _TRISD_RD1 0x02 1074 #define _TRISD_TRISD2 0x04 1075 #define _TRISD_RD2 0x04 1076 #define _TRISD_TRISD3 0x08 1077 #define _TRISD_RD3 0x08 1078 #define _TRISD_TRISD4 0x10 1079 #define _TRISD_RD4 0x10 1080 #define _TRISD_TRISD5 0x20 1081 #define _TRISD_RD5 0x20 1082 #define _TRISD_TRISD6 0x40 1083 #define _TRISD_RD6 0x40 1084 #define _TRISD_TRISD7 0x80 1085 #define _TRISD_RD7 0x80 1086 1087 //============================================================================== 1088 1089 1090 //============================================================================== 1091 // DDRE Bits 1092 1093 extern __at(0x0F96) __sfr DDRE; 1094 1095 typedef union 1096 { 1097 struct 1098 { 1099 unsigned TRISE0 : 1; 1100 unsigned TRISE1 : 1; 1101 unsigned TRISE2 : 1; 1102 unsigned RE3 : 1; 1103 unsigned PSPMODE : 1; 1104 unsigned IBOV : 1; 1105 unsigned OBF : 1; 1106 unsigned IBF : 1; 1107 }; 1108 1109 struct 1110 { 1111 unsigned RE0 : 1; 1112 unsigned RE1 : 1; 1113 unsigned RE2 : 1; 1114 unsigned : 1; 1115 unsigned : 1; 1116 unsigned : 1; 1117 unsigned : 1; 1118 unsigned : 1; 1119 }; 1120 1121 struct 1122 { 1123 unsigned TRISE : 3; 1124 unsigned : 5; 1125 }; 1126 1127 struct 1128 { 1129 unsigned RE : 4; 1130 unsigned : 4; 1131 }; 1132 } __DDREbits_t; 1133 1134 extern __at(0x0F96) volatile __DDREbits_t DDREbits; 1135 1136 #define _TRISE0 0x01 1137 #define _RE0 0x01 1138 #define _TRISE1 0x02 1139 #define _RE1 0x02 1140 #define _TRISE2 0x04 1141 #define _RE2 0x04 1142 #define _RE3 0x08 1143 #define _PSPMODE 0x10 1144 #define _IBOV 0x20 1145 #define _OBF 0x40 1146 #define _IBF 0x80 1147 1148 //============================================================================== 1149 1150 1151 //============================================================================== 1152 // TRISE Bits 1153 1154 extern __at(0x0F96) __sfr TRISE; 1155 1156 typedef union 1157 { 1158 struct 1159 { 1160 unsigned TRISE0 : 1; 1161 unsigned TRISE1 : 1; 1162 unsigned TRISE2 : 1; 1163 unsigned RE3 : 1; 1164 unsigned PSPMODE : 1; 1165 unsigned IBOV : 1; 1166 unsigned OBF : 1; 1167 unsigned IBF : 1; 1168 }; 1169 1170 struct 1171 { 1172 unsigned RE0 : 1; 1173 unsigned RE1 : 1; 1174 unsigned RE2 : 1; 1175 unsigned : 1; 1176 unsigned : 1; 1177 unsigned : 1; 1178 unsigned : 1; 1179 unsigned : 1; 1180 }; 1181 1182 struct 1183 { 1184 unsigned TRISE : 3; 1185 unsigned : 5; 1186 }; 1187 1188 struct 1189 { 1190 unsigned RE : 4; 1191 unsigned : 4; 1192 }; 1193 } __TRISEbits_t; 1194 1195 extern __at(0x0F96) volatile __TRISEbits_t TRISEbits; 1196 1197 #define _TRISE_TRISE0 0x01 1198 #define _TRISE_RE0 0x01 1199 #define _TRISE_TRISE1 0x02 1200 #define _TRISE_RE1 0x02 1201 #define _TRISE_TRISE2 0x04 1202 #define _TRISE_RE2 0x04 1203 #define _TRISE_RE3 0x08 1204 #define _TRISE_PSPMODE 0x10 1205 #define _TRISE_IBOV 0x20 1206 #define _TRISE_OBF 0x40 1207 #define _TRISE_IBF 0x80 1208 1209 //============================================================================== 1210 1211 1212 //============================================================================== 1213 // OSCTUNE Bits 1214 1215 extern __at(0x0F9B) __sfr OSCTUNE; 1216 1217 typedef union 1218 { 1219 struct 1220 { 1221 unsigned TUN0 : 1; 1222 unsigned TUN1 : 1; 1223 unsigned TUN2 : 1; 1224 unsigned TUN3 : 1; 1225 unsigned TUN4 : 1; 1226 unsigned : 1; 1227 unsigned PLLEN : 1; 1228 unsigned INTSRC : 1; 1229 }; 1230 1231 struct 1232 { 1233 unsigned TUN : 5; 1234 unsigned : 3; 1235 }; 1236 } __OSCTUNEbits_t; 1237 1238 extern __at(0x0F9B) volatile __OSCTUNEbits_t OSCTUNEbits; 1239 1240 #define _TUN0 0x01 1241 #define _TUN1 0x02 1242 #define _TUN2 0x04 1243 #define _TUN3 0x08 1244 #define _TUN4 0x10 1245 #define _PLLEN 0x40 1246 #define _INTSRC 0x80 1247 1248 //============================================================================== 1249 1250 1251 //============================================================================== 1252 // PIE1 Bits 1253 1254 extern __at(0x0F9D) __sfr PIE1; 1255 1256 typedef struct 1257 { 1258 unsigned TMR1IE : 1; 1259 unsigned TMR2IE : 1; 1260 unsigned CCP1IE : 1; 1261 unsigned SSPIE : 1; 1262 unsigned TXIE : 1; 1263 unsigned RCIE : 1; 1264 unsigned ADIE : 1; 1265 unsigned PSPIE : 1; 1266 } __PIE1bits_t; 1267 1268 extern __at(0x0F9D) volatile __PIE1bits_t PIE1bits; 1269 1270 #define _TMR1IE 0x01 1271 #define _TMR2IE 0x02 1272 #define _CCP1IE 0x04 1273 #define _SSPIE 0x08 1274 #define _TXIE 0x10 1275 #define _RCIE 0x20 1276 #define _ADIE 0x40 1277 #define _PSPIE 0x80 1278 1279 //============================================================================== 1280 1281 1282 //============================================================================== 1283 // PIR1 Bits 1284 1285 extern __at(0x0F9E) __sfr PIR1; 1286 1287 typedef struct 1288 { 1289 unsigned TMR1IF : 1; 1290 unsigned TMR2IF : 1; 1291 unsigned CCP1IF : 1; 1292 unsigned SSPIF : 1; 1293 unsigned TXIF : 1; 1294 unsigned RCIF : 1; 1295 unsigned ADIF : 1; 1296 unsigned PSPIF : 1; 1297 } __PIR1bits_t; 1298 1299 extern __at(0x0F9E) volatile __PIR1bits_t PIR1bits; 1300 1301 #define _TMR1IF 0x01 1302 #define _TMR2IF 0x02 1303 #define _CCP1IF 0x04 1304 #define _SSPIF 0x08 1305 #define _TXIF 0x10 1306 #define _RCIF 0x20 1307 #define _ADIF 0x40 1308 #define _PSPIF 0x80 1309 1310 //============================================================================== 1311 1312 1313 //============================================================================== 1314 // IPR1 Bits 1315 1316 extern __at(0x0F9F) __sfr IPR1; 1317 1318 typedef struct 1319 { 1320 unsigned TMR1IP : 1; 1321 unsigned TMR2IP : 1; 1322 unsigned CCP1IP : 1; 1323 unsigned SSPIP : 1; 1324 unsigned TXIP : 1; 1325 unsigned RCIP : 1; 1326 unsigned ADIP : 1; 1327 unsigned PSPIP : 1; 1328 } __IPR1bits_t; 1329 1330 extern __at(0x0F9F) volatile __IPR1bits_t IPR1bits; 1331 1332 #define _TMR1IP 0x01 1333 #define _TMR2IP 0x02 1334 #define _CCP1IP 0x04 1335 #define _SSPIP 0x08 1336 #define _TXIP 0x10 1337 #define _RCIP 0x20 1338 #define _ADIP 0x40 1339 #define _PSPIP 0x80 1340 1341 //============================================================================== 1342 1343 1344 //============================================================================== 1345 // PIE2 Bits 1346 1347 extern __at(0x0FA0) __sfr PIE2; 1348 1349 typedef union 1350 { 1351 struct 1352 { 1353 unsigned CCP2IE : 1; 1354 unsigned TMR3IE : 1; 1355 unsigned HLVDIE : 1; 1356 unsigned BCLIE : 1; 1357 unsigned EEIE : 1; 1358 unsigned : 1; 1359 unsigned CMIE : 1; 1360 unsigned OSCFIE : 1; 1361 }; 1362 1363 struct 1364 { 1365 unsigned : 1; 1366 unsigned : 1; 1367 unsigned LVDIE : 1; 1368 unsigned : 1; 1369 unsigned : 1; 1370 unsigned : 1; 1371 unsigned : 1; 1372 unsigned : 1; 1373 }; 1374 } __PIE2bits_t; 1375 1376 extern __at(0x0FA0) volatile __PIE2bits_t PIE2bits; 1377 1378 #define _CCP2IE 0x01 1379 #define _TMR3IE 0x02 1380 #define _HLVDIE 0x04 1381 #define _LVDIE 0x04 1382 #define _BCLIE 0x08 1383 #define _EEIE 0x10 1384 #define _CMIE 0x40 1385 #define _OSCFIE 0x80 1386 1387 //============================================================================== 1388 1389 1390 //============================================================================== 1391 // PIR2 Bits 1392 1393 extern __at(0x0FA1) __sfr PIR2; 1394 1395 typedef union 1396 { 1397 struct 1398 { 1399 unsigned CCP2IF : 1; 1400 unsigned TMR3IF : 1; 1401 unsigned HLVDIF : 1; 1402 unsigned BCLIF : 1; 1403 unsigned EEIF : 1; 1404 unsigned : 1; 1405 unsigned CMIF : 1; 1406 unsigned OSCFIF : 1; 1407 }; 1408 1409 struct 1410 { 1411 unsigned : 1; 1412 unsigned : 1; 1413 unsigned LVDIF : 1; 1414 unsigned : 1; 1415 unsigned : 1; 1416 unsigned : 1; 1417 unsigned : 1; 1418 unsigned : 1; 1419 }; 1420 } __PIR2bits_t; 1421 1422 extern __at(0x0FA1) volatile __PIR2bits_t PIR2bits; 1423 1424 #define _CCP2IF 0x01 1425 #define _TMR3IF 0x02 1426 #define _HLVDIF 0x04 1427 #define _LVDIF 0x04 1428 #define _BCLIF 0x08 1429 #define _EEIF 0x10 1430 #define _CMIF 0x40 1431 #define _OSCFIF 0x80 1432 1433 //============================================================================== 1434 1435 1436 //============================================================================== 1437 // IPR2 Bits 1438 1439 extern __at(0x0FA2) __sfr IPR2; 1440 1441 typedef union 1442 { 1443 struct 1444 { 1445 unsigned CCP2IP : 1; 1446 unsigned TMR3IP : 1; 1447 unsigned HLVDIP : 1; 1448 unsigned BCLIP : 1; 1449 unsigned EEIP : 1; 1450 unsigned : 1; 1451 unsigned CMIP : 1; 1452 unsigned OSCFIP : 1; 1453 }; 1454 1455 struct 1456 { 1457 unsigned : 1; 1458 unsigned : 1; 1459 unsigned LVDIP : 1; 1460 unsigned : 1; 1461 unsigned : 1; 1462 unsigned : 1; 1463 unsigned : 1; 1464 unsigned : 1; 1465 }; 1466 } __IPR2bits_t; 1467 1468 extern __at(0x0FA2) volatile __IPR2bits_t IPR2bits; 1469 1470 #define _CCP2IP 0x01 1471 #define _TMR3IP 0x02 1472 #define _HLVDIP 0x04 1473 #define _LVDIP 0x04 1474 #define _BCLIP 0x08 1475 #define _EEIP 0x10 1476 #define _CMIP 0x40 1477 #define _OSCFIP 0x80 1478 1479 //============================================================================== 1480 1481 1482 //============================================================================== 1483 // EECON1 Bits 1484 1485 extern __at(0x0FA6) __sfr EECON1; 1486 1487 typedef struct 1488 { 1489 unsigned RD : 1; 1490 unsigned WR : 1; 1491 unsigned WREN : 1; 1492 unsigned WRERR : 1; 1493 unsigned FREE : 1; 1494 unsigned : 1; 1495 unsigned CFGS : 1; 1496 unsigned EEPGD : 1; 1497 } __EECON1bits_t; 1498 1499 extern __at(0x0FA6) volatile __EECON1bits_t EECON1bits; 1500 1501 #define _RD 0x01 1502 #define _WR 0x02 1503 #define _WREN 0x04 1504 #define _WRERR 0x08 1505 #define _FREE 0x10 1506 #define _CFGS 0x40 1507 #define _EEPGD 0x80 1508 1509 //============================================================================== 1510 1511 extern __at(0x0FA7) __sfr EECON2; 1512 extern __at(0x0FA8) __sfr EEDATA; 1513 extern __at(0x0FA9) __sfr EEADR; 1514 1515 //============================================================================== 1516 // RCSTA Bits 1517 1518 extern __at(0x0FAB) __sfr RCSTA; 1519 1520 typedef union 1521 { 1522 struct 1523 { 1524 unsigned RX9D : 1; 1525 unsigned OERR : 1; 1526 unsigned FERR : 1; 1527 unsigned ADDEN : 1; 1528 unsigned CREN : 1; 1529 unsigned SREN : 1; 1530 unsigned RX9 : 1; 1531 unsigned SPEN : 1; 1532 }; 1533 1534 struct 1535 { 1536 unsigned : 1; 1537 unsigned : 1; 1538 unsigned : 1; 1539 unsigned ADEN : 1; 1540 unsigned : 1; 1541 unsigned : 1; 1542 unsigned : 1; 1543 unsigned : 1; 1544 }; 1545 } __RCSTAbits_t; 1546 1547 extern __at(0x0FAB) volatile __RCSTAbits_t RCSTAbits; 1548 1549 #define _RX9D 0x01 1550 #define _OERR 0x02 1551 #define _FERR 0x04 1552 #define _ADDEN 0x08 1553 #define _ADEN 0x08 1554 #define _CREN 0x10 1555 #define _SREN 0x20 1556 #define _RX9 0x40 1557 #define _SPEN 0x80 1558 1559 //============================================================================== 1560 1561 1562 //============================================================================== 1563 // RCSTA1 Bits 1564 1565 extern __at(0x0FAB) __sfr RCSTA1; 1566 1567 typedef union 1568 { 1569 struct 1570 { 1571 unsigned RX9D : 1; 1572 unsigned OERR : 1; 1573 unsigned FERR : 1; 1574 unsigned ADDEN : 1; 1575 unsigned CREN : 1; 1576 unsigned SREN : 1; 1577 unsigned RX9 : 1; 1578 unsigned SPEN : 1; 1579 }; 1580 1581 struct 1582 { 1583 unsigned : 1; 1584 unsigned : 1; 1585 unsigned : 1; 1586 unsigned ADEN : 1; 1587 unsigned : 1; 1588 unsigned : 1; 1589 unsigned : 1; 1590 unsigned : 1; 1591 }; 1592 } __RCSTA1bits_t; 1593 1594 extern __at(0x0FAB) volatile __RCSTA1bits_t RCSTA1bits; 1595 1596 #define _RCSTA1_RX9D 0x01 1597 #define _RCSTA1_OERR 0x02 1598 #define _RCSTA1_FERR 0x04 1599 #define _RCSTA1_ADDEN 0x08 1600 #define _RCSTA1_ADEN 0x08 1601 #define _RCSTA1_CREN 0x10 1602 #define _RCSTA1_SREN 0x20 1603 #define _RCSTA1_RX9 0x40 1604 #define _RCSTA1_SPEN 0x80 1605 1606 //============================================================================== 1607 1608 1609 //============================================================================== 1610 // TXSTA Bits 1611 1612 extern __at(0x0FAC) __sfr TXSTA; 1613 1614 typedef struct 1615 { 1616 unsigned TX9D : 1; 1617 unsigned TRMT : 1; 1618 unsigned BRGH : 1; 1619 unsigned SENDB : 1; 1620 unsigned SYNC : 1; 1621 unsigned TXEN : 1; 1622 unsigned TX9 : 1; 1623 unsigned CSRC : 1; 1624 } __TXSTAbits_t; 1625 1626 extern __at(0x0FAC) volatile __TXSTAbits_t TXSTAbits; 1627 1628 #define _TX9D 0x01 1629 #define _TRMT 0x02 1630 #define _BRGH 0x04 1631 #define _SENDB 0x08 1632 #define _SYNC 0x10 1633 #define _TXEN 0x20 1634 #define _TX9 0x40 1635 #define _CSRC 0x80 1636 1637 //============================================================================== 1638 1639 1640 //============================================================================== 1641 // TXSTA1 Bits 1642 1643 extern __at(0x0FAC) __sfr TXSTA1; 1644 1645 typedef struct 1646 { 1647 unsigned TX9D : 1; 1648 unsigned TRMT : 1; 1649 unsigned BRGH : 1; 1650 unsigned SENDB : 1; 1651 unsigned SYNC : 1; 1652 unsigned TXEN : 1; 1653 unsigned TX9 : 1; 1654 unsigned CSRC : 1; 1655 } __TXSTA1bits_t; 1656 1657 extern __at(0x0FAC) volatile __TXSTA1bits_t TXSTA1bits; 1658 1659 #define _TXSTA1_TX9D 0x01 1660 #define _TXSTA1_TRMT 0x02 1661 #define _TXSTA1_BRGH 0x04 1662 #define _TXSTA1_SENDB 0x08 1663 #define _TXSTA1_SYNC 0x10 1664 #define _TXSTA1_TXEN 0x20 1665 #define _TXSTA1_TX9 0x40 1666 #define _TXSTA1_CSRC 0x80 1667 1668 //============================================================================== 1669 1670 extern __at(0x0FAD) __sfr TXREG; 1671 extern __at(0x0FAD) __sfr TXREG1; 1672 extern __at(0x0FAE) __sfr RCREG; 1673 extern __at(0x0FAE) __sfr RCREG1; 1674 extern __at(0x0FAF) __sfr SPBRG; 1675 extern __at(0x0FAF) __sfr SPBRG1; 1676 extern __at(0x0FB0) __sfr SPBRGH; 1677 1678 //============================================================================== 1679 // T3CON Bits 1680 1681 extern __at(0x0FB1) __sfr T3CON; 1682 1683 typedef union 1684 { 1685 struct 1686 { 1687 unsigned TMR3ON : 1; 1688 unsigned TMR3CS : 1; 1689 unsigned NOT_T3SYNC : 1; 1690 unsigned T3CCP1 : 1; 1691 unsigned T3CKPS0 : 1; 1692 unsigned T3CKPS1 : 1; 1693 unsigned T3CCP2 : 1; 1694 unsigned RD16 : 1; 1695 }; 1696 1697 struct 1698 { 1699 unsigned : 1; 1700 unsigned : 1; 1701 unsigned T3SYNC : 1; 1702 unsigned : 1; 1703 unsigned : 1; 1704 unsigned : 1; 1705 unsigned : 1; 1706 unsigned : 1; 1707 }; 1708 1709 struct 1710 { 1711 unsigned : 4; 1712 unsigned T3CKPS : 2; 1713 unsigned : 2; 1714 }; 1715 } __T3CONbits_t; 1716 1717 extern __at(0x0FB1) volatile __T3CONbits_t T3CONbits; 1718 1719 #define _T3CON_TMR3ON 0x01 1720 #define _T3CON_TMR3CS 0x02 1721 #define _T3CON_NOT_T3SYNC 0x04 1722 #define _T3CON_T3SYNC 0x04 1723 #define _T3CON_T3CCP1 0x08 1724 #define _T3CON_T3CKPS0 0x10 1725 #define _T3CON_T3CKPS1 0x20 1726 #define _T3CON_T3CCP2 0x40 1727 #define _T3CON_RD16 0x80 1728 1729 //============================================================================== 1730 1731 extern __at(0x0FB2) __sfr TMR3; 1732 extern __at(0x0FB2) __sfr TMR3L; 1733 extern __at(0x0FB3) __sfr TMR3H; 1734 1735 //============================================================================== 1736 // CMCON Bits 1737 1738 extern __at(0x0FB4) __sfr CMCON; 1739 1740 typedef union 1741 { 1742 struct 1743 { 1744 unsigned CM0 : 1; 1745 unsigned CM1 : 1; 1746 unsigned CM2 : 1; 1747 unsigned CIS : 1; 1748 unsigned C1INV : 1; 1749 unsigned C2INV : 1; 1750 unsigned C1OUT : 1; 1751 unsigned C2OUT : 1; 1752 }; 1753 1754 struct 1755 { 1756 unsigned CM : 3; 1757 unsigned : 5; 1758 }; 1759 } __CMCONbits_t; 1760 1761 extern __at(0x0FB4) volatile __CMCONbits_t CMCONbits; 1762 1763 #define _CM0 0x01 1764 #define _CM1 0x02 1765 #define _CM2 0x04 1766 #define _CIS 0x08 1767 #define _C1INV 0x10 1768 #define _C2INV 0x20 1769 #define _C1OUT 0x40 1770 #define _C2OUT 0x80 1771 1772 //============================================================================== 1773 1774 1775 //============================================================================== 1776 // CVRCON Bits 1777 1778 extern __at(0x0FB5) __sfr CVRCON; 1779 1780 typedef union 1781 { 1782 struct 1783 { 1784 unsigned CVR0 : 1; 1785 unsigned CVR1 : 1; 1786 unsigned CVR2 : 1; 1787 unsigned CVR3 : 1; 1788 unsigned CVRSS : 1; 1789 unsigned CVRR : 1; 1790 unsigned CVROE : 1; 1791 unsigned CVREN : 1; 1792 }; 1793 1794 struct 1795 { 1796 unsigned CVR : 4; 1797 unsigned : 4; 1798 }; 1799 } __CVRCONbits_t; 1800 1801 extern __at(0x0FB5) volatile __CVRCONbits_t CVRCONbits; 1802 1803 #define _CVR0 0x01 1804 #define _CVR1 0x02 1805 #define _CVR2 0x04 1806 #define _CVR3 0x08 1807 #define _CVRSS 0x10 1808 #define _CVRR 0x20 1809 #define _CVROE 0x40 1810 #define _CVREN 0x80 1811 1812 //============================================================================== 1813 1814 1815 //============================================================================== 1816 // ECCP1AS Bits 1817 1818 extern __at(0x0FB6) __sfr ECCP1AS; 1819 1820 typedef union 1821 { 1822 struct 1823 { 1824 unsigned PSSBD0 : 1; 1825 unsigned PSSBD1 : 1; 1826 unsigned PSSAC0 : 1; 1827 unsigned PSSAC1 : 1; 1828 unsigned ECCPAS0 : 1; 1829 unsigned ECCPAS1 : 1; 1830 unsigned ECCPAS2 : 1; 1831 unsigned ECCPASE : 1; 1832 }; 1833 1834 struct 1835 { 1836 unsigned PSSBD : 2; 1837 unsigned : 6; 1838 }; 1839 1840 struct 1841 { 1842 unsigned : 2; 1843 unsigned PSSAC : 2; 1844 unsigned : 4; 1845 }; 1846 1847 struct 1848 { 1849 unsigned : 4; 1850 unsigned ECCPAS : 3; 1851 unsigned : 1; 1852 }; 1853 } __ECCP1ASbits_t; 1854 1855 extern __at(0x0FB6) volatile __ECCP1ASbits_t ECCP1ASbits; 1856 1857 #define _PSSBD0 0x01 1858 #define _PSSBD1 0x02 1859 #define _PSSAC0 0x04 1860 #define _PSSAC1 0x08 1861 #define _ECCPAS0 0x10 1862 #define _ECCPAS1 0x20 1863 #define _ECCPAS2 0x40 1864 #define _ECCPASE 0x80 1865 1866 //============================================================================== 1867 1868 1869 //============================================================================== 1870 // ECCPAS Bits 1871 1872 extern __at(0x0FB6) __sfr ECCPAS; 1873 1874 typedef union 1875 { 1876 struct 1877 { 1878 unsigned PSSBD0 : 1; 1879 unsigned PSSBD1 : 1; 1880 unsigned PSSAC0 : 1; 1881 unsigned PSSAC1 : 1; 1882 unsigned ECCPAS0 : 1; 1883 unsigned ECCPAS1 : 1; 1884 unsigned ECCPAS2 : 1; 1885 unsigned ECCPASE : 1; 1886 }; 1887 1888 struct 1889 { 1890 unsigned PSSBD : 2; 1891 unsigned : 6; 1892 }; 1893 1894 struct 1895 { 1896 unsigned : 2; 1897 unsigned PSSAC : 2; 1898 unsigned : 4; 1899 }; 1900 1901 struct 1902 { 1903 unsigned : 4; 1904 unsigned ECCPAS : 3; 1905 unsigned : 1; 1906 }; 1907 } __ECCPASbits_t; 1908 1909 extern __at(0x0FB6) volatile __ECCPASbits_t ECCPASbits; 1910 1911 #define _ECCPAS_PSSBD0 0x01 1912 #define _ECCPAS_PSSBD1 0x02 1913 #define _ECCPAS_PSSAC0 0x04 1914 #define _ECCPAS_PSSAC1 0x08 1915 #define _ECCPAS_ECCPAS0 0x10 1916 #define _ECCPAS_ECCPAS1 0x20 1917 #define _ECCPAS_ECCPAS2 0x40 1918 #define _ECCPAS_ECCPASE 0x80 1919 1920 //============================================================================== 1921 1922 1923 //============================================================================== 1924 // ECCP1DEL Bits 1925 1926 extern __at(0x0FB7) __sfr ECCP1DEL; 1927 1928 typedef union 1929 { 1930 struct 1931 { 1932 unsigned PDC0 : 1; 1933 unsigned PDC1 : 1; 1934 unsigned PDC2 : 1; 1935 unsigned PDC3 : 1; 1936 unsigned PDC4 : 1; 1937 unsigned PDC5 : 1; 1938 unsigned PDC6 : 1; 1939 unsigned PRSEN : 1; 1940 }; 1941 1942 struct 1943 { 1944 unsigned PDC : 7; 1945 unsigned : 1; 1946 }; 1947 } __ECCP1DELbits_t; 1948 1949 extern __at(0x0FB7) volatile __ECCP1DELbits_t ECCP1DELbits; 1950 1951 #define _PDC0 0x01 1952 #define _PDC1 0x02 1953 #define _PDC2 0x04 1954 #define _PDC3 0x08 1955 #define _PDC4 0x10 1956 #define _PDC5 0x20 1957 #define _PDC6 0x40 1958 #define _PRSEN 0x80 1959 1960 //============================================================================== 1961 1962 1963 //============================================================================== 1964 // PWM1CON Bits 1965 1966 extern __at(0x0FB7) __sfr PWM1CON; 1967 1968 typedef union 1969 { 1970 struct 1971 { 1972 unsigned PDC0 : 1; 1973 unsigned PDC1 : 1; 1974 unsigned PDC2 : 1; 1975 unsigned PDC3 : 1; 1976 unsigned PDC4 : 1; 1977 unsigned PDC5 : 1; 1978 unsigned PDC6 : 1; 1979 unsigned PRSEN : 1; 1980 }; 1981 1982 struct 1983 { 1984 unsigned PDC : 7; 1985 unsigned : 1; 1986 }; 1987 } __PWM1CONbits_t; 1988 1989 extern __at(0x0FB7) volatile __PWM1CONbits_t PWM1CONbits; 1990 1991 #define _PWM1CON_PDC0 0x01 1992 #define _PWM1CON_PDC1 0x02 1993 #define _PWM1CON_PDC2 0x04 1994 #define _PWM1CON_PDC3 0x08 1995 #define _PWM1CON_PDC4 0x10 1996 #define _PWM1CON_PDC5 0x20 1997 #define _PWM1CON_PDC6 0x40 1998 #define _PWM1CON_PRSEN 0x80 1999 2000 //============================================================================== 2001 2002 2003 //============================================================================== 2004 // BAUDCON Bits 2005 2006 extern __at(0x0FB8) __sfr BAUDCON; 2007 2008 typedef union 2009 { 2010 struct 2011 { 2012 unsigned ABDEN : 1; 2013 unsigned WUE : 1; 2014 unsigned : 1; 2015 unsigned BRG16 : 1; 2016 unsigned TXCKP : 1; 2017 unsigned RXDTP : 1; 2018 unsigned RCIDL : 1; 2019 unsigned ABDOVF : 1; 2020 }; 2021 2022 struct 2023 { 2024 unsigned : 1; 2025 unsigned : 1; 2026 unsigned : 1; 2027 unsigned : 1; 2028 unsigned SCKP : 1; 2029 unsigned : 1; 2030 unsigned RCMT : 1; 2031 unsigned : 1; 2032 }; 2033 } __BAUDCONbits_t; 2034 2035 extern __at(0x0FB8) volatile __BAUDCONbits_t BAUDCONbits; 2036 2037 #define _ABDEN 0x01 2038 #define _WUE 0x02 2039 #define _BRG16 0x08 2040 #define _TXCKP 0x10 2041 #define _SCKP 0x10 2042 #define _RXDTP 0x20 2043 #define _RCIDL 0x40 2044 #define _RCMT 0x40 2045 #define _ABDOVF 0x80 2046 2047 //============================================================================== 2048 2049 2050 //============================================================================== 2051 // BAUDCTL Bits 2052 2053 extern __at(0x0FB8) __sfr BAUDCTL; 2054 2055 typedef union 2056 { 2057 struct 2058 { 2059 unsigned ABDEN : 1; 2060 unsigned WUE : 1; 2061 unsigned : 1; 2062 unsigned BRG16 : 1; 2063 unsigned TXCKP : 1; 2064 unsigned RXDTP : 1; 2065 unsigned RCIDL : 1; 2066 unsigned ABDOVF : 1; 2067 }; 2068 2069 struct 2070 { 2071 unsigned : 1; 2072 unsigned : 1; 2073 unsigned : 1; 2074 unsigned : 1; 2075 unsigned SCKP : 1; 2076 unsigned : 1; 2077 unsigned RCMT : 1; 2078 unsigned : 1; 2079 }; 2080 } __BAUDCTLbits_t; 2081 2082 extern __at(0x0FB8) volatile __BAUDCTLbits_t BAUDCTLbits; 2083 2084 #define _BAUDCTL_ABDEN 0x01 2085 #define _BAUDCTL_WUE 0x02 2086 #define _BAUDCTL_BRG16 0x08 2087 #define _BAUDCTL_TXCKP 0x10 2088 #define _BAUDCTL_SCKP 0x10 2089 #define _BAUDCTL_RXDTP 0x20 2090 #define _BAUDCTL_RCIDL 0x40 2091 #define _BAUDCTL_RCMT 0x40 2092 #define _BAUDCTL_ABDOVF 0x80 2093 2094 //============================================================================== 2095 2096 2097 //============================================================================== 2098 // CCP2CON Bits 2099 2100 extern __at(0x0FBA) __sfr CCP2CON; 2101 2102 typedef union 2103 { 2104 struct 2105 { 2106 unsigned CCP2M0 : 1; 2107 unsigned CCP2M1 : 1; 2108 unsigned CCP2M2 : 1; 2109 unsigned CCP2M3 : 1; 2110 unsigned CCP2Y : 1; 2111 unsigned CCP2X : 1; 2112 unsigned : 1; 2113 unsigned : 1; 2114 }; 2115 2116 struct 2117 { 2118 unsigned : 1; 2119 unsigned : 1; 2120 unsigned : 1; 2121 unsigned : 1; 2122 unsigned DC2B0 : 1; 2123 unsigned DC2B1 : 1; 2124 unsigned : 1; 2125 unsigned : 1; 2126 }; 2127 2128 struct 2129 { 2130 unsigned CCP2M : 4; 2131 unsigned : 4; 2132 }; 2133 2134 struct 2135 { 2136 unsigned : 4; 2137 unsigned DC2B : 2; 2138 unsigned : 2; 2139 }; 2140 } __CCP2CONbits_t; 2141 2142 extern __at(0x0FBA) volatile __CCP2CONbits_t CCP2CONbits; 2143 2144 #define _CCP2M0 0x01 2145 #define _CCP2M1 0x02 2146 #define _CCP2M2 0x04 2147 #define _CCP2M3 0x08 2148 #define _CCP2Y 0x10 2149 #define _DC2B0 0x10 2150 #define _CCP2X 0x20 2151 #define _DC2B1 0x20 2152 2153 //============================================================================== 2154 2155 extern __at(0x0FBB) __sfr CCPR2; 2156 extern __at(0x0FBB) __sfr CCPR2L; 2157 extern __at(0x0FBC) __sfr CCPR2H; 2158 2159 //============================================================================== 2160 // CCP1CON Bits 2161 2162 extern __at(0x0FBD) __sfr CCP1CON; 2163 2164 typedef union 2165 { 2166 struct 2167 { 2168 unsigned CCP1M0 : 1; 2169 unsigned CCP1M1 : 1; 2170 unsigned CCP1M2 : 1; 2171 unsigned CCP1M3 : 1; 2172 unsigned CCP1Y : 1; 2173 unsigned CCP1X : 1; 2174 unsigned P1M0 : 1; 2175 unsigned P1M1 : 1; 2176 }; 2177 2178 struct 2179 { 2180 unsigned : 1; 2181 unsigned : 1; 2182 unsigned : 1; 2183 unsigned : 1; 2184 unsigned DC1B0 : 1; 2185 unsigned DC1B1 : 1; 2186 unsigned : 1; 2187 unsigned : 1; 2188 }; 2189 2190 struct 2191 { 2192 unsigned CCP1M : 4; 2193 unsigned : 4; 2194 }; 2195 2196 struct 2197 { 2198 unsigned : 4; 2199 unsigned DC1B : 2; 2200 unsigned : 2; 2201 }; 2202 2203 struct 2204 { 2205 unsigned : 6; 2206 unsigned P1M : 2; 2207 }; 2208 } __CCP1CONbits_t; 2209 2210 extern __at(0x0FBD) volatile __CCP1CONbits_t CCP1CONbits; 2211 2212 #define _CCP1M0 0x01 2213 #define _CCP1M1 0x02 2214 #define _CCP1M2 0x04 2215 #define _CCP1M3 0x08 2216 #define _CCP1Y 0x10 2217 #define _DC1B0 0x10 2218 #define _CCP1X 0x20 2219 #define _DC1B1 0x20 2220 #define _P1M0 0x40 2221 #define _P1M1 0x80 2222 2223 //============================================================================== 2224 2225 extern __at(0x0FBE) __sfr CCPR1; 2226 extern __at(0x0FBE) __sfr CCPR1L; 2227 extern __at(0x0FBF) __sfr CCPR1H; 2228 2229 //============================================================================== 2230 // ADCON2 Bits 2231 2232 extern __at(0x0FC0) __sfr ADCON2; 2233 2234 typedef union 2235 { 2236 struct 2237 { 2238 unsigned ADCS0 : 1; 2239 unsigned ADCS1 : 1; 2240 unsigned ADCS2 : 1; 2241 unsigned ACQT0 : 1; 2242 unsigned ACQT1 : 1; 2243 unsigned ACQT2 : 1; 2244 unsigned : 1; 2245 unsigned ADFM : 1; 2246 }; 2247 2248 struct 2249 { 2250 unsigned ADCS : 3; 2251 unsigned : 5; 2252 }; 2253 2254 struct 2255 { 2256 unsigned : 3; 2257 unsigned ACQT : 3; 2258 unsigned : 2; 2259 }; 2260 } __ADCON2bits_t; 2261 2262 extern __at(0x0FC0) volatile __ADCON2bits_t ADCON2bits; 2263 2264 #define _ADCS0 0x01 2265 #define _ADCS1 0x02 2266 #define _ADCS2 0x04 2267 #define _ACQT0 0x08 2268 #define _ACQT1 0x10 2269 #define _ACQT2 0x20 2270 #define _ADFM 0x80 2271 2272 //============================================================================== 2273 2274 2275 //============================================================================== 2276 // ADCON1 Bits 2277 2278 extern __at(0x0FC1) __sfr ADCON1; 2279 2280 typedef union 2281 { 2282 struct 2283 { 2284 unsigned PCFG0 : 1; 2285 unsigned PCFG1 : 1; 2286 unsigned PCFG2 : 1; 2287 unsigned PCFG3 : 1; 2288 unsigned VCFG0 : 1; 2289 unsigned VCFG1 : 1; 2290 unsigned : 1; 2291 unsigned : 1; 2292 }; 2293 2294 struct 2295 { 2296 unsigned PCFG : 4; 2297 unsigned : 4; 2298 }; 2299 2300 struct 2301 { 2302 unsigned : 4; 2303 unsigned VCFG : 2; 2304 unsigned : 2; 2305 }; 2306 } __ADCON1bits_t; 2307 2308 extern __at(0x0FC1) volatile __ADCON1bits_t ADCON1bits; 2309 2310 #define _PCFG0 0x01 2311 #define _PCFG1 0x02 2312 #define _PCFG2 0x04 2313 #define _PCFG3 0x08 2314 #define _VCFG0 0x10 2315 #define _VCFG1 0x20 2316 2317 //============================================================================== 2318 2319 2320 //============================================================================== 2321 // ADCON0 Bits 2322 2323 extern __at(0x0FC2) __sfr ADCON0; 2324 2325 typedef union 2326 { 2327 struct 2328 { 2329 unsigned ADON : 1; 2330 unsigned GO_NOT_DONE : 1; 2331 unsigned CHS0 : 1; 2332 unsigned CHS1 : 1; 2333 unsigned CHS2 : 1; 2334 unsigned CHS3 : 1; 2335 unsigned : 1; 2336 unsigned : 1; 2337 }; 2338 2339 struct 2340 { 2341 unsigned : 1; 2342 unsigned GO : 1; 2343 unsigned : 1; 2344 unsigned : 1; 2345 unsigned : 1; 2346 unsigned : 1; 2347 unsigned : 1; 2348 unsigned : 1; 2349 }; 2350 2351 struct 2352 { 2353 unsigned : 1; 2354 unsigned DONE : 1; 2355 unsigned : 1; 2356 unsigned : 1; 2357 unsigned : 1; 2358 unsigned : 1; 2359 unsigned : 1; 2360 unsigned : 1; 2361 }; 2362 2363 struct 2364 { 2365 unsigned : 1; 2366 unsigned NOT_DONE : 1; 2367 unsigned : 1; 2368 unsigned : 1; 2369 unsigned : 1; 2370 unsigned : 1; 2371 unsigned : 1; 2372 unsigned : 1; 2373 }; 2374 2375 struct 2376 { 2377 unsigned : 1; 2378 unsigned GO_DONE : 1; 2379 unsigned : 1; 2380 unsigned : 1; 2381 unsigned : 1; 2382 unsigned : 1; 2383 unsigned : 1; 2384 unsigned : 1; 2385 }; 2386 2387 struct 2388 { 2389 unsigned : 2; 2390 unsigned CHS : 4; 2391 unsigned : 2; 2392 }; 2393 } __ADCON0bits_t; 2394 2395 extern __at(0x0FC2) volatile __ADCON0bits_t ADCON0bits; 2396 2397 #define _ADON 0x01 2398 #define _GO_NOT_DONE 0x02 2399 #define _GO 0x02 2400 #define _DONE 0x02 2401 #define _NOT_DONE 0x02 2402 #define _GO_DONE 0x02 2403 #define _CHS0 0x04 2404 #define _CHS1 0x08 2405 #define _CHS2 0x10 2406 #define _CHS3 0x20 2407 2408 //============================================================================== 2409 2410 extern __at(0x0FC3) __sfr ADRES; 2411 extern __at(0x0FC3) __sfr ADRESL; 2412 extern __at(0x0FC4) __sfr ADRESH; 2413 2414 //============================================================================== 2415 // SSPCON2 Bits 2416 2417 extern __at(0x0FC5) __sfr SSPCON2; 2418 2419 typedef union 2420 { 2421 struct 2422 { 2423 unsigned SEN : 1; 2424 unsigned RSEN : 1; 2425 unsigned PEN : 1; 2426 unsigned RCEN : 1; 2427 unsigned ACKEN : 1; 2428 unsigned ACKDT : 1; 2429 unsigned ACKSTAT : 1; 2430 unsigned GCEN : 1; 2431 }; 2432 2433 struct 2434 { 2435 unsigned : 1; 2436 unsigned ADMSK1 : 1; 2437 unsigned ADMSK2 : 1; 2438 unsigned ADMSK3 : 1; 2439 unsigned ADMSK4 : 1; 2440 unsigned ADMSK5 : 1; 2441 unsigned : 1; 2442 unsigned : 1; 2443 }; 2444 } __SSPCON2bits_t; 2445 2446 extern __at(0x0FC5) volatile __SSPCON2bits_t SSPCON2bits; 2447 2448 #define _SEN 0x01 2449 #define _RSEN 0x02 2450 #define _ADMSK1 0x02 2451 #define _PEN 0x04 2452 #define _ADMSK2 0x04 2453 #define _RCEN 0x08 2454 #define _ADMSK3 0x08 2455 #define _ACKEN 0x10 2456 #define _ADMSK4 0x10 2457 #define _ACKDT 0x20 2458 #define _ADMSK5 0x20 2459 #define _ACKSTAT 0x40 2460 #define _GCEN 0x80 2461 2462 //============================================================================== 2463 2464 2465 //============================================================================== 2466 // SSPCON1 Bits 2467 2468 extern __at(0x0FC6) __sfr SSPCON1; 2469 2470 typedef union 2471 { 2472 struct 2473 { 2474 unsigned SSPM0 : 1; 2475 unsigned SSPM1 : 1; 2476 unsigned SSPM2 : 1; 2477 unsigned SSPM3 : 1; 2478 unsigned CKP : 1; 2479 unsigned SSPEN : 1; 2480 unsigned SSPOV : 1; 2481 unsigned WCOL : 1; 2482 }; 2483 2484 struct 2485 { 2486 unsigned SSPM : 4; 2487 unsigned : 4; 2488 }; 2489 } __SSPCON1bits_t; 2490 2491 extern __at(0x0FC6) volatile __SSPCON1bits_t SSPCON1bits; 2492 2493 #define _SSPM0 0x01 2494 #define _SSPM1 0x02 2495 #define _SSPM2 0x04 2496 #define _SSPM3 0x08 2497 #define _CKP 0x10 2498 #define _SSPEN 0x20 2499 #define _SSPOV 0x40 2500 #define _WCOL 0x80 2501 2502 //============================================================================== 2503 2504 2505 //============================================================================== 2506 // SSPSTAT Bits 2507 2508 extern __at(0x0FC7) __sfr SSPSTAT; 2509 2510 typedef union 2511 { 2512 struct 2513 { 2514 unsigned BF : 1; 2515 unsigned UA : 1; 2516 unsigned R_NOT_W : 1; 2517 unsigned S : 1; 2518 unsigned P : 1; 2519 unsigned D_NOT_A : 1; 2520 unsigned CKE : 1; 2521 unsigned SMP : 1; 2522 }; 2523 2524 struct 2525 { 2526 unsigned : 1; 2527 unsigned : 1; 2528 unsigned R : 1; 2529 unsigned : 1; 2530 unsigned : 1; 2531 unsigned D : 1; 2532 unsigned : 1; 2533 unsigned : 1; 2534 }; 2535 2536 struct 2537 { 2538 unsigned : 1; 2539 unsigned : 1; 2540 unsigned NOT_W : 1; 2541 unsigned : 1; 2542 unsigned : 1; 2543 unsigned NOT_A : 1; 2544 unsigned : 1; 2545 unsigned : 1; 2546 }; 2547 2548 struct 2549 { 2550 unsigned : 1; 2551 unsigned : 1; 2552 unsigned R_W : 1; 2553 unsigned : 1; 2554 unsigned : 1; 2555 unsigned D_A : 1; 2556 unsigned : 1; 2557 unsigned : 1; 2558 }; 2559 2560 struct 2561 { 2562 unsigned : 1; 2563 unsigned : 1; 2564 unsigned NOT_WRITE : 1; 2565 unsigned : 1; 2566 unsigned : 1; 2567 unsigned NOT_ADDRESS : 1; 2568 unsigned : 1; 2569 unsigned : 1; 2570 }; 2571 } __SSPSTATbits_t; 2572 2573 extern __at(0x0FC7) volatile __SSPSTATbits_t SSPSTATbits; 2574 2575 #define _BF 0x01 2576 #define _UA 0x02 2577 #define _R_NOT_W 0x04 2578 #define _R 0x04 2579 #define _NOT_W 0x04 2580 #define _R_W 0x04 2581 #define _NOT_WRITE 0x04 2582 #define _S 0x08 2583 #define _P 0x10 2584 #define _D_NOT_A 0x20 2585 #define _D 0x20 2586 #define _NOT_A 0x20 2587 #define _D_A 0x20 2588 #define _NOT_ADDRESS 0x20 2589 #define _CKE 0x40 2590 #define _SMP 0x80 2591 2592 //============================================================================== 2593 2594 extern __at(0x0FC8) __sfr SSPADD; 2595 extern __at(0x0FC9) __sfr SSPBUF; 2596 2597 //============================================================================== 2598 // T2CON Bits 2599 2600 extern __at(0x0FCA) __sfr T2CON; 2601 2602 typedef union 2603 { 2604 struct 2605 { 2606 unsigned T2CKPS0 : 1; 2607 unsigned T2CKPS1 : 1; 2608 unsigned TMR2ON : 1; 2609 unsigned T2OUTPS0 : 1; 2610 unsigned T2OUTPS1 : 1; 2611 unsigned T2OUTPS2 : 1; 2612 unsigned T2OUTPS3 : 1; 2613 unsigned : 1; 2614 }; 2615 2616 struct 2617 { 2618 unsigned : 1; 2619 unsigned : 1; 2620 unsigned : 1; 2621 unsigned TOUTPS0 : 1; 2622 unsigned TOUTPS1 : 1; 2623 unsigned TOUTPS2 : 1; 2624 unsigned TOUTPS3 : 1; 2625 unsigned : 1; 2626 }; 2627 2628 struct 2629 { 2630 unsigned T2CKPS : 2; 2631 unsigned : 6; 2632 }; 2633 2634 struct 2635 { 2636 unsigned : 3; 2637 unsigned T2OUTPS : 4; 2638 unsigned : 1; 2639 }; 2640 2641 struct 2642 { 2643 unsigned : 3; 2644 unsigned TOUTPS : 4; 2645 unsigned : 1; 2646 }; 2647 } __T2CONbits_t; 2648 2649 extern __at(0x0FCA) volatile __T2CONbits_t T2CONbits; 2650 2651 #define _T2CKPS0 0x01 2652 #define _T2CKPS1 0x02 2653 #define _TMR2ON 0x04 2654 #define _T2OUTPS0 0x08 2655 #define _TOUTPS0 0x08 2656 #define _T2OUTPS1 0x10 2657 #define _TOUTPS1 0x10 2658 #define _T2OUTPS2 0x20 2659 #define _TOUTPS2 0x20 2660 #define _T2OUTPS3 0x40 2661 #define _TOUTPS3 0x40 2662 2663 //============================================================================== 2664 2665 extern __at(0x0FCB) __sfr PR2; 2666 extern __at(0x0FCC) __sfr TMR2; 2667 2668 //============================================================================== 2669 // T1CON Bits 2670 2671 extern __at(0x0FCD) __sfr T1CON; 2672 2673 typedef union 2674 { 2675 struct 2676 { 2677 unsigned TMR1ON : 1; 2678 unsigned TMR1CS : 1; 2679 unsigned NOT_T1SYNC : 1; 2680 unsigned T1OSCEN : 1; 2681 unsigned T1CKPS0 : 1; 2682 unsigned T1CKPS1 : 1; 2683 unsigned T1RUN : 1; 2684 unsigned RD16 : 1; 2685 }; 2686 2687 struct 2688 { 2689 unsigned : 1; 2690 unsigned : 1; 2691 unsigned T1SYNC : 1; 2692 unsigned : 1; 2693 unsigned : 1; 2694 unsigned : 1; 2695 unsigned : 1; 2696 unsigned : 1; 2697 }; 2698 2699 struct 2700 { 2701 unsigned : 4; 2702 unsigned T1CKPS : 2; 2703 unsigned : 2; 2704 }; 2705 } __T1CONbits_t; 2706 2707 extern __at(0x0FCD) volatile __T1CONbits_t T1CONbits; 2708 2709 #define _TMR1ON 0x01 2710 #define _TMR1CS 0x02 2711 #define _NOT_T1SYNC 0x04 2712 #define _T1SYNC 0x04 2713 #define _T1OSCEN 0x08 2714 #define _T1CKPS0 0x10 2715 #define _T1CKPS1 0x20 2716 #define _T1RUN 0x40 2717 #define _RD16 0x80 2718 2719 //============================================================================== 2720 2721 extern __at(0x0FCE) __sfr TMR1; 2722 extern __at(0x0FCE) __sfr TMR1L; 2723 extern __at(0x0FCF) __sfr TMR1H; 2724 2725 //============================================================================== 2726 // RCON Bits 2727 2728 extern __at(0x0FD0) __sfr RCON; 2729 2730 typedef union 2731 { 2732 struct 2733 { 2734 unsigned NOT_BOR : 1; 2735 unsigned NOT_POR : 1; 2736 unsigned NOT_PD : 1; 2737 unsigned NOT_TO : 1; 2738 unsigned NOT_RI : 1; 2739 unsigned : 1; 2740 unsigned SBOREN : 1; 2741 unsigned IPEN : 1; 2742 }; 2743 2744 struct 2745 { 2746 unsigned BOR : 1; 2747 unsigned POR : 1; 2748 unsigned PD : 1; 2749 unsigned TO : 1; 2750 unsigned RI : 1; 2751 unsigned : 1; 2752 unsigned : 1; 2753 unsigned : 1; 2754 }; 2755 } __RCONbits_t; 2756 2757 extern __at(0x0FD0) volatile __RCONbits_t RCONbits; 2758 2759 #define _NOT_BOR 0x01 2760 #define _BOR 0x01 2761 #define _NOT_POR 0x02 2762 #define _POR 0x02 2763 #define _NOT_PD 0x04 2764 #define _PD 0x04 2765 #define _NOT_TO 0x08 2766 #define _TO 0x08 2767 #define _NOT_RI 0x10 2768 #define _RI 0x10 2769 #define _SBOREN 0x40 2770 #define _IPEN 0x80 2771 2772 //============================================================================== 2773 2774 2775 //============================================================================== 2776 // WDTCON Bits 2777 2778 extern __at(0x0FD1) __sfr WDTCON; 2779 2780 typedef union 2781 { 2782 struct 2783 { 2784 unsigned SWDTEN : 1; 2785 unsigned : 1; 2786 unsigned : 1; 2787 unsigned : 1; 2788 unsigned : 1; 2789 unsigned : 1; 2790 unsigned : 1; 2791 unsigned : 1; 2792 }; 2793 2794 struct 2795 { 2796 unsigned SWDTE : 1; 2797 unsigned : 1; 2798 unsigned : 1; 2799 unsigned : 1; 2800 unsigned : 1; 2801 unsigned : 1; 2802 unsigned : 1; 2803 unsigned : 1; 2804 }; 2805 } __WDTCONbits_t; 2806 2807 extern __at(0x0FD1) volatile __WDTCONbits_t WDTCONbits; 2808 2809 #define _SWDTEN 0x01 2810 #define _SWDTE 0x01 2811 2812 //============================================================================== 2813 2814 2815 //============================================================================== 2816 // HLVDCON Bits 2817 2818 extern __at(0x0FD2) __sfr HLVDCON; 2819 2820 typedef union 2821 { 2822 struct 2823 { 2824 unsigned HLVDL0 : 1; 2825 unsigned HLVDL1 : 1; 2826 unsigned HLVDL2 : 1; 2827 unsigned HLVDL3 : 1; 2828 unsigned HLVDEN : 1; 2829 unsigned IVRST : 1; 2830 unsigned : 1; 2831 unsigned VDIRMAG : 1; 2832 }; 2833 2834 struct 2835 { 2836 unsigned LVDL0 : 1; 2837 unsigned LVDL1 : 1; 2838 unsigned LVDL2 : 1; 2839 unsigned LVDL3 : 1; 2840 unsigned LVDEN : 1; 2841 unsigned IRVST : 1; 2842 unsigned : 1; 2843 unsigned : 1; 2844 }; 2845 2846 struct 2847 { 2848 unsigned LVV0 : 1; 2849 unsigned LVV1 : 1; 2850 unsigned LVV2 : 1; 2851 unsigned LVV3 : 1; 2852 unsigned : 1; 2853 unsigned BGST : 1; 2854 unsigned : 1; 2855 unsigned : 1; 2856 }; 2857 2858 struct 2859 { 2860 unsigned LVV : 4; 2861 unsigned : 4; 2862 }; 2863 2864 struct 2865 { 2866 unsigned LVDL : 4; 2867 unsigned : 4; 2868 }; 2869 2870 struct 2871 { 2872 unsigned HLVDL : 4; 2873 unsigned : 4; 2874 }; 2875 } __HLVDCONbits_t; 2876 2877 extern __at(0x0FD2) volatile __HLVDCONbits_t HLVDCONbits; 2878 2879 #define _HLVDL0 0x01 2880 #define _LVDL0 0x01 2881 #define _LVV0 0x01 2882 #define _HLVDL1 0x02 2883 #define _LVDL1 0x02 2884 #define _LVV1 0x02 2885 #define _HLVDL2 0x04 2886 #define _LVDL2 0x04 2887 #define _LVV2 0x04 2888 #define _HLVDL3 0x08 2889 #define _LVDL3 0x08 2890 #define _LVV3 0x08 2891 #define _HLVDEN 0x10 2892 #define _LVDEN 0x10 2893 #define _IVRST 0x20 2894 #define _IRVST 0x20 2895 #define _BGST 0x20 2896 #define _VDIRMAG 0x80 2897 2898 //============================================================================== 2899 2900 2901 //============================================================================== 2902 // LVDCON Bits 2903 2904 extern __at(0x0FD2) __sfr LVDCON; 2905 2906 typedef union 2907 { 2908 struct 2909 { 2910 unsigned HLVDL0 : 1; 2911 unsigned HLVDL1 : 1; 2912 unsigned HLVDL2 : 1; 2913 unsigned HLVDL3 : 1; 2914 unsigned HLVDEN : 1; 2915 unsigned IVRST : 1; 2916 unsigned : 1; 2917 unsigned VDIRMAG : 1; 2918 }; 2919 2920 struct 2921 { 2922 unsigned LVDL0 : 1; 2923 unsigned LVDL1 : 1; 2924 unsigned LVDL2 : 1; 2925 unsigned LVDL3 : 1; 2926 unsigned LVDEN : 1; 2927 unsigned IRVST : 1; 2928 unsigned : 1; 2929 unsigned : 1; 2930 }; 2931 2932 struct 2933 { 2934 unsigned LVV0 : 1; 2935 unsigned LVV1 : 1; 2936 unsigned LVV2 : 1; 2937 unsigned LVV3 : 1; 2938 unsigned : 1; 2939 unsigned BGST : 1; 2940 unsigned : 1; 2941 unsigned : 1; 2942 }; 2943 2944 struct 2945 { 2946 unsigned LVV : 4; 2947 unsigned : 4; 2948 }; 2949 2950 struct 2951 { 2952 unsigned LVDL : 4; 2953 unsigned : 4; 2954 }; 2955 2956 struct 2957 { 2958 unsigned HLVDL : 4; 2959 unsigned : 4; 2960 }; 2961 } __LVDCONbits_t; 2962 2963 extern __at(0x0FD2) volatile __LVDCONbits_t LVDCONbits; 2964 2965 #define _LVDCON_HLVDL0 0x01 2966 #define _LVDCON_LVDL0 0x01 2967 #define _LVDCON_LVV0 0x01 2968 #define _LVDCON_HLVDL1 0x02 2969 #define _LVDCON_LVDL1 0x02 2970 #define _LVDCON_LVV1 0x02 2971 #define _LVDCON_HLVDL2 0x04 2972 #define _LVDCON_LVDL2 0x04 2973 #define _LVDCON_LVV2 0x04 2974 #define _LVDCON_HLVDL3 0x08 2975 #define _LVDCON_LVDL3 0x08 2976 #define _LVDCON_LVV3 0x08 2977 #define _LVDCON_HLVDEN 0x10 2978 #define _LVDCON_LVDEN 0x10 2979 #define _LVDCON_IVRST 0x20 2980 #define _LVDCON_IRVST 0x20 2981 #define _LVDCON_BGST 0x20 2982 #define _LVDCON_VDIRMAG 0x80 2983 2984 //============================================================================== 2985 2986 2987 //============================================================================== 2988 // OSCCON Bits 2989 2990 extern __at(0x0FD3) __sfr OSCCON; 2991 2992 typedef union 2993 { 2994 struct 2995 { 2996 unsigned SCS0 : 1; 2997 unsigned SCS1 : 1; 2998 unsigned IOFS : 1; 2999 unsigned OSTS : 1; 3000 unsigned IRCF0 : 1; 3001 unsigned IRCF1 : 1; 3002 unsigned IRCF2 : 1; 3003 unsigned IDLEN : 1; 3004 }; 3005 3006 struct 3007 { 3008 unsigned : 1; 3009 unsigned : 1; 3010 unsigned FLTS : 1; 3011 unsigned : 1; 3012 unsigned : 1; 3013 unsigned : 1; 3014 unsigned : 1; 3015 unsigned : 1; 3016 }; 3017 3018 struct 3019 { 3020 unsigned SCS : 2; 3021 unsigned : 6; 3022 }; 3023 3024 struct 3025 { 3026 unsigned : 4; 3027 unsigned IRCF : 3; 3028 unsigned : 1; 3029 }; 3030 } __OSCCONbits_t; 3031 3032 extern __at(0x0FD3) volatile __OSCCONbits_t OSCCONbits; 3033 3034 #define _SCS0 0x01 3035 #define _SCS1 0x02 3036 #define _IOFS 0x04 3037 #define _FLTS 0x04 3038 #define _OSTS 0x08 3039 #define _IRCF0 0x10 3040 #define _IRCF1 0x20 3041 #define _IRCF2 0x40 3042 #define _IDLEN 0x80 3043 3044 //============================================================================== 3045 3046 3047 //============================================================================== 3048 // T0CON Bits 3049 3050 extern __at(0x0FD5) __sfr T0CON; 3051 3052 typedef union 3053 { 3054 struct 3055 { 3056 unsigned T0PS0 : 1; 3057 unsigned T0PS1 : 1; 3058 unsigned T0PS2 : 1; 3059 unsigned PSA : 1; 3060 unsigned T0SE : 1; 3061 unsigned T0CS : 1; 3062 unsigned T08BIT : 1; 3063 unsigned TMR0ON : 1; 3064 }; 3065 3066 struct 3067 { 3068 unsigned : 1; 3069 unsigned : 1; 3070 unsigned : 1; 3071 unsigned T0PS3 : 1; 3072 unsigned : 1; 3073 unsigned : 1; 3074 unsigned T016BIT : 1; 3075 unsigned : 1; 3076 }; 3077 3078 struct 3079 { 3080 unsigned T0PS : 4; 3081 unsigned : 4; 3082 }; 3083 } __T0CONbits_t; 3084 3085 extern __at(0x0FD5) volatile __T0CONbits_t T0CONbits; 3086 3087 #define _T0PS0 0x01 3088 #define _T0PS1 0x02 3089 #define _T0PS2 0x04 3090 #define _PSA 0x08 3091 #define _T0PS3 0x08 3092 #define _T0SE 0x10 3093 #define _T0CS 0x20 3094 #define _T08BIT 0x40 3095 #define _T016BIT 0x40 3096 #define _TMR0ON 0x80 3097 3098 //============================================================================== 3099 3100 extern __at(0x0FD6) __sfr TMR0; 3101 extern __at(0x0FD6) __sfr TMR0L; 3102 extern __at(0x0FD7) __sfr TMR0H; 3103 3104 //============================================================================== 3105 // STATUS Bits 3106 3107 extern __at(0x0FD8) __sfr STATUS; 3108 3109 typedef struct 3110 { 3111 unsigned C : 1; 3112 unsigned DC : 1; 3113 unsigned Z : 1; 3114 unsigned OV : 1; 3115 unsigned N : 1; 3116 unsigned : 1; 3117 unsigned : 1; 3118 unsigned : 1; 3119 } __STATUSbits_t; 3120 3121 extern __at(0x0FD8) volatile __STATUSbits_t STATUSbits; 3122 3123 #define _C 0x01 3124 #define _DC 0x02 3125 #define _Z 0x04 3126 #define _OV 0x08 3127 #define _N 0x10 3128 3129 //============================================================================== 3130 3131 extern __at(0x0FD9) __sfr FSR2L; 3132 extern __at(0x0FDA) __sfr FSR2H; 3133 extern __at(0x0FDB) __sfr PLUSW2; 3134 extern __at(0x0FDC) __sfr PREINC2; 3135 extern __at(0x0FDD) __sfr POSTDEC2; 3136 extern __at(0x0FDE) __sfr POSTINC2; 3137 extern __at(0x0FDF) __sfr INDF2; 3138 extern __at(0x0FE0) __sfr BSR; 3139 extern __at(0x0FE1) __sfr FSR1L; 3140 extern __at(0x0FE2) __sfr FSR1H; 3141 extern __at(0x0FE3) __sfr PLUSW1; 3142 extern __at(0x0FE4) __sfr PREINC1; 3143 extern __at(0x0FE5) __sfr POSTDEC1; 3144 extern __at(0x0FE6) __sfr POSTINC1; 3145 extern __at(0x0FE7) __sfr INDF1; 3146 extern __at(0x0FE8) __sfr WREG; 3147 extern __at(0x0FE9) __sfr FSR0L; 3148 extern __at(0x0FEA) __sfr FSR0H; 3149 extern __at(0x0FEB) __sfr PLUSW0; 3150 extern __at(0x0FEC) __sfr PREINC0; 3151 extern __at(0x0FED) __sfr POSTDEC0; 3152 extern __at(0x0FEE) __sfr POSTINC0; 3153 extern __at(0x0FEF) __sfr INDF0; 3154 3155 //============================================================================== 3156 // INTCON3 Bits 3157 3158 extern __at(0x0FF0) __sfr INTCON3; 3159 3160 typedef union 3161 { 3162 struct 3163 { 3164 unsigned INT1IF : 1; 3165 unsigned INT2IF : 1; 3166 unsigned : 1; 3167 unsigned INT1IE : 1; 3168 unsigned INT2IE : 1; 3169 unsigned : 1; 3170 unsigned INT1IP : 1; 3171 unsigned INT2IP : 1; 3172 }; 3173 3174 struct 3175 { 3176 unsigned INT1F : 1; 3177 unsigned INT2F : 1; 3178 unsigned : 1; 3179 unsigned INT1E : 1; 3180 unsigned INT2E : 1; 3181 unsigned : 1; 3182 unsigned INT1P : 1; 3183 unsigned INT2P : 1; 3184 }; 3185 } __INTCON3bits_t; 3186 3187 extern __at(0x0FF0) volatile __INTCON3bits_t INTCON3bits; 3188 3189 #define _INT1IF 0x01 3190 #define _INT1F 0x01 3191 #define _INT2IF 0x02 3192 #define _INT2F 0x02 3193 #define _INT1IE 0x08 3194 #define _INT1E 0x08 3195 #define _INT2IE 0x10 3196 #define _INT2E 0x10 3197 #define _INT1IP 0x40 3198 #define _INT1P 0x40 3199 #define _INT2IP 0x80 3200 #define _INT2P 0x80 3201 3202 //============================================================================== 3203 3204 3205 //============================================================================== 3206 // INTCON2 Bits 3207 3208 extern __at(0x0FF1) __sfr INTCON2; 3209 3210 typedef union 3211 { 3212 struct 3213 { 3214 unsigned RBIP : 1; 3215 unsigned : 1; 3216 unsigned TMR0IP : 1; 3217 unsigned : 1; 3218 unsigned INTEDG2 : 1; 3219 unsigned INTEDG1 : 1; 3220 unsigned INTEDG0 : 1; 3221 unsigned NOT_RBPU : 1; 3222 }; 3223 3224 struct 3225 { 3226 unsigned : 1; 3227 unsigned : 1; 3228 unsigned : 1; 3229 unsigned : 1; 3230 unsigned : 1; 3231 unsigned : 1; 3232 unsigned : 1; 3233 unsigned RBPU : 1; 3234 }; 3235 } __INTCON2bits_t; 3236 3237 extern __at(0x0FF1) volatile __INTCON2bits_t INTCON2bits; 3238 3239 #define _RBIP 0x01 3240 #define _TMR0IP 0x04 3241 #define _INTEDG2 0x10 3242 #define _INTEDG1 0x20 3243 #define _INTEDG0 0x40 3244 #define _NOT_RBPU 0x80 3245 #define _RBPU 0x80 3246 3247 //============================================================================== 3248 3249 3250 //============================================================================== 3251 // INTCON Bits 3252 3253 extern __at(0x0FF2) __sfr INTCON; 3254 3255 typedef union 3256 { 3257 struct 3258 { 3259 unsigned RBIF : 1; 3260 unsigned INT0IF : 1; 3261 unsigned TMR0IF : 1; 3262 unsigned RBIE : 1; 3263 unsigned INT0IE : 1; 3264 unsigned TMR0IE : 1; 3265 unsigned PEIE_GIEL : 1; 3266 unsigned GIE_GIEH : 1; 3267 }; 3268 3269 struct 3270 { 3271 unsigned : 1; 3272 unsigned INT0F : 1; 3273 unsigned T0IF : 1; 3274 unsigned : 1; 3275 unsigned INT0E : 1; 3276 unsigned T0IE : 1; 3277 unsigned PEIE : 1; 3278 unsigned GIE : 1; 3279 }; 3280 3281 struct 3282 { 3283 unsigned : 1; 3284 unsigned : 1; 3285 unsigned : 1; 3286 unsigned : 1; 3287 unsigned : 1; 3288 unsigned : 1; 3289 unsigned GIEL : 1; 3290 unsigned GIEH : 1; 3291 }; 3292 } __INTCONbits_t; 3293 3294 extern __at(0x0FF2) volatile __INTCONbits_t INTCONbits; 3295 3296 #define _RBIF 0x01 3297 #define _INT0IF 0x02 3298 #define _INT0F 0x02 3299 #define _TMR0IF 0x04 3300 #define _T0IF 0x04 3301 #define _RBIE 0x08 3302 #define _INT0IE 0x10 3303 #define _INT0E 0x10 3304 #define _TMR0IE 0x20 3305 #define _T0IE 0x20 3306 #define _PEIE_GIEL 0x40 3307 #define _PEIE 0x40 3308 #define _GIEL 0x40 3309 #define _GIE_GIEH 0x80 3310 #define _GIE 0x80 3311 #define _GIEH 0x80 3312 3313 //============================================================================== 3314 3315 extern __at(0x0FF3) __sfr PROD; 3316 extern __at(0x0FF3) __sfr PRODL; 3317 extern __at(0x0FF4) __sfr PRODH; 3318 extern __at(0x0FF5) __sfr TABLAT; 3319 extern __at(0x0FF6) __sfr TBLPTR; 3320 extern __at(0x0FF6) __sfr TBLPTRL; 3321 extern __at(0x0FF7) __sfr TBLPTRH; 3322 extern __at(0x0FF8) __sfr TBLPTRU; 3323 extern __at(0x0FF9) __sfr PC; 3324 extern __at(0x0FF9) __sfr PCL; 3325 extern __at(0x0FFA) __sfr PCLATH; 3326 extern __at(0x0FFB) __sfr PCLATU; 3327 3328 //============================================================================== 3329 // STKPTR Bits 3330 3331 extern __at(0x0FFC) __sfr STKPTR; 3332 3333 typedef union 3334 { 3335 struct 3336 { 3337 unsigned SP0 : 1; 3338 unsigned SP1 : 1; 3339 unsigned SP2 : 1; 3340 unsigned SP3 : 1; 3341 unsigned SP4 : 1; 3342 unsigned : 1; 3343 unsigned STKUNF : 1; 3344 unsigned STKFUL : 1; 3345 }; 3346 3347 struct 3348 { 3349 unsigned : 1; 3350 unsigned : 1; 3351 unsigned : 1; 3352 unsigned : 1; 3353 unsigned : 1; 3354 unsigned : 1; 3355 unsigned : 1; 3356 unsigned STKOVF : 1; 3357 }; 3358 3359 struct 3360 { 3361 unsigned SP : 5; 3362 unsigned : 3; 3363 }; 3364 } __STKPTRbits_t; 3365 3366 extern __at(0x0FFC) volatile __STKPTRbits_t STKPTRbits; 3367 3368 #define _SP0 0x01 3369 #define _SP1 0x02 3370 #define _SP2 0x04 3371 #define _SP3 0x08 3372 #define _SP4 0x10 3373 #define _STKUNF 0x40 3374 #define _STKFUL 0x80 3375 #define _STKOVF 0x80 3376 3377 //============================================================================== 3378 3379 extern __at(0x0FFD) __sfr TOS; 3380 extern __at(0x0FFD) __sfr TOSL; 3381 extern __at(0x0FFE) __sfr TOSH; 3382 extern __at(0x0FFF) __sfr TOSU; 3383 3384 //============================================================================== 3385 // 3386 // Configuration Bits 3387 // 3388 //============================================================================== 3389 3390 #define __CONFIG1H 0x300001 3391 #define __CONFIG2L 0x300002 3392 #define __CONFIG2H 0x300003 3393 #define __CONFIG3H 0x300005 3394 #define __CONFIG4L 0x300006 3395 #define __CONFIG5L 0x300008 3396 #define __CONFIG5H 0x300009 3397 #define __CONFIG6L 0x30000A 3398 #define __CONFIG6H 0x30000B 3399 #define __CONFIG7L 0x30000C 3400 #define __CONFIG7H 0x30000D 3401 3402 //----------------------------- CONFIG1H Options ------------------------------- 3403 3404 #define _OSC_LP_1H 0xF0 // LP oscillator. 3405 #define _OSC_XT_1H 0xF1 // XT oscillator. 3406 #define _OSC_HS_1H 0xF2 // HS oscillator. 3407 #define _OSC_RC_1H 0xF3 // External RC oscillator, CLKO function on RA6. 3408 #define _OSC_EC_1H 0xF4 // EC oscillator, CLKO function on RA6. 3409 #define _OSC_ECIO6_1H 0xF5 // EC oscillator, port function on RA6. 3410 #define _OSC_HSPLL_1H 0xF6 // HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1). 3411 #define _OSC_RCIO6_1H 0xF7 // External RC oscillator, port function on RA6. 3412 #define _OSC_INTIO67_1H 0xF8 // Internal oscillator block, port function on RA6 and RA7. 3413 #define _OSC_INTIO7_1H 0xF9 // Internal oscillator block, CLKO function on RA6, port function on RA7. 3414 #define _FCMEN_OFF_1H 0xBF // Fail-Safe Clock Monitor disabled. 3415 #define _FCMEN_ON_1H 0xFF // Fail-Safe Clock Monitor enabled. 3416 #define _IESO_OFF_1H 0x7F // Oscillator Switchover mode disabled. 3417 #define _IESO_ON_1H 0xFF // Oscillator Switchover mode enabled. 3418 3419 //----------------------------- CONFIG2L Options ------------------------------- 3420 3421 #define _PWRT_ON_2L 0xFE // PWRT enabled. 3422 #define _PWRT_OFF_2L 0xFF // PWRT disabled. 3423 #define _BOREN_OFF_2L 0xF9 // Brown-out Reset disabled in hardware and software. 3424 #define _BOREN_ON_2L 0xFB // Brown-out Reset enabled and controlled by software (SBOREN is enabled). 3425 #define _BOREN_NOSLP_2L 0xFD // Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled). 3426 #define _BOREN_SBORDIS_2L 0xFF // Brown-out Reset enabled in hardware only (SBOREN is disabled). 3427 #define _BORV_0_2L 0xE7 // Maximum setting. 3428 #define _BORV_1_2L 0xEF 3429 #define _BORV_2_2L 0xF7 3430 #define _BORV_3_2L 0xFF // Minimum setting. 3431 3432 //----------------------------- CONFIG2H Options ------------------------------- 3433 3434 #define _WDT_OFF_2H 0xFE // WDT disabled (control is placed on the SWDTEN bit). 3435 #define _WDT_ON_2H 0xFF // WDT enabled. 3436 #define _WDTPS_1_2H 0xE1 // 1:1. 3437 #define _WDTPS_2_2H 0xE3 // 1:2. 3438 #define _WDTPS_4_2H 0xE5 // 1:4. 3439 #define _WDTPS_8_2H 0xE7 // 1:8. 3440 #define _WDTPS_16_2H 0xE9 // 1:16. 3441 #define _WDTPS_32_2H 0xEB // 1:32. 3442 #define _WDTPS_64_2H 0xED // 1:64. 3443 #define _WDTPS_128_2H 0xEF // 1:128. 3444 #define _WDTPS_256_2H 0xF1 // 1:256. 3445 #define _WDTPS_512_2H 0xF3 // 1:512. 3446 #define _WDTPS_1024_2H 0xF5 // 1:1024. 3447 #define _WDTPS_2048_2H 0xF7 // 1:2048. 3448 #define _WDTPS_4096_2H 0xF9 // 1:4096. 3449 #define _WDTPS_8192_2H 0xFB // 1:8192. 3450 #define _WDTPS_16384_2H 0xFD // 1:16384. 3451 #define _WDTPS_32768_2H 0xFF // 1:32768. 3452 3453 //----------------------------- CONFIG3H Options ------------------------------- 3454 3455 #define _CCP2MX_PORTB_3H 0xFE // CCP2 input/output is multiplexed with RB3. 3456 #define _CCP2MX_PORTC_3H 0xFF // CCP2 input/output is multiplexed with RC1. 3457 #define _PBADEN_OFF_3H 0xFD // PORTB<4:0> pins are configured as digital I/O on Reset. 3458 #define _PBADEN_ON_3H 0xFF // PORTB<4:0> pins are configured as analog input channels on Reset. 3459 #define _LPT1OSC_OFF_3H 0xFB // Timer1 configured for higher power operation. 3460 #define _LPT1OSC_ON_3H 0xFF // Timer1 configured for low-power operation. 3461 #define _MCLRE_OFF_3H 0x7F // RE3 input pin enabled; MCLR disabled. 3462 #define _MCLRE_ON_3H 0xFF // MCLR pin enabled; RE3 input pin disabled. 3463 3464 //----------------------------- CONFIG4L Options ------------------------------- 3465 3466 #define _STVREN_OFF_4L 0xFE // Stack full/underflow will not cause Reset. 3467 #define _STVREN_ON_4L 0xFF // Stack full/underflow will cause Reset. 3468 #define _LVP_OFF_4L 0xFB // Single-Supply ICSP disabled. 3469 #define _LVP_ON_4L 0xFF // Single-Supply ICSP enabled. 3470 #define _XINST_OFF_4L 0xBF // Instruction set extension and Indexed Addressing mode disabled (Legacy mode). 3471 #define _XINST_ON_4L 0xFF // Instruction set extension and Indexed Addressing mode enabled. 3472 #define _DEBUG_ON_4L 0x7F // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug. 3473 #define _DEBUG_OFF_4L 0xFF // Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins. 3474 3475 //----------------------------- CONFIG5L Options ------------------------------- 3476 3477 #define _CP0_ON_5L 0xFE // Block 0 (000800-001FFFh) code-protected. 3478 #define _CP0_OFF_5L 0xFF // Block 0 (000800-001FFFh) not code-protected. 3479 #define _CP1_ON_5L 0xFD // Block 1 (002000-003FFFh) code-protected. 3480 #define _CP1_OFF_5L 0xFF // Block 1 (002000-003FFFh) not code-protected. 3481 #define _CP2_ON_5L 0xFB // Block 2 (004000-005FFFh) code-protected. 3482 #define _CP2_OFF_5L 0xFF // Block 2 (004000-005FFFh) not code-protected. 3483 #define _CP3_ON_5L 0xF7 // Block 3 (006000-007FFFh) code-protected. 3484 #define _CP3_OFF_5L 0xFF // Block 3 (006000-007FFFh) not code-protected. 3485 3486 //----------------------------- CONFIG5H Options ------------------------------- 3487 3488 #define _CPB_ON_5H 0xBF // Boot block (000000-0007FFh) code-protected. 3489 #define _CPB_OFF_5H 0xFF // Boot block (000000-0007FFh) not code-protected. 3490 #define _CPD_ON_5H 0x7F // Data EEPROM code-protected. 3491 #define _CPD_OFF_5H 0xFF // Data EEPROM not code-protected. 3492 3493 //----------------------------- CONFIG6L Options ------------------------------- 3494 3495 #define _WRT0_ON_6L 0xFE // Block 0 (000800-001FFFh) write-protected. 3496 #define _WRT0_OFF_6L 0xFF // Block 0 (000800-001FFFh) not write-protected. 3497 #define _WRT1_ON_6L 0xFD // Block 1 (002000-003FFFh) write-protected. 3498 #define _WRT1_OFF_6L 0xFF // Block 1 (002000-003FFFh) not write-protected. 3499 #define _WRT2_ON_6L 0xFB // Block 2 (004000-005FFFh) write-protected. 3500 #define _WRT2_OFF_6L 0xFF // Block 2 (004000-005FFFh) not write-protected. 3501 #define _WRT3_ON_6L 0xF7 // Block 3 (006000-007FFFh) write-protected. 3502 #define _WRT3_OFF_6L 0xFF // Block 3 (006000-007FFFh) not write-protected. 3503 3504 //----------------------------- CONFIG6H Options ------------------------------- 3505 3506 #define _WRTC_ON_6H 0xDF // Configuration registers (300000-3000FFh) write-protected. 3507 #define _WRTC_OFF_6H 0xFF // Configuration registers (300000-3000FFh) not write-protected. 3508 #define _WRTB_ON_6H 0xBF // Boot block (000000-0007FFh) write-protected. 3509 #define _WRTB_OFF_6H 0xFF // Boot block (000000-0007FFh) not write-protected. 3510 #define _WRTD_ON_6H 0x7F // Data EEPROM write-protected. 3511 #define _WRTD_OFF_6H 0xFF // Data EEPROM not write-protected. 3512 3513 //----------------------------- CONFIG7L Options ------------------------------- 3514 3515 #define _EBTR0_ON_7L 0xFE // Block 0 (000800-001FFFh) protected from table reads executed in other blocks. 3516 #define _EBTR0_OFF_7L 0xFF // Block 0 (000800-001FFFh) not protected from table reads executed in other blocks. 3517 #define _EBTR1_ON_7L 0xFD // Block 1 (002000-003FFFh) protected from table reads executed in other blocks. 3518 #define _EBTR1_OFF_7L 0xFF // Block 1 (002000-003FFFh) not protected from table reads executed in other blocks. 3519 #define _EBTR2_ON_7L 0xFB // Block 2 (004000-005FFFh) protected from table reads executed in other blocks. 3520 #define _EBTR2_OFF_7L 0xFF // Block 2 (004000-005FFFh) not protected from table reads executed in other blocks. 3521 #define _EBTR3_ON_7L 0xF7 // Block 3 (006000-007FFFh) protected from table reads executed in other blocks. 3522 #define _EBTR3_OFF_7L 0xFF // Block 3 (006000-007FFFh) not protected from table reads executed in other blocks. 3523 3524 //----------------------------- CONFIG7H Options ------------------------------- 3525 3526 #define _EBTRB_ON_7H 0xBF // Boot block (000000-0007FFh) protected from table reads executed in other blocks. 3527 #define _EBTRB_OFF_7H 0xFF // Boot block (000000-0007FFh) not protected from table reads executed in other blocks. 3528 3529 //============================================================================== 3530 3531 #define __DEVID1 0x3FFFFE 3532 #define __DEVID2 0x3FFFFF 3533 3534 #define __IDLOC0 0x200000 3535 #define __IDLOC1 0x200001 3536 #define __IDLOC2 0x200002 3537 #define __IDLOC3 0x200003 3538 #define __IDLOC4 0x200004 3539 #define __IDLOC5 0x200005 3540 #define __IDLOC6 0x200006 3541 #define __IDLOC7 0x200007 3542 3543 #endif // #ifndef __PIC18LF4523_H__ 3544