OpenCores
URL https://opencores.org/ocsvn/395_vgs/395_vgs/trunk

Subversion Repositories 395_vgs

[/] [395_vgs/] [trunk/] [src/] [PIC18/] [PIC18F452.h] - Blame information for rev 32

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 31 zuofu
// ***************************************
2
// BoostC Header file for PIC18F452
3
// Author(s): David Hobday
4
//
5
// Copyright (C) 2003-2005 Pavel Baranov
6
// Copyright (C) 2003-2005 David Hobday
7
// All Rights Reserved
8
// ***************************************
9
 
10
 
11
// ***************************************
12
// W and F definitions
13
// ***************************************
14
#define W                     0x0000
15
#define F                     0x0001
16
 
17
 
18
////////////////////////////////////////////////////////////////////////////
19
//
20
//       Register Definitions
21
//
22
////////////////////////////////////////////////////////////////////////////
23
 
24
//----- Register Files -----------------------------------------------------
25
 
26
#define TOSU                  0x00000FFF 
27
#define TOSH                  0x00000FFE 
28
#define TOSL                  0x00000FFD 
29
#define STKPTR                0x00000FFC 
30
#define PCLATU                0x00000FFB 
31
#define PCLATH                0x00000FFA 
32
#define PCL                   0x00000FF9 
33
#define TBLPTRU               0x00000FF8 
34
#define TBLPTRH               0x00000FF7 
35
#define TBLPTRL               0x00000FF6 
36
#define TABLAT                0x00000FF5 
37
#define PRODH                 0x00000FF4 
38
#define PRODL                 0x00000FF3 
39
#define INTCON                0x00000FF2 
40
#define INTCON1               0x00000FF2 
41
#define INTCON2               0x00000FF1 
42
#define INTCON3               0x00000FF0 
43
#define INDF0                 0x00000FEF 
44
#define POSTINC0              0x00000FEE 
45
#define POSTDEC0              0x00000FED 
46
#define PREINC0               0x00000FEC 
47
#define PLUSW0                0x00000FEB 
48
#define FSR0H                 0x00000FEA 
49
#define FSR0L                 0x00000FE9 
50
#define WREG                  0x00000FE8 
51
#define INDF1                 0x00000FE7 
52
#define POSTINC1              0x00000FE6 
53
#define POSTDEC1              0x00000FE5 
54
#define PREINC1               0x00000FE4 
55
#define PLUSW1                0x00000FE3 
56
#define FSR1H                 0x00000FE2 
57
#define FSR1L                 0x00000FE1 
58
#define BSR                   0x00000FE0 
59
#define INDF2                 0x00000FDF 
60
#define POSTINC2              0x00000FDE 
61
#define POSTDEC2              0x00000FDD 
62
#define PREINC2               0x00000FDC 
63
#define PLUSW2                0x00000FDB 
64
#define FSR2H                 0x00000FDA 
65
#define FSR2L                 0x00000FD9 
66
#define STATUS                0x00000FD8 
67
#define TMR0H                 0x00000FD7 
68
#define TMR0L                 0x00000FD6 
69
#define T0CON                 0x00000FD5 
70
#define OSCCON                0x00000FD3 
71
#define LVDCON                0x00000FD2 
72
#define WDTCON                0x00000FD1 
73
#define RCON                  0x00000FD0 
74
#define TMR1H                 0x00000FCF 
75
#define TMR1L                 0x00000FCE 
76
#define T1CON                 0x00000FCD 
77
#define TMR2                  0x00000FCC 
78
#define PR2                   0x00000FCB 
79
#define T2CON                 0x00000FCA 
80
#define SSPBUF                0x00000FC9 
81
#define SSPADD                0x00000FC8 
82
#define SSPSTAT               0x00000FC7 
83
#define SSPCON1               0x00000FC6 
84
#define SSPCON2               0x00000FC5 
85
#define ADRESH                0x00000FC4 
86
#define ADRESL                0x00000FC3 
87
#define ADCON0                0x00000FC2 
88
#define ADCON1                0x00000FC1 
89
#define CCPR1H                0x00000FBF 
90
#define CCPR1L                0x00000FBE 
91
#define CCP1CON               0x00000FBD 
92
#define CCPR2H                0x00000FBC 
93
#define CCPR2L                0x00000FBB 
94
#define CCP2CON               0x00000FBA 
95
#define TMR3H                 0x00000FB3 
96
#define TMR3L                 0x00000FB2 
97
#define T3CON                 0x00000FB1 
98
#define SPBRG                 0x00000FAF 
99
#define RCREG                 0x00000FAE 
100
#define TXREG                 0x00000FAD 
101
#define TXSTA                 0x00000FAC 
102
#define RCSTA                 0x00000FAB 
103
#define EEADR                 0x00000FA9 
104
#define EEDATA                0x00000FA8 
105
#define EECON2                0x00000FA7 
106
#define EECON1                0x00000FA6 
107
#define IPR2                  0x00000FA2 
108
#define PIR2                  0x00000FA1 
109
#define PIE2                  0x00000FA0 
110
#define IPR1                  0x00000F9F 
111
#define PIR1                  0x00000F9E 
112
#define PIE1                  0x00000F9D 
113
#define TRISE                 0x00000F96 
114
#define TRISD                 0x00000F95 
115
#define TRISC                 0x00000F94 
116
#define TRISB                 0x00000F93 
117
#define TRISA                 0x00000F92 
118
#define LATE                  0x00000F8D 
119
#define LATD                  0x00000F8C 
120
#define LATC                  0x00000F8B 
121
#define LATB                  0x00000F8A 
122
#define LATA                  0x00000F89 
123
#define PORTE                 0x00000F84 
124
#define PORTD                 0x00000F83 
125
#define PORTC                 0x00000F82 
126
#define PORTB                 0x00000F81 
127
#define PORTA                 0x00000F80 
128
 
