LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Interfacing parallel port with Gambas (https://www.linuxquestions.org/questions/programming-9/interfacing-parallel-port-with-gambas-649580/)

fos 06-16-2008 03:48 AM

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

theNbomr 06-16-2008 10:52 AM

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.

fos 06-16-2008 02:59 PM

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 ?

theNbomr 06-16-2008 04:06 PM

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.

theNbomr 06-16-2008 05:07 PM

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.

fos 06-17-2008 07:56 AM

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

theNbomr 06-17-2008 10:14 AM

/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.

Askjerry 01-17-2018 10:36 PM

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

http://gambaswiki.org/wiki/howto/parport

astrogeek 01-17-2018 10:50 PM

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.

Askjerry 01-17-2018 10:58 PM

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

astrogeek 01-19-2018 02:44 PM

@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.


All times are GMT -5. The time now is 11:15 PM.