About me
Contact
logo

I/O Port Access in Microsoft Visual C++

11:13 AM // 0 comments // Sajib Barua // Category: Interfacing //

Microsoft Visual C/C++ provides access to the I/O ports on the 80x86 CPU via the predefined functions _inp / _inpw and _outp / _outpw.
 
int _inp(unsigned portid); /* returns a byte read from the I/O port portid */
unsigned _inpw(unsigned portid); /* returns a word read from the I/O port portid */
int _outp(unsigned portid,  /* writes the byte value to the I/O port portid */
int value);       /* returns the data actually written            */
unsigned _outpw(unsigned portid,  /* writes the word value to the I/O port portid */
unsigned value);  /* returns the data actually written            */
 
portid can be any unsigned integer in the range 0-65535
 
#include /* required only for function declarations */
 
#define Data    0x378
#define Status  0x379
#define Control 0x37a
 
int Bits,      /* 0 <= Bits <= 255 */
    Dummy;
 
Dummy = _outp(Data,Bits); /* output data */
 
Bits = _inp(Status);      /*  input data */


Bookmark and Share

Related posts :

0 comments for this post

Leave a reply

Older Post
Newer Post
  • IT
  • ft
  • Virtual Assistant
  • Online TV
  • SEO
  • Optimization
  • Satellite TV

Subscribe to Engineering Resources

Receive New Articles As They are Posted

  • Recent posts
  • Recent comments

About Me

Sajib Barua
View my complete profile
  • Home
  • About me
  • Contact
  • RSS