base_io.c

来自「Six objects here: The document you re 」· C语言 代码 · 共 46 行

C
46
字号
#include <reg51.h>	//SFR declarations
#include "base_io.h"
#include "mainloop.h"

extern EPPFLAGS bEPPflags;

void outportb(unsigned int Addr,unsigned char Data)	//send to D12
{
	switch (Addr)	//in fact,'Addr' should be described as 'Command or Data select word'
	{
		case D12_Command:	//send command-byte to D12
			A0c=D12_Command;
			break;
		case D12_Data:	//send data-byte to D12
			A0c=D12_Data;
			break;
	}

	WRc=0;	//Write immediately
	do {if (1+1==2);} while(0);
	P0=Data;
	do {if (1+1==2);} while(0);
	WRc=1;	//enclose
}

unsigned char inportb(unsigned int Addr)	//receive from D12
{
unsigned char tmpData;
	switch (Addr)	//in fact,'Addr' should be described as 'Command or Data select word'
	{
		case D12_Command:
			A0c=D12_Command;
			break;
		case D12_Data:
			A0c=D12_Data;
			break;
	}
	
	RDc=0;	//Read immediately
	do {if (1+1==2);} while(0);
	tmpData=P0;
	do {if (1+1==2);} while(0);
	RDc=1;	//enclose
	return tmpData;
}

⌨️ 快捷键说明

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