00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef _TEMP36_H_
00013 #define _TEMP36_H_
00014
00015
00016 struct {
00017 unsigned long SerialN;
00018 unsigned int error;
00019 unsigned char control;
00020 unsigned char status;
00021 unsigned char eepage;
00022 unsigned int navge;
00023 unsigned char terror[5];
00024 float Temp[36];
00025 float ref;
00026 float AT[36];
00027 unsigned long eepValue;
00028 long eeCtrSet;
00029 float SHTtemp1;
00030 float SHThumi1;
00031 float SHTtemp2;
00032 float SHThumi2;
00033 unsigned int DAC[8];
00034 } xdata user_data;
00035
00036
00037
00038 #define SST_LINE1 1
00039 #define SST_LINE2 2
00040
00041 unsigned char xdata ADT7486A_addrArray[] = {0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50};
00042
00043
00044 unsigned char xdata Terrorclear[]={0xFE, 0xFD, 0xFB, 0xF7, 0xEF, 0xDF, 0xBF, 0x7F};
00045
00046
00047 unsigned char xdata Terrorset[]={0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
00048 #define TAVGMAX (int) 30
00049 float xdata Taverage[36][TAVGMAX];
00050
00051
00052 unsigned int xdata PageAddr[]={0x000, 0x200, 0x400, 0x600};
00053 #define SERIALN_LENGTH 4
00054 #define SERIALN_ADD (PageAddr[3]) // Fixed as sitting at the first byte of the EEPROM
00055
00056
00057 struct EEPAGE {
00058 unsigned long SerialN;
00059 unsigned int structsze;
00060 unsigned int navge;
00061 int ext1offset[18];
00062 int ext2offset[18];
00063 };
00064
00065
00066
00067 struct EEPAGE xdata eepage={
00068
00069 0x00000000
00070
00071 , 110
00072
00073 , 10
00074
00075
00076 , 32, 48, 32, 32, 16, 16, 48, 16, 0, 16, 0, 0, 16, 32, 16, 32, -16, 32
00077
00078
00079
00080 , 48, 32, 48, 64, 64, 32, 48, 64, 0, 16, 16, 32, 48, 48, 32, 32, 16, 32
00081 };
00082
00083 #define PAGE_SIZE sizeof(eepage) // Macro
00084
00085
00086
00087 #define EEP_CTRL_KEY 0x3C000000
00088 #define EEP_CTRL_READ 0x00110000
00089 #define EEP_CTRL_WRITE 0x00220000
00090 #define EEP_CTRL_INVAL_REQ 0xff000000
00091 #define EEP_CTRL_INVAL_KEY 0x00ff0000
00092 #define EEP_CTRL_OFF_RANGE 0x0000ff00
00093 #define PAGE_SIZE sizeof(eepage)
00094 #define TEMPOFF_LAST_INDX 36
00095 #define EEP_RW_IDX 4
00096
00097
00098 #define humsen1 1
00099 #define humsen2 2
00100 sbit SHT_GND1=P1^2;
00101 sbit SHT_VDD1=P1^1;
00102 sbit SHT_GND2=P3^2;
00103 sbit SHT_VDD2=P3^1;
00104
00105
00106 #define First_DACIndex 90
00107 #define Last_DACIndex 97
00108
00109
00110
00111 unsigned char bdata rCTL;
00112 sbit Cref = rCTL ^ 1;
00113 sbit CHum = rCTL ^ 2;
00114 sbit CeeS = rCTL ^ 4;
00115 sbit CeeR = rCTL ^ 5;
00116 sbit CeeClr = rCTL ^ 6;
00117
00118
00119 unsigned char bdata rCSR;
00120 sbit Sref = rCSR ^ 1;
00121 sbit SeeS = rCSR ^ 4;
00122 sbit SeeR = rCSR ^ 5;
00123
00124
00125
00126
00127
00128 unsigned int bdata rESR;
00129 sbit err1 = rESR ^ 8;
00130 sbit err2 = rESR ^ 9;
00131 sbit err3 = rESR ^ 10;
00132 sbit err4 = rESR ^ 11;
00133
00134 sbit err5 = rESR ^ 12;
00135 sbit err6 = rESR ^ 13;
00136 sbit err7 = rESR ^ 14;
00137 sbit err8 = rESR ^ 15;
00138
00139 sbit uCT = rESR ^ 0;
00140 sbit err10 = rESR ^ 1;
00141 sbit err11 = rESR ^ 2;
00142 sbit err12 = rESR ^ 3;
00143
00144 sbit RdssT = rESR ^ 4;
00145 sbit EEPROM = rESR ^ 5;
00146 sbit err15 = rESR ^ 6;
00147 sbit err16 = rESR ^ 7;
00148
00149
00150
00151 #define IDXEER 1
00152 #define IDXCTL 2
00153 #define IDXNAVG 5
00154 #define IDXREF 47
00155 #define IDXEEP_CTL 85
00156
00157
00158 #define DONE 1
00159 #define FAILED 0
00160 #define SET 1
00161 #define CLEAR 0
00162 #endif
00163
00164
00165