⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_parport.c

📁 一个基于s3c2410嵌入式系统的并口实验(包括驱动程序和测试程序)
💻 C
字号:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <syslog.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <syslog.h>
#include <signal.h>


int main()
{
	int parport_fd,count;	
	unsigned char buf[2];
	parport_fd = open("/dev/parport",O_RDWR);
	if (parport_fd <= 0){
		printf("open parport device error\n");
		return 0;
	}
	buf[0]=0xa5;buf[1]=0x03;
	count = write(parport_fd,buf,2);
	printf("Write %d char to parprot\n",count);
	read(parport_fd,buf,1);
	printf("Read %02x from parport\n",buf[0]);
		
	close(parport_fd);
	return 0;
}

	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -