標(biāo)題:
單片機(jī)修改底層函數(shù)putchar()實(shí)現(xiàn)printf()在LCD上輸出 程序Proteus仿真
[打印本頁(yè)]
作者:
king123456.
時(shí)間:
2020-11-27 19:25
標(biāo)題:
單片機(jī)修改底層函數(shù)putchar()實(shí)現(xiàn)printf()在LCD上輸出 程序Proteus仿真
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
51hei.png
(12.55 KB, 下載次數(shù): 32)
下載附件
2020-11-28 00:33 上傳
單片機(jī)源程序如下:
#include <reg51.h>
#include <intrins.h>
#include <stdio.h>
#include <LCD.h>
/*********************** 主函數(shù)函數(shù) *************************/
void main(void){
LcdInitiate();
WriteAddress(0x00);
printf("Hello Everybody\n");
printf("Pai= %.4f",3.1415);
while(1);
}
/*********************** 修改底層輸出函數(shù) *************************/
char putchar (char c){
if (c == '\n'){
WriteAddress(0x40); // LCD光標(biāo)定位
}
else{
WriteData(c); // LCD輸出字符
}
return (c);
}
復(fù)制代碼
所有資料51hei提供下載:
ex8-8.zip
(67.75 KB, 下載次數(shù): 19)
2020-11-27 19:25 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1