3
;==========================================================================
4
; MPASM PIC16F1937 processor include
6
; (c) Copyright 1999-2009 Microchip Technology, All rights reserved
7
;==========================================================================
11
;==========================================================================
12
; This header file defines configurations, registers, and other useful
13
; bits of information for the PIC16F1937 microcontroller. These names
14
; are taken to match the data sheets as closely as possible.
16
; Note that the processor must be selected before this file is included.
17
; The processor may be selected the following ways:
19
; 1. Command line switch:
20
; C:\MPASM MYFILE.ASM /PIC16F1937
21
; 2. LIST directive in the source file
23
; 3. Processor Type entry in the MPASM full-screen interface
24
; 4. Setting the processor in the MPLAB Project Dialog
25
;==========================================================================
27
;==========================================================================
31
;==========================================================================
33
MESSG "Processor-header file mismatch. Verify selected processor."
40
;==========================================================================
42
; Register Definitions
44
;==========================================================================
46
;----- Register Files -----------------------------------------------------
48
;-----Bank0------------------
83
;-----Bank1------------------
92
OPTION_REG EQU H'0095'
106
;-----Bank2------------------
125
;-----Bank3------------------
147
;-----Bank4------------------
158
;-----Bank5------------------
174
;-----Bank6------------------
188
;-----Bank7------------------
193
;-----Bank8------------------
201
;-----Bank15------------------
220
LCDDATA10 EQU H'07AA'
221
LCDDATA11 EQU H'07AB'
223
;-----Bank31------------------
224
STATUS_SHAD EQU H'0FE4'
225
WREG_SHAD EQU H'0FE5'
227
PCLATH_SHAD EQU H'0FE7'
228
FSR0L_SHAD EQU H'0FE8'
229
FSR0H_SHAD EQU H'0FE9'
230
FSR1L_SHAD EQU H'0FEA'
231
FSR1H_SHAD EQU H'0FEB'
237
;----- STATUS Bits -----------------------------------------------------
245
;----- BSR Bits -----------------------------------------------------
254
;----- INTCON Bits -----------------------------------------------------
265
;----- PORTA Bits -----------------------------------------------------
277
;----- PORTB Bits -----------------------------------------------------
289
;----- PORTC Bits -----------------------------------------------------
301
;----- PORTD Bits -----------------------------------------------------
313
;----- PORTE Bits -----------------------------------------------------
321
;----- PIR1 Bits -----------------------------------------------------
332
;----- PIR2 Bits -----------------------------------------------------
342
;----- PIR3 Bits -----------------------------------------------------
350
;----- T1CON Bits -----------------------------------------------------
352
NOT_T1SYNC EQU H'0002'
361
;----- T1GCON Bits -----------------------------------------------------
373
;----- T2CON Bits -----------------------------------------------------
384
;----- CPSCON0 Bits -----------------------------------------------------
393
;----- CPSCON1 Bits -----------------------------------------------------
401
;----- TRISA Bits -----------------------------------------------------
413
;----- TRISB Bits -----------------------------------------------------
425
;----- TRISC Bits -----------------------------------------------------
437
;----- TRISD Bits -----------------------------------------------------
448
;----- TRISE Bits -----------------------------------------------------
455
;----- PIE1 Bits -----------------------------------------------------
466
;----- PIE2 Bits -----------------------------------------------------
476
;----- PIE3 Bits -----------------------------------------------------
484
;----- OPTION_REG Bits -----------------------------------------------------
492
NOT_WPUEN EQU H'0007'
496
;----- PCON Bits -----------------------------------------------------
500
NOT_RMCLR EQU H'0003'
505
;----- WDTCON Bits -----------------------------------------------------
515
;----- OSCTUNE Bits -----------------------------------------------------
525
;----- OSCCON Bits -----------------------------------------------------
536
;----- OSCSTAT Bits -----------------------------------------------------
547
;----- ADCON0 Bits -----------------------------------------------------
549
GO_NOT_DONE EQU H'0001'
559
;----- ADCON1 Bits -----------------------------------------------------
570
;----- LATA Bits -----------------------------------------------------
582
;----- LATB Bits -----------------------------------------------------
594
;----- LATC Bits -----------------------------------------------------
606
;----- LATD Bits -----------------------------------------------------
618
;----- LATE Bits -----------------------------------------------------
625
;----- CM1CON0 Bits -----------------------------------------------------
635
;----- CM1CON1 Bits -----------------------------------------------------
645
;----- CM2CON0 Bits -----------------------------------------------------
655
;----- CM2CON1 Bits -----------------------------------------------------
665
;----- CMOUT Bits -----------------------------------------------------
670
;----- BORCON Bits -----------------------------------------------------
675
;----- VREFCON0 Bits -----------------------------------------------------
687
;----- VREFCON1 Bits -----------------------------------------------------
697
;----- VREFCON2 Bits -----------------------------------------------------
706
;----- SRCON0 Bits -----------------------------------------------------
718
;----- SRCON1 Bits -----------------------------------------------------
729
;----- APFCON Bits -----------------------------------------------------
739
;----- ANSELA Bits -----------------------------------------------------
749
;----- ANSELB Bits -----------------------------------------------------
759
;----- ANSELD Bits -----------------------------------------------------
771
;----- ANSELE Bits -----------------------------------------------------
778
;----- EECON1 Bits -----------------------------------------------------
789
;----- RCSTA Bits -----------------------------------------------------
800
;----- TXSTA Bits -----------------------------------------------------
811
;----- BAUDCTL Bits -----------------------------------------------------
820
;----- WPUB Bits -----------------------------------------------------
832
;----- WPUE Bits -----------------------------------------------------
836
;----- SSPSTAT Bits -----------------------------------------------------
847
;----- SSPCON Bits -----------------------------------------------------
858
;----- SSPCON2 Bits -----------------------------------------------------
869
;----- SSPCON3 Bits -----------------------------------------------------
878
;----- CCP1CON Bits -----------------------------------------------------
890
;----- PWM1CON Bits -----------------------------------------------------
901
;----- ECCP1AS Bits -----------------------------------------------------
912
;----- PSTR1CON Bits -----------------------------------------------------
920
;----- CCP2CON Bits -----------------------------------------------------
931
;----- PWM2CON Bits -----------------------------------------------------
942
;----- ECCP2AS Bits -----------------------------------------------------
953
;----- PSTR2CON Bits -----------------------------------------------------
961
;----- CCPTMRS0 Bits -----------------------------------------------------
972
;----- CCPTMRS1 Bits -----------------------------------------------------
977
;----- CCP3CON Bits -----------------------------------------------------
988
;----- PWM3CON Bits -----------------------------------------------------
999
;----- ECCP3AS Bits -----------------------------------------------------
1010
;----- PSTR3CON Bits -----------------------------------------------------
1015
STR3SYNC EQU H'0004'
1018
;----- CCP4CON Bits -----------------------------------------------------
1027
;----- CCP5CON Bits -----------------------------------------------------
1036
;----- IOCBP Bits -----------------------------------------------------
1048
;----- IOCBN Bits -----------------------------------------------------
1060
;----- IOCBF Bits -----------------------------------------------------
1072
;----- T4CON Bits -----------------------------------------------------
1076
T4OUTPS0 EQU H'0003'
1077
T4OUTPS1 EQU H'0004'
1078
T4OUTPS2 EQU H'0005'
1079
T4OUTPS3 EQU H'0006'
1083
;----- T6CON Bits -----------------------------------------------------
1087
T6OUTPS0 EQU H'0003'
1088
T6OUTPS1 EQU H'0004'
1089
T6OUTPS2 EQU H'0005'
1090
T6OUTPS3 EQU H'0006'
1094
;----- LCDCON Bits -----------------------------------------------------
1105
;----- LCDPS Bits -----------------------------------------------------
1117
;----- LCDREF Bits -----------------------------------------------------
1126
;----- LCDCST Bits -----------------------------------------------------
1133
;----- LCDRL Bits -----------------------------------------------------
1144
;----- LCDSE0 Bits -----------------------------------------------------
1155
;----- LCDSE1 Bits -----------------------------------------------------
1166
;----- LCDSE2 Bits -----------------------------------------------------
1177
;----- LCDDATA0 Bits -----------------------------------------------------
1178
SEG0COM0 EQU H'0000'
1179
SEG1COM0 EQU H'0001'
1180
SEG2COM0 EQU H'0002'
1181
SEG3COM0 EQU H'0003'
1182
SEG4COM0 EQU H'0004'
1183
SEG5COM0 EQU H'0005'
1184
SEG6COM0 EQU H'0006'
1185
SEG7COM0 EQU H'0007'
1188
;----- LCDDATA1 Bits -----------------------------------------------------
1189
SEG8COM0 EQU H'0000'
1190
SEG9COM0 EQU H'0001'
1191
SEG10COM0 EQU H'0002'
1192
SEG11COM0 EQU H'0003'
1193
SEG12COM0 EQU H'0004'
1194
SEG13COM0 EQU H'0005'
1195
SEG14COM0 EQU H'0006'
1196
SEG15COM0 EQU H'0007'
1199
;----- LCDDATA2 Bits -----------------------------------------------------
1200
SEG16COM0 EQU H'0000'
1201
SEG17COM0 EQU H'0001'
1202
SEG18COM0 EQU H'0002'
1203
SEG19COM0 EQU H'0003'
1204
SEG20COM0 EQU H'0004'
1205
SEG21COM0 EQU H'0005'
1206
SEG22COM0 EQU H'0006'
1207
SEG23COM0 EQU H'0007'
1210
;----- LCDDATA3 Bits -----------------------------------------------------
1211
SEG0COM1 EQU H'0000'
1212
SEG1COM1 EQU H'0001'
1213
SEG2COM1 EQU H'0002'
1214
SEG3COM1 EQU H'0003'
1215
SEG4COM1 EQU H'0004'
1216
SEG5COM1 EQU H'0005'
1217
SEG6COM1 EQU H'0006'
1218
SEG7COM1 EQU H'0007'
1221
;----- LCDDATA4 Bits -----------------------------------------------------
1222
SEG8COM1 EQU H'0000'
1223
SEG9COM1 EQU H'0001'
1224
SEG10COM1 EQU H'0002'
1225
SEG11COM1 EQU H'0003'
1226
SEG12COM1 EQU H'0004'
1227
SEG13COM1 EQU H'0005'
1228
SEG14COM1 EQU H'0006'
1229
SEG15COM1 EQU H'0007'
1232
;----- LCDDATA5 Bits -----------------------------------------------------
1233
SEG16COM1 EQU H'0000'
1234
SEG17COM1 EQU H'0001'
1235
SEG18COM1 EQU H'0002'
1236
SEG19COM1 EQU H'0003'
1237
SEG20COM1 EQU H'0004'
1238
SEG21COM1 EQU H'0005'
1239
SEG22COM1 EQU H'0006'
1240
SEG23COM1 EQU H'0007'
1243
;----- LCDDATA6 Bits -----------------------------------------------------
1244
SEG0COM2 EQU H'0000'
1245
SEG1COM2 EQU H'0001'
1246
SEG2COM2 EQU H'0002'
1247
SEG3COM2 EQU H'0003'
1248
SEG4COM2 EQU H'0004'
1249
SEG5COM2 EQU H'0005'
1250
SEG6COM2 EQU H'0006'
1251
SEG7COM2 EQU H'0007'
1254
;----- LCDDATA7 Bits -----------------------------------------------------
1255
SEG8COM2 EQU H'0000'
1256
SEG9COM2 EQU H'0001'
1257
SEG10COM2 EQU H'0002'
1258
SEG11COM2 EQU H'0003'
1259
SEG12COM2 EQU H'0004'
1260
SEG13COM2 EQU H'0005'
1261
SEG14COM2 EQU H'0006'
1262
SEG15COM2 EQU H'0007'
1265
;----- LCDDATA8 Bits -----------------------------------------------------
1266
SEG16COM2 EQU H'0000'
1267
SEG17COM2 EQU H'0001'
1268
SEG18COM2 EQU H'0002'
1269
SEG19COM2 EQU H'0003'
1270
SEG20COM2 EQU H'0004'
1271
SEG21COM2 EQU H'0005'
1272
SEG22COM2 EQU H'0006'
1273
SEG23COM2 EQU H'0007'
1276
;----- LCDDATA9 Bits -----------------------------------------------------
1277
SEG0COM3 EQU H'0000'
1278
SEG1COM3 EQU H'0001'
1279
SEG2COM3 EQU H'0002'
1280
SEG3COM3 EQU H'0003'
1281
SEG4COM3 EQU H'0004'
1282
SEG5COM3 EQU H'0005'
1283
SEG6COM3 EQU H'0006'
1284
SEG7COM3 EQU H'0007'
1287
;----- LCDDATA10 Bits -----------------------------------------------------
1288
SEG8COM3 EQU H'0000'
1289
SEG9COM3 EQU H'0001'
1290
SEG10COM3 EQU H'0002'
1291
SEG11COM3 EQU H'0003'
1292
SEG12COM3 EQU H'0004'
1293
SEG13COM3 EQU H'0005'
1294
SEG14COM3 EQU H'0006'
1295
SEG15COM3 EQU H'0007'
1298
;----- LCDDATA11 Bits -----------------------------------------------------
1299
SEG16COM3 EQU H'0000'
1300
SEG17COM3 EQU H'0001'
1301
SEG18COM3 EQU H'0002'
1302
SEG19COM3 EQU H'0003'
1303
SEG20COM3 EQU H'0004'
1304
SEG21COM3 EQU H'0005'
1305
SEG22COM3 EQU H'0006'
1306
SEG23COM3 EQU H'0007'
1309
;----- STATUS_SHAD Bits -----------------------------------------------------
1316
;==========================================================================
1320
;==========================================================================
1327
__BADRAM H'011E'-H'011F'
1329
__BADRAM H'0197'-H'0198'
1331
__BADRAM H'020E'-H'020F'
1332
__BADRAM H'0218'-H'021F'
1333
__BADRAM H'028C'-H'0290'
1335
__BADRAM H'030C'-H'0310'
1339
__BADRAM H'0330'-H'036F'
1340
__BADRAM H'038C'-H'0393'
1341
__BADRAM H'0397'-H'039F'
1342
__BADRAM H'03A0'-H'03EF'
1343
__BADRAM H'040C'-H'0414'
1344
__BADRAM H'0418'-H'041B'
1346
__BADRAM H'0420'-H'046F'
1347
__BADRAM H'048C'-H'049F'
1348
__BADRAM H'04A0'-H'04EF'
1349
__BADRAM H'050C'-H'051F'
1350
__BADRAM H'0520'-H'056F'
1351
__BADRAM H'058C'-H'059F'
1352
__BADRAM H'05A0'-H'05EF'
1353
__BADRAM H'060C'-H'061F'
1354
__BADRAM H'0620'-H'066F'
1355
__BADRAM H'068C'-H'069F'
1356
__BADRAM H'06A0'-H'06EF'
1357
__BADRAM H'070C'-H'071F'
1358
__BADRAM H'0720'-H'076F'
1359
__BADRAM H'078C'-H'0790'
1360
__BADRAM H'0796'-H'0797'
1361
__BADRAM H'079B'-H'079F'
1362
__BADRAM H'07AC'-H'07EF'
1363
__BADRAM H'080C'-H'081F'
1364
__BADRAM H'0820'-H'086F'
1365
__BADRAM H'088C'-H'089F'
1366
__BADRAM H'08A0'-H'08EF'
1367
__BADRAM H'090C'-H'091F'
1368
__BADRAM H'0920'-H'096F'
1369
__BADRAM H'098C'-H'099F'
1370
__BADRAM H'09A0'-H'09EF'
1371
__BADRAM H'0A0C'-H'0A1F'
1372
__BADRAM H'0A20'-H'0A6F'
1373
__BADRAM H'0A8C'-H'0A9F'
1374
__BADRAM H'0AA0'-H'0AEF'
1375
__BADRAM H'0B0C'-H'0B1F'
1376
__BADRAM H'0B20'-H'0B6F'
1377
__BADRAM H'0B8C'-H'0B9F'
1378
__BADRAM H'0BA0'-H'0BEF'
1379
__BADRAM H'0C0C'-H'0C1F'
1380
__BADRAM H'0C20'-H'0C6F'
1381
__BADRAM H'0C8C'-H'0C9F'
1382
__BADRAM H'0CA0'-H'0CEF'
1383
__BADRAM H'0D0C'-H'0D1F'
1384
__BADRAM H'0D20'-H'0D6F'
1385
__BADRAM H'0D8C'-H'0D9F'
1386
__BADRAM H'0DA0'-H'0DEF'
1387
__BADRAM H'0E0C'-H'0E1F'
1388
__BADRAM H'0E20'-H'0E6F'
1389
__BADRAM H'0E8C'-H'0E9F'
1390
__BADRAM H'0EA0'-H'0EEF'
1391
__BADRAM H'0F0C'-H'0F1F'
1392
__BADRAM H'0F20'-H'0F6F'
1393
__BADRAM H'0F8C'-H'0FE3'
1396
;==========================================================================
1398
; Configuration Bits
1404
;==========================================================================
1406
; The following is an assignment of address values for all of the
1407
; configuration registers for the purpose of table reads
1408
_CONFIG1 EQU H'8007'
1409
_CONFIG2 EQU H'8008'
1411
;----- CONFIG1 Options --------------------------------------------------
1412
_FOSC_LP EQU H'FFF8' ; LP Oscillator, Low-power crystal on RA6/OSC2/CLKO pin and RA7/OSC1/CLKI
1413
_FOSC_XT EQU H'FFF9' ; XT Oscillator, Crystal/resonator on RA6/OSC2/CLKO pin and RA7/OSC1/CLKI
1414
_FOSC_HS EQU H'FFFA' ; HS Oscillator, High speed crystal/resonator on RA6/OSC2/CLKO pin and RA7/OSC1/CLKI
1415
_FOSC_EXTRC EQU H'FFFB' ; EXTRC Oscillator, RC on RA7/OSC1/CLKIN
1416
_FOSC_INTOSC EQU H'FFFC' ; INTOSC Oscillator, I/O function on RA7/OSC1/CLKI
1417
_FOSC_ECL EQU H'FFFD' ; ECL, External Clock, Low Power Mode: CLKI on RA7/OSC1/CLKI
1418
_FOSC_ECM EQU H'FFFE' ; ECM, External Clock, Medium Power Mode: CLKI on RA7/OSC1/CLKI
1419
_FOSC_ECH EQU H'FFFF' ; ECH, External Clock, High Power Mode: CLKI on RA7/OSC1/CLKI
1421
_WDTE_OFF EQU H'FFE7' ; WDT disabled
1422
_WDTE_SWDTEN EQU H'FFEF' ; WDT controlled by the SWDTEN bit in the WDTCON register
1423
_WDTE_NSLEEP EQU H'FFF7' ; WDT enabled while running and disabled in Sleep
1424
_WDTE_ON EQU H'FFFF' ; WDT enabled
1426
_PWRTE_ON EQU H'FFDF' ; PWRT enabled
1427
_PWRTE_OFF EQU H'FFFF' ; PWRT disabled
1429
_MCLRE_OFF EQU H'FFBF' ; RE3/MCLR/VPP pin function is digital input
1430
_MCLRE_ON EQU H'FFFF' ; RE3/MCLR/VPP pin function is MCLR
1432
_CP_ON EQU H'FF7F' ; Program memory code protection is enabled
1433
_CP_OFF EQU H'FFFF' ; Program memory code protection is disabled
1435
_CPD_ON EQU H'FEFF' ; Data memory code protection is enabled
1436
_CPD_OFF EQU H'FFFF' ; Data memory code protection is disabled
1438
_BOREN_OFF EQU H'F9FF' ; Brown-out Reset disabled
1439
_BOREN_SBODEN EQU H'FBFF' ; Brown-out Reset controlled by the SBOREN bit in the PCON register
1440
_BOREN_NSLEEP EQU H'FDFF' ; Brown-out Reset enabled while running and disabled in Sleep
1441
_BOREN_ON EQU H'FFFF' ; Brown-out Reset enabled
1443
_CLKOUTEN_OFF EQU H'F7FF' ; CLKOUT function is enabled on RA6/CLKOUT pin
1444
_CLKOUTEN_ON EQU H'FFFF' ; CLKOUT function is disabled. I/O or oscillator function on RA6/CLKOUT
1446
_IESO_OFF EQU H'EFFF' ; Internal/External Switchover mode is disabled
1447
_IESO_ON EQU H'FFFF' ; Internal/External Switchover mode is enabled
1449
_FCMEN_OFF EQU H'DFFF' ; Fail-Safe Clock Monitor is disabled
1450
_FCMEN_ON EQU H'FFFF' ; Fail-Safe Clock Monitor is enabled
1452
;----- CONFIG2 Options --------------------------------------------------
1453
_WRT_ALL EQU H'FFFC' ; 000h to 1FFFh write protected, no addresses may be modified by EECON control
1454
_WRT_HALF EQU H'FFFD' ; 000h to FFFh write protected, 1000h to 1FFFh may be modified by EECON control
1455
_WRT_BOOT EQU H'FFFE' ; 000h to 1FFh write protected, 200h to 1FFFh may be modified by EECON control
1456
_WRT_OFF EQU H'FFFF' ; Write protection off
1458
_VCAPEN_RA0 EQU H'FFCF' ; VCAP functionality is enabled on RA0
1459
_VCAPEN_RA5 EQU H'FFDF' ; VCAP functionality is enabled on RA5
1460
_VCAPEN_RA6 EQU H'FFEF' ; VCAP functionality is enabled on RA6
1461
_VCAPEN_OFF EQU H'FFFF' ; All VCAP pin functions are disabled
1463
_PLLEN_OFF EQU H'FEFF' ; 4x PLL disabled
1464
_PLLEN_ON EQU H'FFFF' ; 4x PLL enabled
1466
_STVREN_OFF EQU H'FDFF' ; Stack Overflow or underflow will not cause a Reset
1467
_STVREN_ON EQU H'FFFF' ; Stack Overflow or underflow will cause a Reset
1469
_BORV_27 EQU H'FBFF' ; Brown-out Reset Voltage (VBOR) set to 2.7 V
1470
_BORV_19 EQU H'FFFF' ; Brown-out Reset Voltage (VBOR) set to 1.9 V
1472
_DEBUG_ON EQU H'EFFF' ; Background debugger is enabled
1473
_DEBUG_OFF EQU H'FFFF' ; Background debugger is disabled
1475
_LVP_OFF EQU H'DFFF' ; HV on MCLR/VPP must be used for programming
1476
_LVP_ON EQU H'FFFF' ; Low voltage programming enabled
1479
_DEVID1 EQU H'008006'
1481
_IDLOC0 EQU H'008000'
1482
_IDLOC1 EQU H'008001'
1483
_IDLOC2 EQU H'008002'
1484
_IDLOC3 EQU H'008003'