芯片破解单片机驱动ADS1115的程序
| 芯片破解#include <reg52.h> 芯片破解#include <intrins.h> sbit SCL=P1^0; //SCL sbit SDA=P1^1; //SDA sbit led0 = P1^2; sbit led1 = P1^3; unsigned char Initdata[4]={0}; code unsigned char seg7code[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff}; //不带小数点的共阳芯片破解数码管段码 code unsigned char seg7codeB[]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,0xff}; //带小数点的共阳芯片破解数码管段码 unsigned int date; unsigned char cnt; //******************延时子程序 ******************************* void delay(unsigned char i) { for(i;i>0;i--); } void delay1ms(unsigned char t) { unsigned char i; unsigned char j; for(i=124;i>0;i--); for(j=0;j<t;j++); } /****************************开始ADC通信*************************/ void StartADcom() { SDA =0; SCL=1; delay(100); SDA =1; delay(20); SDA =0; SCL=0; delay(10); } /***********************************停止ADC通信**************************************/ void StopADcom() { SDA=0; delay(10); SCL=1; delay(20); SDA=1; delay(10); } /********************************单字节I2C传输**************************************/ void Send_Byte(unsigned char byte) { unsigned char i; for(i=0;i<8;i++) { if((byte<<i)&0x80) SDA=1; else SDA=0; delay(5); SCL=1; delay(10); SCL=0; delay(10); } delay(5); SDA=1; delay(5); SCL=1; delay(10); SCL=0; delay(10); } /*************************读取一个字节*****************************/ unsigned char Read_Byte() { unsigned char temp=0; unsigned char i; for(i=0;i<8;i++) { temp=temp<<1; //shift left to receive next bit SCL=0; //set clock high delay(10); SCL=1; _nop_(); delay(5); if(SDA==1) //check if Data=high temp|=0x01; //yes - set bit high _nop_(); delay(10); } SCL=0; delay(5); SDA=0; delay(5); SCL=1; delay(20); SCL=0; delay(5); SDA=1; return temp; } /**************************配置ADC转换芯片*************************************/ void Confige1115(unsigned char channel_x) { unsigned char i=0; unsigned char a_channel; switch(channel_x) { case 1: a_channel=0x42; break; case 2: a_channel=0x52; break; case 3: a_channel=0x62; break; case 4: a_channel=0x72; break; default: break; } Initdata[0] =0x90; Initdata[1] =0x01; Initdata[2]=a_channel; Initdata[3] =0x83; SCL=1; StartADcom(); for(i=0;i<4;i++) { Send_Byte(Initdata[i]); delay(20); } StopADcom(); } |

芯片解密