資源簡(jiǎn)介
STM32中74hc595初始化函數(shù),以及發(fā)送單字節(jié)和字符串函數(shù)。
代碼片段和文件信息
#include?“bsp_74HC595.h“
#include?“delay.h“
//SCLK:PB12??RCLK:PB13??DS:PB14
void?HC595_GPIO_Configuration(void)
{
GPIO_InitTypeDef?GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB??ENABLE);
GPIO_InitStructure.GPIO_Pin?=?GPIO_Pin_12?|?GPIO_Pin_13?|?GPIO_Pin_14;
GPIO_InitStructure.GPIO_Speed?=?GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode?=?GPIO_Mode_Out_PP;
GPIO_Init(GPIOB?&GPIO_InitStructure);
GPIO_WriteBit(GPIOB?GPIO_Pin_12?|?GPIO_Pin_13?|?GPIO_Pin_14?Bit_RESET);
}
void?HC595_Byte_Send(unsigned?char?byte)
{
int?i;
for(i?=?0;?i?8;
評(píng)論
共有 條評(píng)論