Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3670
Number of posts: 9122

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
outport in 32bit Posted by kayakayakaya on 20 Jan 2003 at 4:44 PM
ı 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);
}
Report
Re: outport in 32bit Posted by AsmGuru62 on 21 Jan 2003 at 7:57 AM
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

: &#305; can easly use outport command in turbo c but &#305; cant use in borland c++ and microsoft compilers. because: outport uses only 16bit.
: which command do &#305; use for to send data to parallel port in microsoft c++ 6.0 or c++.net
: help me...
: Thankss...
:
: ----------------------------
: in turbo c &#305; 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.






Report
Re: outport in 32bit Posted by kayakayakaya on 21 Jan 2003 at 12:53 PM

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....
Report
Re: outport in 32bit Posted by AsmGuru62 on 22 Jan 2003 at 7:55 AM
:
: 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....
:
You can COPY/PASTE the code I posted and use it in your C++ code without a problem.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.