Solved

outportb in WIN32

Posted on 1997-01-31
1
689 Views
Last Modified: 2013-12-04
A group at Queen's University is trying to implement the (out,in)portb command in an WIN32 program. We are using the command to directly control the digital port of a National Instruments A/D card. In a 16-bit Dos application, we could simply use the (in,out)portb command, but when trying to create a 32-bit windows GUI application, Borland C++ 5.0 won't compile the program. Checking the help manual and the compatibility list for certain commands, it lists that (in,out)portb is not avaliable to WIN32. Is there any way around this in a WIN95 environment to use the outportb command in a 32-bit application. If so, how would one do it? (does it possibly involve accessing the EISA.vxd file in windows 95?)

Thanks for such consideration,

Yael Maguire
Queen's University, Kingston, Ontario.
0
Comment
Question by:yael
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
glittle earned 50 total points
ID: 1298619
2 possible methods that should work for Win95.

1.  If your compiler has inline assembly, use it to insert the proper assembly calls.

unsigned char inportb(int port)
{
    _asm {
        mov    dx, port
        xor      ax,ax
        in         al, dx
    }
    return;
}

void outputb(int port, char ch)
{
    _asm {
        mov    dx, port
        xor       ax,ax
        mov    al, ch
        out       dx, al
    }
    return;
}

These examples are for Microsoft C, but should give you the basic concept.  


2.  Write 2 assembly language functions and link them with your C program.  The assembly used above can be the kernel code for these functions.  You simply need to know how to interface assembly with Borlannd's C++ 5.0 environment.

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question