1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
|
/*
* This declarations of the PIC16C433 MCU.
*
* This file is part of the GNU PIC library for SDCC, originally
* created by Molnar Karoly <molnarkaroly@users.sf.net> 2016.
*
* This file is generated automatically by the cinc2h.pl, 2016-04-13 17:23:02 UTC.
*
* SDCC is licensed under the GNU Public license (GPL) v2. Note that
* this license covers the code to the compiler and other executables,
* but explicitly does not cover any code or objects generated by sdcc.
*
* For pic device libraries and header files which are derived from
* Microchip header (.inc) and linker script (.lkr) files Microchip
* requires that "The header files should state that they are only to be
* used with authentic Microchip devices" which makes them incompatible
* with the GPL. Pic device libraries and header files are located at
* non-free/lib and non-free/include directories respectively.
* Sdcc should be run with the --use-non-free command line option in
* order to include non-free header files and libraries.
*
* See http://sdcc.sourceforge.net/ for the latest information on sdcc.
*/
#ifndef __PIC16C433_H__
#define __PIC16C433_H__
//==============================================================================
//
// Register Addresses
//
//==============================================================================
#ifndef NO_ADDR_DEFINES
#define INDF_ADDR 0x0000
#define TMR0_ADDR 0x0001
#define PCL_ADDR 0x0002
#define STATUS_ADDR 0x0003
#define FSR_ADDR 0x0004
#define GPIO_ADDR 0x0005
#define PCLATH_ADDR 0x000A
#define INTCON_ADDR 0x000B
#define PIR1_ADDR 0x000C
#define ADRES_ADDR 0x001E
#define ADCON0_ADDR 0x001F
#define OPTION_REG_ADDR 0x0081
#define TRISIO_ADDR 0x0085
#define PIE1_ADDR 0x008C
#define PCON_ADDR 0x008E
#define OSCCAL_ADDR 0x008F
#define ADCON1_ADDR 0x009F
#endif // #ifndef NO_ADDR_DEFINES
//==============================================================================
//
// Register Definitions
//
//==============================================================================
//==============================================================================
// TRIS Bits
#define _TRIS0 0x01
#define _TRIS1 0x02
#define _TRIS2 0x04
#define _TRIS3 0x08
#define _TRIS4 0x10
#define _TRIS5 0x20
//==============================================================================
extern __at(0x0000) __sfr INDF;
extern __at(0x0001) __sfr TMR0;
extern __at(0x0002) __sfr PCL;
//==============================================================================
// STATUS Bits
extern __at(0x0003) __sfr STATUS;
typedef union
{
struct
{
unsigned C : 1;
unsigned DC : 1;
unsigned Z : 1;
unsigned NOT_PD : 1;
unsigned NOT_TO : 1;
unsigned RP0 : 1;
unsigned RP1 : 1;
unsigned IRP : 1;
};
struct
{
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned LINRX : 1;
unsigned LINTX : 1;
};
struct
{
unsigned : 5;
unsigned RP : 2;
unsigned : 1;
};
} __STATUSbits_t;
extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
#define _STATUS_C 0x01
#define _STATUS_DC 0x02
#define _STATUS_Z 0x04
#define _STATUS_NOT_PD 0x08
#define _STATUS_NOT_TO 0x10
#define _STATUS_RP0 0x20
#define _STATUS_RP1 0x40
#define _STATUS_LINRX 0x40
#define _STATUS_IRP 0x80
#define _STATUS_LINTX 0x80
//==============================================================================
extern __at(0x0004) __sfr FSR;
//==============================================================================
// GPIO Bits
extern __at(0x0005) __sfr GPIO;
typedef union
{
struct
{
unsigned GP0 : 1;
unsigned GP1 : 1;
unsigned GP2 : 1;
unsigned GP3 : 1;
unsigned GP4 : 1;
unsigned GP5 : 1;
unsigned LINRX : 1;
unsigned LINTX : 1;
};
struct
{
unsigned GP : 6;
unsigned : 2;
};
} __GPIObits_t;
extern __at(0x0005) volatile __GPIObits_t GPIObits;
#define _GP0 0x01
#define _GP1 0x02
#define _GP2 0x04
#define _GP3 0x08
#define _GP4 0x10
#define _GP5 0x20
#define _LINRX 0x40
#define _LINTX 0x80
//==============================================================================
extern __at(0x000A) __sfr PCLATH;
//==============================================================================
// INTCON Bits
extern __at(0x000B) __sfr INTCON;
typedef union
{
struct
{
unsigned GPIF : 1;
unsigned INTF : 1;
unsigned T0IF : 1;
unsigned GPIE : 1;
unsigned INTE : 1;
unsigned T0IE : 1;
unsigned PEIE : 1;
unsigned GIE : 1;
};
struct
{
unsigned : 1;
unsigned : 1;
unsigned TMR0IF : 1;
unsigned : 1;
unsigned : 1;
unsigned TMR0IE : 1;
unsigned : 1;
unsigned : 1;
};
} __INTCONbits_t;
extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
#define _GPIF 0x01
#define _INTF 0x02
#define _T0IF 0x04
#define _TMR0IF 0x04
#define _GPIE 0x08
#define _INTE 0x10
#define _T0IE 0x20
#define _TMR0IE 0x20
#define _PEIE 0x40
#define _GIE 0x80
//==============================================================================
//==============================================================================
// PIR1 Bits
extern __at(0x000C) __sfr PIR1;
typedef struct
{
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned ADIF : 1;
unsigned : 1;
} __PIR1bits_t;
extern __at(0x000C) volatile __PIR1bits_t PIR1bits;
#define _ADIF 0x40
//==============================================================================
extern __at(0x001E) __sfr ADRES;
//==============================================================================
// ADCON0 Bits
extern __at(0x001F) __sfr ADCON0;
typedef union
{
struct
{
unsigned ADON : 1;
unsigned : 1;
unsigned GO_NOT_DONE : 1;
unsigned CHS0 : 1;
unsigned CHS1 : 1;
unsigned : 1;
unsigned ADCS0 : 1;
unsigned ADCS1 : 1;
};
struct
{
unsigned : 1;
unsigned : 1;
unsigned GO : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
};
struct
{
unsigned : 1;
unsigned : 1;
unsigned NOT_DONE : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
};
struct
{
unsigned : 1;
unsigned : 1;
unsigned GO_DONE : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
};
struct
{
unsigned : 3;
unsigned CHS : 2;
unsigned : 3;
};
struct
{
unsigned : 6;
unsigned ADCS : 2;
};
} __ADCON0bits_t;
extern __at(0x001F) volatile __ADCON0bits_t ADCON0bits;
#define _ADON 0x01
#define _GO_NOT_DONE 0x04
#define _GO 0x04
#define _NOT_DONE 0x04
#define _GO_DONE 0x04
#define _CHS0 0x08
#define _CHS1 0x10
#define _ADCS0 0x40
#define _ADCS1 0x80
//==============================================================================
//==============================================================================
// OPTION_REG Bits
extern __at(0x0081) __sfr OPTION_REG;
typedef union
{
struct
{
unsigned PS0 : 1;
unsigned PS1 : 1;
unsigned PS2 : 1;
unsigned PSA : 1;
unsigned T0SE : 1;
unsigned T0CS : 1;
unsigned INTEDG : 1;
unsigned NOT_GPPU : 1;
};
struct
{
unsigned PS : 3;
unsigned : 5;
};
} __OPTION_REGbits_t;
extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
#define _PS0 0x01
#define _PS1 0x02
#define _PS2 0x04
#define _PSA 0x08
#define _T0SE 0x10
#define _T0CS 0x20
#define _INTEDG 0x40
#define _NOT_GPPU 0x80
//==============================================================================
//==============================================================================
// TRISIO Bits
extern __at(0x0085) __sfr TRISIO;
typedef union
{
struct
{
unsigned TRIS0 : 1;
unsigned TRIS1 : 1;
unsigned TRIS2 : 1;
unsigned TRIS3 : 1;
unsigned TRIS4 : 1;
unsigned TRIS5 : 1;
unsigned : 1;
unsigned : 1;
};
struct
{
unsigned TRIS : 6;
unsigned : 2;
};
} __TRISIObits_t;
extern __at(0x0085) volatile __TRISIObits_t TRISIObits;
#define _TRISIO_TRIS0 0x01
#define _TRISIO_TRIS1 0x02
#define _TRISIO_TRIS2 0x04
#define _TRISIO_TRIS3 0x08
#define _TRISIO_TRIS4 0x10
#define _TRISIO_TRIS5 0x20
//==============================================================================
//==============================================================================
// PIE1 Bits
extern __at(0x008C) __sfr PIE1;
typedef struct
{
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned ADIE : 1;
unsigned : 1;
} __PIE1bits_t;
extern __at(0x008C) volatile __PIE1bits_t PIE1bits;
#define _ADIE 0x40
//==============================================================================
//==============================================================================
// PCON Bits
extern __at(0x008E) __sfr PCON;
typedef struct
{
unsigned : 1;
unsigned NOT_POR : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
} __PCONbits_t;
extern __at(0x008E) volatile __PCONbits_t PCONbits;
#define _NOT_POR 0x02
//==============================================================================
//==============================================================================
// OSCCAL Bits
extern __at(0x008F) __sfr OSCCAL;
typedef union
{
struct
{
unsigned : 1;
unsigned : 1;
unsigned CALSLW : 1;
unsigned CALFST : 1;
unsigned CAL0 : 1;
unsigned CAL1 : 1;
unsigned CAL2 : 1;
unsigned CAL3 : 1;
};
struct
{
unsigned : 4;
unsigned CAL : 4;
};
} __OSCCALbits_t;
extern __at(0x008F) volatile __OSCCALbits_t OSCCALbits;
#define _CALSLW 0x04
#define _CALFST 0x08
#define _CAL0 0x10
#define _CAL1 0x20
#define _CAL2 0x40
#define _CAL3 0x80
//==============================================================================
//==============================================================================
// ADCON1 Bits
extern __at(0x009F) __sfr ADCON1;
typedef union
{
struct
{
unsigned PCFG0 : 1;
unsigned PCFG1 : 1;
unsigned PCFG2 : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
unsigned : 1;
};
struct
{
unsigned PCFG : 3;
unsigned : 5;
};
} __ADCON1bits_t;
extern __at(0x009F) volatile __ADCON1bits_t ADCON1bits;
#define _PCFG0 0x01
#define _PCFG1 0x02
#define _PCFG2 0x04
//==============================================================================
//==============================================================================
//
// Configuration Bits
//
//==============================================================================
#define _CONFIG1 0x2007
//----------------------------- CONFIG1 Options -------------------------------
#define _FOSC_LP 0x3FF8 // LP oscillator.
#define _LP_OSC 0x3FF8 // LP oscillator.
#define _FOSC_XT 0x3FF9 // XT oscillator.
#define _XT_OSC 0x3FF9 // XT oscillator.
#define _FOSC_HS 0x3FFA // HS oscillator.
#define _HS_OSC 0x3FFA // HS oscillator.
#define _FOSC_EXTCLK 0x3FFB // EC I/O.
#define _EXTCLK_OSC 0x3FFB // EC I/O.
#define _FOSC_INTRCIO 0x3FFC // INTRC, OSC2 is I/O.
#define _INTRC_OSC_NOCLKOUT 0x3FFC // INTRC, OSC2 is I/O.
#define _INTRC_OSC 0x3FFC // INTRC, OSC2 is I/O.
#define _FOSC_INTRCCLK 0x3FFD // INTRC, clockout on OSC2.
#define _INTRC_OSC_CLKOUT 0x3FFD // INTRC, clockout on OSC2.
#define _FOSC_EXTRCIO 0x3FFE // EXTRC, OSC2 is I/O.
#define _EXTRC_OSC_NOCLKOUT 0x3FFE // EXTRC, OSC2 is I/O.
#define _EXTRC_OSC 0x3FFE // EXTRC, OSC2 is I/O.
#define _FOSC_EXTRCCLK 0x3FFF // EXTRC, clockout on OSC2.
#define _EXTRC_OSC_CLKOUT 0x3FFF // EXTRC, clockout on OSC2.
#define _WDTE_OFF 0x3FF7 // WDT disabled.
#define _WDT_OFF 0x3FF7 // WDT disabled.
#define _WDTE_ON 0x3FFF // WDT enabled.
#define _WDT_ON 0x3FFF // WDT enabled.
#define _PWRTE_ON 0x3FEF // PWRT enabled.
#define _PWRTE_OFF 0x3FFF // PWRT disabled.
#define _CP_ALL 0x009F // All memory is code protected.
#define _CP_75 0x15BF // 0200h-07FEh code protected.
#define _CP_50 0x2ADF // 0400h-07FEh code protected.
#define _CP_OFF 0x3FFF // Code protection off.
#define _MCLRE_OFF 0x3F7F // Internal.
#define _MCLRE_ON 0x3FFF // External.
//==============================================================================
#define _IDLOC0 0x2000
#define _IDLOC1 0x2001
#define _IDLOC2 0x2002
#define _IDLOC3 0x2003
//==============================================================================
#ifndef NO_BIT_DEFINES
#define ADON ADCON0bits.ADON // bit 0
#define GO_NOT_DONE ADCON0bits.GO_NOT_DONE // bit 2, shadows bit in ADCON0bits
#define GO ADCON0bits.GO // bit 2, shadows bit in ADCON0bits
#define NOT_DONE ADCON0bits.NOT_DONE // bit 2, shadows bit in ADCON0bits
#define GO_DONE ADCON0bits.GO_DONE // bit 2, shadows bit in ADCON0bits
#define CHS0 ADCON0bits.CHS0 // bit 3
#define CHS1 ADCON0bits.CHS1 // bit 4
#define ADCS0 ADCON0bits.ADCS0 // bit 6
#define ADCS1 ADCON0bits.ADCS1 // bit 7
#define PCFG0 ADCON1bits.PCFG0 // bit 0
#define PCFG1 ADCON1bits.PCFG1 // bit 1
#define PCFG2 ADCON1bits.PCFG2 // bit 2
#define GP0 GPIObits.GP0 // bit 0
#define GP1 GPIObits.GP1 // bit 1
#define GP2 GPIObits.GP2 // bit 2
#define GP3 GPIObits.GP3 // bit 3
#define GP4 GPIObits.GP4 // bit 4
#define GP5 GPIObits.GP5 // bit 5
#define LINRX GPIObits.LINRX // bit 6
#define LINTX GPIObits.LINTX // bit 7
#define GPIF INTCONbits.GPIF // bit 0
#define INTF INTCONbits.INTF // bit 1
#define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
#define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
#define GPIE INTCONbits.GPIE // bit 3
#define INTE INTCONbits.INTE // bit 4
#define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
#define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
#define PEIE INTCONbits.PEIE // bit 6
#define GIE INTCONbits.GIE // bit 7
#define PS0 OPTION_REGbits.PS0 // bit 0
#define PS1 OPTION_REGbits.PS1 // bit 1
#define PS2 OPTION_REGbits.PS2 // bit 2
#define PSA OPTION_REGbits.PSA // bit 3
#define T0SE OPTION_REGbits.T0SE // bit 4
#define T0CS OPTION_REGbits.T0CS // bit 5
#define INTEDG OPTION_REGbits.INTEDG // bit 6
#define NOT_GPPU OPTION_REGbits.NOT_GPPU // bit 7
#define CALSLW OSCCALbits.CALSLW // bit 2
#define CALFST OSCCALbits.CALFST // bit 3
#define CAL0 OSCCALbits.CAL0 // bit 4
#define CAL1 OSCCALbits.CAL1 // bit 5
#define CAL2 OSCCALbits.CAL2 // bit 6
#define CAL3 OSCCALbits.CAL3 // bit 7
#define NOT_POR PCONbits.NOT_POR // bit 1
#define ADIE PIE1bits.ADIE // bit 6
#define ADIF PIR1bits.ADIF // bit 6
#define TRIS0 TRISbits.TRIS0 // bit 0
#define TRIS1 TRISbits.TRIS1 // bit 1
#define TRIS2 TRISbits.TRIS2 // bit 2
#define TRIS3 TRISbits.TRIS3 // bit 3
#define TRIS4 TRISbits.TRIS4 // bit 4
#define TRIS5 TRISbits.TRIS5 // bit 5
#endif // #ifndef NO_BIT_DEFINES
#endif // #ifndef __PIC16C433_H__
|