2
; P18F242.INC Standard Header File, Version 0.01 Microchip Technology, Inc.
5
; This header file defines configurations, registers, and other useful bits of
6
; information for the PIC18F242 microcontroller. These names are taken to match
7
; the data sheets as closely as possible.
9
; Note that the processor must be selected before this file is
10
; included. The processor may be selected the following ways:
12
; 1. Command line switch:
13
; C:\ MPASM MYFILE.ASM /PIC18F242
14
; 2. LIST directive in the source file
16
; 3. Processor Type entry in the MPASM full-screen interface
17
; 4. Setting the processor in the MPLAB Project Dialog
19
;==========================================================================
23
;==========================================================================
24
;Rev: Date: Details: Who:
25
; 03/23/01 Modified C242 for F242 tr
27
;==========================================================================
31
;==========================================================================
33
MESSG "Processor-header file mismatch. Verify selected processor."
36
;==========================================================================
37
; 18Cxxx Family EQUates
38
;==========================================================================
49
;==========================================================================
51
;==========================================================================
52
; 16Cxxx/17Cxxx Substitutions
53
;==========================================================================
55
#define clrw clrf WREG ; PIC16Cxxx code substitution (WREG is addressable)
56
#define CLRW CLRF WREG ; PIC16Cxxx code substitution (WREG is addressable)
57
#define negw negf WREG ; PIC16Cxxx code substitution (WREG is addressable)
58
#define NEGW NEGF WREG ; PIC16Cxxx code substitution (WREG is addressable)
59
#define movpf movff ; PIC17Cxxx code substitution
60
#define MOVPF MOVFF ; PIC17Cxxx code substitution
61
#define movfp movff ; PIC17Cxxx code substitution
62
#define MOVFP MOVFF ; PIC17Cxxx code substitution
63
#define lcall call ; PIC17Cxxx code substitution
64
#define LCALL CALL ; PIC17Cxxx code substitution
65
#define lgoto goto ; PIC17Cxxx code substitution
66
#define LGOTO GOTO ; PIC17Cxxx code substitution
67
#define DDRA TRISA ; PIC17Cxxx SFR substitution
68
#define DDRB TRISB ; PIC17Cxxx SFR substitution
69
#define DDRC TRISC ; PIC17Cxxx SFR substitution
71
;==========================================================================
73
; Register Definitions
75
;==========================================================================
77
;----- Register Files -----------------------------------------------------
128
;RESERVED_0FD4 EQU H'0FD4'
153
;RESERVED_0FC0 EQU H'0FC0'
162
;RESERVED_0FB9 EQU H'0FB9'
163
;RESERVED_0FB8 EQU H'0FB8'
164
;RESERVED_0FB7 EQU H'0FB7'
165
;RESERVED_0FB6 EQU H'0FB6'
166
;RESERVED_0FB5 EQU H'0FB5'
167
;RESERVED_0FB4 EQU H'0FB4'
173
;RESERVED_0FB0 EQU H'0FB0'
181
;RESERVED_0FAA EQU H'0FAA'
188
;RESERVED_0FA5 EQU H'0FA5'
189
;RESERVED_0FA4 EQU H'0FA4'
190
;RESERVED_0FA3 EQU H'0FA3'
199
;RESERVED_0F9C EQU H'0F9C'
200
;RESERVED_0F9B EQU H'0F9B'
201
;RESERVED_0F9A EQU H'0F9A'
202
;RESERVED_0F99 EQU H'0F99'
203
;RESERVED_0F98 EQU H'0F98'
204
;RESERVED_0F97 EQU H'0F97'
205
;RESERVED_0F96 EQU H'0F96'
206
;RESERVED_0F95 EQU H'0F95'
212
;RESERVED_0F91 EQU H'0F91'
213
;RESERVED_0F90 EQU H'0F90'
214
;RESERVED_0F8F EQU H'0F8F'
215
;RESERVED_0F8E EQU H'0F8E'
216
;RESERVED_0F8D EQU H'0F8D'
217
;RESERVED_0F8C EQU H'0F8C'
223
;RESERVED_0F88 EQU H'0F88'
224
;RESERVED_0F87 EQU H'0F87'
225
;RESERVED_0F86 EQU H'0F86'
226
;RESERVED_0F85 EQU H'0F85'
227
;RESERVED_0F84 EQU H'0F84'
228
;RESERVED_0F83 EQU H'0F83'
234
;----- STKPTR Bits --------------------------------------------------------
238
;----- INTCON Bits --------------------------------------------------------
244
T0IE EQU H'0005' ; For backward compatibility
246
INT0E EQU H'0004' ; For backward compatibility
249
T0IF EQU H'0002' ; For backward compatibility
251
INT0F EQU H'0001' ; For backward compatibility
254
;----- INTCON2 Bits --------------------------------------------------------
261
T0IP EQU H'0002' ; For compatibility with T0IE and T0IF
264
;----- INTCON3 Bits --------------------------------------------------------
272
;----- STATUS Bits --------------------------------------------------------
279
;----- T0CON Bits ---------------------------------------------------------
289
;----- OSCON Bits ---------------------------------------------------------
292
;----- LVDCON Bits ---------------------------------------------------------
300
;----- WDTCON Bits ---------------------------------------------------------
303
;----- RCON Bits -----------------------------------------------------------
316
;----- T1CON Bits ---------------------------------------------------------
321
NOT_T1SYNC EQU H'0002'
323
T1INSYNC EQU H'0002' ; For backward compatibility
327
;----- T2CON Bits ---------------------------------------------------------
336
;----- SSPSTAT Bits -------------------------------------------------------
342
NOT_ADDRESS EQU H'0005'
344
DATA_ADDRESS EQU H'0005'
348
I2C_START EQU H'0003'
352
NOT_WRITE EQU H'0002'
354
READ_WRITE EQU H'0002'
358
;----- SSPCON1 Bits --------------------------------------------------------
368
;----- SSPCON2 Bits --------------------------------------------------------
378
;----- ADCON0 Bits --------------------------------------------------------
390
;----- ADCON1 Bits --------------------------------------------------------
398
;----- CCP1CON Bits -------------------------------------------------------
400
CCP1X EQU H'0005' ; For backward compatibility
402
CCP1Y EQU H'0004' ; For backward compatibility
408
;----- CCP2CON Bits -------------------------------------------------------
410
CCP2X EQU H'0005' ; For backward compatibility
412
CCP2Y EQU H'0004' ; For backward compatibility
418
;----- T3CON Bits ---------------------------------------------------------
424
NOT_T3SYNC EQU H'0002'
426
T3INSYNC EQU H'0002' ; For backward compatibility
430
;----- TXSTA Bits ---------------------------------------------------------
433
NOT_TX8 EQU H'0006' ; For backward compatibility
434
TX8_9 EQU H'0006' ; For backward compatibility
440
TXD8 EQU H'0000' ; For backward compatibility
442
;----- RCSTA Bits ---------------------------------------------------------
445
RC9 EQU H'0006' ; For backward compatibility
446
NOT_RC8 EQU H'0006' ; For backward compatibility
447
RC8_9 EQU H'0006' ; For backward compatibility
454
RCD8 EQU H'0000' ; For backward compatibility
456
;----- IPR2 Bits ----------------------------------------------------------
463
;----- PIR2 Bits ----------------------------------------------------------
470
;----- PIE2 Bits ----------------------------------------------------------
477
;----- IPR1 Bits ----------------------------------------------------------
487
;----- PIR1 Bits ----------------------------------------------------------
497
;----- PIE1 Bits ----------------------------------------------------------
507
;==========================================================================
509
; I/O Pin Name Definitions
511
;==========================================================================
513
;----- PORTA ------------------------------------------------------------------
535
;----- PORTB ------------------------------------------------------------------
550
;----- PORTC ------------------------------------------------------------------
572
;****DT EQU 7 ;*** Not Available due to conflict with
573
;*** Define Table (DT) directive
577
;==========================================================================
580
;==========================================================================
584
;==========================================================================
588
;==========================================================================
592
; Data Sheet Include File Address
593
; CONFIG1L = Configuration Byte 0 300000h
594
; CONFIG1H = Configuration Byte 1 300001h
595
; CONFIG2L = Configuration Byte 2 300002h
596
; CONFIG2H = Configuration Byte 3 300003h
597
; CONFIG3L = Configuration Byte 4 300004h
598
; CONFIG3H = Configuration Byte 5 300005h
599
; CONFIG4L = Configuration Byte 6 300006h
600
; CONFIG4H = Configuration Byte 7 300007h
601
; CONFIG5L = Configuration Byte 8 300008h
602
; CONFIG5H = Configuration Byte 9 300009h
603
; CONFIG6L = Configuration Byte A 30000ah
604
; CONFIG6H = Configuration Byte B 30000bh
605
; CONFIG7L = Configuration Byte C 30000ch
606
; CONFIG7H = Configuration Byte D 30000dh
608
;==========================================================================
610
;Configuration Byte 1 Options
611
_OSCS_ON_1 EQU H'DF' ; Oscillator Switch enable
612
_OSCS_OFF_1 EQU H'FF'
614
_LP_OSC_1 EQU H'F8' ; Oscillator type
618
_EC_OSC_1 EQU H'FC' ; External Clock w/OSC2 output divide by 4
619
_ECIO_OSC_1 EQU H'FD' ; w/OSC2 as an IO pin (RA6)
620
_HSPLL_OSC_1 EQU H'FE' ; HS PLL
621
_RCIO_OSC_1 EQU H'FF' ; RC w/OSC2 as an IO pin (RA6)
623
;Configuration Byte 2 Options
624
_BOR_ON_2 EQU H'FF' ; Brown-Out Reset enable
626
_PWRT_OFF_2 EQU H'FF' ; Power-Up Timer enable
628
_BORV_20_2 EQU H'FF' ; BOR Voltage - 2.0v
629
_BORV_27_2 EQU H'FB' ; 2.7v
630
_BORV_42_2 EQU H'F7' ; 4.2v
631
_BORV_45_2 EQU H'F3' ; 4.5v
633
;Configuration Byte 3 Options
634
_WDT_ON_3 EQU H'FF' ; Watch Dog Timer enable
636
_WDTPS_128_3 EQU H'FF' ; Watch Dog Timer PostScaler count
637
_WDTPS_64_3 EQU H'FD'
638
_WDTPS_32_3 EQU H'FB'
639
_WDTPS_16_3 EQU H'F9'
645
;Configuration Byte 5 Options
646
_CCP2MX_ON_5 EQU H'FF' ; CCP2 pin Mux enable
647
_CCP2MX_OFF_5 EQU H'FE'
649
;Configuration Byte 6 Options
650
_STVR_ON_6 EQU H'FF' ; Stack over/underflow Reset enable
651
_STVR_OFF_6 EQU H'FE'
652
_LVP_ON_6 EQU H'FF' ; Low-voltage ICSP enable
654
_DEBUG_ON_6 EQU H'7F' ; Backgound Debugger enable
655
_DEBUG_OFF_6 EQU H'FF'
657
;Configuration Byte 8 Options
658
_CP0_ON_8 EQU H'FE' ; Code protect user block enable
663
;Configuration Byte 9 Options
664
_CPB_ON_9 EQU H'BF' ; Code protect boot block enable
666
_CPD_ON_9 EQU H'7F' ; Code protect Data EE enable
669
;Configuration Byte A Options
670
_WRT0_ON_A EQU H'FE' ; Write protect user block enable
671
_WRT0_OFF_A EQU H'FF'
673
_WRT1_OFF_A EQU H'FF'
675
;Configuration Byte B Options
676
_WRTC_ON_B EQU H'DF' ; Write protect CONFIG regs enable
677
_WRTC_OFF_B EQU H'FF'
678
_WRTB_ON_B EQU H'BF' ; Write protect boot block enable
679
_WRTB_OFF_B EQU H'FF'
680
_WRTD_ON_B EQU H'7F' ; Write protect Data EE enable
681
_WRTD_OFF_B EQU H'FF'
683
;Configuration Byte C Options
684
_EBTR0_ON_C EQU H'FE' ; Table Read protect user block enable
685
_EBTR0_OFF_C EQU H'FF'
686
_EBTR1_ON_C EQU H'FD'
687
_EBTR1_OFF_C EQU H'FF'
689
;Configuration Byte D Options
690
_EBTRB_ON_D EQU H'BF' ; Table Read protect boot block enable
691
_EBTRB_OFF_D EQU H'FF'
693
; To use the Configuration Bits, place the following lines in your source code
694
; in the following format, and change the configuration value to the desired
695
; setting (such as CP_OFF to CP_ON). These are currently commented out here
696
; and each __CONFIG line should have the preceding semicolon removed when
697
; pasted into your source code.
699
; The following is a assignment of address values for all of the configuration
700
; registers for the purpose of table reads
701
_CONFIG0 EQU H'300000'
702
_CONFIG1 EQU H'300001'
703
_CONFIG2 EQU H'300002'
704
_CONFIG3 EQU H'300003'
705
_CONFIG4 EQU H'300004'
706
_CONFIG5 EQU H'300005'
707
_CONFIG6 EQU H'300006'
708
_CONFIG7 EQU H'300007'
709
_CONFIG8 EQU H'300008'
710
_CONFIG9 EQU H'300009'
711
_CONFIGA EQU H'30000A'
712
_CONFIGB EQU H'30000B'
713
_CONFIGC EQU H'30000C'
714
_CONFIGD EQU H'30000D'
715
_DEVID1 EQU H'3FFFFE'
716
_DEVID2 EQU H'3FFFFF'
717
_IDLOC0 EQU H'200000'
718
_IDLOC1 EQU H'200001'
719
_IDLOC2 EQU H'200002'
720
_IDLOC3 EQU H'200003'
721
_IDLOC4 EQU H'200004'
722
_IDLOC5 EQU H'200005'
723
_IDLOC6 EQU H'200006'
724
_IDLOC7 EQU H'200007'
726
;Program Configuration Register 1
727
; __CONFIG _CONFIG1, _OSCS_OFF_1 & _RCIO_OSC_1
729
;Program Configuration Register 2
730
; __CONFIG _CONFIG2, _BOR_ON_2 & _BORV_20_2 & _PWRT_OFF_2
732
;Program Configuration Register 3
733
; __CONFIG _CONFIG3, _WDT_ON_3 & _WDTPS_128_3
735
;Program Configuration Register 5
736
; __CONFIG _CONFIG5, _CCP2MX_ON_5
738
;Program Configuration Register 6
739
; __CONFIG _CONFIG6, _STVR_ON_6 & _LVP_OFF_6 & _DEBUG_OFF_6
741
;Program Configuration Register 8
742
; __CONFIG _CONFIG8, _CP0_OFF_8 & _CP1_OFF_8
744
;Program Configuration Register 9
745
; __CONFIG _CONFIG9, _CPB_ON_9 & _CPD_OFF_9
747
;Program Configuration Register A
748
; __CONFIG _CONFIGA, _WRT0_OFF_A & _WRT1_OFF_A
750
;Program Configuration Register B
751
; __CONFIG _CONFIGB, _WRTC_OFF_C & _WRTC_OFF_B & _WRTC_OFF_D
753
;Program Configuration Register C
754
; __CONFIG _CONFIGC, _EBTR0_OFF_C & _EBTR1_OFF_C
756
;Program Configuration Register D
757
; __CONFIG _CONFIGD, _EBTRB_OFF_D
759
;ID Locations Register 0
760
; __IDLOCS _IDLOC0, <expression>
762
;ID Locations Register 1
763
; __IDLOCS _IDLOC1, <expression>
765
;ID Locations Register 2
766
; __IDLOCS _IDLOC2, <expression>
768
;ID Locations Register 3
769
; __IDLOCS _IDLOC3, <expression>
771
;ID Locations Register 4
772
; __IDLOCS _IDLOC4, <expression>
774
;ID Locations Register 5
775
; __IDLOCS _IDLOC5, <expression>
777
;ID Locations Register 6
778
; __IDLOCS _IDLOC6, <expression>
780
;ID Locations Register 7
781
; __IDLOCS _IDLOC7, <expression>
783
;Device ID registers hold device ID and revision number and can only be read
784
;Device ID Register 1
785
; DEV2, DEV1, DEV0, REV4, REV3, REV2, REV1, REV0
786
;Device ID Register 2
787
; DEV10, DEV9, DEV8, DEV7, DEV6, DEV5, DEV4, DEV3
790
;==========================================================================