首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

帮忙看看一个小程序.非常感谢解决方法

2012-04-22 
帮忙看看一个小程序...非常感谢#includewindows.h#includestdio.h#includeconio.h#includewinio.h

帮忙看看一个小程序...非常感谢
#include   <windows.h>
#include   <stdio.h>
#include   <conio.h>
#include   "winio.h "

#define   REG_RX   0x3F8
#define   REG_TX   0x3F8
#define   REG_IER   0x3F9
#define   REG_IIR   0x3FA
#define   REG_LCR   0x3FB
#define   REG_MCR   0x3FC
#define   REG_LSR   0x3FD
#define   REG_MSR   0x3FE
#define   REG_FCR   0x3FF

void   f_InitialCom()
{
int   inVal,outVal;

_outp(REG_LCR,0x80);
inVal=_inp(REG_LCR);
printf( "LCR:%Xh\n ",inVal);
_outp(REG_TX,0x78);
_outp(REG_IER,0);
_outp(REG_LCR,0x03);
_outp(REG_IER,0);
_outp(REG_FCR,0x80);
}
void   main()
{
        int   inVal,outVal;
        bool   bResult;
      //   Call   InitializeWinIo   to   initialize   the   WinIo   library.

        bResult   =   InitializeWinIo();

        if   (bResult)
        {
//   Under   Windows   NT/2000/XP,   after   calling   InitializeWinIo,
//   you   can   call   _inp/_outp   instead   of   using   GetPortVal/SetPortVal
//f_InitialCom();
_outp(REG_LCR,0x80);
inVal=_inp(REG_LCR);
printf( "LCR:%Xh\n ",inVal);
//   When   you 're   done   using   WinIo,   call   ShutdownWinIo
ShutdownWinIo();
        }
        else
        {
printf( "Error   during   initialization   of   WinIo.\n ");
exit(1);
        }
}

输出总是0xFFh,好象数值都没写进去.
帮忙看看.

[解决办法]
你这种方式不对,winNT,以上,就不让用户直接写PORT
http://vip2.6to23.com/testsys/ VC编程中有

热点排行