Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A VC++ or a C++ program to send data to a PCI Card such as a modem car

Status
Not open for further replies.

chuchuchu

Programmer
Jan 3, 2004
1
US
I used to send and recieve binary data through the serial and parallel port of a PC by writting a C progam using INPORT and OUTPORT commands. I can't do this when it comes to a PCI modem or sound card. I need help on how I can do that with VB or C++ to RX/TX data to a PCI card.

Sincerely
John
 
Take a look of these functions and structures:
CreateFile();
ReadFile();
WriteFile();
SetCommMask();
GetCommMask();
GetCommState();
SetCommState();
BuildCommDCB();
CreateEvent();
WaitCommEvent();
DCB, COMMTIMEOUTS, OVERLAPPED ... struct

-obislavu-

 
I guessing that by INPORT and OUTPORT you mean the 80x86 instructions for performing peripheral I/O. In a protected mode operating system, like Windows, you can't write any normal program that uses these instructions, because they are protected. They are blocked by Windows in most cases. Sometimes Windows will emulate the instructions so it appears you can still access them, but it won't work for every PCI card.

In Windows the only way to directly access peripheral I/O all the time, including the PCI bus, is to write a device driver. You can do this by getting a copy of the Windows Device Driver Kit (DDK) from Microsoft. It takes a bit of work, but fortunately others have already written generic device drivers to do INPORT/OUTPORT. I bet you'll find a good enough one through a Google search.

For communications peripherals, such as parallel and serial ports, Windows provides built-in device drivers for you. The functions obislavu mentioned are the ones you call to use these device drivers. Note that these only work for you if the PCI card you are trying to access is a communications device. For a sound card, its device driver is usually plugged into the Wave API (WaveOutOpen, WaveInOpen, and other functions) or the DirectX API (too complex to get into here).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top