Howdy, Stranger!

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

Categories

Borland C++ Builder

BondfireBondfire Member Posts: 28
Hi,
I need some help using Borland C++ Biulder 5.0
I'm trying to develop a GUI,which accesses
the PC's parallel port but as it is Builder doesn't
support the function outportb which i need to access
the parallel port for writing.I overcame that by using the following
assembly langauge embedded in my C++ code which access
the parallel port:
asm{
mov dx, 03078
mov al, ffff
out dx,al

}
I got an error message compling my
code..then i discovered that i have to have #pragam inline
in my code.Now it complies fine but it doesn't execute!After compiling,nothing happens,the form doesn't show up.Is
there anyone who has a solution to this problem?..how i
can execute my form?

Thanks



Comments

  • LundinLundin Member Posts: 3,711
    : Hi,
    : I need some help using Borland C++ Biulder 5.0
    : I'm trying to develop a GUI,which accesses
    : the PC's parallel port but as it is Builder doesn't
    : support the function outportb which i need to access
    : the parallel port for writing.I overcame that by using the following
    : assembly langauge embedded in my C++ code which access
    : the parallel port:
    : asm{
    : mov dx, 03078
    : mov al, ffff
    : out dx,al
    :
    : }
    : I got an error message compling my
    : code..then i discovered that i have to have #pragam inline
    : in my code.Now it complies fine but it doesn't execute!After compiling,nothing happens,the form doesn't show up.Is
    : there anyone who has a solution to this problem?..how i
    : can execute my form?
    :
    : Thanks
    :
    :

    Let me guess, you have Windows NT/2000/XP?
    You can't make direct access to the I/O ports in those versions, for what ever reason...

    If that is the case, then this page should be just what you need, it has got a outportb function that works no matter which Win OS version:
    http://www.beyondlogic.org/porttalk/porttalk.htm
  • BondfireBondfire Member Posts: 28
    : : Hi,
    : : I need some help using Borland C++ Biulder 5.0
    : : I'm trying to develop a GUI,which accesses
    : : the PC's parallel port but as it is Builder doesn't
    : : support the function outportb which i need to access
    : : the parallel port for writing.I overcame that by using the following
    : : assembly langauge embedded in my C++ code which access
    : : the parallel port:
    : : asm{
    : : mov dx, 03078
    : : mov al, ffff
    : : out dx,al
    : :
    : : }
    : : I got an error message compling my
    : : code..then i discovered that i have to have #pragam inline
    : : in my code.Now it complies fine but it doesn't execute!After compiling,nothing happens,the form doesn't show up.Is
    : : there anyone who has a solution to this problem?..how i
    : : can execute my form?
    : :
    : : Thanks
    : :
    : :
    :
    : Let me guess, you have Windows NT/2000/XP?
    : You can't make direct access to the I/O ports in those versions, for what ever reason...
    :
    : If that is the case, then this page should be just what you need, it has got a outportb function that works no matter which Win OS version:
    : http://www.beyondlogic.org/porttalk/porttalk.htm
    :

    Hi Again,

    I'm using Windows 98.. and still i'm having this problem!
    I think its something with Borland Builder 5..i'm able to compile it but
    when executing it, the form doesn't show up..this is the first time
    i'm using Borland Builder and i think that i might not have chosen
    some setting properly...i've tried it on other Pc's running windows 98
    but with no luck...i've also tried to get help on some Borland newsgroups but just found some broken links!
  • stoberstober Member Posts: 9,765 ✭✭✭
    it's not Borland's Builder -- PCs in protected mode (such as all versions of Windows operating system) prevent any program that is not part of the operating system or an OS device driver from accessing port address directly. One reason is that those addresses are remapped to different address scheme when in protected mode. Programs must have "ring 0" privledges to access those ports.
  • BondfireBondfire Member Posts: 28
    : it's not Borland's Builder -- PCs in protected mode (such as all versions of Windows operating system) prevent any program that is not part of the operating system or an OS device driver from accessing port address directly. One reason is that those addresses are remapped to different address scheme when in protected mode. Programs must have "ring 0" privledges to access those ports.
    :

    Hi,
    Thanks for your reply.
    I think its something with Borland Builder coz i tried to access the parallel port with Borland C++ 5.02 and it recognized the function outportb and i was able to compile and execute my code..i then tested the voltage at the data pins of the parallel port and they gave me a reading...so i was able to access the parallel port in Borland C++ 5.02, in dos interface but i want to develop a GUI for my work..that why i chose Borland Builder 5.

    You may try what i'm experiencing...Just add a button to the form and in the OnMouseClick event handler for the form add the assmebly code

    asm{
    mov dx, 0378h
    mov al, ffff
    out dx,al
    }

    This means that when you execute the form,and click the button, you'll send the data ffff(logic highs) to the data pins of the parallel port but as it is, it doesn't execute!...i'm really confused why!

    Thanks
  • stoberstober Member Posts: 9,765 ✭✭✭
    : Hi,
    : Thanks for your reply.
    : I think its something with Borland Builder coz i tried to access the parallel port with Borland C++ 5.02 and it recognized the function outportb and i was able to compile and execute my code..i then tested the voltage at the data pins of the parallel port and they gave me a reading...so i was able to access the parallel port in Borland C++ 5.02, in dos interface but i want to develop a GUI for my work..that why i chose Borland Builder 5.
    :
    [blue]You aren't listening!!! You can do that with MS-DOS 6.X or earlier 16-bit compilers but not with any version of a 32-bit compiler no matter who makes the compiler. If you want to write a Windows (or unix) program you have to learn different ways to access the hardware than you did with MS-DOS programs.

    Lundin gave you a link that explains how you can access those ports in 32-bit programs.
    [/blue]


  • BondfireBondfire Member Posts: 28
    : : Hi,
    : : Thanks for your reply.
    : : I think its something with Borland Builder coz i tried to access the parallel port with Borland C++ 5.02 and it recognized the function outportb and i was able to compile and execute my code..i then tested the voltage at the data pins of the parallel port and they gave me a reading...so i was able to access the parallel port in Borland C++ 5.02, in dos interface but i want to develop a GUI for my work..that why i chose Borland Builder 5.
    : :
    : [blue]You aren't listening!!! You can do that with MS-DOS 6.X or earlier 16-bit compilers but not with any version of a 32-bit compiler no matter who makes the compiler. If you want to write a Windows (or unix) program you have to learn different ways to access the hardware than you did with MS-DOS programs.
    :

    : Lundin gave you a link that explains how you can access those ports in 32-bit programs.
    : [/blue]
    :
    :
    :
    Oops! sorry! i'd mistaken what you were saying with something else.
    I'll try the beyond logic link....thanks

Sign In or Register to comment.