欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
HK32單片機(jī)串口打印程序
[打印本頁]
作者:
sr861126
時(shí)間:
2024-3-26 10:42
標(biāo)題:
HK32單片機(jī)串口打印程序
串口打印文本
/**
******************************************************************************
* @file main.c
* @author Alexander
* @version V1.0
* @date 2022-xx-xx
* @brief 串口中斷接收測試
******************************************************************************
* @attention
*
* 實(shí)驗(yàn)平臺(tái):HK32F030M開發(fā)板
*
******************************************************************************
*/
#include "hk32f030m.h"
#include "bsp_usart.h"
#include "bsp_led.h"
static void Show_Message(void);
enum{
/* ftp */
FTP_TEST = 10,
};
struct oam_excute_st
{
int (*doit)(char*, char* , int *);
int (*dumpit)(char*, char* , int *, int );
};
extern struct oam_excute_st * oam_execute ;
int ftp_test (char *buf, char *outbuf, int *len){
printf("hello,world\n");
// return 0;
}
struct oam_excute_st ftp_oam_table[]=
{
[FTP_TEST] = {.doit = ftp_test},
};
/**
* @brief 主函數(shù)
* @param 無
* @retval 無
*/
int main(void)
{
char ch,i;
/* 初始化RGB彩燈 */
LED_GPIO_Config();
/* 初始化USART 配置模式為 115200 8-N-1 */
USART_Config();
/* 打印指令輸入提示信息 */
// Show_Message();
while(1)
{
/* 獲取字符指令 */
// ch=getchar();
// printf("接收到字符:%c\n",ch);
// printf(" 指令 ------ LED狀態(tài) \n");
ftp_oam_table[FTP_TEST].doit(NULL,NULL,&i);
}
}
/**
* @brief 打印指令輸入提示信息
* @param 無
* @retval 無
*/
static void Show_Message(void)
{
printf("\r\n 這是一個(gè)通過串口通信指令控制LED實(shí)驗(yàn) \n");
printf("使用 USART 參數(shù)為:%d 8-N-1 \n",DEBUG_USART_BAUDRATE);
printf("開發(fā)板接到指令后控制LED狀態(tài),指令對應(yīng)如下:\n");
printf(" 指令 ------ LED狀態(tài) \n");
printf(" 1 ------ LED1亮 \n");
printf(" 2 ------ LED2亮 \n");
printf(" 3 ------ LED3亮 \n");
printf(" 4 ------ LED1滅 \n");
printf(" 5 ------ LED2滅 \n");
printf(" 6 ------ LED3滅 \n");
printf(" 7 ------ LED1反轉(zhuǎn) \n");
printf(" 8 ------ LED2反轉(zhuǎn) \n");
printf(" 9 ------ LED3反轉(zhuǎn) \n");
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(char* file , uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif /* USE_FULL_ASSERT */
復(fù)制代碼
原理圖: 無
仿真: 無
代碼:
程序.7z
(173.59 KB, 下載次數(shù): 2)
2024-3-26 13:39 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1