473,396 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Parallel port command

Hi,

I am trying to use "_outp " function to write to parallel port . I am
using microsoft visual C++6.0. I am using it like this _outp ( 956,
255) . I am using decimal numbers. The thing is that program crahes
evertime , I run it. Please advice!

John

#include < stdio. >
#include <dos.h >

main ()

{
_outp ( 956, 255);

}

Feb 2 '06 #1
5 2926

"john" wrote:
Hi,

I am trying to use "_outp " function to write to parallel port . I am
using microsoft visual C++6.0. I am using it like this _outp ( 956,
255) . I am using decimal numbers. The thing is that program crahes
evertime , I run it. Please advice!
Visual C(++) is for windows... I suppose you are running XP,2K or NT...
these prevent you from accessing hardware directly. You will need a kernel
mode driver to do that. have a look at:
http://www.logix4u.net/inpout32.htm will do it for the OSes mentioned
above...

Your problem has nothing to do with C... thus it is off topic here...
main ()
First: it is int main()...
_outp ( 956, 255);


does work perfectly for me ... under DOS or W95, W98 ...

regards
John F(dot)
Feb 2 '06 #2
"john" <co********@hotmail.com> writes:
I am trying to use "_outp " function to write to parallel port . I am
using microsoft visual C++6.0. I am using it like this _outp ( 956,
255) . I am using decimal numbers. The thing is that program crahes
evertime , I run it. Please advice!

John
"program crashes" doesn't tell us much. Without knowing *how* it
crashes, and what error message you get, it's less likely that anyone
will be able help.
#include < stdio. >
This should be "#include <stdio.h>". I don't know whether the spaces
are allowed (though at least some compilers will treat them as part of
the header name), but the missing 'h' will almost certainly cause an
error.

The code you posted is almost certainly not the code you actually
compiled. Don't re-type your code; copy-and-paste it *exactly*. If
you're writing code off the top of your head into your editor or
newsreader, copy-and-paste it into a source file and compile it before
hitting "send". Don't ask us to waste our time guessing which errors
are in your original code and which were introduced when you re-typed
it.

Since your program doesn't use anything from the <stdio.h> header, the
"#include" directive isn't necessary (but it shouldn't hurt anything).
#include <dos.h >
<dos.h > is not a standard header. Neither is <dos.h>.
main ()
This should be "int main(void)".

{
_outp ( 956, 255);
Non-standard function.

You should have a "return 0;" here.
}


I suggest you fix these errors and then post your question to a
newsgroup where it's actually topical.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 2 '06 #3

"john" <co********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi,

I am trying to use "_outp " function to write to parallel port . I am
using microsoft visual C++6.0. I am using it like this _outp ( 956,
255) . I am using decimal numbers. The thing is that program crahes
evertime , I run it. Please advice!

John

#include < stdio. >
#include <dos.h >
Using dos.h will require, most likely, a dos compiler and dos to actually
run on. You can get a free version of turbo c or c++ from the borland
museum. Just google it.

The Grue

main ()

{
_outp ( 956, 255);

}

Feb 2 '06 #4
john wrote:
Hi,

I am trying to use "_outp " function to write to parallel port . I am
using microsoft visual C++6.0. I am using it like this _outp ( 956,
255) . I am using decimal numbers. The thing is that program crahes
evertime , I run it. Please advice!

John

#include < stdio. >
#include <dos.h >

main ()

{
_outp ( 956, 255);

}

Dont you have to allow access to those ports first?
Otherwise acces to those port WILL crash your
program.
Google for "USERPORT" or "PORT ACCESS".
There are a number of utilitys to do this for you.
Copy'd from readme:
UserPort.txt

The files UserPort.sys and UserPort.exe are required if you want to have
access to
your printer port using the GMT g_n*h.dll library.
These file stem from an lp object for Pure-Data, taken from zexy (pd
project)
ported by Olaf Matthes.
Adapted to GMT use by Godfried-Willem Raes, 28.05.2002.

To get it running under WinNT/2000/XP a special kernel driver is needed.
These systems do not allow direct access to I/O ports. The subfolder
'UserPort' contains a kernel driver that handles the I/O stuff. Just copy
the file UserPort.sys into
c:\winnt\system32\drivers
and run the program
UserPort.exe.
Click on 'Start' and then 'Exit'. If you ever whish to remove
the kernel driver start the programm again and click 'Stop'.

Under Win95/98/Me all this is not needed!!!

Good Luck!
Feb 3 '06 #5
Sjouke Burry <bu*************@ppllaanneett.nnlll> writes:
john wrote:
I am trying to use "_outp " function to write to parallel port . I am
using microsoft visual C++6.0. I am using it like this _outp ( 956,
255) . I am using decimal numbers. The thing is that program crahes
evertime , I run it. Please advice!
John
#include < stdio. >
#include <dos.h >
main ()
{
_outp ( 956, 255);
}

Dont you have to allow access to those ports first?
Otherwise acces to those port WILL crash your
program.
Google for "USERPORT" or "PORT ACCESS".
There are a number of utilitys to do this for you.

[snip]

This is entirely off-topic in comp.lang.c. Please take this
discussion to a DOS or Windows newsgroup, where you'll find people who
are far more likely to have answers than we are here.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 3 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Todd Gardner | last post by:
--------------------------------------------------------------- I would appreciate any ideas how to write to the parallel port (Mem 0x378) when runnning WinXP or Mandrake 9.2. In C and LabVIEW I...
0
by: Diego Solis | last post by:
Hi people, I need to write a C# program which communicates with a thermal printer. After a search for the web I found that a way to comunicate with the ports is calling the kernel32.dll, which...
6
by: Novice Experl | last post by:
I'd like to write a simple application that interfaces with the parallel port, and changes the data on it according to keyboard input. I hope I can get it to run under windows xp and / or windows...
3
by: Danijel Babic | last post by:
Hi! Is there any way to control parallel port from VB.NET. I want to be able to send or read data from parallel port on Windows XP. Some ActiveX or dll, API or anything. Thx!
11
by: Isaac T Alston | last post by:
Basically, I'm thinking about building a robot which can be controlled by programs which I write, I'm going to interface to the robot through the parallel port (like in this tutorial here:...
12
by: david.brown.0 | last post by:
I'm trying to make a Java program access a parallel port. Java's comm API does not provide me with the control I need. I need to be able to write to the data and control pins and read the status...
2
by: hari | last post by:
Hi all, I need to automate printer command testing, prinetr supports parallel/ serial/USB.How can i send the commands from python to printer. I have got pyparallel, as am new to python, no...
4
by: Soren | last post by:
Hi, I want to control some motors using the parallel port.. however, my laptop does not have any parallel ports (very few do). What I do have is a USB->Parallel converter... I thought about...
1
by: ssndk123 | last post by:
Hi, Using the UserPort program that changes permissions in XP so that I am able to write directly to the parallel port using assembler.. I'm trying to send out square wave pulses for x number...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.