芯片破解TM1650驱动数码管的STM程序
- 芯片破解#include "stm32f10x.h"
- 芯片破解#include "sys_conf.h"
- 芯片破解#include <stdio.h>
- void DelayXms(unsigned int count)
- {
- unsigned int i,j;
- for(i=0; i<count; i++)
- {
- //WatchDOG();
- for(j=0; j<7968; j++)
- {
- __NOP();
-
- }
-
- }
- }
- void DelayXus(unsigned int count)
- {
- unsigned int i,j;
- for(i=0; i<count; i++)
- {
- for(j=0; j<8; j++)
- {
- __NOP();
-
- }
-
- }
- }
- void IIC_Init(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10|GPIO_Pin_11;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
-
-
- }
- void SDA_IN(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
- GPIO_InitStructure.GPIO_Pin = IIC_SDA_PIN;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(IIC_SDA_PORT,&GPIO_InitStructure);
- }
- void SDA_OUT(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
- GPIO_InitStructure.GPIO_Pin = IIC_SDA_PIN;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(IIC_SDA_PORT,&GPIO_InitStructure);
- }
- /***************************************************************************
- - 功能描述:STM32f103 模拟IIC起始信号函数
- - 隶属模块:STM32 IIC操作
- - 函数属性:外部,使用户使用
- - 参数说明:无
- - 返回说明:无
- - 函数实现步骤:
- (1)首先将SDA配置为输出
- (2)在SCL为高电平期间,SDA有下降沿的变化
- ***************************************************************************/
- void IIC_Start(void)
- {
- SDA_OUT(); //sda线输出
- Set_IIC_SDA;
- Set_IIC_SCL;
- DelayXus(4);
- Clr_IIC_SDA;//START:when CLK is high,DATA change form high to low
- DelayXus(4);
- Clr_IIC_SCL;//钳住I2C总线,准备发送或接收数据
- }
- /***************************************************************************
- - 功能描述:STM32f103 模拟IIC终止信号函数
- - 隶属模块:STM32 IIC操作
- - 函数属性:外部,使用户使用
- - 参数说明:无
- - 返回说明:无
- - 函数实现步骤:
- (1)首先将SDA配置为输出
- (2)在SCL为高电平期间,SDA有上升沿的变化
- ***************************************************************************/
- void IIC_Stop(void)
- {
- SDA_OUT();//sda线输出
- Clr_IIC_SCL;
- Clr_IIC_SDA;//STOP:when CLK is high DATA change form low to high
- DelayXus(4);
- Set_IIC_SCL;
- Set_IIC_SDA;//发送I2C总线结束信号
- DelayXus(4);
- }

芯片解密