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
|
/*
* Copyright (c) 2004 Deva Seetharam deva@alum.mit.edu
* All rights reserved.
* Copyright (c) 1996 Tommaso Cucinotta, Alessandro Evangelista, Luigi Rizzo
* All rights reserved.
*
* Dip. di Ingegneria dell'Informazione, Universita of Pisa,
* via Diotisalvi 2 -- 56126 Pisa.
* email: simulpic@iet.unipi.it
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by
* Tommaso Cucinotta, Alessandro Evangelista and Luigi Rizzo
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/***
*** pictype.h
***
*** contains specific parameters for the pic type
***
*** This is for the Microchip PIC 16F84
***/
#ifndef _PICTYPE
#define _PICTYPE
#define PROGMEM_SIZE 1024
#define EEPROM_SIZE 64
#define EEPROM_BASE 0x2100 /* in the hex file... */
#define ALLMEM_SIZE (EEPROM_BASE + EEPROM_SIZE)
#define STACK_SIZE 8
#define GENERAL_PURPOSE_REGISTERS 68
#define RAM_BEGIN 0x0C
#define RAM_END 0x4F
#define NO_MEM_LOADED 0
#define MEM_LOADED 1
#define f_RTCC 0x01
#define f_PCL 0x02
#define f_STATUS 0x03
#define f_FSR 0x04
#define f_PORTA 0x05
#define f_PORTB 0x06
#define f_EEDATA 0x08
#define f_EEADR 0x09
#define f_PCLATH 0x0A
#define f_INTCON 0x0B
#define f_OPTION 0x81
#define f_TRISA 0x85
#define f_TRISB 0x86
#define f_EECON1 0x88
#define f_EECON2 0x89
#define STATUS_IRP 0x07
#define STATUS_RP1 0x06
#define STATUS_RP0 0x05
#define STATUS_TO 0x04
#define STATUS_PD 0x03
#define STATUS_Z 0x02
#define STATUS_DC 0x01
#define STATUS_C 0x00
#define INTCON_GIE 0x07
#define INTCON_EEIE 0x06
#define INTCON_RTIE 0x05
#define INTCON_INTE 0x04
#define INTCON_RBIE 0x03
#define INTCON_RTIF 0x02
#define INTCON_INTF 0x01
#define INTCON_RBIF 0x00
#define OPTION_RBPU 7
#define OPTION_INTEDG 6
#define OPTION_RTS 5
#define OPTION_RTE 4
#define OPTION_PSA 3
#define EECON1_EEIF 4
#define EECON1_WRERR 3
#define EECON1_WREN 2
#define EECON1_WR 1
#define EECON1_RD 0
#define S_MASK_IRP 0x80
#define S_MASK_RP1 0x40
#define S_MASK_RP0 0x20
#define S_MASK_TO 0x10
#define S_MASK_PD 0x08
#define S_MASK_Z 0x04
#define S_MASK_DC 0x02
#define S_MASK_C 0x01
#define I_MASK_GIE 0x80
#define I_MASK_EEIE 0x40
#define I_MASK_RTIE 0x20
#define I_MASK_INTE 0x10
#define I_MASK_RBIE 0x08
#define I_MASK_RTIF 0x04
#define I_MASK_INTF 0x02
#define I_MASK_RBIF 0x01
#define OPT_MASK_RBPU 0x80
#define OPT_MASK_INTEDG 0x40
#define OPT_MASK_RTS 0x20
#define OPT_MASK_RTE 0x10
#define OPT_MASK_PSA 0x08
#define OPT_MASK_PS2 0x04
#define OPT_MASK_PS1 0x02
#define OPT_MASK_PS0 0x01
typedef unsigned char TByte;
typedef unsigned short TWord;
typedef unsigned char TRegister; /* 8 bit */
typedef unsigned short TData_Address; /* 16 bit */
typedef unsigned short TProgram_Address; /* 13 bit */
typedef unsigned char TEEPROM_Address; /* 7 bit */
typedef unsigned short TOp_Code; /* 14 bit */
typedef unsigned char TBit_Address; /* 3 bit */
typedef enum { _f , _W } TDestination;
typedef enum { IN_0, IN_1, OUT } TPin_State;
typedef struct {
TPin_State MCLR, RA[5], RB[8];
} TInput_State;
typedef int TBool; /* ==0:False; !=0:True */
#define FALSE 0
#define TRUE 1
typedef char* TString;
#endif
|