129
/////// STKPTR Bits ////////////////////////////////////////////////////////
130
#define STKFUL                0x00000007 
131
#define STKUNF                0x00000006 
132
 
133
/////// INTCON Bits ////////////////////////////////////////////////////////
134
#define GIE                   0x00000007 
135
#define GIEH                  0x00000007 
136
#define PEIE                  0x00000006 
137
#define GIEL                  0x00000006 
138
#define TMR0IE                0x00000005 
139
#define T0IE                  0x00000005 // For backward compatibility
140
#define INT0IE                0x00000004 
141
#define INT0E                 0x00000004 // For backward compatibility
142
#define RBIE                  0x00000003 
143
#define TMR0IF                0x00000002 
144
#define T0IF                  0x00000002 // For backward compatibility
145
#define INT0IF                0x00000001 
146
#define INT0F                 0x00000001 // For backward compatibility
147
#define RBIF                  0x00000000 
148
 
149
/////// INTCON2 Bits ////////////////////////////////////////////////////////
150
#define NOT_RBPU              0x00000007 
151
#define RBPU                  0x00000007 
152
#define INTEDG0               0x00000006 
153
#define INTEDG1               0x00000005 
154
#define INTEDG2               0x00000004 
155
#define TMR0IP                0x00000002 
156
#define T0IP                  0x00000002 // For compatibility with T0IE and T0IF
157
#define RBIP                  0x00000000 
158
 
159
/////// INTCON3 Bits ////////////////////////////////////////////////////////
160
#define INT2IP                0x00000007 
161
#define INT1IP                0x00000006 
162
#define INT2IE                0x00000004 
163
#define INT1IE                0x00000003 
164
#define INT2IF                0x00000001 
165
#define INT1IF                0x00000000 
166
 
167
/////// STATUS Bits ////////////////////////////////////////////////////////
168
#define N                     0x00000004 
169
#define OV                    0x00000003 
170
#define Z                     0x00000002 
171
#define DC                    0x00000001 
172
#define C                     0x00000000 
173
 
174
/////// T0CON Bits /////////////////////////////////////////////////////////
175
#define TMR0ON                0x00000007 
176
#define T08BIT                0x00000006 
177
#define T0CS                  0x00000005 
178
#define T0SE                  0x00000004 
179
#define PSA                   0x00000003 
180
#define T0PS2                 0x00000002 
181
#define T0PS1                 0x00000001 
182
#define T0PS0                 0x00000000 
183
 
184
/////// OSCCON Bits /////////////////////////////////////////////////////////
185
#define SCS                   0x00000000 
186
 
187
/////// LVDCON Bits /////////////////////////////////////////////////////////
188
#define IRVST                 0x00000005 
189
#define LVDEN                 0x00000004 
190
#define LVDL3                 0x00000003 
191
#define LVDL2                 0x00000002 
192
#define LVDL1                 0x00000001 
193
#define LVDL0                 0x00000000 
194
 
195
/////// WDTCON Bits /////////////////////////////////////////////////////////
196
#define SWDTE                 0x00000000 
197
#define SWDTEN                0x00000000 
198
 
199
/////// RCON Bits ///////////////////////////////////////////////////////////
200
#define IPEN                  0x00000007 
201
#define NOT_RI                0x00000004 
202
#define RI                    0x00000004 
203
#define NOT_TO                0x00000003 
204
#define TO                    0x00000003 
205
#define NOT_PD                0x00000002 
206
#define PD                    0x00000002 
207
#define NOT_POR               0x00000001 
208
#define POR                   0x00000001 
209
#define NOT_BOR               0x00000000 
210
#define BOR                   0x00000000 
211
 
212
/////// T1CON Bits /////////////////////////////////////////////////////////
213
#define RD16                  0x00000007 
214
#define T1CKPS1               0x00000005 
215
#define T1CKPS0               0x00000004 
216
#define T1OSCEN               0x00000003 
217
#define NOT_T1SYNC            0x00000002 
218
#define T1SYNC                0x00000002 
219
#define T1INSYNC              0x00000002 // For backward compatibility
220
#define TMR1CS                0x00000001 
221
#define TMR1ON                0x00000000 
222
 
223
/////// T2CON Bits /////////////////////////////////////////////////////////
224
#define TOUTPS3               0x00000006 
225
#define TOUTPS2               0x00000005 
226
#define TOUTPS1               0x00000004 
227
#define TOUTPS0               0x00000003 
228
#define TMR2ON                0x00000002 
229
#define T2CKPS1               0x00000001 
230
#define T2CKPS0               0x00000000 
231
 
232
/////// SSPSTAT Bits ///////////////////////////////////////////////////////
233
#define SMP                   0x00000007 
234
#define CKE                   0x00000006 
235
#define D                     0x00000005 
236
#define I2C_DAT               0x00000005 
237
#define NOT_A                 0x00000005 
238
#define NOT_ADDRESS           0x00000005 
239
#define D_A                   0x00000005 
240
#define DATA_ADDRESS          0x00000005 
241
#define P                     0x00000004 
242
#define I2C_STOP              0x00000004 
243
#define S                     0x00000003 
244
#define I2C_START             0x00000003 
245
#define R                     0x00000002 
246
#define I2C_READ              0x00000002 
247
#define NOT_W                 0x00000002 
248
#define NOT_WRITE             0x00000002 
249
#define R_W                   0x00000002 
250
#define READ_WRITE            0x00000002 
251
#define UA                    0x00000001 
252
#define BF                    0x00000000 
253
 
254
/////// SSPCON1 Bits ////////////////////////////////////////////////////////
255
#define WCOL                  0x00000007 
256
#define SSPOV                 0x00000006 
257
#define SSPEN                 0x00000005 
258
#define CKP                   0x00000004 
259
#define SSPM3                 0x00000003 
260
#define SSPM2                 0x00000002 
261
#define SSPM1                 0x00000001 
262
#define SSPM0                 0x00000000 
263
 
264
/////// SSPCON2 Bits ////////////////////////////////////////////////////////
265
#define GCEN                  0x00000007 
266
#define ACKSTAT               0x00000006 
267
#define ACKDT                 0x00000005 
268
#define ACKEN                 0x00000004 
269
#define RCEN                  0x00000003 
270
#define PEN                   0x00000002 
271
#define RSEN                  0x00000001 
272
#define SEN                   0x00000000 
273
 
274
/////// ADCON0 Bits ////////////////////////////////////////////////////////
275
#define ADCS1                 0x00000007 
276
#define ADCS0                 0x00000006 
277
#define CHS2                  0x00000005 
278
#define CHS1                  0x00000004 
279
#define CHS0                  0x00000003 
280
#define GO                    0x00000002 
281
#define NOT_DONE              0x00000002 
282
#define DONE                  0x00000002 
283
#define GO_DONE               0x00000002 
284
#define ADON                  0x00000000 
285
 
286
/////// ADCON1 Bits ////////////////////////////////////////////////////////
287
#define ADFM                  0x00000007 
288
#define ADCS2                 0x00000006 
289
#define PCFG3                 0x00000003 
290
#define PCFG2                 0x00000002 
291
#define PCFG1                 0x00000001 
292
#define PCFG0                 0x00000000 
293
 
294
/////// CCP1CON Bits ///////////////////////////////////////////////////////
295
#define DC1B1                 0x00000005 
296
#define CCP1X                 0x00000005 // For backward compatibility
297
#define DC1B0                 0x00000004 
298
#define CCP1Y                 0x00000004 // For backward compatibility
299
#define CCP1M3                0x00000003 
300
#define CCP1M2                0x00000002 
301
#define CCP1M1                0x00000001 
302
#define CCP1M0                0x00000000 
303
 
304
/////// CCP2CON Bits ///////////////////////////////////////////////////////
305
#define DC2B1                 0x00000005 
306
#define CCP2X                 0x00000005 // For backward compatibility
307
#define DC2B0                 0x00000004 
308
#define CCP2Y                 0x00000004 // For backward compatibility
309
#define CCP2M3                0x00000003 
310
#define CCP2M2                0x00000002 
311
#define CCP2M1                0x00000001 
312
#define CCP2M0                0x00000000 
313
 
314
/////// T3CON Bits /////////////////////////////////////////////////////////
315
#define RD16                  0x00000007 
316
#define T3CCP2                0x00000006 
317
#define T3CKPS1               0x00000005 
318
#define T3CKPS0               0x00000004 
319
#define T3CCP1                0x00000003 
320
#define NOT_T3SYNC            0x00000002 
321
#define T3SYNC                0x00000002 
322
#define T3INSYNC              0x00000002 // For backward compatibility
323
#define TMR3CS                0x00000001 
324
#define TMR3ON                0x00000000 
325
 
326
/////// TXSTA Bits /////////////////////////////////////////////////////////
327
#define CSRC                  0x00000007 
328
#define TX9                   0x00000006 
329
#define NOT_TX8               0x00000006 // For backward compatibility
330
#define TX8_9                 0x00000006 // For backward compatibility
331
#define TXEN                  0x00000005 
332
#define SYNC                  0x00000004 
333
#define BRGH                  0x00000002 
334
#define TRMT                  0x00000001 
335
#define TX9D                  0x00000000 
336
#define TXD8                  0x00000000 // For backward compatibility
337
 
338
/////// RCSTA Bits /////////////////////////////////////////////////////////
339
#define SPEN                  0x00000007 
340
#define RX9                   0x00000006 
341
#define RC9                   0x00000006 // For backward compatibility
342
#define NOT_RC8               0x00000006 // For backward compatibility
343
#define RC8_9                 0x00000006 // For backward compatibility
344
#define SREN                  0x00000005 
345
#define CREN                  0x00000004 
346
#define ADDEN                 0x00000003 
347
#define FERR                  0x00000002 
348
#define OERR                  0x00000001 
349
#define RX9D                  0x00000000 
350
#define RCD8                  0x00000000 // For backward compatibility
351
 
352
/////// IPR2 Bits //////////////////////////////////////////////////////////
353
#define EEIP                  0x00000004 
354
#define BCLIP                 0x00000003 
355
#define LVDIP                 0x00000002 
356
#define TMR3IP                0x00000001 
357
#define CCP2IP                0x00000000 
358
 
