2440平台下linux串口开发源码示例(2440双串口间通信)
/***************************************************************************** 程序说明:示例程序演示了2440平台下linux串口应用开发,可实现2440串口2与串口3的通讯*** 硬件设置:将2440板子上的串口2、3TXD、RXD交叉短接*** 编译运行:在宿主机上编译程序源码,打开超级终端(可与2440进行命令交互),*** 在2440平台上打开串口终端,设置端口为ttySAC1,B15200,8bit DATA*** 结果验证:Com communicate start please send data to me
The data you send back
have reveived data
succeed!and com was closed**************************************************************************/#include<stdio.h>
#include<string.h>
#include<sys/types.h>
#include<errno.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>
#include<termio.h>
#include<stdlib.h>int set_opt(int fd,int nSpeed,int nBits,char nEvent,int nStop);int open_port(int fd,int comport); int main(void)
{ int fd;
int nread,i;
char vcCom_start[]="Com communicate start\n";
char vcCom_wait[]="please send data to me\n";
char vcCom_rece[20];
char vcCom_OKmsg[]="have reveived data\n";
char vcCom_over[]="succeed!and com was closed
相关文档:
1、用GCC编译
1.1、创建源文件
(main.c) C 源文件 - main.c
#include
#include “reciprocal.hpp”
int main (int argc, char **argv)
{
int i;
i = atoi (argv[1]);
printf (“The reciprocal of %d is %g\n”, i, reciprocal (i ......
Link from: http://www.faqs.org/docs/Linux-mini/C++-dlopen.html
//1. == main.cpp =============================================
// How to build?
// g++ -o main main.cpp -ldl
//=======================================================
#include <iostream>
#include <dlfcn.h>
int main() { ......
1、总结背景
在linux系统下,如果你下载并安装了应用程序,很有可能在键入它的名称时出现“command not found”的提示内容。如果每次都到安装目标文件夹内,找到可执行文件来进行操作就太繁琐了。这涉及到环境变量PATH的设置问题,而PATH的设置也是在linux下定制环境变量的一个组成部分。本案例基于RedHat AS4讲 ......