2 * This declarations of the PIC16C558 MCU.
4 * This file is part of the GNU PIC library for SDCC, originally
5 * created by Molnar Karoly <molnarkaroly@users.sf.net> 2016.
7 * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:23:02 UTC.
9 * SDCC is licensed under the GNU Public license (GPL) v2. Note that
10 * this license covers the code to the compiler and other executables,
11 * but explicitly does not cover any code or objects generated by sdcc.
13 * For pic device libraries and header files which are derived from
14 * Microchip header (.inc) and linker script (.lkr) files Microchip
15 * requires that "The header files should state that they are only to be
16 * used with authentic Microchip devices" which makes them incompatible
17 * with the GPL. Pic device libraries and header files are located at
18 * non-free/lib and non-free/include directories respectively.
19 * Sdcc should be run with the --use-non-free command line option in
20 * order to include non-free header files and libraries.
22 * See http://sdcc.sourceforge.net/ for the latest information on sdcc.
25 #ifndef __PIC16C558_H__
26 #define __PIC16C558_H__
28 //==============================================================================
32 //==============================================================================
34 #ifndef NO_ADDR_DEFINES
36 #define INDF_ADDR 0x0000
37 #define TMR0_ADDR 0x0001
38 #define PCL_ADDR 0x0002
39 #define STATUS_ADDR 0x0003
40 #define FSR_ADDR 0x0004
41 #define PORTA_ADDR 0x0005
42 #define PORTB_ADDR 0x0006
43 #define PCLATH_ADDR 0x000A
44 #define INTCON_ADDR 0x000B
45 #define OPTION_REG_ADDR 0x0081
46 #define TRISA_ADDR 0x0085
47 #define TRISB_ADDR 0x0086
48 #define PCON_ADDR 0x008E
50 #endif // #ifndef NO_ADDR_DEFINES
52 //==============================================================================
54 // Register Definitions
56 //==============================================================================
58 extern __at(0x0000) __sfr INDF
;
59 extern __at(0x0001) __sfr TMR0
;
60 extern __at(0x0002) __sfr PCL
;
62 //==============================================================================
65 extern __at(0x0003) __sfr STATUS
;
89 extern __at(0x0003) volatile __STATUSbits_t STATUSbits
;
100 //==============================================================================
102 extern __at(0x0004) __sfr FSR
;
104 //==============================================================================
107 extern __at(0x0005) __sfr PORTA
;
130 extern __at(0x0005) volatile __PORTAbits_t PORTAbits
;
138 //==============================================================================
141 //==============================================================================
144 extern __at(0x0006) __sfr PORTB
;
158 extern __at(0x0006) volatile __PORTBbits_t PORTBbits
;
169 //==============================================================================
171 extern __at(0x000A) __sfr PCLATH
;
173 //==============================================================================
176 extern __at(0x000B) __sfr INTCON
;
205 extern __at(0x000B) volatile __INTCONbits_t INTCONbits
;
217 //==============================================================================
220 //==============================================================================
223 extern __at(0x0081) __sfr OPTION_REG
;
236 unsigned NOT_RBPU
: 1;
244 } __OPTION_REGbits_t
;
246 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits
;
255 #define _NOT_RBPU 0x80
257 //==============================================================================
260 //==============================================================================
263 extern __at(0x0085) __sfr TRISA
;
286 extern __at(0x0085) volatile __TRISAbits_t TRISAbits
;
294 //==============================================================================
297 //==============================================================================
300 extern __at(0x0086) __sfr TRISB
;
314 extern __at(0x0086) volatile __TRISBbits_t TRISBbits
;
325 //==============================================================================
328 //==============================================================================
331 extern __at(0x008E) __sfr PCON
;
336 unsigned NOT_POR
: 1;
345 extern __at(0x008E) volatile __PCONbits_t PCONbits
;
347 #define _NOT_POR 0x02
349 //==============================================================================
352 //==============================================================================
354 // Configuration Bits
356 //==============================================================================
358 #define _CONFIG1 0x2007
360 //----------------------------- CONFIG1 Options -------------------------------
362 #define _FOSC_LP 0x3FFC // LP oscillator.
363 #define _LP_OSC 0x3FFC // LP oscillator.
364 #define _FOSC_XT 0x3FFD // XT oscillator.
365 #define _XT_OSC 0x3FFD // XT oscillator.
366 #define _FOSC_HS 0x3FFE // HS oscillator.
367 #define _HS_OSC 0x3FFE // HS oscillator.
368 #define _FOSC_RC 0x3FFF // RC oscillator.
369 #define _RC_OSC 0x3FFF // RC oscillator.
370 #define _WDTE_OFF 0x3FFB // WDT disabled.
371 #define _WDT_OFF 0x3FFB // WDT disabled.
372 #define _WDTE_ON 0x3FFF // WDT enabled.
373 #define _WDT_ON 0x3FFF // WDT enabled.
374 #define _PWRTE_ON 0x3FF7 // PWRT enabled.
375 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
376 #define _CP_ALL 0x00CF // 000h:7FFh code protected.
377 #define _CP_75 0x15DF // 0200h-07FFh code protected.
378 #define _CP_50 0x2AEF // 0400h-07FFh code protected.
379 #define _CP_OFF 0x3FFF // Program Memory code protection off.
381 //==============================================================================
383 #define _IDLOC0 0x2000
384 #define _IDLOC1 0x2001
385 #define _IDLOC2 0x2002
386 #define _IDLOC3 0x2003
388 //==============================================================================
390 #ifndef NO_BIT_DEFINES
392 #define RBIF INTCONbits.RBIF // bit 0
393 #define INTF INTCONbits.INTF // bit 1
394 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
395 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
396 #define RBIE INTCONbits.RBIE // bit 3
397 #define INTE INTCONbits.INTE // bit 4
398 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
399 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
400 #define GIE INTCONbits.GIE // bit 7
402 #define PS0 OPTION_REGbits.PS0 // bit 0
403 #define PS1 OPTION_REGbits.PS1 // bit 1
404 #define PS2 OPTION_REGbits.PS2 // bit 2
405 #define PSA OPTION_REGbits.PSA // bit 3
406 #define T0SE OPTION_REGbits.T0SE // bit 4
407 #define T0CS OPTION_REGbits.T0CS // bit 5
408 #define INTEDG OPTION_REGbits.INTEDG // bit 6
409 #define NOT_RBPU OPTION_REGbits.NOT_RBPU // bit 7
411 #define NOT_POR PCONbits.NOT_POR // bit 1
413 #define RA0 PORTAbits.RA0 // bit 0
414 #define RA1 PORTAbits.RA1 // bit 1
415 #define RA2 PORTAbits.RA2 // bit 2
416 #define RA3 PORTAbits.RA3 // bit 3
417 #define RA4 PORTAbits.RA4 // bit 4
419 #define RB0 PORTBbits.RB0 // bit 0
420 #define RB1 PORTBbits.RB1 // bit 1
421 #define RB2 PORTBbits.RB2 // bit 2
422 #define RB3 PORTBbits.RB3 // bit 3
423 #define RB4 PORTBbits.RB4 // bit 4
424 #define RB5 PORTBbits.RB5 // bit 5
425 #define RB6 PORTBbits.RB6 // bit 6
426 #define RB7 PORTBbits.RB7 // bit 7
428 #define C STATUSbits.C // bit 0
429 #define DC STATUSbits.DC // bit 1
430 #define Z STATUSbits.Z // bit 2
431 #define NOT_PD STATUSbits.NOT_PD // bit 3
432 #define NOT_TO STATUSbits.NOT_TO // bit 4
433 #define RP0 STATUSbits.RP0 // bit 5
434 #define RP1 STATUSbits.RP1 // bit 6
435 #define IRP STATUSbits.IRP // bit 7
437 #define TRISA0 TRISAbits.TRISA0 // bit 0
438 #define TRISA1 TRISAbits.TRISA1 // bit 1
439 #define TRISA2 TRISAbits.TRISA2 // bit 2
440 #define TRISA3 TRISAbits.TRISA3 // bit 3
441 #define TRISA4 TRISAbits.TRISA4 // bit 4
443 #define TRISB0 TRISBbits.TRISB0 // bit 0
444 #define TRISB1 TRISBbits.TRISB1 // bit 1
445 #define TRISB2 TRISBbits.TRISB2 // bit 2
446 #define TRISB3 TRISBbits.TRISB3 // bit 3
447 #define TRISB4 TRISBbits.TRISB4 // bit 4
448 #define TRISB5 TRISBbits.TRISB5 // bit 5
449 #define TRISB6 TRISBbits.TRISB6 // bit 6
450 #define TRISB7 TRISBbits.TRISB7 // bit 7
452 #endif // #ifndef NO_BIT_DEFINES
454 #endif // #ifndef __PIC16C558_H__