This message was edited by AsmGuru62 at 2003-1-21 7:58:35
This message was edited by AsmGuru62 at 2003-1-21 7:58:8
: ı can easly use outport command in turbo c but ı cant use in borland c++ and microsoft compilers. because: outport uses only 16bit.
: which command do ı use for to send data to parallel port in microsoft c++ 6.0 or c++.net
: help me...
: Thankss...
:
: ----------------------------
: in turbo c ı use that.
: #include <stdio.h>
: #include <conio.h>
: main()
: {
: outport(0x378h,2);
: }
:
In VC++ it will be:
void OutPortByte (UINT uiPortAddress, BYTE byteData)
{
_asm mov edx, uiPortAddress
_asm mov al, byteData
_asm out dx, al
}
void OutPortWord (UINT uiPortAddress, WORD wordData)
{
_asm mov edx, uiPortAddress
_asm mov ax, wordData
_asm out dx, ax
}
So, you call it as:
OutPortByte (0x378 /*Why did you use 0x378h?*/, 2);
Also, the port access depends on what address are you trying to access. Sometimes Windows does not allow these operations and you will get the Access Violation thingy. In case your PC has some custom made equipment, like a robotic arm - Windows should not cause any problems. But if you are trying to do some graphics or sound or hard drives manipulation - usually, Windows will not allow it.