CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Complete headers with sfrs defined

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
LytseFlap



Joined: 22 Dec 2004
Posts: 6
Location: Leeuwarden

View user's profile Send private message

Complete headers with sfrs defined
PostPosted: Wed Dec 22, 2004 6:45 am     Reply with quote

Hello,

Does anyone where to get libraries of all the sfr-registers. The regular device headers from CCS do not support writing to (e.g.) RTIF bit or writing a value to PIN _B1 instead of INPUT_LOW(PIN_B1).
At the moment I made my own .sfr file for a pic-controller. This library only defines the registers en bits I want to use. It's a hell of a job to define these registers and bits in a seperate library.

Is there a possability to include the .inc files from microchips MPLAB in a source file?

I need those sf-registers to use some assembley in my codes.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 22, 2004 1:49 pm     Reply with quote

You didn't say what PIC you were using.

This thread contains an SFR header file for the 16F877.
http://www.ccsinfo.com/forum/viewtopic.php?t=296
This one is from Mark:
http://www.ccsinfo.com/forum/viewtopic.php?t=20186

Here is one for the 18F252 from Mark:
http://www.ccsinfo.com/forum/viewtopic.php?t=14755
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

PostPosted: Wed Dec 22, 2004 3:48 pm     Reply with quote

The 252 from mark works for the 452 and 458 too.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Dec 22, 2004 8:53 pm     Reply with quote

Quote:
At the moment I made my own .sfr file for a pic-controller. This library only defines the registers en bits I want to use. It's a hell of a job to define these registers and bits in a seperate library.


That's just being lazy Laughing It is just a little typing Wink
drh



Joined: 12 Jul 2004
Posts: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Thu Dec 23, 2004 8:33 am     Reply with quote

Once I decide on a new processor to use, I write a .DEF file with all of the special function register addresses and bits. I concider this part of the job.
_________________
David
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

PostPosted: Thu Dec 23, 2004 4:56 pm     Reply with quote

Mark,

How do you access DCCPX?

Code:
union {
   struct {
      unsigned char CCP2M0:1;
      unsigned char CCP2M1:1;
      unsigned char CCP2M2:1;
      unsigned char CCP2M3:1;
      unsigned char CCP2Y:1;
      unsigned char CCP2X:1;
   } ;
   struct {
      unsigned char UNUSED0:4;
      unsigned char DC2B0:1;
      unsigned char DC2B1:1;
   } ;
   struct {
      unsigned char UNUSED1:5;
      unsigned char DCCPX:1;
   } ;
} CCP2CONbits ;
LytseFlap



Joined: 22 Dec 2004
Posts: 6
Location: Leeuwarden

View user's profile Send private message

PostPosted: Fri Dec 24, 2004 2:38 am     Reply with quote

PCM programmer wrote:
You didn't say what PIC you were using.

This thread contains an SFR header file for the 16F877.
http://www.ccsinfo.com/forum/viewtopic.php?t=296
This one is from Mark:
http://www.ccsinfo.com/forum/viewtopic.php?t=20186

Here is one for the 18F252 from Mark:
http://www.ccsinfo.com/forum/viewtopic.php?t=14755

