资源简介
HAL库版本,硬件SPI驱动74HC595,函数斜的很清楚,已经实现
代码片段和文件信息
/******************************************************************************
* Copyright 2018-2028 MK.
* FileName: 74HC595.c
* Desc:
*
*
* Author:
* Date:
* Notes:
*
* -----------------------------------------------------------------
* Histroy: v1.0
*
******************************************************************************/
#include “74HC595.h“
/* ?óê±?£?é82615468 sp-320-12
* */
SPI_HandleTypeDef hspi_HC595;
static uint8_t Knum=0;
static void delay(uint32_t t)
{
uint32_t i;
while(t--)
for (i = 0; i < 1; i++);
}
/******************************************************************************
* Name: HC595Init
*
* Desc: HC5953?ê??ˉ
* Param:
* Return:
* Global:
* Note:
* Author:
* -------------------------------------
* Log:
******************************************************************************/
void HC595Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* SPI1íaéèê±?óê1?ü */
__HAL_RCC_SPI1_CLK_ENABLE();
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
hspi_HC595.Instance = HC595_SPIx;
hspi_HC595.Init.Mode = SPI_MODE_MASTER;
hspi_HC595.Init.Direction = SPI_DIRECTION_2LINES;
hspi_HC595.Init.DataSize = SPI_DATASIZE_8BIT;
hspi_HC595.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi_HC595.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi_HC595.Init.NSS = SPI_NSS_SOFT;
hspi_HC595.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
hspi_HC595.Init.FirstBit = SPI_FIRSTBIT_LSB;
hspi_HC595.Init.TIMode = SPI_TIMODE_DISABLE;
hspi_HC595.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi_HC595.Init.CRCPolynomial = 7;
/**HC595 GPIO Configuration
PA5 ------> HC595_SCK
PA6 ------> HC595_MISO
PA7 ------> HC595_MOSI
PC4 ------> HC595_CS
PA4 ------> HC595_RCK
*/
GPIO_InitStructure.Pin = HC595_CLK_PIN | HC595_DATA_PIN;
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_PULLUP;
GPIO_InitStructure.Alternate = GPIO_AF5_SPI1;
HAL_GPIO_Init(HC595_SPI_GPIO &GPIO_InitStructure);
GPIO_InitStructure.Pin = HC595_CS_PIN;
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStructure.Mode = GPIO_MODE_OU
相关资源
- 16x16 LED点阵 74hc164 74hc595 仿真DSN
- 74HC595芯片中文资料
- 16x16 LED点阵 驱动 74hc164 74hc595 参考电
- 16x16 LED点阵 驱动 74hc164 74hc595
- 74HC595和ZLG7290中文资料
- 基于74HC595的LED流水灯 带实物图
- SPI接口与74HC595的连接原理图
- 一个74hc595驱动3个数码管
- 74HC595显示程序
- 89C2051+DS1302+74HC595+8位LED数码管的电子
- 16*64点阵 74HC154 ,74HC595
- 74HC595流水灯程序
- 74hc595详解符程序原理图
- 74HC595的驱动和测试程序
- Linux下74HC595的驱动程序控制数码管
- 基于PIC单片机的电子时钟设计
- 74HC595级联动态显示的C程序
- STM32中74hc595初始化函数
- AT89C51单片机写的74HC595驱动程
- 74HC595单片机驱动
- LED点阵书写屏09全国电子设计大赛
- 74HC595驱动数码管显示
评论
共有 条评论