| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2679 人关注过本帖
标题:求助:WinIo的SetPortVal函数调用失败问题
只看楼主 加入收藏
可爱的大海
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2019-3-8
收藏
 问题点数:0 回复次数:0 
求助:WinIo的SetPortVal函数调用失败问题
在VC6.0中,使用WinIO向并口发送数据,SetPortVal函数调用失败。并口是PCI转并口卡,地址为3FF8.
#include <windows.h>
#include <stdio.h>
#include "WinIo.h"

void main()
{
   
  DWORD dwPortVal=0x0;
  bool bResult = InitializeWinIo();
  WORD m_port=(WORD)0x3FF8;
  // Call InitializeWinIo to initialize the WinIo library.
  while(true)
  {

      
      if (bResult)
      {
        // Under Windows NT/2000/XP, after calling InitializeWinIo,
        // you can call _inp/_outp instead of using GetPortVal/SetPortVal
        bool bSet =    SetPortVal(m_port,1,1);
        if(!bSet)
            printf("失败!\n");
        break;
        GetPortVal(m_port, &dwPortVal, 1);
        printf("端口值:%d\n",dwPortVal);
        Sleep(500);

        bResult=false;
    //    printf("success run WinIo.\n");

        // When you're done using WinIo, call ShutdownWinIo
      }
      if(!bResult)
      {
        // Under Windows NT/2000/XP, after calling InitializeWinIo,
        // you can call _inp/_outp instead of using GetPortVal/SetPortVal
        bool bSet =    SetPortVal(m_port,0,1);
        GetPortVal(m_port, &dwPortVal, 1);
        printf("端口值:%d\n",dwPortVal);
        Sleep(500);

        bResult=true;
    //    printf("success run WinIo.\n");

        // When you're done using WinIo, call ShutdownWinIo
      }
        
  }
  
ShutdownWinIo();

}
运行结果是显示失败,说明SetPortVal函数调用失败。请问原因出在哪?
搜索更多相关主题的帖子: 函数 调用 失败 Call printf 
2019-03-08 16:49
快速回复:求助:WinIo的SetPortVal函数调用失败问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014357 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved