資源簡介
韓國ADS的,常用觸摸按鍵芯片TSM12方案,主要用在市面上常用的12鍵的門鎖
代碼片段和文件信息
#include? /*?special?function?register?declarations???*/
/*?for?the?intended?8051?derivative?????????*/
#include? /*?prototype?declarations?for?I/O?functions?*/
#ifdef?MONITOR51 /*?Debugging?with?Monitor-51?needs???*/
char?code?reserve?[3]?_at_?0x23; /*?space?for?serial?interrupt?if?????*/
#endif /*?Stop?Exection?with?Serial?Intr.???*/
/*?is?enabled????????????????????????*/
#define?READ????0 /*?Read?*/
#define?WRITE???1 /*?Write?*/
#define?FALSE 0 /*?False?*/
#define?TRUE 1 /*?True?*/
#define?LOW FALSE /*?Low?status?of?I2c?Line?*/
#define?HIGH TRUE /*?High?status?of?I2c?Line?*/
#define?SDA 0x01 /*?SDA?Line?*/
#define?SDAHIGH HIGH /*?High?status?of?SDA?*/
#define?SDALOW LOW /*?Low?status?of?SDA?*/
#define?SCL 0x02 /*?SCL?Line?*/
#define?SCLHIGH HIGH /*?High?status?of?SCL?*/
#define?SCLLOW LOW /*?Low?status?of?SCL?*/
#define?ACK 0x04 /*?Ack?Line?*/
sbit SCLP?= P1^0;
sbit? ISDAP?= P1^1;
sbit? OSDAP?= P1^1;
sbit SINT?= P1^2;
sbit i2c_en?= P1^3;
sbit i2c_imp?= P1^4;
//sbit I2C_MODE?= P1^5;
sbit RST?= P1^5;
sbit LED1?=?P0^0;
sbit LED2?=?P0^1;
sbit LED3?=?P0^2;
sbit LED4?=?P0^3;
sbit LED5?=?P0^4;
sbit LED6?=?P0^5;
sbit LED7?=?P0^6;
sbit LED8?=?P0^7;
sbit LED9?=?P2^0;
sbit LED10?=?P2^1;
sbit LED11?=?P2^2;
sbit LED12?=?P2^3;
void?I2c_Read(void);
void?I2c_Write(void);
void?I2c_Start(void);
void?I2c_Stop(void);
void?serial_send(void);
void?nop(void);
void?Noise_State(void);
void?TSM12_Init(void);
void?Go_sleep_mode(void);
void?Exit_sleep_mode(void);
void?Delay(unsigned?char?delay_time);
unsigned?char?reg_w_data[8];
unsigned?char?reg_r_data[22];
unsigned?char?serial_buffer;
unsigned?char?NbData;
unsigned?char?i=0;
unsigned?char?ack;
unsigned?char?hex_buff;
unsigned?char?hex_high;
unsigned?char?hex_low;
unsigned?char?nop_loop;
unsigned?char?WAddress;
unsigned?char?RAddress;
unsigned?char?timer_1ms_flag;
unsigned?int??timer_60s_count;
unsigned?char?timer_1ms_flag_backup;
unsigned?char?sleep_flag;
unsigned?char?interrupt_bit;
char?bdata byte_wr_data;
sbit? byte_wr_data_0?=?byte_wr_data?^?0;
sbit? byte_wr_data_1?=?byte_wr_data?^?1;
sbit? byte_wr_data_2?=?byte_wr_data?^?2;
sbit? byte_wr_data_3?=?byte_wr_data?^?3;
sbit? byte_wr_data_4?=?byte_wr_data?^?4;
sbit? byte_wr_data_5?=?byte_wr_data?^?5;
sbit? byte_wr_data_6?=?byte_wr_data?^?6;
sbit? byte_wr_data_7?=?byte_wr_data?^?7;
char?bdata byte_rd_data;
sbit? byte_rd_data_0?=?byte_rd_data?^?0;
sbit? byte_rd_data_1?=?byte_rd_data?^?1;
sbit? byte_rd_data_2?=?byte_rd_data?^?2;
sbit? byte_rd_data_3?=?byte_rd_data?^?3;
sbit? byte_rd_data_4?=?byte_rd_data?^?4;
sbit? byte_rd_data_5?=?byte_rd_data?^?5;
sbit? byte_rd_data_6?=?byte_rd_data?^?6;
sbit? byte_rd_data_7?=?byte_rd_data?^?7;
char?bdata cmd_bit;
sbit cmd_start?=?cmd_bit?^?0;
sbit cmd_rw?=?cmd_bit?^?1;
sbit cmd_r?=?cmd_bit?^?2;
sbit cmd_
評論
共有 條評論