GPIO模拟SPI通信主机代码

时间:2022-04-14 10:30:50
【文件属性】:

文件名称:GPIO模拟SPI通信主机代码

文件大小:10.37MB

文件格式:RAR

更新时间:2022-04-14 10:30:50

SPI STM32

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) { } }


网友评论