/* * Header file for the Microchip * PIC 16c84 chip * PIC 16f84 chip * PIC 16cr84 chip * Midrange Microcontrollers */ static unsigned char RTCC @ 0x01; static unsigned char TMR0 @ 0x01; static unsigned char PCL @ 0x02; static unsigned char STATUS @ 0x03; static unsigned char FSR @ 0x04; static unsigned char PORTA @ 0x05; static unsigned char PORTB @ 0x06; static unsigned char EEDATA @ 0x08; static unsigned char EEADR @ 0x09; static unsigned char PCLATH @ 0x0A; static unsigned char INTCON @ 0x0B; static unsigned char bank1 OPTION @ 0x81; static unsigned char bank1 TRISA @ 0x85; static unsigned char bank1 TRISB @ 0x86; static unsigned char bank1 EECON1 @ 0x88; static unsigned char bank1 EECON2 @ 0x89; /* STATUS bits */ static bit RP0 @ (unsigned)&STATUS*8+5; static bit TO @ (unsigned)&STATUS*8+4; static bit PD @ (unsigned)&STATUS*8+3; /* INTCON bits */ static bit GIE @ (unsigned)&INTCON*8+7; static bit EEIE @ (unsigned)&INTCON*8+6; static bit T0IE @ (unsigned)&INTCON*8+5; static bit INTE @ (unsigned)&INTCON*8+4; static bit RBIE @ (unsigned)&INTCON*8+3; static bit T0IF @ (unsigned)&INTCON*8+2; static bit INTF @ (unsigned)&INTCON*8+1; static bit RBIF @ (unsigned)&INTCON*8+0; /* OPTION bits */ static bit RBPU @ (unsigned)&OPTION*8+7; static bit INTEDG @ (unsigned)&OPTION*8+6; static bit T0CS @ (unsigned)&OPTION*8+5; static bit T0SE @ (unsigned)&OPTION*8+4; static bit PSA @ (unsigned)&OPTION*8+3; static bit PS2 @ (unsigned)&OPTION*8+2; static bit PS1 @ (unsigned)&OPTION*8+1; static bit PS0 @ (unsigned)&OPTION*8+0; /* EECON1 bits */ static bit EEIF @ (unsigned)&EECON1*8+4; static bit WRERR @ (unsigned)&EECON1*8+3; static bit WREN @ (unsigned)&EECON1*8+2; static bit WR @ (unsigned)&EECON1*8+1; static bit RD @ (unsigned)&EECON1*8+0; /* macro versions of EEPROM write and read */ #define EEPROM_WRITE_0(addr, value) while(WR)continue;EEADR=(addr);EEDATA=(value);GIE=0;WREN=1;\ EECON2=0X55;EECON2=0XAA;WR=1;WREN=0 /*-ne ustreza!!!*/ #define EEPROM_READ_0(addr) ((EEADR=(addr)),(RD=1),EEDATA) /* library function versions */ extern void eeprom_write(unsigned char addr, unsigned char value); extern unsigned char eeprom_read(unsigned char addr); /* makroji za EEPROM, write ne dela dobro */ #define EEPROM_WRITE(addr, value) EEADR=(addr);EEDATA=(value);RP0=1;WREN=1;GIE=0;\ EECON2=0x55;EECON2=0xAA;RP0=1;WR=1;GIE=1;while(WR)continue;WREN=0;RP0=0 /* popravjeno S.Murko pa çe zmerom ne gre*/ #define EEPROM_READ(addr) ((EEADR=(addr)),(RP0=1),(RD=1),(RP0=0),EEDATA) /* popravjeno S.Murko pa deluje*/ #define CONFIG_ADDR 0x2007 #define FOSC0 0x01 #define FOSC1 0x02 #define WDTE 0x04 #define PWRTE 0x08 #define CP 0x10 /* konstante za CONFIG prepisane iz MPASM S.Murko 26.12.97 */ #define _CP_ON 3FEFh #define _CP_OFF 3FFFh #define _PWRTE_ON 3FFFh #define _PWRTE_OFF 3FF7h #define _WDT_ON 3FFFh #define _WDT_OFF 3FFBh #define _LP_OSC 3FFCh #define _XT_OSC 3FFDh #define _HS_OSC 3FFEh #define _RC_OSC 3FFFh