359
/////// PIR2 Bits //////////////////////////////////////////////////////////
360
#define EEIF                  0x00000004 
361
#define BCLIF                 0x00000003 
362
#define LVDIF                 0x00000002 
363
#define TMR3IF                0x00000001 
364
#define CCP2IF                0x00000000 
365
 
366
/////// PIE2 Bits //////////////////////////////////////////////////////////
367
#define EEIE                  0x00000004 
368
#define BCLIE                 0x00000003 
369
#define LVDIE                 0x00000002 
370
#define TMR3IE                0x00000001 
371
#define CCP2IE                0x00000000 
372
 
373
/////// IPR1 Bits //////////////////////////////////////////////////////////
374
#define PSPIP                 0x00000007 
375
#define ADIP                  0x00000006 
376
#define RCIP                  0x00000005 
377
#define TXIP                  0x00000004 
378
#define SSPIP                 0x00000003 
379
#define CCP1IP                0x00000002 
380
#define TMR2IP                0x00000001 
381
#define TMR1IP                0x00000000 
382
 
383
/////// PIR1 Bits //////////////////////////////////////////////////////////
384
#define PSPIF                 0x00000007 
385
#define ADIF                  0x00000006 
386
#define RCIF                  0x00000005 
387
#define TXIF                  0x00000004 
388
#define SSPIF                 0x00000003 
389
#define CCP1IF                0x00000002 
390
#define TMR2IF                0x00000001 
391
#define TMR1IF                0x00000000 
392
 
393
/////// PIE1 Bits //////////////////////////////////////////////////////////
394
#define PSPIE                 0x00000007 
395
#define ADIE                  0x00000006 
396
#define RCIE                  0x00000005 
397
#define TXIE                  0x00000004 
398
#define SSPIE                 0x00000003 
399
#define CCP1IE                0x00000002 
400
#define TMR2IE                0x00000001 
401
#define TMR1IE                0x00000000 
402
 
403
/////// TRISE Bits /////////////////////////////////////////////////////////
404
#define IBF                   0x00000007 
405
#define OBF                   0x00000006 
406
#define IBOV                  0x00000005 
407
#define PSPMODE               0x00000004 
408
#define TRISE2                0x00000002 
409
#define TRISE1                0x00000001 
410
#define TRISE0                0x00000000 
411
 
412
/////// EECON1 Bits /////////////////////////////////////////////////////////
413
#define EEPGD                 0x00000007 
414
#define CFGS                  0x00000006 
415
#define FREE                  0x00000004 
416
#define WRERR                 0x00000003 
417
#define WREN                  0x00000002 
418
#define WR                    0x00000001 
419
#define RD                    0x00000000 
420
 
421
////////////////////////////////////////////////////////////////////////////
422
//
423
//       I/O Pin Name Definitions
424
//
425
////////////////////////////////////////////////////////////////////////////
426
 
427
//----- PORTA ------------------------------------------------------------------
428
 
429
#define RA0                   0x00000000 
430
#define AN0                   0x00000000 
431
#define RA1                   0x00000001 
432
#define AN1                   0x00000001 
433
#define RA2                   0x00000002 
434
#define AN2                   0x00000002 
435
#define VREFM                 0x00000002 
436
#define RA3                   0x00000003 
437
#define AN3                   0x00000003 
438
#define VREFP                 0x00000003 
439
#define RA4                   0x00000004 
440
#define T0CKI                 0x00000004 
441
#define RA5                   0x00000005 
442
#define AN4                   0x00000005 
443
#define SS                    0x00000005 
444
#define LVDIN                 0x00000005 
445
#define RA6                   0x00000006 
446
#define OSC2                  0x00000006 
447
#define CLKO                  0x00000006 
448
 
449
/////// PORTB //////////////////////////////////////////////////////////////////
450
#define RB0                   0x00000000 
451
#define INT0                  0x00000000 
452
#define RB1                   0x00000001 
453
#define INT1                  0x00000001 
454
#define RB2                   0x00000002 
455
#define INT2                  0x00000002 
456
#define RB3                   0x00000003 
457
#define CCP2A                 0x00000003 
458
#define RB4                   0x00000004 
459
#define RB5                   0x00000005 
460
#define RB6                   0x00000006 
461
#define RB7                   0x00000007 
462
 
463
/////// PORTC //////////////////////////////////////////////////////////////////
464
#define RC0                   0x00000000 
465
#define T1OSO                 0x00000000 
466
#define T1CKI                 0x00000000 
467
#define RC1                   0x00000001 
468
#define T1OSI                 0x00000001 
469
#define CCP2                  0x00000001 
470
#define RC2                   0x00000002 
471
#define CCP1                  0x00000002 
472
#define RC3                   0x00000003 
473
#define SCK                   0x00000003 
474
#define SCL                   0x00000003 
475
#define RC4                   0x00000004 
476
#define SDI                   0x00000004 
477
#define SDA                   0x00000004 
478
#define RC5                   0x00000005 
479
#define SDO                   0x00000005 
480
#define RC6                   0x00000006 
481
#define TX                    0x00000006 
482
#define CK                    0x00000006 
483
#define RC7                   0x00000007 
484
#define RX                    0x00000007 
485
 
486
//***    Define Table (DT) directive
487
 
