上传文件至 /
This commit is contained in:
164
temperature.h
Normal file
164
temperature.h
Normal file
@@ -0,0 +1,164 @@
|
||||
#ifndef _TEMPERATURE_H_
|
||||
#define _TEMPERATURE_H_
|
||||
|
||||
#include "MAIN.H"
|
||||
|
||||
|
||||
#define DQ P3_5
|
||||
|
||||
///*Bit definition of config register*/
|
||||
#define CFG_CLKSTRETCH_Mask 0x20
|
||||
#define CFG_MPS_Mask 0x1C
|
||||
#define CFG_Repeatbility_Mask 0x03
|
||||
|
||||
#define CFG_ClkStreatch_Disable (0x00 << 5)
|
||||
#define CFG_ClkStreatch_Enable (0x01 << 5)
|
||||
|
||||
#define CFG_MPS_Single 0x00
|
||||
#define CFG_MPS_Half 0x04
|
||||
#define CFG_MPS_1 0x08
|
||||
#define CFG_MPS_2 0x0C
|
||||
#define CFG_MPS_4 0x10
|
||||
#define CFG_MPS_10 0x14
|
||||
|
||||
#define CFG_Repeatbility_Low 0x00
|
||||
#define CFG_Repeatbility_Medium 0x01
|
||||
#define CFG_Repeatbility_High 0x02
|
||||
|
||||
|
||||
#define MAXNUM 5 /*<2A><><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>оƬ<D0BE><C6AC><EFBFBD><EFBFBD>*/
|
||||
|
||||
typedef enum {
|
||||
FALSE = 0,
|
||||
TRUE = !FALSE
|
||||
} BOOL;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char Tha_set_lsb;
|
||||
char Tla_set_lsb;
|
||||
ubyte Cfg; /*ϵͳ<CFB5><CDB3><EFBFBD>üĴ<C3BC><C4B4><EFBFBD>, RW*/
|
||||
} M601_SCRATCHPAD_WRITE;
|
||||
|
||||
|
||||
/* M601/01 ow Commands-------------------------------------------------------*/
|
||||
typedef enum
|
||||
{
|
||||
//ROM command
|
||||
SKIP_ROM = 0xcc,
|
||||
READ_ROM = 0x33,
|
||||
MATCH_ROM = 0x55,
|
||||
SEARCH_ROM = 0xf0,
|
||||
ALARM_SEARCH = 0xec,
|
||||
//Function command
|
||||
CONVERT_T = 0x44,
|
||||
READ_SCRATCHPAD = 0xbe,
|
||||
WRITE_SCRATCHPAD = 0x4e,
|
||||
} M601_OW_CMD;
|
||||
|
||||
|
||||
|
||||
|
||||
/****************** Scratchpad/SRAM ******************/
|
||||
/*SRAM scratchpad*/
|
||||
typedef struct
|
||||
{
|
||||
ubyte T_lsb; /*The LSB of <20>¶Ƚ<C2B6><C8BD><EFBFBD>, RO*/
|
||||
ubyte T_msb; /*The MSB of <20>¶Ƚ<C2B6><C8BD><EFBFBD>, RO*/
|
||||
ubyte C1_lsb; /*The LSB of <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>C1, RO*/
|
||||
ubyte C1_msb; /*The MSB of <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>C1, Ro*/
|
||||
ubyte Tha_set_lsb;
|
||||
ubyte Tla_set_lsb;
|
||||
ubyte Cfg; /*ϵͳ<CFB5><CDB3><EFBFBD>üĴ<C3BC><C4B4><EFBFBD>, RW*/
|
||||
ubyte Status; /*ϵͳ״̬<D7B4>Ĵ<EFBFBD><C4B4><EFBFBD>, RO*/
|
||||
ubyte crc_scr; /*CRC for byte0-7, RO*/
|
||||
} M601_SCRATCHPAD_READ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//20250116 <20><><EFBFBD><EFBFBD><EFBFBD>¶Ȳɼ<C8B2><C9BC>ֽ<EFBFBD>
|
||||
typedef struct _StrSwSample
|
||||
{
|
||||
unsigned int emergency_stop_switch : 1; // ͨ<><CDA8>1<EFBFBD><31><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>
|
||||
unsigned int High_voltage_switch : 1; // ͨ<><CDA8>2<EFBFBD><32><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
|
||||
unsigned int CH03 : 1; // ͨ<><CDA8>3
|
||||
unsigned int CH04 : 1; // ͨ<><CDA8>4
|
||||
unsigned int CH05 : 1; // ͨ<><CDA8>5
|
||||
unsigned int CH06 : 1; // ͨ<><CDA8>6
|
||||
unsigned int CH07 : 1; // ͨ<><CDA8>7
|
||||
unsigned int CH08 : 1; // ͨ<><CDA8>8
|
||||
unsigned int CH09 : 1; // ͨ<><CDA8>9
|
||||
unsigned int CH10 : 1; // ͨ<><CDA8>10
|
||||
unsigned int CH11 : 1; // ͨ<><CDA8>11
|
||||
unsigned int CH12 : 1; // ͨ<><CDA8>12
|
||||
unsigned int CH13 : 1; // ͨ<><CDA8>13
|
||||
unsigned int CH14 : 1; // ͨ<><CDA8>14
|
||||
unsigned int CH15 : 1; // ͨ<><CDA8>15
|
||||
unsigned int CH16 : 1; // ͨ<><CDA8>16
|
||||
unsigned int CH17 : 1; // ͨ<><CDA8>17
|
||||
unsigned int CH18 : 1; // ͨ<><CDA8>18
|
||||
unsigned int CH19 : 1; // ͨ<><CDA8>19
|
||||
unsigned int CH20 : 1; // ͨ<><CDA8>20
|
||||
unsigned int CH21 : 1; // ͨ<><CDA8>21
|
||||
unsigned int CH22 : 1; // ͨ<><CDA8>22
|
||||
unsigned int CH23 : 1; // ͨ<><CDA8>23
|
||||
unsigned int CH24 : 1; // ͨ<><CDA8>24
|
||||
unsigned int CH25 : 1; // ͨ<><CDA8>25
|
||||
unsigned int CH26 : 1; // ͨ<><CDA8>26
|
||||
unsigned int CH27 : 1; // ͨ<><CDA8>27
|
||||
unsigned int CH28 : 1; // ͨ<><CDA8>28
|
||||
unsigned int CH29 : 1; // ͨ<><CDA8>29
|
||||
unsigned int CH30 : 1; // ͨ<><CDA8>30
|
||||
unsigned int CH31 : 1; // ͨ<><CDA8>31
|
||||
unsigned int CH32 : 1; // ͨ<><CDA8>32
|
||||
|
||||
// unsigned int CH33 : 1; // ͨ<><CDA8>33
|
||||
// unsigned int CH34 : 1; // ͨ<><CDA8>34
|
||||
// unsigned int CH35 : 1; // ͨ<><CDA8>35
|
||||
// unsigned int CH36 : 1; // ͨ<><CDA8>36
|
||||
// unsigned int CH37 : 1; // ͨ<><CDA8>37
|
||||
// unsigned int CH38 : 1; // ͨ<><CDA8>38
|
||||
// unsigned int CH39 : 1; // ͨ<><CDA8>39
|
||||
// unsigned int CH40 : 1; // ͨ<><CDA8>40
|
||||
// unsigned int CH41 : 1; // ͨ<><CDA8>41
|
||||
// unsigned int CH42 : 1; // ͨ<><CDA8>42
|
||||
// unsigned int CH43 : 1; // ͨ<><CDA8>43
|
||||
// unsigned int CH44 : 1; // ͨ<><CDA8>44
|
||||
// unsigned int reserve : 4;
|
||||
|
||||
unsigned int temperature[2]; // <20>¶<EFBFBD>
|
||||
|
||||
} StrSwSample;
|
||||
|
||||
typedef union _UnSwSample
|
||||
{
|
||||
StrSwSample bit_data; // ʹ<>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>Ľṹ<C4BD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char arr[sizeof(StrSwSample)]; // ͨ<><CDA8><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>С
|
||||
} UnSwSample;
|
||||
|
||||
|
||||
|
||||
|
||||
extern UnSwSample UnSwSample_1 ;
|
||||
|
||||
|
||||
|
||||
BOOL GetTemp(void);
|
||||
BOOL SetConfig(ubyte mps, ubyte repeatability);
|
||||
|
||||
|
||||
int Search_ROM(unsigned char(*romID)[8]);
|
||||
extern unsigned char romid[MAXNUM][8];
|
||||
extern int RomNum;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _TEMPERATURE_H_
|
||||
Reference in New Issue
Block a user