阅读:859回复:1
读中断寄存器,高手们,来看看
用AT89C52+D12
A接高,WR,RD,ALE,D0-7互接 读中断寄存器读不出来数据,都是0怎么回事,高手们,来看看 unsigned short D12_ReadInterruptRegister(void) { unsigned char b1; unsigned int j; //outportb(D12_COMMAND, 0xF4); outportcmd(0xF4); b1 = inportb(); j = inportb(); j <<= 8; j += b1; return j; } D12_DATA=0xff02; D12_COMMAND=0xff03; void outportcmd(unsigned char value) { *((unsigned char xdata *)D12_COMMAND)=value } void outportdata(unsigned char value) { *((unsigned char xdata *)D12_DATA)=value; } unsigned char inportb(void) { return *((unsigned xdata *)D12_DATA); } [编辑 - 1/7/04 by yyouking] |
|
|
沙发#
发布于:2004-01-08 13:14
#define D12_COMMAND (*(unsigned char xdata *)0xff03)
#define D12_DATA (*(unsigned char xdata *)0xff02) void outportcmd(unsigned char value) { D12_COMMAND=value; } void outportdata(unsigned char value) { D12_DATA=value; } unsigned char inportb(void) { return D12_DATA; } |
|