Topics Topics Edit Profile Profile Help/Instructions Help Member List Member List  
Search Last 1|3|7 Days Search Search Tree View Tree View  

Parallel port control with C++

:: EPE Chat Zone ­:: ­Radio Bygones Message Board :: » EPE Forum Archives 2005-2006 » Archive through 07 June, 2006 » Parallel port control with C++ « Previous Next »

  Thread Last Poster Posts Pages Last Post
  ClosedClosed: New threads not accepted on this page        

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Noel
Valued Member
Username: Noel

Post Number: 14
Registered: 06-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, 25 May, 2006 - 05:25 pm:   Edit Post Delete Post Print Post

Hi all,
I am working on a project which requires individual pin (d0 - d7)on a computers LPT1 port to be switched on and off for durations in the region of 100mS. I have some knowledge of general programming with Borland C++ but I have absolutly no idea of what the code is that send parallel port pins high/low with this language. Can anyone tell me what this code might be or if its even possible. I intend to use the software with whatever operating system (win95/98/2k etc) creates the least work for me. I have searched the internet in vain for an .exe file that would allow me to control the individual pins for durations less than 1 second, and where the timing can be modified.
Any help would be greatly appreciated.
kind regards, Noel.
Top of pagePrevious messageNext messageBottom of page Link to this message

Micro82
Regular Contributor
Username: Micro82

Post Number: 41
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, 25 May, 2006 - 07:09 pm:   Edit Post Delete Post Print Post

Hi there,

Try having a look at some of the EPE projects that use inpout32.dll

I have used this quite a bit in the past within VB and with a little patience you should be able to use it with C++.

This file allows access to the parallel and RS232 ports from the window environment.

Hope this helps

Regards
Pete
Pete@customsoft.karoo.co.uk
Top of pagePrevious messageNext messageBottom of page Link to this message

Mikehibbett
Frequent Contributor
Username: Mikehibbett

Post Number: 443
Registered: 04-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, 25 May, 2006 - 07:20 pm:   Edit Post Delete Post Print Post

Very simple in Win95/Win98; slightly harder in win2K, winXP. I'll drop you some sample code if you like - PM me.

Can't do it right now - got to cut the grass while the sun is shining!

Mike.
-----
www.drivesentinel.co.uk - Home build GPS Speed Camera Detectors
Top of pagePrevious messageNext messageBottom of page Link to this message

John_becker
:::: Super User ::::
Username: John_becker

Post Number: 348
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, 25 May, 2006 - 07:36 pm:   Edit Post Delete Post Print Post

Micro82, I'm not sure that DLL can be used elsewhere, only with VB6, are you sure about C?
But take up Mike H's offer, good man he is and knowledgable in such areas! (Tis important about that grass though , still got mine to do before it reaches fence height - and Gill wont be convinced by my argument that at Chelsea many of the display gardens had similar grasses height in them, and they got Gold etc :-)

J
Top of pagePrevious messageNext messageBottom of page Link to this message

Mikehibbett
Frequent Contributor
Username: Mikehibbett

Post Number: 444
Registered: 04-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, 25 May, 2006 - 08:35 pm:   Edit Post Delete Post Print Post

Right. Grass done. Darn stuff never stops growing!

Ok, I use Visual C++ but Borland has a similar set of functions you can call: inp( port ) and outp(port, value)
These read or write values to 'ports' on the Intel/AMD processor.

The parallel port can be accessed through these calls. To save me typing, there is a nice description, with some C code here:

http://www.ctv.es/pckits/tutorial.html#pdescr

Using inp and outp works fine for win95 and win98; winNT, Win2K and WinXP are slightly more secure than the older OSs and do not allow an application program direct address to these ports. You can however install a special driver program that will over come those restrictions, without having to change a line of your code. There are several versions on the web, I use PortTalk, which you can get here:

http://www.beyondlogic.org/porttalk/porttalk.htm

Hope thats helps.

Oh by the way John, I believe that any programming language can interface a DLL's API. I think in the case of inpout32.dll and 'C' there probably isn't much point due to the fact that the feature is already implemented in 'C'.

Ah well, back to the household chores!

Mike.
-----
www.drivesentinel.co.uk - Home build GPS Speed Camera Detectors
Top of pagePrevious messageNext messageBottom of page Link to this message

Amr_bekhit
Frequent Contributor
Username: Amr_bekhit

Post Number: 207
Registered: 06-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, 25 May, 2006 - 10:39 pm:   Edit Post Delete Post Print Post

I used Borland C++ before and remeber the inp and outp commands: I don't think they worked on NT systems. Just a warning.

--Amr
Top of pagePrevious messageNext messageBottom of page Link to this message

Mikehibbett
Frequent Contributor
Username: Mikehibbett

Post Number: 445
Registered: 04-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, 25 May, 2006 - 10:46 pm:   Edit Post Delete Post Print Post

>I used Borland C++ before and remeber the inp and outp commands: I don't think they worked on NT systems.

They will if you use the driver I mentioned in the last post.

Mike
-----
www.drivesentinel.co.uk - Home build GPS Speed Camera Detectors
Top of pagePrevious messageNext messageBottom of page Link to this message

John_becker
:::: Super User ::::
Username: John_becker

Post Number: 350
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 26 May, 2006 - 01:24 am:   Edit Post Delete Post Print Post

Amr, INPOUT32 might not have worked for you if using an earlier version, but I believe a later version does. The one currently supplied with TK3 was downloaded from the the original site (I forget what that is) some 18 months ago and reportedly works fine with later W platforms. It has a date of 2004 something or other. Email me via HQ and I'll send a copy if you have difficulties, it's not copy-restricted.

J
Top of pagePrevious messageNext messageBottom of page Link to this message

Amr_bekhit
Frequent Contributor
Username: Amr_bekhit

Post Number: 208
Registered: 06-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 26 May, 2006 - 01:26 am:   Edit Post Delete Post Print Post

No no, inpout32 works fine for me. I was talking about Borland C++'s built in inp and outp functions.

--Amr
Top of pagePrevious messageNext messageBottom of page Link to this message

Noel
Valued Member
Username: Noel

Post Number: 15
Registered: 06-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 26 May, 2006 - 10:14 am:   Edit Post Delete Post Print Post

Thank you all for your very generous offers of help. I will try to digest all this info. If I rum into problems - Im sure I will be back. Thanks alot.
P.S. Mike - Have you ever seen those automatic vacuum cleaners that you switch on in a room and walk away from, they have a fleet of sensors to allow them get around objects automatically - It would make an intresting project for you to adapt this technology to your lawnmower!!!
Top of pagePrevious messageNext messageBottom of page Link to this message

Mikehibbett
Frequent Contributor
Username: Mikehibbett

Post Number: 446
Registered: 04-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, 26 May, 2006 - 10:50 am:   Edit Post Delete Post Print Post

>P.S. Mike - Have you ever seen those automatic vacuum cleaners

Funny you should say that. A few years back myself and a few friends designed a vacuum cleaning robot for a competition in Switzerland. By a complete fluke we won. You can see our cleaner in action here:

http://robotika.cz/competitions/cleaning2002/en

The case was made from an Apache Pizza box, which really annoyed some of the other competitors :o)

Mike.
-----
www.drivesentinel.co.uk - Home build GPS Speed Camera Detectors
Top of pagePrevious messageNext messageBottom of page Link to this message

Scott2734
Frequent Contributor
Username: Scott2734

Post Number: 76
Registered: 10-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Saturday, 27 May, 2006 - 07:09 am:   Edit Post Delete Post Print Post

I hope im not too off topic here. Mike,did you learn c++ from the visual side, or did you learn c++ standard library first then move on to gui interfaces? The reason im asking is because i started with a visual c++ book and figured out quickly that it didnt get to the core of the language.I then got a c++ book that tought the standard library and feel that im learning the core language now, but, it doesnt go into gui interfaces.It works with the dos command box mostly. Could you recomend a book that works with the standard library that gets into the advanced gui interfaces? I'm wanting to learn the standard library so i can program on cross platforms and not just microsoft operating systems.
Top of pagePrevious messageNext messageBottom of page Link to this message

Zeitghost
Frequent Contributor
Username: Zeitghost

Post Number: 188
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Saturday, 27 May, 2006 - 04:56 pm:   Edit Post Delete Post Print Post

Petzold's book, "Programming Windoze", is the standard tome for the Windoze API and it's all in C... currently on 5th Edition... I've been reading it since Windoze 3 (2nd Edition) & still can't create a decent interface... :o(
Top of pagePrevious messageNext messageBottom of page Link to this message

Mikehibbett
Frequent Contributor
Username: Mikehibbett

Post Number: 448
Registered: 04-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Saturday, 27 May, 2006 - 07:14 pm:   Edit Post Delete Post Print Post

>Mike,did you learn c++ from the visual side?

Kind of picked it up as I went along. I don't like the interface, there is so much that is poorly documented.

The hard stuff is easy, but the simple stuff can sometimes be almost impossible. I'm glad I work with embedded systems!

Mike.
-----
www.drivesentinel.co.uk - Home build GPS Speed Camera Detectors

Administration Administration Log Out Log Out   Previous Page Previous Page Next Page Next Page