阅读:1007回复:2
串口中断
在VXD中初始化串口如下:(在dos下用TC是成功的)
void MyHwInt::OnHardwareInt(VMHANDLE hVM) { unsigned char i,j; _outp(0x70,0xc); _inp(0x71); x++; if(x>=1024) { //查询COM1口有无数据来 i=_inp(0x3fd);//查询状态寄存器 if((i&0x01)!=0) { j=_inp(0x3f8);//读出数据 *(pVal)=i; //VSD_Bell(); } else *(pVal)=0x5555; // x=0;y++; dprintf(\"y++\"); //VWIN32_QueueUserApc(CallBackApc,(DWORD)&y,TheThread); VWIN32_PulseWin32Event(hEventRing0); //VSD_Bell(); } sendPhysicalEOI(); } BOOL MbiDevice::OnSysDynamicDeviceInit() { pMyIRQ=new MyHwInt(); if (!pMyIRQ || !pMyIRQ->hook()) return FALSE; _outp(0x70,0xb); b=_inp(0x71); _outp(0x70,0xb); _outp(0x71,0x40 | b);//允许周期中断 //初始化COM1 _outp(0x3fb,(unsigned char)0x80);//DLAB=1 _outp(0x3f8,(unsigned char)0x0c);//LSB _outp(0x3f9,(unsigned char)0x00);//MSB _outp(0x3fb,(unsigned char)0x03);//8bits no parity 1 stop _outp(0x3f9,(unsigned char)0x01);//open int // pMyIRQ->physicalUnmask(); return TRUE; } 串口始终没被正确初始化,无数据收到,HY? |
|
沙发#
发布于:2002-09-29 10:16
为什么不用vcommport呢?
|
|
|
板凳#
发布于:2002-09-29 13:57
因此初始是以前程序搬来的且此法简单
|
|