STM32驱动TW1637四位数码管模块计数 TIM输出PWM

#include "stm32f10x.h"                  // Device header
#include "delay.h"
#define	GPIO_CLKD1(x)		 GPIO_WriteBit(GPIOD,GPIO_Pin_1,(BitAction)(x)); //CLK
#define	GPIO_SDAD2(x)		 GPIO_WriteBit(GPIOD,GPIO_Pin_2,(BitAction)(x)); //CLK

//小时
struct hour_1{
	unsigned char shi;
	unsigned char ge;
}Hour;
 
//分钟
 struct min_1{
unsigned char shi;
unsigned char ge;
}Min;

const unsigned char SEGData[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};//1-9
const unsigned char SEGDataDp[]={0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef}; //有小数点只用于地址0xc1
 

void Out_SD()
{
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD,ENABLE);
	GPIO_InitTypeDef GPIO_InitStruct;
	GPIO_InitStruct.GPIO_Mode=GPIO_Mode_Out_PP;
	GPIO_InitStruct.GPIO_Pin=GPIO_Pin_1|GPIO_Pin_2;
	GPIO_InitStruct.GPIO_Speed=GPIO_Speed_50MHz;
	GPIO_Init(GPIOD,&GPIO_InitStruct);
	
}

void TM1637_start()
{
	GPIO_CLKD1(1);
	GPIO_SDAD2(1);
	Delay_us(150);
	GPIO_SDAD2(0);
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爱吃瓜的亚瑟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值