That's exact the problem. Thera are some sfr libraries available. I really appreciate the work of other people. I made myself a complete sfr file for a Philips microcontroller and published it.
But what bothers me is that I'm very disapointed in the fact that CCS doesn't make them. You pay 75 dollar for one copy and MPLAB delivers the .inc libraries for free (sorry I'm Dutch ;) ).

At the moment I'm using a PIC16F870 for taking over a wheelchair controller.
chingB



Joined: 29 Dec 2003
Posts: 81

View user's profile Send private message

PostPosted: Sat Dec 25, 2004 8:44 am     Reply with quote

Hi,

I made my own libraries for the PIC18F452 but this one is not yet complete.

anyway, hope this helps.


Code:


/******************************************************************************
* Filename     : PIC18F452-REG.H                                              *
* Purpose      : PIC18F452 Special Function Registers, Structure and Defines  *
* Copyright    :                                                              *
* Version      :                                                              *
* Written by   :                                                              *
* Date Updated :                                                              *
* Users        :                                                              *
******************************************************************************/

#ifndef __PIC18F452_REG_H__
#define __PIC18F452_REG_H__

/******************************************************************************
* PORTA Memory Mapping, Data Structures and Definitions                       *
******************************************************************************/
#define PORTA_BASE      0xF80
#define PORTA           ((unsigned int *) PORTA_BASE)

typedef struct PortAStruct
{
    unsigned int A0  :1;
    unsigned int A1  :1;
    unsigned int A2  :1;
    unsigned int A3  :1;
    unsigned int A4  :1;
    unsigned int A5  :1;
    unsigned int A6  :1;
    unsigned int A7  :1;
} PORTA_STRUCT;

PORTA_STRUCT PortAbits;
#locate PortAbits = PORTA_BASE


/******************************************************************************
* PORTB Memory Mapping, Data Structures and Definitions                       *
******************************************************************************/
#define PORTB_BASE      0xF81
#define PORTB           ((unsigned int *) PORTB_BASE)

typedef struct PortBStruct
{
    unsigned int B0  :1;
    unsigned int B1  :1;
    unsigned int B2  :1;
    unsigned int B3  :1;
    unsigned int B4  :1;
    unsigned int B5  :1;
    unsigned int B6  :1;
    unsigned int B7  :1;
} PORTB_STRUCT;

PORTB_STRUCT PortBbits;
#locate PortBbits = PORTB_BASE


/******************************************************************************
* PORTC Memory Mapping, Data Structures and Definitions                       *
******************************************************************************/
#define PORTC_BASE      0xF82
#define PORTC           ((unsigned int *) PORTC_BASE)

typedef struct PortCStruct
{
    unsigned int C0  :1;
    unsigned int C1  :1;
    unsigned int C2  :1;
    unsigned int C3  :1;
    unsigned int C4  :1;

    unsigned int C5  :1;
    unsigned int C6  :1;
    unsigned int C7  :1;
} PORTC_STRUCT;

PORTC_STRUCT PortCbits;
#locate PortCbits = PORTC_BASE


/******************************************************************************
* PORTD Memory Mapping, Data Structures and Definitions                       *
******************************************************************************/
#define PORTD_BASE      0xF83
#define PORTD           ((unsigned int *) PORTD_BASE)

typedef struct PortDStruct
{
    unsigned int D0  :1;
    unsigned int D1  :1;
    unsigned int D2  :1;
    unsigned int D3  :1;
    unsigned int D4  :1;
    unsigned int D5  :1;
    unsigned int D6  :1;
    unsigned int D7  :1;
} PORTD_STRUCT;

PORTD_STRUCT PortDbits;
#locate PortDbits = PORTD_BASE


/******************************************************************************
* PORTE Memory Mapping, Data Structures and Definitions                       *
******************************************************************************/
#define PORTE_BASE      0xF84
#define PORTE           ((unsigned int *) PORTE_BASE)

typedef struct PortEStruct
{
    unsigned int E0     :1;
    unsigned int E1     :1;
    unsigned int E2     :1;
    unsigned int Dummy3 :1;
    unsigned int Dummy4 :1;
    unsigned int Dummy5 :1;
    unsigned int Dummy6 :1;
    unsigned int Dummy7 :1;
} PORTE_STRUCT;

PORTE_STRUCT PortEbits;
#locate PortEbits = PORTE_BASE


/******************************************************************************
* TRISA Memory Mapping, Data Structures and Definitions                       *
******************************************************************************/
#define TRISA_BASE      0xF92
#define TRISA           ((unsigned int *) TRISA_BASE)

typedef struct TrisAStruct
{
    unsigned int TrisA0 :1;
    unsigned int TrisA1 :1;
    unsigned int TrisA2 :1;
    unsigned int TrisA3 :1;
    unsigned int TrisA4 :1;
    unsigned int TrisA5 :1;
    unsigned int TrisA6 :1;
    unsigned int Dummy7 :1;
} TRISA_STRUCT;

TRISA_STRUCT TrisAbits;
#locate TrisAbits = TRISA_BASE


/******************************************************************************
* TRISB Memory Mapping, Data Structures and Definitions                       *
******************************************************************************/
#define TRISB_BASE      0xF93
#define TRISB           ((unsigned int *) TRISB_BASE)

typedef struct TrisBStruct
{
    unsigned int TrisB0 :1;
    unsigned int TrisB1 :1;
    unsigned int TrisB2 :1;
    unsigned int TrisB3 :1;
    unsigned int TrisB4 :1;
    unsigned int TrisB5 :1;
    unsigned int TrisB6 :1;
    unsigned int TrisB7 :1;
} TRISB_STRUCT;

TRISB_STRUCT TrisBbits;
#locate TrisBbits = TRISB_BASE


/******************************************************************************
* TRISC Memory Mapping, Data Structures and Definitions                       *
******************************************************************************/
#define TRISC_BASE      0xF94
#define TRISC           ((unsigned int *) TRISC_BASE)

typedef struct TrisCStruct
{
    unsigned int TrisC0 :1;
    unsigned int TrisC1 :1;
    unsigned int TrisC2 :1;
    unsigned int TrisC3 :1;
    unsigned int TrisC4 :1;
    unsigned int TrisC5 :1;
    unsigned int TrisC6 :1;
    unsigned int TrisC7 :1;
} TRISC_STRUCT;

TRISC_STRUCT TrisCbits;
#locate TrisCbits = TRISC_BASE


/******************************************************************************
* TRISD Memory Mapping, Data Structures and Definitions                       *
******************************************************************************/
#define TRISD_BASE      0xF95
#define TRISD           ((unsigned int *) TRISD_BASE)

typedef struct TrisDStruct
{
    unsigned int TrisD0 :1;
    unsigned int TrisD1 :1;
    unsigned int TrisD2 :1;
    unsigned int TrisD3 :1;
    unsigned int TrisD4 :1;
    unsigned int TrisD5 :1;
    unsigned int TrisD6 :1;
    unsigned int TrisD7 :1;
} TRISD_STRUCT;

TRISD_STRUCT TrisDbits;
#locate TrisDbits = TRISD_BASE


/******************************************************************************
* TRISE Memory Mapping, Data Structures and Definitions                       *
******************************************************************************/
#define TRISE_BASE      0xF96
#define TRISE           ((unsigned int *) TRISE_BASE)

typedef struct TrisEStruct
{
    unsigned int TrisE0  :1;
    unsigned int TrisE1  :1;
    unsigned int TrisE2  :1;
    unsigned int Dummy3  :1;
    unsigned int PSPMODE :1;
    unsigned int IBOV    :1;
    unsigned int OBF     :1;
    unsigned int IBF     :1;
} TRISE_STRUCT;

TRISE_STRUCT TrisEbits;
#locate TrisEbits = TRISE_BASE


/******************************************************************************
* EECON1 Memory Mapping, Data Structures and Definitions                      *
******************************************************************************/
#define EECON1_BASE     0xFA6
#define EECON1          ((unsigned int *) EECON1_BASE)

typedef struct Eecon1Struct
{
    unsigned int RD      :1;
    unsigned int WR      :1;
    unsigned int WREN    :1;
    unsigned int WRERR   :1;
    unsigned int FREE    :1;
    unsigned int Dummy5  :1;
    unsigned int CFGS    :1;
    unsigned int EEPGD   :1;
} EECON1_STRUCT;

EECON1_STRUCT Eecon1bits;
#locate Eecon1bits = EECON1_BASE


/******************************************************************************
* EECON2 Memory Mapping                                                       *
******************************************************************************/
#define EECON2_BASE     0xFA7
#define EECON2          ((unsigned int *) EECON2_BASE)


/******************************************************************************
* EEDATA Memory Mapping                                                       *
******************************************************************************/
#define EEDATA_BASE     0xFA8
#define EEDATA          ((unsigned int *) EEDATA_BASE)


/******************************************************************************
* EEADR Memory Mapping                                                        *
******************************************************************************/
#define EEADR_BASE      0xFA9
#define EEADR           ((unsigned int *) EEADR_BASE)


/******************************************************************************
* TXREG Memory Mapping                                                        *
******************************************************************************/
#define TXREG_BASE      0xFAD
#define TXREG           ((unsigned int *) TXREG_BASE)


/******************************************************************************
* RCREG Memory Mapping                                                        *
******************************************************************************/
#define RCREG_BASE      0xFAE
#define RCREG           ((unsigned int *) RCREG_BASE)


/******************************************************************************
* INTCON3 Memory Mapping, Data Structures and Definitions                     *
******************************************************************************/
#define INTCON3_BASE    0xFF0
#define INTCON3         ((unsigned int *) INTCON3_BASE)

typedef struct Intcon3Struct
{
    unsigned int INT1IF  :1;
    unsigned int INT2IF  :1;
    unsigned int Dummy2  :1;
    unsigned int INT1IE  :1;
    unsigned int INT2IE  :1;
    unsigned int Dummy5  :1;
    unsigned int INT1IP  :1;
    unsigned int INT2IP  :1;
} INTCON3_STRUCT;

INTCON3_STRUCT Intcon3bits;
#locate Intcon3bits = INTCON3_BASE


/******************************************************************************
* INTCON2 Memory Mapping, Data Structures and Definitions                     *
******************************************************************************/
#define INTCON2_BASE    0xFF1
#define INTCON2         ((unsigned int *) INTCON2_BASE)

typedef struct Intcon2Struct
{
    unsigned int RBIP    :1;
    unsigned int Dummy1  :1;
    unsigned int TMR0IP  :1;
    unsigned int Dummy3  :1;
    unsigned int INTEDG2 :1;
    unsigned int INTEDG1 :1;
    unsigned int INTEDG0 :1;
    unsigned int RBPU    :1;
} INTCON2_STRUCT;

INTCON2_STRUCT Intcon2bits;
#locate Intcon2bits = INTCON2_BASE


/******************************************************************************
* INTCON Memory Mapping, Data Structures and Definitions                      *
******************************************************************************/
#define INTCON_BASE     0xFF2
#define INTCON          ((unsigned int *) INTCON_BASE)

typedef struct IntconStruct
{
    unsigned int RBIF    :1;
    unsigned int INT0IF  :1;
    unsigned int TMR0IF  :1;
    unsigned int RBIE    :1;
    unsigned int INT0IE  :1;
    unsigned int TMR0IE  :1;
    unsigned int PEIE    :1;
    unsigned int GIE     :1;
} INTCON_STRUCT;

INTCON_STRUCT Intconbits;
#locate Intconbits = INTCON_BASE


/******************************************************************************
* SSPBUF Memory Mapping (SSP Receive/Transmit Buffer Register)                *
******************************************************************************/
#define SSPBUF_BASE     0xFC9
#define SSPBUF          ((unsigned int *) SSPBUF_BASE)


/******************************************************************************
* SSPADD Memory Mapping                                                       *
******************************************************************************/
#define SSPADD_BASE     0xFC8
#define SSPADD          ((unsigned int *) SSPADD_BASE)


/******************************************************************************
* SSPSTAT Memory Mapping, Data Structures and Definitions                     *
******************************************************************************/
#define SSPSTAT_BASE    0xFC7
#define SSPSTAT         ((unsigned int *) SSPSTAT_BASE)

typedef struct SspstatStruct
{
    unsigned int BF    :1;
    unsigned int UA    :1;
    unsigned int RW    :1;
    unsigned int S     :1;
    unsigned int P     :1;
    unsigned int DA    :1;
    unsigned int CKE   :1;
    unsigned int SMP   :1;
} SSPSTAT_STRUCT;

SSPSTAT_STRUCT Sspstatbits;
#locate Sspstatbits = SSPSTAT_BASE


/******************************************************************************
* SSPCON1 Memory Mapping, Data Structures and Definitions                     *
******************************************************************************/
#define SSPCON1_BASE    0xFC6
#define SSPCON1         ((unsigned int *) SSPCON1_BASE)

typedef struct Sspcon1Struct
{
    unsigned int SSPMX :4;
    unsigned int CKP   :1;
    unsigned int SSPEN :1;
    unsigned int SSPOV :1;
    unsigned int WCOL  :1;
} SSPCON1_STRUCT;

SSPCON1_STRUCT Sspcon1bits;
#locate Sspcon1bits = SSPCON1_BASE


/******************************************************************************
* SSPCON2 Memory Mapping, Data Structures and Definitions                     *
******************************************************************************/
#define SSPCON2_BASE    0xFC5
#define SSPCON2         ((unsigned int *) SSPCON2_BASE)

typedef struct Sspcon2Struct
{
    unsigned int SEN     :1;
    unsigned int RSEN    :1;
    unsigned int PEN     :1;
    unsigned int RCEN    :1;
    unsigned int ACKEN   :1;
    unsigned int ACKDT   :1;
    unsigned int ACKSTAT :1;
    unsigned int GCEN    :1;
} SSPCON2_STRUCT;

SSPCON2_STRUCT Sspcon2bits;
#locate Sspcon2bits = SSPCON2_BASE


/******************************************************************************
* PIR1 Memory Mapping, Data Structures and Definitions                        *
******************************************************************************/
#define PIR1_BASE       0xF9E
#define PIR1            ((unsigned int *) PIR1_BASE)

typedef struct Pir1Struct
{
    unsigned int TMR1IF  :1;
    unsigned int TMR2IF  :1;
    unsigned int CCP1IF  :1;
    unsigned int SSPIF   :1;
    unsigned int TXIF    :1;
    unsigned int RCIF    :1;
    unsigned int ADIF    :1;
    unsigned int PSPIF   :1;
} PIR1_STRUCT;

PIR1_STRUCT Pir1bits;
#locate Pir1bits = PIR1_BASE


/******************************************************************************
* PIR2 Memory Mapping, Data Structures and Definitions                        *
******************************************************************************/
#define PIR2_BASE       0xFA1
#define PIR2            ((unsigned int *) PIR2_BASE)

typedef struct Pir2Struct
{
    unsigned int CCP2IF  :1;
    unsigned int TMR3IF  :1;
    unsigned int LVDIF   :1;
    unsigned int BCLIF   :1;
    unsigned int EEIF    :1;
    unsigned int Dummy7  :3;
} PIR2_STRUCT;

PIR2_STRUCT Pir2bits;
#locate Pir2bits = PIR2_BASE


#endif

Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group