Solved

outportb in WIN32

Posted on 1997-01-31
1
681 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows 10 Scheduled Tasks 11 111
What is MicroStrategy.NET? 2 89
C# LINQ ForEach() question 6 111
What are MicroServices? 4 65
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 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