488
/////// PORTD //////////////////////////////////////////////////////////////////
489
#define RD0                   0x00000000 
490
#define PSP0                  0x00000000 
491
#define RD1                   0x00000001 
492
#define PSP1                  0x00000001 
493
#define RD2                   0x00000002 
494
#define PSP2                  0x00000002 
495
#define RD3                   0x00000003 
496
#define PSP3                  0x00000003 
497
#define RD4                   0x00000004 
498
#define PSP4                  0x00000004 
499
#define RD5                   0x00000005 
500
#define PSP5                  0x00000005 
501
#define RD6                   0x00000006 
502
#define PSP6                  0x00000006 
503
#define RD7                   0x00000007 
504
#define PSP7                  0x00000007 
505
 
506
/////// PORTE //////////////////////////////////////////////////////////////////
507
#define RE0                   0x00000000 
508
#define RD                    0x00000000 
509
#define AN5                   0x00000000 
510
#define RE1                   0x00000001 
511
#define WR                    0x00000001 
512
#define AN6                   0x00000001 
513
#define RE2                   0x00000002 
514
#define CS                    0x00000002 
515
#define AN7                   0x00000002 
516
 
517
////////////////////////////////////////////////////////////////////////////
518
//
519
//   IMPORTANT: For the PIC18 devices, the __CONFIG directive has been
520
//              superseded by the CONFIG directive.  The following settings
521
//              are available for this device.
522
//
523
//   Oscillator Selection:
524
//     OSC = LP             LP
525
//     OSC = XT             XT
526
//     OSC = HS             HS
527
//     OSC = RC             RC
528
//     OSC = EC             EC-OSC2 as Clock Out
529
//     OSC = ECIO           EC-OSC2 as RA6
530
//     OSC = HSPLL          HS-PLL Enabled
531
//     OSC = RCIO           RC-OSC2 as RA6
532
//
533
//   Osc. Switch Enable:
534
//     OSCS = ON            Enabled
535
//     OSCS = OFF           Disabled
536
//
537
//   Power Up Timer:
538
//     PWRT = ON            Enabled
539
//     PWRT = OFF           Disabled
540
//
541
//   Brown Out Reset:
542
//     BOR = OFF            Disabled
543
//     BOR = ON             Enabled
544
//
545
//   Brown Out Voltage:
546
//     BORV = 45            4.5V
547
//     BORV = 42            4.2V
548
//     BORV = 27            2.7V
549
//     BORV = 25            2.5V
550
//
551
//   Watchdog Timer:
552
//     WDT = OFF            Disabled
553
//     WDT = ON             Enabled
554
//
555
//   Watchdog Postscaler:
556
//     WDTPS = 1            1:1
557
//     WDTPS = 2            1:2
558
//     WDTPS = 4            1:4
559
//     WDTPS = 8            1:8
560
//     WDTPS = 16           1:16
561
//     WDTPS = 32           1:32
562
//     WDTPS = 64           1:64
563
//     WDTPS = 128          1:128
564
//
565
//   CCP2 Mux:
566
//     CCP2MUX = OFF        Disable (RB3)
567
//     CCP2MUX = ON         Enable (RC1)
568
//
569
//   Stack Overflow Reset:
570
//     STVR = OFF           Disabled
571
//     STVR = ON            Enabled
572
//
573
//   Low Voltage ICSP:
574
//     LVP = OFF            Disabled
575
//     LVP = ON             Enabled
576
//
577
//   Background Debugger Enable:
578
//     DEBUG = ON           Enabled
579
//     DEBUG = OFF          Disabled
580
//
581
//   Code Protection Block 0:
582
//     CP0 = ON             Enabled
583
//     CP0 = OFF            Disabled
584
//
585
//   Code Protection Block 1:
586
//     CP1 = ON             Enabled
587
//     CP1 = OFF            Disabled
588
//
589
//   Code Protection Block 2:
590
//     CP2 = ON             Enabled
591
//     CP2 = OFF            Disabled
592
//
593
//   Code Protection Block 3:
594
//     CP3 = ON             Enabled
595
//     CP3 = OFF            Disabled
596
//
597
//   Boot Block Code Protection:
598
//     CPB = ON             Enabled
599
//     CPB = OFF            Disabled
600
//
601
//   Data EEPROM Code Protection:
602
//     CPD = ON             Enabled
603
//     CPD = OFF            Disabled
604
//
605
//   Write Protection Block 0:
606
//     WRT0 = ON            Enabled
607
//     WRT0 = OFF           Disabled
608
//
609
//   Write Protection Block 1:
610
//     WRT1 = ON            Enabled
611
//     WRT1 = OFF           Disabled
612
//
613
//   Write Protection Block 2:
614
//     WRT2 = ON            Enabled
615
//     WRT2 = OFF           Disabled
616
//
617
//   Write Protection Block 3:
618
//     WRT3 = ON            Enabled
619
//     WRT3 = OFF           Disabled
620
//
621
//   Boot Block Write Protection:
622
//     WRTB = ON            Enabled
623
//     WRTB = OFF           Disabled
624
//
625
//   Configuration Register Write Protection:
626
//     WRTC = ON            Enabled
627
//     WRTC = OFF           Disabled
628
//
629
//   Data EEPROM Write Protection:
630
//     WRTD = ON            Enabled
631
//     WRTD = OFF           Disabled
632
//
633
//   Table Read Protection Block 0:
634
//     EBTR0 = ON           Enabled
635
//     EBTR0 = OFF          Disabled
636
//
637
//   Table Read Protection Block 1:
638
//     EBTR1 = ON           Enabled
639
//     EBTR1 = OFF          Disabled
640
//
641
//   Table Read Protection Block 2:
642
//     EBTR2 = ON           Enabled
643
//     EBTR2 = OFF          Disabled
644
//
645
//   Table Read Protection Block 3:
646
//     EBTR3 = ON           Enabled
647
//     EBTR3 = OFF          Disabled
648
//
649
//   Boot Block Table Read Protection:
650
//     EBTRB = ON           Enabled
651
//     EBTRB = OFF          Disabled
652
//
653
////////////////////////////////////////////////////////////////////////////
654
////////////////////////////////////////////////////////////////////////////
655
//
656
//       Configuration Bits
657
//
658
//     Data Sheet    Include File                  Address
659
//     CONFIG1L    = Configuration Byte 1L         300000h
660
//     CONFIG1H    = Configuration Byte 1H         300001h
661
//     CONFIG2L    = Configuration Byte 2L         300002h
662
//     CONFIG2H    = Configuration Byte 2H         300003h
663
//     CONFIG3L    = Configuration Byte 3L         300004h
664
//     CONFIG3H    = Configuration Byte 3H         300005h
665
//     CONFIG4L    = Configuration Byte 4L         300006h
666
//     CONFIG4H    = Configuration Byte 4H         300007h
667
//     CONFIG5L    = Configuration Byte 5L         300008h
668
//     CONFIG5H    = Configuration Byte 5H         300009h
669
//     CONFIG6L    = Configuration Byte 6L         30000ah
670
//     CONFIG6H    = Configuration Byte 6H         30000bh
671
//     CONFIG7L    = Configuration Byte 7L         30000ch
672
//     CONFIG7H    = Configuration Byte 7H         30000dh
673
//
674
////////////////////////////////////////////////////////////////////////////
675
 
676
//Configuration Byte 1H Options
677
 
678
#define _OSCS_ON_1H           0x000000DF // Oscillator Switch enable
679
#define _OSCS_OFF_1H          0x000000FF 
680
#define _LP_OSC_1H            0x000000F8 // Oscillator type
681
#define _XT_OSC_1H            0x000000F9 
682
#define _HS_OSC_1H            0x000000FA 
683
#define _RC_OSC_1H            0x000000FB 
684
#define _EC_OSC_1H            0x000000FC // External Clock w/OSC2 output divide by 4
685
#define _ECIO_OSC_1H          0x000000FD // w/OSC2 as an IO pin (RA6)
686
#define _HSPLL_OSC_1H         0x000000FE // HS PLL
687
#define _RCIO_OSC_1H          0x000000FF // RC w/OSC2 as an IO pin (RA6)
688
 
689
//Configuration Byte 2L Options
690
#define _BOR_ON_2L            0x000000FF // Brown-Out Reset enable
691
#define _BOR_OFF_2L           0x000000FD 
692
#define _PWRT_OFF_2L          0x000000FF // Power-Up Timer enable
693
#define _PWRT_ON_2L           0x000000FE 
694
#define _BORV_20_2L           0x000000FF // BOR Voltage - 2.0v
695
#define _BORV_27_2L           0x000000FB //               2.7v
696
#define _BORV_42_2L           0x000000F7 //               4.2v
697
#define _BORV_45_2L           0x000000F3 //               4.5v
698
 
699
//Configuration Byte 2H Options
700
#define _WDT_ON_2H            0x000000FF // Watch Dog Timer enable
701
#define _WDT_OFF_2H           0x000000FE 
702
#define _WDTPS_128_2H         0x000000FF // Watch Dog Timer PostScaler count
703
#define _WDTPS_64_2H          0x000000FD 
704
#define _WDTPS_32_2H          0x000000FB 
705
#define _WDTPS_16_2H          0x000000F9 
706
#define _WDTPS_8_2H           0x000000F7 
707
#define _WDTPS_4_2H           0x000000F5 
708
#define _WDTPS_2_2H           0x000000F3 
709
#define _WDTPS_1_2H           0x000000F1 
710
 
711
//Configuration Byte 3H Options
712
#define _CCP2MX_ON_3H         0x000000FF // CCP2 pin Mux enable
713
#define _CCP2MX_OFF_3H        0x000000FE 
714
 
715
//Configuration Byte 4L Options
716
#define _STVR_ON_4L           0x000000FF // Stack over/underflow Reset enable
717
#define _STVR_OFF_4L          0x000000FE 
718
#define _LVP_ON_4L            0x000000FF // Low-voltage ICSP enable
719
#define _LVP_OFF_4L           0x000000FB 
720
#define _DEBUG_ON_4L          0x0000007F // Backgound Debugger enable
721
#define _DEBUG_OFF_4L         0x000000FF 
722
 
723
//Configuration Byte 5L Options
724
#define _CP0_ON_5L            0x000000FE // Code protect user block enable
725
#define _CP0_OFF_5L           0x000000FF 
726
#define _CP1_ON_5L            0x000000FD 
727
#define _CP1_OFF_5L           0x000000FF 
728
#define _CP2_ON_5L            0x000000FB 
729
#define _CP2_OFF_5L           0x000000FF 
730
#define _CP3_ON_5L            0x000000F7 
731
#define _CP3_OFF_5L           0x000000FF 
732
 
733
//Configuration Byte 5H Options
734
#define _CPB_ON_5H            0x000000BF // Code protect boot block enable
735
#define _CPB_OFF_5H           0x000000FF 
736
#define _CPD_ON_5H            0x0000007F // Code protect Data EE enable
737
#define _CPD_OFF_5H           0x000000FF 
738
 
