|
|
View previous topic :: View next topic |
Author |
Message |
alwaysfresh
Joined: 04 Jul 2005 Posts: 8
|
Looking for CDC Library... USB-PIC |
Posted: Mon Jul 04, 2005 1:15 pm |
|
|
Looking for a CDC library/code for the CCS compiler will be out... for USB PIC communication....
Thanks |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
|
alwaysfresh
Joined: 04 Jul 2005 Posts: 8
|
|
Posted: Tue Jul 05, 2005 8:45 am |
|
|
How do I port the stuff? I am new, can you explain what you mean by "port"...
I have tried to compile the c18 code it in CCS it does not work. There seems to be alot of difference in how the code is written.
Thanks for the reply Mark,
Andy |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Jul 05, 2005 8:57 am |
|
|
You answered you own question. You must change the code to use CCS's terminology. The code is written in C so its not that bad. |
|
|
Dummy Guest
|
CDC library |
Posted: Tue Jul 05, 2005 9:27 am |
|
|
I have seen CDC used many times in relation to USB, what does it stand for? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Jul 05, 2005 9:33 am |
|
|
Ever heard of Google
Communication Device Class |
|
|
alwaysfresh
Joined: 04 Jul 2005 Posts: 8
|
|
Posted: Wed Jul 06, 2005 12:15 pm |
|
|
How Difficult of a task do you think it would be to change the code from c18 to ccs?....
I have made many changes to the c18 files to get them to just compile in ccs, but not surprisingly it is not working...
The way the c18 compiler and ccs compiler interact with the pics registers seems alot different, can you give me some tips on how to change the header files or is the c18 header file is useless for this task?...
For ccs is the only way of altering registers directly is through asm?... Can you give me an example, just how to change a register directly in CCS?
Thanks Mark again for you reply,
Andy |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Jul 06, 2005 12:21 pm |
|
|
You don't need to resort to asm to modify registers. You just need to declare them. See this post for an example. Note this is for a PIC16 and not a PIC18
http://www.ccsinfo.com/forum/viewtopic.php?t=20186
The C18 header file won't do you any good as it is. You must locate the variables.
I don't think it to be difficult at all since it is in C and it is for the same microcontroller. You might have a little trouble if there are any pointers to consts but you can work around that. |
|
|
Dumbo Guest
|
Mark |
Posted: Wed Jul 06, 2005 3:27 pm |
|
|
Ever heard of wise-[spam]
Why don't you simply respond in a civil manner. |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
Re: Mark |
Posted: Wed Jul 06, 2005 3:44 pm |
|
|
Dumbo wrote: | Ever heard of wise-[spam]
Why don't you simply respond in a civil manner. |
Mark was civil. "Google is your friend" or "How about Google" are valid answers for alwaysfresh's question. Mark even went the extra step and typed out "Communication Device Class".
Frankly, anybody trying to do USB work would be well advised that it isn't as simple as RS232 and they should spend time reading (Jan Axelson's book at the minimum) and cruising around with Google before ever attempting to write code (PC, PIC or otherwise).
And if you (Dumbo) are going to criticize the information provided in this forum the least you could do is register. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Jul 06, 2005 6:50 pm |
|
|
I'll be uncivilized for a second.
His name says it all |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Jul 06, 2005 6:54 pm |
|
|
alwaysfresh wrote: | How Difficult of a task do you think it would be to change the code from c18 to ccs?....
I have made many changes to the c18 files to get them to just compile in ccs, but not surprisingly it is not working...
The way the c18 compiler and ccs compiler interact with the pics registers seems alot different, can you give me some tips on how to change the header files or is the c18 header file is useless for this task?...
For ccs is the only way of altering registers directly is through asm?... Can you give me an example, just how to change a register directly in CCS?
Thanks Mark again for you reply,
Andy |
I've got an FAE that's going to give a PIC USB development board. When I have time, I'll port the C18 code. It won't be for a while though. I've got another project that I am working on and someone has requested that I port some other code but I think it would be good to have in the library since I have seen a couple of posts regarding it already. |
|
|
Dumbo Guest
|
Mark |
Posted: Thu Jul 07, 2005 1:19 am |
|
|
Your arrogance does not pass for intelligence... |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu Jul 07, 2005 8:27 am |
|
|
Nope. Mark is spot on here.
AND he helps many, many people.
Leave him alone. |
|
|
alwaysfresh
Joined: 04 Jul 2005 Posts: 8
|
|
Posted: Thu Jul 07, 2005 8:46 am |
|
|
Thanks for your reply Mark, I have changed the header file... I posted it below. I am currently trying to get the rest of the CDC code to work, but I think it may take a while.
Andy
Code: |
#ifndef 18F4550_H
#define 18F4550_H
//////// Standard Header file for the PIC18F4550 device ////////////////
#device PIC18F4550
#nolist
//////// Program memory: 16384x16 Data RAM: 2048 Stack: 31
//////// I/O: 35 Analog Pins: 13
//////// Data EEPROM: 256
//////// C Scratch area: 00 ID Location: 2000
//////// Fuses: XT,XTPLL,EC_IO,EC,ECPIO,ECPLL,INTRC_IO,INTRC,PROTECT
//////// Fuses: NOPROTECT,BROWNOUT_NOSL,BROWNOUT_SW,NOBROWNOUT,BROWNOUT,WDT1
//////// Fuses: WDT2,WDT4,WDT8,WDT16,WDT32,WDT64,WDT128,WDT,NOWDT,BORV20
//////// Fuses: BORV28,BORV43,BORV46,PUT,NOPUT,CPD,NOCPD,NOSTVREN,STVREN
//////// Fuses: NODEBUG,DEBUG,NOLVP,LVP,WRT,NOWRT,WRTD,NOWRTD,IESO,NOIESO
//////// Fuses: FCMEN,NOFCMEN,PBADEN,NOPBADEN,CCP2B3,CCP2C1,WRTC,NOWRTC,WRTB
//////// Fuses: NOWRTB,EBTR,NOEBTR,EBTRB,NOEBTRB,CPB,NOCPB,MCLR,NOMCLR
//////// Fuses: LPT1OSC,NOLPT1OSC,XINST,WDT256,WDT512,WDT1024,WDT2048
//////// Fuses: WDT4096,WDT8192,WDT16384,WDT32768,NOXINST,INTXT,INTHS,HS
//////// Fuses: HSPLL,PLL1,PLL2,PLL3,PLL4,PLL5,PLL6,PLL10,PLL12,CPUDIV1
//////// Fuses: CPUDIV2,CPUDIV3,CPUDIV4,USBDIV,NOUSBDIV,VREGEN,NOVREGEN
//////// Fuses: ICPRT,NOICPRT
////////
////////////////////////////////////////////////////////////////// I/O
// Discrete I/O Functions: SET_TRIS_x(), OUTPUT_x(), INPUT_x(),
// PORT_B_PULLUPS(), INPUT(),
// OUTPUT_LOW(), OUTPUT_HIGH(),
// OUTPUT_FLOAT(), OUTPUT_BIT()
// Constants used to identify pins in the above are:
#define PIN_A0 31744
#define PIN_A1 31745
#define PIN_A2 31746
#define PIN_A3 31747
#define PIN_A4 31748
#define PIN_A5 31749
#define PIN_A6 31750
#define PIN_B0 31752
#define PIN_B1 31753
#define PIN_B2 31754
#define PIN_B3 31755
#define PIN_B4 31756
#define PIN_B5 31757
#define PIN_B6 31758
#define PIN_B7 31759
#define PIN_C0 31760
#define PIN_C1 31761
#define PIN_C2 31762
#define PIN_C3 31763
#define PIN_C4 31764
#define PIN_C5 31765
#define PIN_C6 31766
#define PIN_C7 31767
#define PIN_D0 31768
#define PIN_D1 31769
#define PIN_D2 31770
#define PIN_D3 31771
#define PIN_D4 31772
#define PIN_D5 31773
#define PIN_D6 31774
#define PIN_D7 31775
#define PIN_E0 31776
#define PIN_E1 31777
#define PIN_E2 31778
#define PIN_E3 31779
/////////////////CHANGES TO c18 Header code
unsigned char SPPDATA;
#locate SPPDATA=0xF62
unsigned char SPPCFG;
#locate SPPCFG=0xF63
struct {
unsigned WS0:1;
unsigned WS1:1;
unsigned WS2:1;
unsigned WS3:1;
unsigned CLK1EN:1;
unsigned CSEN:1;
unsigned CLKCFG0:1;
unsigned CLKCFG1:1;
} SPPCFGbits;
#locate SPPCFGbits=0xF63
extern unsigned char SPPEPS;
#locate SPPEPS=0xF64
extern struct {
unsigned ADDR0:1;
unsigned ADDR1:1;
unsigned ADDR2:1;
unsigned ADDR3:1;
unsigned SPPBUSY:1;
unsigned TEMP:1;
unsigned WRSPP:1;
unsigned RDSPP:1;
} SPPEPSbits;
#locate SPPEPSbits=0xF64
extern unsigned char SPPCON;
#locate SPPCON=0xF65
extern struct {
unsigned SPPEN:1;
unsigned SPPOWN:1;
} SPPCONbits;
#locate SPPCONbits=0xF65
extern volatile unsigned UFRM;
#locate UFRM=0xF66
extern volatile unsigned char UFRML;
#locate UFRML=0xF66
extern volatile unsigned char UFRMH;
#locate UFRMH=0xF67
extern volatile unsigned char UIR;
#locate UIR=0xF68
extern volatile struct {
unsigned URSTIF:1;
unsigned UERRIF:1;
unsigned ACTVIF:1;
unsigned TRNIF:1;
unsigned IDLEIF:1;
unsigned STALLIF:1;
unsigned SOFIF:1;
} UIRbits;
#locate UIRbits=0xF68
extern volatile unsigned char UIE;
#locate UIE=0xF69
extern volatile struct {
unsigned URSTIE:1;
unsigned UERRIE:1;
unsigned ACTVIE:1;
unsigned TRNIE:1;
unsigned IDLEIE:1;
unsigned STALLIE:1;
unsigned SOFIE:1;
} UIEbits;
#locate UIE=0xF69
extern volatile unsigned char UEIR;
#locate UEIR=0xF6A
extern volatile struct {
unsigned PIDEF:1;
unsigned CRC5EF:1;
unsigned CRC16EF:1;
unsigned DFN8EF:1;
unsigned BTOEF:1;
unsigned TEMP:2;
unsigned BTSEF:1;
} UEIRbits;
#locate UEIRbits=0xF6A
extern volatile unsigned char UEIE;
#locate UEIE=0xF6B
extern volatile struct {
unsigned PIDEE:1;
unsigned CRC5EE:1;
unsigned CRC16EE:1;
unsigned DFN8EE:1;
unsigned BTOEE:1;
unsigned TEMP:2;
unsigned BTSEE:1;
} UEIEbits;
#locate UEIEbits=0xF6B
extern volatile unsigned char USTAT;
#locate USTAT=0xF6C
extern volatile struct {
unsigned TEMP:1;
unsigned PPBI:1;
unsigned DIR:1;
unsigned ENDP0:1;
unsigned ENDP1:1;
unsigned ENDP2:1;
unsigned ENDP3:1;
} USTATbits;
#locate USTATbits=0xF6C
extern unsigned char UCON;
#locate UCON=0xF6D
extern struct {
unsigned TEMP:1;
unsigned SUSPND:1;
unsigned RESUME:1;
unsigned USBEN:1;
unsigned PKTDIS:1;
unsigned SE0:1;
unsigned PPBRST:1;
} UCONbits;
#locate UCONBITS=0xF6D
extern unsigned char UADDR;
#locate UADDR=0xF6E
extern struct {
unsigned ADDR0:1;
unsigned ADDR1:1;
unsigned ADDR2:1;
unsigned ADDR3:1;
unsigned ADDR4:1;
unsigned ADDR5:1;
unsigned ADDR6:1;
} UADDRbits;
#locate UADDRbits=0xF6E
extern unsigned char UCFG;
#locate UCFG=0xF6F
extern struct {
unsigned PPB0:1;
unsigned PPB1:1;
unsigned FSEN:1;
unsigned UTRDIS:1;
unsigned UPUEN:1;
unsigned TEMP:1;
unsigned UOEMON:1;
unsigned UTEYE:1;
} UCFGbits;
#locate UCFGbits=0xF6F
extern unsigned char UEP0;
#locate UEP0=0xF70
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP0bits;
#locate UEP0bits=0xF70
extern unsigned char UEP1;
#locate UEP1=0xF71
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP1bits;
#locate UEP1bits=0xF71
extern unsigned char UEP2;
#locate UEP2=0xF72
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP2bits;
#locate UEP2bits=0xF72
extern unsigned char UEP3;
#locate UEP3=0xF73
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP3bits;
#locate UEP3bits=0xF73
extern unsigned char UEP4;
#locate UEP4=0xF74
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP4bits;
#locate UEP4bits=0xF74
extern unsigned char UEP5;
#locate UEP5=0xF75
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP5bits;
#locate UEP5bits=0xF75
extern unsigned char UEP6;
#locate UEP6=0xF76
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP6bits;
#locate UEP6bits=0xF76
extern unsigned char UEP7;
#locate UEP7=0xF77
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP7bits;
#locate UEP7bits=0xF77
extern unsigned char UEP8;
#locate UEP8=0xF78
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP8bits;
#locate UEP8bits=0xF78
extern unsigned char UEP9;
#locate UEP9=0xF79
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP9bits;
#locate UEP9bits=0xF79
extern unsigned char UEP10;
#locate UEP10=0xF7A
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP10bits;
#locate UEP10bits=0xF7A
extern unsigned char UEP11;
#locate UEP11=0xF7B
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP11bits;
#locate UEP11bits=0xF7B
extern unsigned char UEP12;
#locate UEP12=0xF7C
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP12bits;
#locate UEP12bits=0xF7C
extern unsigned char UEP13;
#locate UEP13=0xF7D
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP13bits;
#locate UEP13bits=0xF7D
extern unsigned char UEP14;
#locate UEP14=0xF7E
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP14bits;
#locate UEP14bits=0xF7E
extern unsigned char UEP15;
#locate UEP15=0xF7F
extern struct {
unsigned EPSTALL:1;
unsigned EPINEN:1;
unsigned EPOUTEN:1;
unsigned EPCONDIS:1;
unsigned EPHSHK:1;
} UEP15bits;
#locate UEP15bits=0xF7F
extern volatile unsigned char PORTA;
#locate UEP=0xF80
extern volatile union {
struct {
unsigned RA0:1;
unsigned RA1:1;
unsigned RA2:1;
unsigned RA3:1;
unsigned RA4:1;
unsigned RA5:1;
unsigned RA6:1;
};
struct {
unsigned AN0:1;
unsigned AN1:1;
unsigned AN2:1;
unsigned AN3:1;
unsigned T0CKI:1;
unsigned AN4:1;
unsigned OSC2:1;
};
struct {
unsigned TEMP:2;
unsigned VREFM:1;
unsigned VREFP:1;
unsigned TEMP2:1;
unsigned LVDIN:1;
};
struct {
unsigned TEMPv:5;
unsigned HLVDIN:1;
};
} PORTAbits;
#locate PORTAbits=0xF80
extern volatile unsigned char PORTB;
#locate PORTB=0xF81
extern volatile union {
// struct {
unsigned RB0:1;
unsigned RB1:1;
unsigned RB2:1;
unsigned RB3:1;
unsigned RB4:1;
unsigned RB5:1;
unsigned RB6:1;
unsigned RB7:1;
// };
struct {
unsigned INT0:1;
unsigned INT1_C18:1;
unsigned INT2:1;
};
struct {
unsigned TEMP:5;
unsigned PGM:1;
unsigned PGC:1;
unsigned PGD:1;
};
} PORTBbits;
#locate PORTBbits=0xF81
extern volatile unsigned char PORTC;
#locate PORTC=0xF82
extern volatile union {
struct {
unsigned RC0:1;
unsigned RC1:1;
unsigned RC2:1;
unsigned TEMP:1;
unsigned RC4:1;
unsigned RC5:1;
unsigned RC6:1;
unsigned RC7:1;
};
struct {
unsigned T1OSO:1;
unsigned T1OSI:1;
unsigned CCP1:1;
unsigned TEMP:3;
unsigned TX:1;
unsigned RX:1;
};
struct {
unsigned T13CKI:1;
unsigned TEMP:1;
unsigned P1A:1;
unsigned TEMP2:3;
unsigned CK:1;
unsigned DT:1;
};
} PORTCbits;
#locate PORTCbits=0xF82
extern volatile unsigned char PORTD;
#locate PORTD=0xF83
extern volatile union {
struct {
unsigned RD0:1;
unsigned RD1:1;
unsigned RD2:1;
unsigned RD3:1;
unsigned RD4:1;
unsigned RD5:1;
unsigned RD6:1;
unsigned RD7:1;
};
struct {
unsigned SPP0:1;
unsigned SPP1:1;
unsigned SPP2:1;
unsigned SPP3:1;
unsigned SPP4:1;
unsigned SPP5:1;
unsigned SPP6:1;
unsigned SPP7:1;
};
} PORTDbits;
#locate PORTDbits=0xF83
extern volatile unsigned char PORTE;
#locate PORTE=0xF84
extern volatile union {
struct {
unsigned RE0:1;
unsigned RE1:1;
unsigned RE2:1;
unsigned RE3:1;
unsigned TEMP:3;
unsigned RDPU:1;
};
struct {
unsigned CK1SPP:1;
unsigned CK2SPP:1;
unsigned OESPP:1;
};
} PORTEbits;
#locate PORTEbits=0xF84
extern volatile unsigned char LATA;
#locate LATA=0xF89
extern volatile struct {
unsigned LATA0:1;
unsigned LATA1:1;
unsigned LATA2:1;
unsigned LATA3:1;
unsigned LATA4:1;
unsigned LATA5:1;
unsigned LATA6:1;
} LATAbits;
#locate LATAbits=0xF89
extern volatile unsigned char LATB;
#locate LATB=0xF8A
extern volatile struct {
unsigned LATB0:1;
unsigned LATB1:1;
unsigned LATB2:1;
unsigned LATB3:1;
unsigned LATB4:1;
unsigned LATB5:1;
unsigned LATB6:1;
unsigned LATB7:1;
} LATBbits;
#locate LATBbits=0xF8A
extern volatile unsigned char LATC;
#locate LATC=0xF8B
extern volatile struct {
unsigned LATC0:1;
unsigned LATC1:1;
unsigned LATC2:1;
unsigned TEMP:3;
unsigned LATC6:1;
unsigned LATC7:1;
} LATCbits;
#locate LATCbits=0xF8B
extern volatile unsigned char LATD;
#locate LATD=0xF8C
extern volatile struct {
unsigned LATD0:1;
unsigned LATD1:1;
unsigned LATD2:1;
unsigned LATD3:1;
unsigned LATD4:1;
unsigned LATD5:1;
unsigned LATD6:1;
unsigned LATD7:1;
} LATDbits;
#locate LATDbits=0xF8C
extern volatile unsigned char LATE;
#locate LATE=0xF8D
extern volatile struct {
unsigned LATE0:1;
unsigned LATE1:1;
unsigned LATE2:1;
} LATEbits;
#locate LATEbits=0xF8D
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//extern volatile unsigned char DDRA;
//#locate $$REGISTER$$=0x$$$
//extern volatile struct {
// unsigned RA0:1;
// unsigned RA1:1;
// unsigned RA2:1;
// unsigned RA3:1;
// unsigned RA4:1;
// unsigned RA5:1;
// unsigned RA6:1;
//} DDRAbits;
//#locate $$REGISTER$$=0x$$$
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//--------------------------------------------------------------------
extern volatile unsigned char TRISA;
#locate TRISA=0xF92
extern volatile struct {
unsigned TRISA0:1;
unsigned TRISA1:1;
unsigned TRISA2:1;
unsigned TRISA3:1;
unsigned TRISA4:1;
unsigned TRISA5:1;
unsigned TRISA6:1;
} TRISAbits;
#locate TRISAbits=0xF92
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//extern volatile unsigned char DDRB;
//#locate $$REGISTER$$=0x$$$
//extern volatile struct {
// unsigned RB0:1;
// unsigned RB1:1;
// unsigned RB2:1;
// unsigned RB3:1;
// unsigned RB4:1;
// unsigned RB5:1;
// unsigned RB6:1;
// unsigned RB7:1;
//} DDRBbits;
//#locate $$REGISTER$$=0x$$$
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//--------------------------------------------------------------------
extern volatile unsigned char TRISB;
#locate TRISB=0xF93
extern volatile struct {
unsigned TRISB0:1;
unsigned TRISB1:1;
unsigned TRISB2:1;
unsigned TRISB3:1;
unsigned TRISB4:1;
unsigned TRISB5:1;
unsigned TRISB6:1;
unsigned TRISB7:1;
} TRISBbits;
#locate TRISBbits=0xF93
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//--------------------------------------------------------------------
/*
extern volatile unsigned char DDRC;
#locate $$REGISTER$$=0x$$$
extern volatile struct {
unsigned RC0:1;
unsigned RC1:1;
unsigned RC2:1;
unsigned TEMP:3;
unsigned RC6:1;
unsigned RC7:1;
} DDRCbits;
#locate $$REGISTER$$=0x$$$
*/
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//--------------------------------------------------------------------
extern volatile unsigned char TRISC;
#locate TRISC=0xF94
extern volatile struct {
unsigned TRISC0:1;
unsigned TRISC1:1;
unsigned TRISC2:1;
unsigned TEMP:3;
unsigned TRISC6:1;
unsigned TRISC7:1;
} TRISCbits;
#locate TRISCbits=0xF94
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//--------------------------------------------------------------------
/*
extern volatile unsigned char DDRD;
#locate $$REGISTER$$=0x$$$
extern volatile struct {
unsigned RD0:1;
unsigned RD1:1;
unsigned RD2:1;
unsigned RD3:1;
unsigned RD4:1;
unsigned RD5:1;
unsigned RD6:1;
unsigned RD7:1;
} DDRDbits;
#locate $$REGISTER$$=0x$$$
*/
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//--------------------------------------------------------------------
extern volatile unsigned char TRISD;
#locate TRISD=0xF95
extern volatile struct {
unsigned TRISD0:1;
unsigned TRISD1:1;
unsigned TRISD2:1;
unsigned TRISD3:1;
unsigned TRISD4:1;
unsigned TRISD5:1;
unsigned TRISD6:1;
unsigned TRISD7:1;
} TRISDbits;
#locate TRISDbits=0xF95
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//--------------------------------------------------------------------
/*
extern volatile unsigned char DDRE;
#locate $$REGISTER$$=0x$$$
extern volatile struct {
unsigned RE0:1;
unsigned RE1:1;
unsigned RE2:1;
} DDREbits;
#locate $$REGISTER$$=0x$$$
*/
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//--------------------------------------------------------------------
extern volatile unsigned char TRISE;
#locate TRISE=0xF96
extern volatile struct {
unsigned TRISE0:1;
unsigned TRISE1:1;
unsigned TRISE2:1;
} TRISEbits;
#locate TRISE=0xF96
extern volatile unsigned char OSCTUNE;
#locate OSCTUNE=0xF9B
extern volatile struct {
unsigned TUN0:1;
unsigned TUN1:1;
unsigned TUN2:2;
unsigned TUN3:1;
unsigned TUN4:1;
unsigned TEMP:2;
unsigned INTSRC:1;
} OSCTUNEbits;
#locate OSCTUNEbits=0xF9B
extern volatile unsigned char PIE1;
#locate PIE1=0xF9D
extern volatile struct {
unsigned TMR1IE:1;
unsigned TMR2IE:1;
unsigned CCP1IE:1;
unsigned SSPIE:1;
unsigned TXIE:1;
unsigned RCIE:1;
unsigned ADIE:1;
unsigned SPPIE:1;
} PIE1bits;
#locate PIE1bits=0xF9D
extern volatile unsigned char PIR1;
#locate PIR1=0xF9E
extern volatile struct {
unsigned TMR1IF:1;
unsigned TMR2IF:1;
unsigned CCP1IF:1;
unsigned SSPIF:1;
unsigned TXIF:1;
unsigned RCIF:1;
unsigned ADIF:1;
unsigned SPPIF:1;
} PIR1bits;
#locate PIR1bits=0xF9E
extern volatile unsigned char IPR1;
#locate IPR1=0xF9F
extern volatile struct {
unsigned TMR1IP:1;
unsigned TMR2IP:1;
unsigned CCP1IP:1;
unsigned SSPIP:1;
unsigned TXIP:1;
unsigned RCIP:1;
unsigned ADIP:1;
unsigned SPPIP:1;
} IPR1bits;
#locate IPR1bits=0xF9F
extern volatile unsigned char PIE2;
#locate PIE2=0xFA0
extern volatile struct {
// struct {
unsigned CCP2IE:1;
unsigned TMR3IE:1;
unsigned LVDIE:1;
unsigned BCLIE:1;
unsigned EEIE:1;
unsigned USBIE:1;
unsigned CMIE:1;
unsigned OSCFIE:1;
// };
// struct {
unsigned TEMP:2;
unsigned HLVDIE:1;
// };
} PIE2bits;
#locate PIE2bits=0xFA0
extern volatile unsigned char PIR2;
#locate PIR2=0xFA1
extern volatile struct {
// struct {
unsigned CCP2IF:1;
unsigned TMR3IF:1;
unsigned LVDIF:1;
unsigned BCLIF:1;
unsigned EEIF:1;
unsigned USBIF:1;
unsigned CMIF:1;
unsigned OSCFIF:1;
// };
// struct {
unsigned TEMP:2;
unsigned HLVDIF:1;
// };
} PIR2bits;
#locate PIR2bits=0xFA1
extern volatile unsigned char IPR2;
#locate IPR2=0xFA2
extern volatile union {
struct {
unsigned CCP2IP:1;
unsigned TMR3IP:1;
unsigned LVDIP:1;
unsigned BCLIP:1;
unsigned EEIP:1;
unsigned USBIP:1;
unsigned CMIP:1;
unsigned OSCFIP:1;
};
struct {
unsigned TEMP:2;
unsigned HLVDIP:1;
};
} IPR2bits;
#locate IPR2bits=0xFA2
extern volatile unsigned char EECON1;
#locate EECON1=0xFA6
extern volatile struct {
unsigned RD:1;
unsigned WR:1;
unsigned WREN:1;
unsigned WRERR:1;
unsigned FREE:1;
unsigned TEMP:1;
unsigned CFGS:1;
unsigned EEPGD:1;
} EECON1bits;
#locate EECON1bits=0xFA6
extern volatile unsigned char EECON2;
#locate EECON2=0xFA7
extern volatile unsigned char EEDATA;
#locate EEDATA=0xFA8
extern volatile unsigned char EEADR;
#locate EEADR=0xFA9
extern volatile unsigned char RCSTA;
#locate RCSTA=0xFAB
extern volatile union {
struct {
unsigned RX9D:1;
unsigned OERR:1;
unsigned FERR:1;
unsigned ADDEN:1;
unsigned CREN:1;
unsigned SREN:1;
unsigned RX9:1;
unsigned SPEN:1;
};
struct {
unsigned TEMP:3;
unsigned ADEN:1;
};
} RCSTAbits;
#locate RCSTAbits=0xFAB
extern volatile unsigned char TXSTA;
#locate TXSTA=0xFAC
extern volatile struct {
unsigned TX9D:1;
unsigned TRMT:1;
unsigned BRGH:1;
unsigned SENDB:1;
unsigned SYNC:1;
unsigned TXEN:1;
unsigned TX9:1;
unsigned CSRC:1;
} TXSTAbits;
#locate TXSTAbits=0xFAC
extern volatile unsigned char TXREG;
#locate TXREG=0xFAD
extern volatile unsigned char RCREG;
#locate RCREG=0xFAE
extern volatile unsigned char SPBRG;
#locate SPBRG=0xFAF
extern volatile unsigned char SPBRGH;
#locate SPBRGH=0xFB0
extern volatile unsigned char T3CON;
#locate T3CON=0xFB1
extern volatile union {
struct {
unsigned TMR3ON:1;
unsigned TMR3CS:1;
unsigned T3SYNC:1;
unsigned T3CCP1:1;
unsigned T3CKPS0:1;
unsigned T3CKPS1:1;
unsigned T3CCP2:1;
unsigned RD16:1;
};
struct {
unsigned TEMP:2;
unsigned T3NSYNC:1;
};
struct {
unsigned TEMP:2;
unsigned NOT_T3SYNC:1;
};
} T3CONbits;
#locate T3CONbits=0xFB1
extern volatile unsigned char TMR3L;
#locate TMR3L=0xFB2
extern volatile unsigned char TMR3H;
#locate TMR3H=0xFB3
extern volatile unsigned char CMCON;
#locate CMCON=0xFB4
extern volatile struct {
unsigned CM0:1;
unsigned CM1:1;
unsigned CM2:1;
unsigned CIS:1;
unsigned C1INV:1;
unsigned C2INV:1;
unsigned C1OUT:1;
unsigned C2OUT:1;
} CMCONbits;
#locate CMCONbits=0xFB4
extern volatile unsigned char CVRCON;
#locate CVRCON=0xFB5
extern volatile union {
struct {
unsigned CVR0:1;
unsigned CVR1:1;
unsigned CVR2:1;
unsigned CVR3:1;
unsigned CVREF:1;
unsigned CVRR:1;
unsigned CVROE:1;
unsigned CVREN:1;
};
struct {
unsigned TEMP:4;
unsigned CVRSS:1;
};
} CVRCONbits;
#locate CVRCONbits=0xFB5
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
/*
extern volatile unsigned char CCP1AS;
#locate CCP1AS=0xFB6
extern volatile struct {
unsigned TEMP:2;
unsigned PSSAC0:1;
unsigned PSSAC1:1;
unsigned ECCPAS0:1;
unsigned ECCPAS1:1;
unsigned ECCPAS2:1;
unsigned ECCPASE:1;
} CCP1ASbits;
#locate CCP1ASbits=0xFB6
*/
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
extern volatile unsigned char ECCP1AS;
#locate ECCP1AS=0xFB6
extern volatile struct {
unsigned PSSBD0:1;
unsigned PSSBD1:1;
unsigned PSSAC0:1;
unsigned PSSAC1:1;
unsigned ECCPAS0:1;
unsigned ECCPAS1:1;
unsigned ECCPAS2:1;
unsigned ECCPASE:1;
} ECCP1ASbits;
#locate ECCP1ASbits=0xFB6
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
/*
extern volatile unsigned char CCP1DEL;
#locate CCP1DEL=0x$$$
extern volatile struct {
unsigned filler0:7;
unsigned PRSEN:1;
} CCP1DELbits;
#locate CCP1DELbits=0x$$$
*/
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
extern volatile unsigned char ECCP1DEL;
#locate ECCP1DEL=0xFB7
extern volatile struct {
unsigned PDC0:1;
unsigned PDC1:1;
unsigned PDC2:1;
unsigned PDC3:1;
unsigned PDC4:1;
unsigned PDC5:1;
unsigned PDC6:1;
unsigned PRSEN:1;
} ECCP1DELbits;
#locate ECCP1DELbits=0xFB7
extern volatile unsigned char BAUDCON;
#locate BAUDCON=0xFB8
extern volatile union {
struct {
unsigned ABDEN:1;
unsigned WUE:1;
unsigned TEMP:1;
unsigned BRG16:1;
unsigned SCKP:1;
unsigned TEMP2:1;
unsigned RCIDL:1;
unsigned ABDOVF:1;
};
struct {
unsigned TEMP:6;
unsigned RCMT:1;
};
} BAUDCONbits;
#locate BAUDCONbits=0xFB8
extern volatile unsigned char CCP2CON;
#locate CCP2CON=0xFBA
extern volatile struct {
unsigned CCP2M0:1;
unsigned CCP2M1:1;
unsigned CCP2M2:1;
unsigned CCP2M3:1;
unsigned DC2B0:1;
unsigned DC2B1:1;
} CCP2CONbits;
#locate CCP2CONbits=0xFBA
extern volatile unsigned CCPR2;
#locate CCPR2=0xFBB
extern volatile unsigned char CCPR2L;
#locate CCPR2L=0xFBB
extern volatile unsigned char CCPR2H;
#locate CCPR2H=0xFBC
extern volatile unsigned char CCP1CON;
#locate CCP1CON=0xFBD
extern volatile struct {
unsigned CCP1M0:1;
unsigned CCP1M1:1;
unsigned CCP1M2:1;
unsigned CCP1M3:1;
unsigned DC1B0:1;
unsigned DC1B1:1;
unsigned P1M0:1;
unsigned P1M1:1;
} CCP1CONbits;
#locate CCP1CONbits=0xFBD
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/*
extern volatile unsigned char ECCP1CON;
#locate ECCP1CON=0x$$$
extern volatile struct {
unsigned CCP1M0:1;
unsigned CCP1M1:1;
unsigned CCP1M2:1;
unsigned CCP1M3:1;
unsigned DC1B0:1;
unsigned DC1B1:1;
unsigned P1M0:1;
unsigned P1M1:1;
} ECCP1CONbits;
#locate ECCP1CONbits=0x$$$
*/
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern volatile unsigned CCPR1;
#locate CCPR1=0xFBE
extern volatile unsigned char CCPR1L;
#locate CCPR1L=0xFBE
extern volatile unsigned char CCPR1H;
#locate CCPR1H=0xFBF
extern volatile unsigned char ADCON2;
#locate ADCON2=0xFC0
extern volatile struct {
unsigned ADCS0:1;
unsigned ADCS1:1;
unsigned ADCS2:1;
unsigned ACQT0:1;
unsigned ACQT1:1;
unsigned ACQT2:1;
unsigned TEMP:1;
unsigned ADFM:1;
} ADCON2bits;
#locate ADCON2bits=0xFC0
extern volatile unsigned char ADCON1;
#locate ADCON1=0xFC1
extern volatile struct {
unsigned PCFG0:1;
unsigned PCFG1:1;
unsigned PCFG2:1;
unsigned PCFG3:1;
unsigned VCFG0:1;
unsigned VCFG1:1;
} ADCON1bits;
#locate ADCON1bits=0xFC1
extern volatile unsigned char ADCON0;
#locate ADCON0=0xFC2
extern volatile union {
struct {
unsigned ADON:1;
unsigned GO_DONE:1;
unsigned CHS0:1;
unsigned CHS1:1;
unsigned CHS2:1;
unsigned CHS3:1;
};
struct {
unsigned TEMP:1;
unsigned DONE:1;
};
struct {
unsigned TEMP:1;
unsigned GO:1;
};
struct {
unsigned TEMP:1;
unsigned NOT_DONE:1;
};
} ADCON0bits;
#locate ADCON0bits=0xFC2
extern volatile unsigned ADRES;
#locate ADRES=0xFC3
extern volatile unsigned char ADRESL;
#locate ADRESL=0xFC3
extern volatile unsigned char ADRESH;
#locate ADRESH=0xFC4
extern volatile unsigned char SSPCON2;
#locate SSPCON2=0xFC5
extern volatile struct {
unsigned SEN:1;
unsigned RSEN:1;
unsigned PEN:1;
unsigned RCEN:1;
unsigned ACKEN:1;
unsigned ACKDT:1;
unsigned ACKSTAT:1;
unsigned GCEN:1;
} SSPCON2bits;
#locate SSPCON2bits=0xFC5
extern volatile unsigned char SSPCON1;
#locate SSPCON1=0xFC6
extern volatile struct {
unsigned SSPM0:1;
unsigned SSPM1:1;
unsigned SSPM2:1;
unsigned SSPM3:1;
unsigned CKP:1;
unsigned SSPEN:1;
unsigned SSPOV:1;
unsigned WCOL:1;
} SSPCON1bits;
#locate SSPCON1bits=0xFC6
extern volatile unsigned char SSPSTAT;
#locate SSPSTAT=0xFC7
extern volatile union {
struct {
unsigned BF:1;
unsigned UA:1;
unsigned R_W:1;
unsigned S:1;
unsigned P:1;
unsigned D_A:1;
unsigned CKE:1;
unsigned SMP:1;
};
struct {
unsigned TEMP:2;
unsigned I2C_READ:1;
unsigned I2C_START:1;
unsigned I2C_STOP:1;
unsigned I2C_DAT:1;
};
struct {
unsigned TEMP:2;
unsigned NOT_W:1;
unsigned TEMP2:2;
unsigned NOT_A:1;
};
struct {
unsigned TEMP:2;
unsigned NOT_WRITE:1;
unsigned TEMP2:2;
unsigned NOT_ADDRESS:1;
};
struct {
unsigned TEMP:2;
unsigned READ_WRITE:1;
unsigned TEMP2:2;
unsigned DATA_ADDRESS:1;
};
struct {
unsigned TEMP:2;
unsigned R:1;
unsigned TEMPv2:2;
unsigned D:1;
};
} SSPSTATbits;
#locate SSPSTATbits=0xFC7
extern volatile unsigned char SSPADD;
#locate SSPADD=0xFC8
extern volatile unsigned char SSPBUF;
#locate SSPBUF=0xFC9
extern volatile unsigned char T2CON;
#locate T2CON=0xFCA
extern volatile struct {
unsigned T2CKPS0:1;
unsigned T2CKPS1:1;
unsigned TMR2ON:1;
unsigned T2OUTPS0:1;
unsigned T2OUTPS1:1;
unsigned T2OUTPS2:1;
unsigned T2OUTPS3:1;
} T2CONbits;
#locate T2CONbits=0xFCA
extern volatile unsigned char PR2;
#locate PR2=0xFCB
extern volatile unsigned char TMR2;
#locate TMR2=0xFCC
extern volatile unsigned char T1CON;
#locate T1CON=0xFCD
extern volatile union {
struct {
unsigned TMR1ON:1;
unsigned TMR1CS:1;
unsigned T1SYNC:1;
unsigned T1OSCEN:1;
unsigned T1CKPS0:1;
unsigned T1CKPS1:1;
unsigned T1RUN:1;
unsigned RD16:1;
};
struct {
unsigned TEMP:2;
unsigned NOT_T1SYNC:1;
};
} T1CONbits;
#locate T1CONbits=0xFCD
extern volatile unsigned char TMR1L;
#locate TMR1L=0xFCE
extern volatile unsigned char TMR1H;
#locate TMR1H=0xFCF
extern volatile unsigned char RCON;
#locate RCON=0xFD0
extern volatile union {
struct {
unsigned NOT_BOR:1;
unsigned NOT_POR:1;
unsigned NOT_PD:1;
unsigned NOT_TO:1;
unsigned NOT_RI:1;
unsigned TEMPv:1;
unsigned SBOREN:1;
unsigned NOT_IPEN:1;
};
struct {
unsigned BOR:1;
unsigned POR:1;
unsigned PD:1;
unsigned TO:1;
unsigned RI:1;
unsigned TEMP:2;
unsigned IPEN:1;
};
} RCONbits;
#locate RCONbits=0xFD0
extern volatile unsigned char WDTCON;
#locate WDTCON=0xFD1
extern volatile union {
struct {
unsigned SWDTEN:1;
};
struct {
unsigned SWDTE:1;
};
} WDTCONbits;
#locate WDTCONbits=0xFD1
extern volatile unsigned char HLVDCON;
#locate HLVDCON=0xFD2
extern volatile union {
struct {
unsigned LVDL0:1;
unsigned LVDL1:1;
unsigned LVDL2:1;
unsigned LVDL3:1;
unsigned LVDEN:1;
unsigned IRVST:1;
};
struct {
unsigned LVV0:1;
unsigned LVV1:1;
unsigned LVV2:1;
unsigned LVV3:1;
unsigned TEMP:1;
unsigned BGST:1;
};
struct {
unsigned HLVDL0:1;
unsigned HLVDL1:1;
unsigned HLVDL2:1;
unsigned HLVDL3:1;
unsigned HLVDEN:1;
unsigned TEMP:2;
unsigned VDIRMAG:1;
};
struct {
unsigned TEMP:5;
unsigned IVRST:1;
};
} HLVDCONbits;
#locate HLVDCONbits=0xFD2
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
/*
extern volatile unsigned char LVDCON;
#locate LVDCON=0x$$$
extern volatile union {
struct {
unsigned LVDL0:1;
unsigned LVDL1:1;
unsigned LVDL2:1;
unsigned LVDL3:1;
unsigned LVDEN:1;
unsigned IRVST:1;
};
struct {
unsigned LVV0:1;
unsigned LVV1:1;
unsigned LVV2:1;
unsigned LVV3:1;
unsigned TEMP:1;
unsigned BGST:1;
};
struct {
unsigned HLVDL0:1;
unsigned HLVDL1:1;
unsigned HLVDL2:1;
unsigned HLVDL3:1;
unsigned HLVDEN:1;
unsigned TEMP:2;
unsigned VDIRMAG:1;
};
struct {
unsigned TEMP:5;
unsigned IVRST:1;
};
} LVDCONbits;
#locate $$REGISTER$$=0x$$$
*/
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
extern volatile unsigned char OSCCON;
#locate OSCCON=0xFD3
extern volatile union {
struct {
unsigned SCS0:1;
unsigned SCS1:1;
unsigned IOFS:1;
unsigned OSTS:1;
unsigned IRCF0:1;
unsigned IRCF1:1;
unsigned IRCF2:1;
unsigned IDLEN:1;
};
struct {
unsigned TEMP:2;
unsigned FLTS:1;
};
} OSCCONbits;
#locate OSCCONbits=0xFD3
extern volatile unsigned char T0CON;
#locate T0CON=0xFD5
extern volatile struct {
unsigned T0PS0:1;
unsigned T0PS1:1;
unsigned T0PS2:1;
unsigned PSA:1;
unsigned T0SE:1;
unsigned T0CS:1;
unsigned T08BIT:1;
unsigned TMR0ON:1;
} T0CONbits;
#locate T0CONbits=0xFD5
extern volatile unsigned char TMR0L;
#locate TMR0L=0xFD6
extern volatile unsigned char TMR0H;
#locate TMR0H=0xFD7
extern unsigned char STATUS;
#locate STATUS=0xFD8
extern struct {
unsigned C:1;
unsigned DC:1;
unsigned Z:1;
unsigned OV:1;
unsigned N:1;
} STATUSbits;
#locate STATUSbits=0xFD8
extern unsigned FSR2;
#locate FSR2=0xFD9
extern unsigned char FSR2L;
#locate FSR2L=0xFD9
extern unsigned char FSR2H;
#locate FSR2H=0xFDA
extern volatile unsigned char PLUSW2;
#locate PLUSW2=0xFDB
extern volatile unsigned char PREINC2;
#locate PREINC2=0xFDC
extern volatile unsigned char POSTDEC2;
#locate POSTDEC2=0xFDD
extern volatile unsigned char POSTINC2;
#locate POSTINC2=0xFDE
extern unsigned char INDF2;
#locate INDF2=0xFDF
extern unsigned char BSR;
#locate BSR=0xFE0
extern unsigned FSR1;
#locate FSR1=0xFE1
extern unsigned char FSR1L;
#locate FSR1L=0xFE1
extern unsigned char FSR1H;
#locate FSR1H=0xFE2
extern volatile unsigned char PLUSW1;
#locate PLUSW1=0xFE3
extern volatile unsigned char PREINC1;
#locate PREINC1=0xFE4
extern volatile unsigned char POSTDEC1;
#locate POSTDEC1=0xFE5
extern volatile unsigned char POSTINC1;
#locate POSTINC1=0xFE6
extern unsigned char INDF1;
#locate INDF1=0xFE7
extern unsigned char WREG;
#locate WREG=0xFE8
extern unsigned FSR0;
#locate FSR0=0xFE9
extern unsigned char FSR0L;
#locate FSR0L=0xFE9
extern unsigned char FSR0H;
#locate FSR0H=0xFEA
extern volatile unsigned char PLUSW0;
#locate PLUSW0=0xFEB
extern volatile unsigned char PREINC0;
#locate PREINC0=0xFEC
extern volatile unsigned char POSTDEC0;
#locate POSTDEC0=0xFED
extern volatile unsigned char POSTINC0;
#locate POSTINC0=0xFEE
extern unsigned char INDF0;
#locate INDF0=0xFEF
extern volatile unsigned char INTCON3;
#locate INTCON3=0xFF0
extern volatile union {
struct {
unsigned INT1IF:1;
unsigned INT2IF:1;
unsigned TEMP:1;
unsigned INT1IE:1;
unsigned INT2IE:1;
unsigned TEMPv2:1;
unsigned INT1IP:1;
unsigned INT2IP:1;
};
struct {
unsigned INT1F:1;
unsigned INT2F:1;
unsigned TEMP:1;
unsigned INT1E:1;
unsigned INT2E:1;
unsigned TEMP2:1;
unsigned INT1P:1;
unsigned INT2P:1;
};
} INTCON3bits;
#locate INTCON3bits=0xFF0
extern volatile unsigned char INTCON2;
#locate INTCON2=0xFF1
extern volatile union {
// struct {
unsigned RBIP:1;
unsigned TEMP:1;
unsigned TMR0IP:1;
unsigned TEMP2:1;
unsigned INTEDG2:1;
unsigned INTEDG1:1;
unsigned INTEDG0:1;
unsigned NOT_RBPU:1;
// };
// struct {
unsigned TEMP3:2;
unsigned T0IP:1;
unsigned TEMP4:4;
unsigned RBPU:1;
// };
} INTCON2bits;
#locate INTCON2bits=0xFF1
extern volatile unsigned char INTCON;
#locate INTCON=0xFF2
extern volatile union {
// struct {
unsigned RBIF:1;
unsigned INT0IF:1;
unsigned TMR0IF:1;
unsigned RBIE:1;
unsigned INT0IE:1;
unsigned TMR0IE:1;
unsigned PEIE:1;
unsigned GIE:1;
// };
// struct {
unsigned TEMP:1;
unsigned INT0F:1;
unsigned T0IF:1;
unsigned TEMP2:1;
unsigned INT0E:1;
unsigned T0IE:1;
unsigned GIEL:1;
unsigned GIEH:1;
// };
} INTCONbits;
#locate INTCONbits=0xFF2
extern unsigned PROD;
#locate PROD=0xFF3
extern unsigned char PRODL;
#locate PRODL=0xFF3
extern unsigned char PRODH;
#locate PRODH=0xFF4
extern volatile unsigned char TABLAT;
#locate TABLAT=0xFF5
extern volatile unsigned int32 TBLPTR;
#locate TBLPTR=0xFF6
extern volatile unsigned char TBLPTRL;
#locate TBLPTRL=0xFF6
extern volatile unsigned char TBLPTRH;
#locate TBLPTRH=0xFF7
extern volatile unsigned char TBLPTRU;
#locate TBLPTRU=0xFF8
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
/*
extern volatile unsigned int32 PC;
#locate PC=0x$$$
*/
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
extern volatile unsigned char PCL;
#locate PCL=0xFF9
extern volatile unsigned char PCLATH;
#locate PCLATH=0xFFA
extern volatile unsigned char PCLATU;
#locate PCLATU=0xFFB
extern volatile unsigned char STKPTR;
#locate STKPTR=0xFFC
extern volatile struct {
unsigned STKPTR0:1;
unsigned STKPTR1:1;
unsigned STKPTR2:1;
unsigned STKPTR3:1;
unsigned STKPTR4:1;
unsigned TEMP:1;
unsigned STKUNF:1;
unsigned STKFUL:1;
} STKPTRbits;
#locate STKPTRbits=0xFFC
//--------------------------------------------------------------------------------NOTE TOS is out of range---
//TOS addresses a 24bit data set, but in ccs I can get a 24bit variables 32bit won't compile so I set it to 16
extern unsigned int16 TOS;
#locate TOS=0xFFD
extern unsigned char TOSL;
#locate TOSL=0xFFD
extern unsigned char TOSH;
#locate TOSH=0xFFE
extern unsigned char TOSU;
#locate TOSU=0xFFF
//OTHER C18 stuff removed
/*-------------------------------------------------------------------------
* Some useful defines for inline assembly stuff
*-------------------------------------------------------------------------*/
//#define ACCESS 0
//#define BANKED 1
/*-------------------------------------------------------------------------
* Some useful macros for inline assembly stuff
*-------------------------------------------------------------------------*/
//#define Nop() {_asm nop _endasm}
//#define ClrWdt() {_asm clrwdt _endasm}
//#define Sleep() {_asm sleep _endasm}
//#define Reset() {_asm reset _endasm}
//#define Rlcf(f,dest,access) {_asm movlb f rlcf f,dest,access _endasm}
//#define Rlncf(f,dest,access) {_asm movlb f rlncf f,dest,access _endasm}
//#define Rrcf(f,dest,access) {_asm movlb f rrcf f,dest,access _endasm}
//#define Rrncf(f,dest,access) {_asm movlb f rrncf f,dest,access _endasm}
//#define Swapf(f,dest,access) {_asm movlb f swapf f,dest,access _endasm }
/*-------------------------------------------------------------------------
* A fairly inclusive set of registers to save for interrupts.
* These are locations which are commonly used by the compiler.
*-------------------------------------------------------------------------*/
//#define INTSAVELOCS TBLPTR, TABLAT, PROD
//#endif
////////////////////////////////////////////////////////////////// Useful defines
#define FALSE 0
#define TRUE 1
#define BYTE int
#define BOOLEAN short int
#define getc getch
#define fgetc getch
#define getchar getch
#define putc putchar
#define fputc putchar
#define fgets gets
#define fputs puts
////////////////////////////////////////////////////////////////// Control
// Control Functions: RESET_CPU(), SLEEP(), RESTART_CAUSE()
// Constants returned from RESTART_CAUSE() are:
#define WDT_TIMEOUT 4
#define MCLR_FROM_SLEEP 8
#define NORMAL_POWER_UP 12
#define BROWNOUT_RESTART 14
////////////////////////////////////////////////////////////////// Timer 0
// Timer 0 (AKA RTCC)Functions: SETUP_COUNTERS() or SETUP_TIMER_0(),
// SET_TIMER0() or SET_RTCC(),
// GET_TIMER0() or GET_RTCC()
// Constants used for SETUP_TIMER_0() are:
#define RTCC_INTERNAL 0
#define RTCC_EXT_L_TO_H 32
#define RTCC_EXT_H_TO_L 48
#define RTCC_DIV_1 8
#define RTCC_DIV_2 0
#define RTCC_DIV_4 1
#define RTCC_DIV_8 2
#define RTCC_DIV_16 3
#define RTCC_DIV_32 4
#define RTCC_DIV_64 5
#define RTCC_DIV_128 6
#define RTCC_DIV_256 7
#define RTCC_OFF 0x80
#define RTCC_8_BIT 0x40
// Constants used for SETUP_COUNTERS() are the above
// constants for the 1st param and the following for
// the 2nd param:
////////////////////////////////////////////////////////////////// WDT
// Watch Dog Timer Functions: SETUP_WDT() or SETUP_COUNTERS() (see above)
// RESTART_WDT()
//
#define WDT_ON 0x100
#define WDT_OFF 0
////////////////////////////////////////////////////////////////// Timer 1
// Timer 1 Functions: SETUP_TIMER_1, GET_TIMER1, SET_TIMER1
// Constants used for SETUP_TIMER_1() are:
// (or (via |) together constants from each group)
#define T1_DISABLED 0
#define T1_INTERNAL 0x85
#define T1_EXTERNAL 0x87
#define T1_EXTERNAL_SYNC 0x83
#define T1_CLK_OUT 8
#define T1_DIV_BY_1 0
#define T1_DIV_BY_2 0x10
#define T1_DIV_BY_4 0x20
#define T1_DIV_BY_8 0x30
////////////////////////////////////////////////////////////////// Timer 2
// Timer 2 Functions: SETUP_TIMER_2, GET_TIMER2, SET_TIMER2
// Constants used for SETUP_TIMER_2() are:
#define T2_DISABLED 0
#define T2_DIV_BY_1 4
#define T2_DIV_BY_4 5
#define T2_DIV_BY_16 6
////////////////////////////////////////////////////////////////// Timer 3
// Timer 3 Functions: SETUP_TIMER_3, GET_TIMER3, SET_TIMER3
// Constants used for SETUP_TIMER_3() are:
// (or (via |) together constants from each group)
#define T3_DISABLED 0
#define T3_INTERNAL 0x85
#define T3_EXTERNAL 0x87
#define T3_EXTERNAL_SYNC 0x83
#define T3_DIV_BY_1 0
#define T3_DIV_BY_2 0x10
#define T3_DIV_BY_4 0x20
#define T3_DIV_BY_8 0x30
////////////////////////////////////////////////////////////////// Timer 4
// Timer 4 Functions: SETUP_TIMER_4, GET_TIMER4, SET_TIMER4
// Constants used for SETUP_TIMER_4() are:
#define T4_DISABLED 0
#define T4_DIV_BY_1 4
#define T4_DIV_BY_4 5
#define T4_DIV_BY_16 6
////////////////////////////////////////////////////////////////// CCP
// CCP Functions: SETUP_CCPx, SET_PWMx_DUTY
// CCP Variables: CCP_x, CCP_x_LOW, CCP_x_HIGH
// Constants used for SETUP_CCPx() are:
#define CCP_OFF 0
#define CCP_CAPTURE_FE 4
#define CCP_CAPTURE_RE 5
#define CCP_CAPTURE_DIV_4 6
#define CCP_CAPTURE_DIV_16 7
#define CCP_COMPARE_SET_ON_MATCH 8
#define CCP_COMPARE_CLR_ON_MATCH 9
#define CCP_COMPARE_INT 0xA
#define CCP_COMPARE_INT_AND_TOGGLE 0x2
#define CCP_COMPARE_RESET_TIMER 0xB
#define CCP_PWM 0xC
#define CCP_PWM_PLUS_1 0x1c
#define CCP_PWM_PLUS_2 0x2c
#define CCP_PWM_PLUS_3 0x3c
#define CCP_USE_TIMER3 0x100
long CCP_1;
#byte CCP_1 = 0xfbe
#byte CCP_1_LOW= 0xfbe
#byte CCP_1_HIGH= 0xfbf
long CCP_2;
#byte CCP_2 = 0xfbb
#byte CCP_2_LOW= 0xfbb
#byte CCP_2_HIGH= 0xfbc
long CCP_3;
#byte CCP_3 = 0xfb8
#byte CCP_3_LOW= 0xfb8
#byte CCP_3_HIGH= 0xfb9
long CCP_4;
#byte CCP_4 = 0xf74
#byte CCP_4_LOW= 0xf74
#byte CCP_4_HIGH= 0xf75
long CCP_5;
#byte CCP_5 = 0xf71
#byte CCP_5_LOW= 0xf71
#byte CCP_5_HIGH= 0xf72
// The following should be used with a call to SETUP_TIMER_3 (or one of these in)
#define T3_CCP1_TO_5 0x48
#define T3_CCP2_TO_5 0x8
#define T3_CCP3_TO_5 0x40
////////////////////////////////////////////////////////////////// PSP
// PSP Functions: SETUP_PSP, PSP_INPUT_FULL(), PSP_OUTPUT_FULL(),
// PSP_OVERFLOW(), INPUT_D(), OUTPUT_D()
// PSP Variables: PSP_DATA
// Constants used in SETUP_PSP() are:
#define PSP_ENABLED 0x10
#define PSP_DISABLED 0
#byte PSP_DATA= 0xF83
////////////////////////////////////////////////////////////////// SPI
// SPI Functions: SETUP_SPI, SPI_WRITE, SPI_READ, SPI_DATA_IN
// Constants used in SETUP_SSP() are:
#define SPI_MASTER 0x20
#define SPI_SLAVE 0x24
#define SPI_L_TO_H 0
#define SPI_H_TO_L 0x10
#define SPI_CLK_DIV_4 0
#define SPI_CLK_DIV_16 1
#define SPI_CLK_DIV_64 2
#define SPI_CLK_T2 3
#define SPI_SS_DISABLED 1
#define SPI_SAMPLE_AT_END 0x8000
#define SPI_XMIT_L_TO_H 0x4000
////////////////////////////////////////////////////////////////// UART
// Constants used in setup_uart() are:
// FALSE - Turn UART off
// TRUE - Turn UART on
#define UART_ADDRESS 2
#define UART_DATA 4
////////////////////////////////////////////////////////////////// COMP
// Comparator Variables: C1OUT, C2OUT
// Constants used in setup_comparators() are:
#define F6_F5_F4_F5 0x70ff04
#define F6_F5_F4_F3_OUT_ON_F2_F1 0x78F903
#define F6_F5_F4_F5_OUT_ON_F2_F1 0x70F905
#define NC_NC_NC_NC 0x00ff07
#define F6_F5_F4_F3 0x78ff02
#define F6_F5_NC_NC_OUT_ON_F2 0x60FB01
#define F6_VR_F4_VR 0x50ff06
#define F5_VR_F3_VR 0x28ff0e
#bit C1OUT = 0xfb4.6
#bit C2OUT = 0xfb4.7
////////////////////////////////////////////////////////////////// VREF
// Constants used in setup_vref() are:
//
#define VREF_LOW 0xa0
#define VREF_HIGH 0x80
// Or (with |) the above with a number 0-15
#define VREF_F5 0x40
#define VREF_COMP 0x10
////////////////////////////////////////////////////////////////// VREF
// Constants used in setup_low_volt_detect() are:
//
#define LVD_LVDIN 0x1F
#define LVD_45 0x1E
#define LVD_42 0x1D
#define LVD_40 0x1C
#define LVD_38 0x1B
#define LVD_36 0x1A
#define LVD_35 0x19
#define LVD_33 0x18
#define LVD_30 0x17
#define LVD_28 0x16
#define LVD_27 0x15
#define LVD_25 0x14
#define LVD_23 0x13
#define LVD_21 0x12
#define LVD_19 0x11
////////////////////////////////////////////////////////////////// INTERNAL RC
// Constants used in setup_oscillator() are:
#define OSC_TIMER1 1
#define OSC_NORMAL 0
////////////////////////////////////////////////////////////////// EXT MEM
// External Memory Functions: SETUP_EXTERNAL_MEMORY(), READ_EXTERNAL_MEMORY(),
// WRITE_EXTERNAL_MEMORY()
//
// Constants used in SETUP_EXTERNAL_MEMORY() are:
#define EXTMEM_BYTE_WRITE 0x80
#define EXTMEM_BYTE_SELECT 0x81
#define EXTMEM_WORD_WRITE 0x82
#define EXTMEM_DISABLE 0
// Use one of the above and optionaly OR in one of:
#define EXTMEM_WAIT_0 0x30
#define EXTMEM_WAIT_1 0x20
#define EXTMEM_WAIT_2 0x10
#define EXTMEM_WAIT_3 0x00 // Default
////////////////////////////////////////////////////////////////// ADC
// ADC Functions: SETUP_ADC(), SETUP_ADC_PORTS() (aka SETUP_PORT_A),
// SET_ADC_CHANNEL(), READ_ADC()
// Constants used for SETUP_ADC() are:
#define ADC_OFF 0 // ADC Off
#define ADC_CLOCK_DIV_2 0x100
#define ADC_CLOCK_DIV_4 0x04
#define ADC_CLOCK_DIV_8 0x01
#define ADC_CLOCK_DIV_16 0x05
#define ADC_CLOCK_DIV_32 0x02
#define ADC_CLOCK_DIV_64 0x06
#define ADC_CLOCK_INTERNAL 0x07 // Internal 2-6us
// Constants used in SETUP_ADC_PORTS() are:
#define NO_ANALOGS 0x0F // None
#define ALL_ANALOG 0x00 // A0 A1 A2 A3 A5 F0 F1 F2 F3 F4 F5 F6 H4 H5 H6 H7
#define AN0_TO_AN13 0x01 // A0 A1 A2 A3 A5 F0 F1 F2 F3 F4 F5 F6 H4 H5
#define AN0_TO_AN12 0x02 // A0 A1 A2 A3 A5 F0 F1 F2 F3 F4 F5 F6 H4
#define AN0_TO_AN11 0x03 // A0 A1 A2 A3 A5 F0 F1 F2 F3 F4 F5 F6
#define AN0_TO_AN10 0x04 // A0 A1 A2 A3 A5 F0 F1 F2 F3 F4 F5
#define AN0_TO_AN9 0x05 // A0 A1 A2 A3 A5 F0 F1 F2 F3 F4
#define AN0_TO_AN8 0x06 // A0 A1 A2 A3 A5 F0 F1 F2 F3
#define AN0_TO_AN7 0x07 // A0 A1 A2 A3 A5 F0 F1 F2
#define AN0_TO_AN6 0x08 // A0 A1 A2 A3 A5 F0 F1
#define AN0_TO_AN5 0x09 // A0 A1 A2 A3 A5 F0
#define AN0_TO_AN4 0x0A // A0 A1 A2 A3 A5
#define AN0_TO_AN3 0x0B // A0 A1 A2 A3
#define AN0_TO_AN2 0x0C // A0 A1 A2
#define AN0_TO_AN1 0x0D // A0 A1
#define AN0 0x0E // A0
#define ANALOG_AN0_TO_AN13 0x01 //!old only provided for compatibility
#define ANALOG_AN0_TO_AN12 0x02 //!old only provided for compatibility
#define ANALOG_AN0_TO_AN11 0x03 //!old only provided for compatibility
#define ANALOG_AN0_TO_AN10 0x04 //!old only provided for compatibility
#define ANALOG_AN0_TO_AN9 0x05 //!old only provided for compatibility
#define ANALOG_AN0_TO_AN8 0x06 //!old only provided for compatibility
#define ANALOG_AN0_TO_AN7 0x07 //!old only provided for compatibility
#define ANALOG_AN0_TO_AN6 0x08 //!old only provided for compatibility
#define ANALOG_AN0_TO_AN5 0x09 //!old only provided for compatibility
#define ANALOG_AN0_TO_AN4 0x0A //!old only provided for compatibility
#define ANALOG_AN0_TO_AN3 0x0B //!old only provided for compatibility
#define ANALOG_AN0_TO_AN2 0x0C //!old only provided for compatibility
#define ANALOG_AN0_TO_AN1 0x0D //!old only provided for compatibility
#define ANALOG_AN0 0x0E //!old only provided for compatibility
// The following may be OR'ed in with the above using |
#define VSS_VDD 0x00 // Range 0-Vdd
#define VREF_VREF 0x30 // Range VrefL-VrefH
#define VREF_VDD 0x20 // Range VrefL-Vdd
#define VSS_VREF 0x10 // Range 0-VrefH
// Constants used in READ_ADC() are:
#define ADC_START_AND_READ 7 // This is the default if nothing is specified
#define ADC_START_ONLY 1
#define ADC_READ_ONLY 6
////////////////////////////////////////////////////////////////// INT
// Interrupt Functions: ENABLE_INTERRUPTS(), DISABLE_INTERRUPTS(),
// EXT_INT_EDGE()
//
// Constants used in EXT_INT_EDGE() are:
#define L_TO_H 0x40
#define H_TO_L 0
// Constants used in ENABLE/DISABLE_INTERRUPTS() are:
#define GLOBAL 0xF2C0
#define INT_RTCC 0xF220
#define INT_TIMER0 0xF220
#define INT_TIMER1 0x9D01
#define INT_TIMER2 0x9D02
#define INT_TIMER3 0xA002
#define INT_EXT 0xF210
#define INT_EXT1 0xF008
#define INT_EXT2 0xF010
#define INT_EXT3 0xF020
#define INT_RB 0xF208
#define INT_PSP 0x9D80
#define INT_AD 0x9D40
#define INT_RDA 0x9D20
#define INT_TBE 0x9D10
#define INT_SSP 0x9D08
#define INT_CCP1 0x9D04
#define INT_CCP2 0xA001
#define INT_BUSCOL 0xA008
#define INT_LOWVOLT 0xA004
#define INT_COMP 0xA040
#define INT_EEPROM 0xA010
#define INT_RDA2 0xA320
#define INT_TBE2 0xA310
#define INT_TIMER4 0xA308
#define INT_CCP3 0xA301
#define INT_CCP4 0xA302
#define INT_CCP5 0xA304
#list |
Last edited by alwaysfresh on Thu Jul 07, 2005 1:46 pm; edited 3 times in total |
|
|
|
|
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
|