心得体会:研究了好几天,终于搞定了,主要是DS1990手册上面的bit发送和接收低前高后没有写清楚;时序基本按照手册就可以了。
头文件的定义
#define TM_Read_ROM 0x33
#define TM_Search_ROM 0xF0
#define TM_Match_ROM 0x55
#define TM_Skip_ROM 0xCC
#define ibottom_low PORT_ResetBits(PortA,Pin09)
#define ibottom_high PORT_SetBits(PortA,Pin09)
#define ibottom_input PORT_GetBit(PortA,Pin09)
typedef enum
{ Bit_RESET = 0,
Bit_SET
}BitAction;
typedef struct
{
u8 Family_Code;
u8 Serial_Number[6];
u8 crc;
}IBottom_Typedef;
变量定义
u8 Byte_buf[8]={0};
IBottom_Typedef ibottom_sn={0};
/*****************************************************************************
函 数 名: TM_GPIO_Configuration
功能描述: TM钥匙的GPIO配置
输入输出:
修改时间:2022年9月21日
修改记录:
*****************************************************************************/
void TM_GPIO_Configuration(void)
{
stc_port_init_t stcPortInit;
MEM_ZERO_STRUCT(stcPortInit);
stcPortInit.enPinMode = Pin_Mode_Out;
stcPortInit.enExInt = Enable;
stcPortInit.enPullUp = Enable;
PORT_Init(PortA, Pin10, &stcPortInit);
data_output_set();
ibottom_high;
TM_LED_OFF;
}
/******************