739
//Configuration Byte 6L Options
740
#define _WRT0_ON_6L           0x000000FE // Write protect user block enable
741
#define _WRT0_OFF_6L          0x000000FF 
742
#define _WRT1_ON_6L           0x000000FD 
743
#define _WRT1_OFF_6L          0x000000FF 
744
#define _WRT2_ON_6L           0x000000FB 
745
#define _WRT2_OFF_6L          0x000000FF 
746
#define _WRT3_ON_6L           0x000000F7 
747
#define _WRT3_OFF_6L          0x000000FF 
748
 
749
//Configuration Byte 6H Options
750
#define _WRTC_ON_6H           0x000000DF // Write protect CONFIG regs enable
751
#define _WRTC_OFF_6H          0x000000FF 
752
#define _WRTB_ON_6H           0x000000BF // Write protect boot block enable
753
#define _WRTB_OFF_6H          0x000000FF 
754
#define _WRTD_ON_6H           0x0000007F // Write protect Data EE enable
755
#define _WRTD_OFF_6H          0x000000FF 
756
 
757
//Configuration Byte 7L Options
758
#define _EBTR0_ON_7L          0x000000FE // Table Read protect user block enable
759
#define _EBTR0_OFF_7L         0x000000FF 
760
#define _EBTR1_ON_7L          0x000000FD 
761
#define _EBTR1_OFF_7L         0x000000FF 
762
#define _EBTR2_ON_7L          0x000000FB 
763
#define _EBTR2_OFF_7L         0x000000FF 
764
#define _EBTR3_ON_7L          0x000000F7 
765
#define _EBTR3_OFF_7L         0x000000FF 
766
 
767
//Configuration Byte 7H Options
768
#define _EBTRB_ON_7H          0x000000BF // Table Read protect boot block enable
769
#define _EBTRB_OFF_7H         0x000000FF 
770
 
771
// To use the Configuration Bits, place the following lines in your source code
772
//  in the following format, and change the configuration value to the desired
773
//  setting (such as CP_OFF to CP_ON).  These are currently commented out here
774
//  and each #pragma DATA line should have the preceding semicolon removed when
775
//  pasted into your source code.
776
 
777
//  The following is a assignment of address values for all of the configuration
778
//  registers for the purpose of table reads
779
#define _CONFIG1L             0x00300000 
780
#define _CONFIG1H             0x00300001 
781
#define _CONFIG2L             0x00300002 
782
#define _CONFIG2H             0x00300003 
783
#define _CONFIG3L             0x00300004 
784
#define _CONFIG3H             0x00300005 
785
#define _CONFIG4L             0x00300006 
786
#define _CONFIG4H             0x00300007 
787
#define _CONFIG5L             0x00300008 
788
#define _CONFIG5H             0x00300009 
789
#define _CONFIG6L             0x0030000A 
790
#define _CONFIG6H             0x0030000B 
791
#define _CONFIG7L             0x0030000C 
792
#define _CONFIG7H             0x0030000D 
793
#define _DEVID1               0x003FFFFE 
794
#define _DEVID2               0x003FFFFF 
795
#define _IDLOC0               0x00200000 
796
#define _IDLOC1               0x00200001 
797
#define _IDLOC2               0x00200002 
798
#define _IDLOC3               0x00200003 
799
#define _IDLOC4               0x00200004 
800
#define _IDLOC5               0x00200005 
801
#define _IDLOC6               0x00200006 
802
#define _IDLOC7               0x00200007 
803
 
804
//Program Configuration Register 1H
805
//              #pragma DATA    _CONFIG1H, _OSCS_OFF_1H & _RCIO_OSC_1H
806
 
807
//Program Configuration Register 2L
808
//              #pragma DATA    _CONFIG2L, _BOR_ON_2L & _BORV_20_2L & _PWRT_OFF_2L
809
 
810
//Program Configuration Register 2H
811
//              #pragma DATA    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
812
 
813
//Program Configuration Register 3H
814
//              #pragma DATA    _CONFIG3H, _CCP2MX_ON_3H
815
 
816
//Program Configuration Register 4L
817
//              #pragma DATA    _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
818
 
819
//Program Configuration Register 5L
820
//              #pragma DATA    _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
821
 
822
//Program Configuration Register 5H
823
//              #pragma DATA    _CONFIG5H, _CPB_ON_5H & _CPD_OFF_5H
824
 
825
//Program Configuration Register 6L
826
//              #pragma DATA    _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
827
 
828
//Program Configuration Register 6H
829
//              #pragma DATA    _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
830
 
831
//Program Configuration Register 7L
832
//              #pragma DATA    _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
833
 
834
//Program Configuration Register 7H
835
//              #pragma DATA    _CONFIG7H, _EBTRB_OFF_7H
836
 
837
//ID Locations Register 0
838
//              pragma DATA    _IDLOC0, <expression>
839
 
840
//ID Locations Register 1
841
//              pragma DATA    _IDLOC1, <expression>
842
 
843
//ID Locations Register 2
844
//              pragma DATA    _IDLOC2, <expression>
845
 
846
//ID Locations Register 3
847
//              pragma DATA    _IDLOC3, <expression>
848
 
849
//ID Locations Register 4
850
//              pragma DATA    _IDLOC4, <expression>
851
 
852
//ID Locations Register 5
853
//              pragma DATA    _IDLOC5, <expression>
854
 
855
//ID Locations Register 6
856
//              pragma DATA    _IDLOC6, <expression>
857
 
858
//ID Locations Register 7
859
//              pragma DATA    _IDLOC7, <expression>
860
 
861
//Device ID registers hold device ID and revision number and can only be read
862
//Device ID Register 1
863
//               DEV2, DEV1, DEV0, REV4, REV3, REV2, REV1, REV0
864
//Device ID Register 2
865
//               DEV10, DEV9, DEV8, DEV7, DEV6, DEV5, DEV4, DEV3
866
 
867
////////////////////////////////////////////////
868
// registers define with @ for direct access
869
////////////////////////////////////////////////
870
volatile char porta                  @PORTA;
871
volatile char portb                  @PORTB;
872
volatile char portc                  @PORTC;
873
volatile char portd                  @PORTD;
874
volatile char porte                  @PORTE;
875
volatile char lata                   @LATA;
876
volatile char latb                   @LATB;
877
volatile char latc                   @LATC;
878
volatile char latd                   @LATD;
879
volatile char late                   @LATE;
880
volatile char trisa                  @TRISA;
881
volatile char trisb                  @TRISB;
882
volatile char trisc                  @TRISC;
883
volatile char trisd                  @TRISD;
884
volatile char trise                  @TRISE;
885
volatile char pie1                   @PIE1;
886
volatile char pir1                   @PIR1;
887
volatile char ipr1                   @IPR1;
888
volatile char pie2                   @PIE2;
889
volatile char pir2                   @PIR2;
890
volatile char ipr2                   @IPR2;
891
volatile char eecon1                 @EECON1;
892
volatile char eecon2                 @EECON2;
893
volatile char eedata                 @EEDATA;
894
volatile char eeadr                  @EEADR;
895
volatile char rcsta                  @RCSTA;
896
volatile char txsta                  @TXSTA;
897
volatile char txreg                  @TXREG;
898
volatile char rcreg                  @RCREG;
899
volatile char spbrg                  @SPBRG;
900
volatile char t3con                  @T3CON;
901
volatile char tmr3l                  @TMR3L;
902
volatile char tmr3h                  @TMR3H;
903
volatile char ccp2con                @CCP2CON;
904
volatile char ccpr2l                 @CCPR2L;
905
volatile char ccpr2h                 @CCPR2H;
906
volatile char ccp1con                @CCP1CON;
907
volatile char ccpr1l                 @CCPR1L;
908
volatile char ccpr1h                 @CCPR1H;
909
volatile char adcon1                 @ADCON1;
910
volatile char adcon0                 @ADCON0;
911
volatile char adresl                 @ADRESL;
912
volatile char adresh                 @ADRESH;
913
volatile char sspcon2                @SSPCON2;
914
volatile char sspcon1                @SSPCON1;
915
volatile char sspstat                @SSPSTAT;
916
volatile char sspadd                 @SSPADD;
917
volatile char sspbuf                 @SSPBUF;
918
volatile char t2con                  @T2CON;
919
volatile char pr2                    @PR2;
920
volatile char tmr2                   @TMR2;
921
volatile char t1con                  @T1CON;
922
volatile char tmr1l                  @TMR1L;
923
volatile char tmr1h                  @TMR1H;
924
volatile char rcon                   @RCON;
925
volatile char wdtcon                 @WDTCON;
926
volatile char lvdcon                 @LVDCON;
927
volatile char osccon                 @OSCCON;
928
volatile char t0con                  @T0CON;
929
volatile char tmr0l                  @TMR0L;
930
volatile char tmr0h                  @TMR0H;
931
volatile char status                 @STATUS;
932
volatile char fsr2l                  @FSR2L;
933
volatile char fsr2h                  @FSR2H;
934
volatile char plusw2                 @PLUSW2;
935
volatile char preinc2                @PREINC2;
936
volatile char postdec2               @POSTDEC2;
937
volatile char postinc2               @POSTINC2;
938
volatile char indf2                  @INDF2;
939
volatile char bsr                    @BSR;
940
volatile char fsr1l                  @FSR1L;
941
volatile char fsr1h                  @FSR1H;
942
volatile char plusw1                 @PLUSW1;
943
volatile char preinc1                @PREINC1;
944
volatile char postdec1               @POSTDEC1;
945
volatile char postinc1               @POSTINC1;
946
volatile char indf1                  @INDF1;
947
volatile char wreg                   @WREG;
948
volatile char fsr0l                  @FSR0L;
949
volatile char fsr0h                  @FSR0H;
950
volatile char plusw0                 @PLUSW0;
951
volatile char preinc0                @PREINC0;
952
volatile char postdec0               @POSTDEC0;
953
volatile char postinc0               @POSTINC0;
954
volatile char indf0                  @INDF0;
955
volatile char intcon3                @INTCON3;
956
volatile char intcon2                @INTCON2;
957
volatile char intcon                 @INTCON;
958
volatile char prodl                  @PRODL;
959
volatile char prodh                  @PRODH;
960
volatile char tablat                 @TABLAT;
961
volatile char tblptrl                @TBLPTRL;
962
volatile char tblptrh                @TBLPTRH;
963
volatile char tblptru                @TBLPTRU;
964
volatile char pcl                    @PCL;
965
volatile char pclath                 @PCLATH;
966
volatile char pclatu                 @PCLATU;
967
volatile char stkptr                 @STKPTR;
968
volatile char tosl                   @TOSL;
969
volatile char tosh                   @TOSH;
970
volatile char tosu                   @TOSU;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.