LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-16-2008, 03:48 AM   #1
fos
LQ Newbie
 
Registered: Jun 2008
Distribution: Ubuntu 10.04 LTS
Posts: 11

Rep: Reputation: 0
Interfacing parallel port with Gambas


Hello,

this is my first post.
I need to interface a simple electronic circuit, which I constructed some time ago, with my computer using Gambas. I found out Parapin, and it seems to be very useful but I didn't find how to use it in Gambas. How can I include Parapin in Gambas, in C++ I do "#include <parapin.h>"

Thanks, Francesco

Last edited by fos; 06-16-2008 at 03:50 AM.
 
Old 06-16-2008, 10:52 AM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
I'm pretty sure parapin is a C-only API. I don't know anything about Gambas, but it is not uncommon for languages to provide some bridge mechanism to allow the language to import/bind-to interfaces for other languages, especially C. As I understand it, Gambas is a sort of Visual BASIC clone for Linux. As such, I cannot imagine there is a lot of support for the kind of low-level tinkering you are trying to do. Have you though about whether you are using the right tool?
--- rod.
 
Old 06-16-2008, 02:59 PM   #3
fos
LQ Newbie
 
Registered: Jun 2008
Distribution: Ubuntu 10.04 LTS
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks, I read on the Gambas web Documentation that it's possible to interface the program with a parallel port using parapin or an other way that I don't understand. Can someone help me please ?
 
Old 06-16-2008, 04:06 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Can you provide a link to that information? I see that you are on Newbie status, so you may have to describe where to click from the Gambas home page.
Maybe a mod can grant you an exception somehow.
--- rod.
 
Old 06-16-2008, 05:07 PM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Okay, never mind. I found it, and I see that the /dev/port method is available. Is there a reason you cannot or don't want to use that?
Note that to poke around at hardware in direct ways like you are trying to do will require root privileges. Maybe that is your big obstacle. This holds true in any language, BTW.
--- rod.
 
Old 06-17-2008, 07:56 AM   #6
fos
LQ Newbie
 
Registered: Jun 2008
Distribution: Ubuntu 10.04 LTS
Posts: 11

Original Poster
Rep: Reputation: 0
Use /dev/port method might work, but I don't know how to use it. I don't know Gambas well, I am able to use only Visual Basic. So when I used to work with Windows, Visual Basic was fine but now I need to command the parallel port with Gambas.
I'd like to have some example codes.

Thanks
 
Old 06-17-2008, 10:14 AM   #7
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
/dev/port is a kind of 'pseudo-file' which uses the same semantics for reading and writing as does a normal file: open()/read()/write()/seek()/close(). You open the file '/dev/port', just like an ordinary file. To access a particular IO port, you seek() to that port, as if you were seek()ing to a particular byte offset in a normal file. All subsequent read()s or write()s will get/send the data to/from that IO port. You can then seek() to a different port address, for read() and write()s there.
If you find this difficult, I think you will find the parapin interface equally challenging. For any of this to make sense, you need understand the fundamental basis of accessing IO space on an x86 CPU. Have you done any prior programming at this level on any platform? There is a decent discussion of the concept in another LQ thread, where I posted some C code that demonstrates the concepts.
--- rod.
 
Old 01-17-2018, 10:36 PM   #8
Askjerry
LQ Newbie
 
Registered: Jan 2018
Posts: 6

Rep: Reputation: Disabled
Post UPDATE

For anyone else following this... here is more data that should answer the question.

http://gambaswiki.org/wiki/howto/parport
 
Old 01-17-2018, 10:50 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,586
Blog Entries: 11

Rep: Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617
Welcome to LQ!

You have replied to a thread last active 10 years ago. While your post may be relevant, necroposting as it is called is generally frowned upon and it is preferred that you open your own thread with current information regarding your own issues.

Please review the Site FAQ for guidance in posting your questions and general forum usage.
 
Old 01-17-2018, 10:58 PM   #10
Askjerry
LQ Newbie
 
Registered: Jan 2018
Posts: 6

Rep: Reputation: Disabled
Didn't mean to step on any toes as it were... but I've been researching the topic about an hour now... and read through the above topic as part of that research... upon hitting the bottom of the thread, the answer was not conclusive.

I figured that i would save someone else the trouble and post the detailed information here... rather than start a mirror thread. I'm quite active on the LinuxCNC forum... and I have seen up to 5 threads following the same issue. I always attempt to mitigate that. For example, I had a thread about GLADE control panels... and when resolved, had another thread about python code to add additional functionality. In the body of each thread, I supplied a link to the parent thread so that any user could gain from what had been learned without excessive searching.

Anyway, assume positive intent. :-)

Once I get a handle on Linux programming... I'm sure I'll be full of questions.
Thanks,
Jerry
 
Old 01-19-2018, 02:44 PM   #11
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,586
Blog Entries: 11

Rep: Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617
@AskJerry: Your experience and skills are a welcome addition to LQ!

However, as you mentioned complying with "the rules" in order to be able to post a link to your own site or other arena where you participate, I think it important to comment:

Although there must be rules in a public forum, LinuxQuestions is not about "the rules", it is all about participation, sharing and interacting with others, helping others and forming a community in the process. As such, the rules are there as a guide, not an algorithmic device to be used for advantage.

Posting self-contained, complete and relevant replies to the questions of others, even in older threads, is always welcome! Seeking out old threads as an opportunity to post self promoting links, relevant or not, is not acceptable behavior.

Please remember that your posts here form a permanent resource which will be found by others seeking help for years to come. External links come and go, youtube channels disappear and content is changed, all of which affects the completeness and quality of the information found here. So it is preferred that you provide answers, and questions, which are self-complete within themselves and the context of the thread, with minimal reliance on external resources.

Participation consists in taking time to understand the questions asked, and from that understanding to formulate your own response, inline. Use of search skills to find external resources is most useful before asking questions or posting replies, and is encouraged.

Last edited by astrogeek; 01-19-2018 at 03:26 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Serial/Parallel/Game Port Interfacing sparkyssb Programming 8 06-29-2006 01:41 PM
interfacing using parallel port divu Programming 1 04-13-2006 08:39 AM
Parallel port/i2c interfacing question Mike Davies Linux - Hardware 0 10-01-2005 08:45 AM
interfacing using perl(parallel port) teao Programming 1 07-29-2003 03:47 AM
Interfacing Video camera with USB port Tanyakolee Linux - General 1 06-12-2001 02:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration