-
SPI通信主机的GPIO模拟代码
资源介绍
GPIO模拟SPI通信主机代码
主函数如下:
#include "sys.h"
#include "delay.h"
#include "usart.h"
#include "led.h"
#include "key.h"
#include "spi.h"
#include "lcd.h"
#include "sdram.h"
unsigned char data[9]="B16030410";
int main(void)
{
u8 receivr_Data=0,i=0;
HAL_Init();
Stm32_Clock_Init(360,25,2,8);
delay_init(180);
uart_init(115200);
LED_Init();
LCD_Init();
SDRAM_Init();
POINT_COLOR=BLUE;
LCD_Clear(WHITE);
SPI_Init();
LCD_ShowString(10,40, 96,24,24,"Rx data:");
LCD_ShowString(10,80,216,24,24,"Tx data:B16030410");
delay_ms(1000);
for(i=0;i<9;i++)
{
delay_ms(100);
SPI_WriteByte(data[i]);
}
LED1=0;
delay_ms(1000);
for(i=0;i<9;i++)
{
while(SPI_MISO==0);
SPI_MOSI_H;
receivr_Data=SPI_ReadByte();
SPI_MOSI_L;
LCD_ShowChar(106+12*i,40,receivr_Data,24,0);
}
while(1)
{
}
}
- 上一篇: mstar 6a628数据手册
- 下一篇: MSTAR,SAR数据集格式转换为JPG