📄 final.c
字号:
#include <stdio.h>#include <stdlib.h>#include <string.h>#include "/usr/src/arm/linux/include/asm/unistd.h"#include "/arm_linux_root/kkai/new/lcd.h"extern int errno;static void delay(int n){ int i, j; for(i = 0; i < 1000; i++) for(j = 0; j < n; j++) ;} void uart_2(char *s){ int fd,rt; int i; char message[60]="\n\rplease input 0-9 or q to quit the program: "; if ((fd = open("/dev/uart2", 0)) < 0) { printf("cannot open /dev/uart2\n"); exit(0); }; /*通过uart2显示提示信息*/ for(i=0;i<60;i++) { ioctl(fd,3,message[i]); }/*通过uart1显示提示信息*/ printf("\nThe char:"); delay(25000); rt=ioctl(fd,4,s); s[1]='\0'; close(fd);}int main(){ char s[5]; int i=0; printf("\nReady to transfer chars.\n"); for(;;) { for(i=0;i<5;i++) { s[i]='\0'; } uart_2(s); printf("%c\n", *s); if(*s == 'q') { return 0; } } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -