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

📄 pcout.c

📁 用于读写并口数据
💻 C
字号:
#define J 10240
#define EPP_DATA 0x37c
#define EPP_ADD  0x37b
#define EPP_STATE 0x379
#define EPP_CTROL 0x37a
#include <stdio.h>
#include<conio.h>
#include<stdlib.h>


main()
{
	unsigned short Data_out=0;
	unsigned char Data_OH,Data_OL;


//open the binary file for read
	char outfile[10];
	FILE *out;
	int j=0;
	printf("Enter the outfile name:\n");
	scanf("%s",outfile);
	if((out=fopen(outfile,"rb"))==NULL)
	{
		printf("cannot open outfile\n");
		exit(0);
	}

	for(j=0;j<J;j++)
	{
		do
		{
	 		Data_out=fgetc(out);
			Data_OH=(unsigned char)(Data_out>>8);
//pin 16(address 0x04;location bit 2)presents the topNDIn
			_outp(EPP_CTROL,0x04);
			_outp(EPP_ADD,Data_OH);
			Data_OL=(unsigned char)Data_out;
			_outp(EPP_DATA,Data_OL);
		}
		while(!feof(out));
	};
//close binary file
	fclose(out);
}




⌨️ 快捷键说明

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