outport in 32bit - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

outport in 32bit

ı 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
#include
main()
{
outport(0x378h,2);
}

Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    [b][red]This message was edited by AsmGuru62 at 2003-1-21 7:58:35[/red][/b][hr]
    [b][red]This message was edited by AsmGuru62 at 2003-1-21 7:58:8[/red][/b][hr]
    : ı 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
    : #include
    : main()
    : {
    : outport(0x378h,2);
    : }
    :
    [blue]In VC++ it will be:[/blue][code]
    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
    }
    [/code][blue]So, you call it as:

    OutPortByte (0x378 [b]/*Why did you use 0x378[red]h[/red]?*/[/b], 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 [b]Access Violation[/b] 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.[/blue]





  • kayakayakayakayakayakaya Posts: 2Member

    Thank you for help and...
    i just want to plug some diots to the parallel port. after that i will plug some device. (may be i will make a robot!)
    That's very good but i want to know c++ codes. is there any ready c++ code exist in borland or MS compiler for outport? These are asm codes (it can be use in c ) but if i know the c++ codes it should be very good for me.
    Thank you very much again for your help....
  • AsmGuru62AsmGuru62 Posts: 6,519Member
    :
    : Thank you for help and...
    : i just want to plug some diots to the parallel port. after that i will plug some device. (may be i will make a robot!)
    : That's very good but i want to know c++ codes. is there any ready c++ code exist in borland or MS compiler for outport? These are asm codes (it can be use in c ) but if i know the c++ codes it should be very good for me.
    : Thank you very much again for your help....
    :
    [blue]You can COPY/PASTE the code I posted and use it in your C++ code without a problem.[/blue]
Sign In or Register to comment.