PDA

View Full Version : Input driver for parallel port



Ron
October 13th, 2002, 01:55 PM
Michael,

There is no parallel driver in there but making one is trivial ( i love it when they use that word it means its simple but i never figure it out :) ) With a little programing experience and my help on the plugin stuff you might be able to do it yourself

-Ron

Ron
October 13th, 2002, 01:55 PM
Hi Michael,

You are in luck! MarkF wrote a plugin for you ! its hardwired to LPT 1, I don't know the details about it but if you ask here Mark will surely reply :)

Parallel.zip get it here! (source included) (http://www.stack.nl/~stilgar/windoze/files/Parallel.zip)

Thanks a lot Mark!!

Ron
October 13th, 2002, 01:55 PM
Michael,

Mark updated his plugin to include everything we could ever dream up :smile: so get it while it is hot (from the download section of the girder page)

-Ron

Mark F
October 13th, 2002, 01:55 PM
Yeah, it felt like my brain was going to explode. I had to do something (in less than 2 hours) and the X-10 and serial plugin source is at home. I hope this helps.

As Ron said, I hardwired to LPT1 and didn't know which pins you wanted to watch so I queried the status port. There is NO user interface. This only works on non-NT based systems.

Michael H
October 13th, 2002, 01:55 PM
Hi, I'm relatively new to the Girder-software but my first impression is very good!

Is there an HW input-driver available for the parallel port?

I want to hook up 8 switches to this port to control the actions. (I have a pc without a keyboard)

I run Windows 95 so direct-port-adressing is still possible????

Keep up the good work guys!!

Michael H
October 13th, 2002, 01:55 PM
Thanks guys!

I hope to try it this weekend!

If ever your brain starts to explode again, please add all 8 databits to this driver. So that i can connect 8 pushbuttons for different functions!

I cannot do this myself because I haven't been programming since the day that Quickbasic died! :-)

Engine Management Systems aren't programmed in a 'visual' language! (and that's my game)

But if there are electronics questions around......ask me!!!

Vic
November 19th, 2002, 05:39 AM
Is there a new Version of parallel input plugin available ?
I tried to compile the Version from the Developers-Page (Input driver for Ver 3.1), but this plugin didn't work with my Version of Girder (that is 3.2.6b).

Thanks.

Mark F
November 19th, 2002, 06:13 AM
The plugin from that page hasn't been updated since 5/14/2001. I have no immediate plans to update it for Girder 3.2.6b. Sorry. :(

Vic
November 19th, 2002, 12:05 PM
Thank you -
but is there an other way to connect four or five keys (normal buttons for a stand-alone player) to a PC and run them with Girder ?

- Vic

Mark F
November 20th, 2002, 05:37 AM
Sure. You could connect up to 4 keys to a serial port.

Check out this (http://www.girder.nl/phpBB2/viewtopic.php?t=2753) thread.

Marsupial
November 20th, 2002, 06:06 AM
Er... Ifever I need something like 13 push buttons, is there a way to implement that within the serial port or should I go with another device?

Maybe connecting 3 comports?

Can serial port uses 2-3 ports within girder??


maybe dismounting an external numeric keypad?

thanks for any suggestions!

Mark F
November 20th, 2002, 07:37 AM
The serial plugin supports all the ports in your system. I've tested using the 5 on one of my home machines, concurrently, with no problems.

However, I would look at a multiplex arrangement before I'd take up multiple ports.

Thecleaner
November 20th, 2002, 08:58 AM
Hello,
i have a question to the LPT port too so i thought i can post it here.....

I want to control singel pins from the LPT port?
can I do this with girder?

I want to plug some devices at a parallel card an control them with the pc.... but i found no good software for this job.... to code my own is a little bit to tricky for my in the moment....

so can you help me?
and sorry für my bad english... :)

Marsupial
November 20th, 2002, 10:44 AM
thanks Mark, I tought of that, but how would it be wise to multiplex 13 switches to use with the serial plugin?

some PIC?

I'm realy more a software guy but am willing to devellop this thing, just need some hints :)

so thanks.

I'd like to make it simple...

Mark F
November 20th, 2002, 11:01 AM
OK. This is critical mass. :D

I'll build a plugin before the weekend for reading and writing ports on a PC. The timing of the polling along with the responsibility of direct access to a piece of hardware (and the havoc that it can cause) will be left to the user.

Mark F
November 20th, 2002, 11:10 AM
Mars -

There used to be a link to a picture in this thread (http://www.girder.nl/phpBB2/viewtopic.php?t=2321) that showed the wiring for 15 switches to the RING, DCD, CTS and DSR lines. When you pressed one switch, it caused these lines to have one of 16 bit patterns applied (0000 - 1111) to them. By seeing which combination of lines were on, you could discern the currently pressed switch.

Unfortunately, the link no longer works. :(

EDIT: I was able to find the drawing again. :)
Use this link http://www.meierspage.de
Enter the site
on the left side, choose How2s
next to the bottom, choose "Winamp Steuerung für den Com-Port"

There are two schematics on this page. One for 4 buttons and one for 15.

Mark F
November 20th, 2002, 01:15 PM
I just sent two plugins to Ron. HOWEVER, my mail system has rejected the files 3 times so I'm not sure they will get through. :(

One plugin is the parallel port plugin in an updated form. It uses the latest Girder API and accesses the parallel port using a .dll so it works on Windows (98, ME) and NT based systems (NT, 2000, XP).

The other plugin exports 6 functions to LUA so you can read or write any IO port on your system. It uses the same .dll file to access the ports.

The .dll you need to use either of these plugins is the PortIO driver from this (http://www.driverlinx.com/Software_Products/softwareproducts.htm) site. If you already use MMcM's parallel LCD support, you have this stuff already. If you have to download it, you must register with the site. Sorry. :(

Thecleaner
November 22nd, 2002, 05:12 AM
I think i have to push the topic... ;)

Ron
November 22nd, 2002, 05:30 AM
why ?

Marsupial
November 22nd, 2002, 06:27 AM
Thanks Mark!!!
totally missed that other thread.

:D

Ok, I cannot read German (or is it Dutch?) but I believe this is intended to be used within a winamp serial plugin.

Now according to that previous thread, this setup works with 4 buttons under the girder serial plugin. Can I expect the 15-button layout to function as well?

Thanks a lot... I have soldering to do this week-end! :D

Mark F
November 22nd, 2002, 07:57 AM
I would expect the 15 button version to work but to be a bit more work to keep the states straight. The latest serial plugin could make this a bit easier as you can define a modem event handler in LUA that gets handed the current line status on every change.

If you need an example of what I'm talking about, I can whip one up for you. I've been looking around for some switches, a non-soldering breadboard and other stuff so I can try this and build a serial device support file. Maybe next week while I'm on vacation. :)

Marsupial
November 22nd, 2002, 08:34 AM
Hey thanks for the help mark.

I'll have to proceed with GVMS-Lua translation before using LUA handler...

I reduced my GVMS usage a lot, but now still didn't do the change.
(if I open a GVMS GML into a LUA version of girder, will I still see the GVMS??? Can I still modify the scripts to translate them from GVMS to LUA??)

Anyhow, I don't understand the "states" your talking about... as far as I understood, the 15 switch layout is simply a 1-2-3-4 pin enabler depending on the switch pressed.

now the serial plugin have a "modem" event handler that looks to the same 4 pins and whenever there is one change it pops a girder event and have a variable with the state.

This is as I understood it.
now if this is true, then we only have to use the curren state to call a user event similar to any other remote controll press.

Am I making any sense?
Or I totally misunderstood how its supposed to be used.?

Mark F
November 22nd, 2002, 09:15 AM
You are exactly right. When I mentioned states, I was thinking of NOT using the modem event handler. Sorry for being a scatter-brain. :o

GVMS? What's that? :lol:

The trouble is GVMS doesn't support the TriggerEvent() command that LUA has. This means the event handler will know the state but won't be able to do anything with it. Therefore, I don't think you will be able to use the event handling method with GVMS. I believe you will need to catch the individual line change events that are generated by the serial plugin. Each change event will represent the change of one line.

This will be harder then the event handler method.

Ron
November 22nd, 2002, 09:30 AM
I reduced my GVMS usage a lot, but now still didn't do the change.
(if I open a GVMS GML into a LUA version of girder, will I still see the GVMS??? Can I still modify the scripts to translate them from GVMS to LUA??)

Yes you'll still see the GVMS code, it won't run, but you can see it.

Marsupial
November 22nd, 2002, 11:42 AM
Thanks Ron, now I know how I'll procees to translate from one another.


Mark - I'll surely upgrade to lua somewhere next week, by then I probably will have the hardware soldered and everything.

I'll then be a LUA newbe, so guidance would help a lot.

I still don't understand how the script should receive events...
normally isn't it when you have events that you start a script?

or is it that only the lua version would be able to get the info regarding all 4 lines?

What I want to do is plain simple: I want to use the 15 keys just like the multimedia keys of a keyboard... any help would be welcome.

Mark F
November 22nd, 2002, 01:05 PM
I'll try to be simple :D (this is normally when I start to babble the most so beware)

The serial plugin readme file goes over some of this but is probably not as clear as it should be.

The last few Serial plugin versions have added the capability of changing incoming serial data before it becomes events. The "things" that change the data are called event handlers. These event handlers are invoked directly by the threads of the serial plugin that service the hardware driver. The best way to write these event handlers is using LUA.

When one of these event handler scripts gets control, a special variable (named SerialValue) will contain the characters or data for the event. On a modem event, it will contain the state of all four lines (RING, DCD, CTS and DSR). Inspecting this value should allow you to generate unique events for each button press/release event.

This all hinges on using LUA because LUA allows you to generate events using the TirggerEvent() function. For example, a simple modem event handler for this function would look like this:


-- send the modem line information as an event
TriggerEvent(SerialValue,18)

Something more complicated would use the SerialValue to look up a more meaningful string ("button1", "button2", etc.) to send. As I said, I'm hoping to work on something similar next week while I'm on vacation. If I get it working, I'll post the device file (this defines everything about the device INCLUDING the event handlers) for you.

If you don't upgrade to LUA, this will be much harder. :(

Marsupial
November 25th, 2002, 12:56 PM
Thanks a lot Mark, this will definately be very usefull if you acomplishe that.

As for the plug-in, just seeing if I understood how it works.
the lua thread can monitor the changes so we can generate events according to the button presses?

I really tought the button changes would generate an event from the modemEvents in the serial plug-in without other process on our side.

anyhow, thanks for the info.

:D

Mark F
November 26th, 2002, 02:59 AM
The plugin can be set up to do one of two things:

Generate events for each detected line change
Call a routine (event handler) when one or more line changes is detected

The first one was added first and can be used just like any other event generated by a plugin. It is more difficult to use in the 15 button case as you, the .gml developer, need to keep track of which events have occured over a period of time to tell which button has been pressed.

The second one requires a LUA event handler to be useful; but, you should get all the line changes at once.

Marsupial
November 26th, 2002, 11:42 AM
Ok - now I get it... the 4 status will be sent as 4 different events... :( I tought since they change together it would give the final setup.

I'll need some tutorial on event handler - never used any. :oops:
Is there a lua event handler made somewhere? in fact any websites on LUA would be usefull. :)

Anyhow, thanks a lot for the info, it's greatly appreciated.



(nota: I realised this thing uses 28 1N4148... had only 18 left :cry: Local radioShack don't have them - delaying the soldering... Well, time to pass to LUA!)

Mark F
November 26th, 2002, 02:33 PM
I don't have tutorials for anything, sorry. :( The serial plugin distribution has some demo/example files though. The mouseremote and rpplus remote support files have some event handlers in them. They are not modem event handlers but character event handlers.

Mark F
November 27th, 2002, 04:43 PM
I just soldered together a REALLY rudimentary bread board.

WOW. Never let a software guy build hardware. :D

I found that the serial plugin generates all the modem events except the one for the ring line going low. This means you will be able to build 14 switches and detect button down/up events. The only one you can't use is the one represented by the ring by itself because you'll lose the button up event.

I use the Win32 serial interface in the serial plugin. I'm testing with Win '98 so it may work differently on a different release of Windows but this is what I'm seeing.

I'll work on the device support file later tonight or early tomorrow and post it here.

Mark F
November 28th, 2002, 03:35 AM
I'm attaching a device support file for a switch implementation (it will work for any number or config up to the max of 15). It requires LUA, the Serial Plugin (the latest), the WinLUAEx plugin (the latest) and the latest Girder.

See the serial plugin readme file for a bit on importing a device support file.

Feel free to change the button names in the enable event script to something more meaningful.

By the way, on my machine, when brought high, the ring indicator continuously fires until the line is released. I don't know if the same will be true on your machine.

Enjoy. :)

Marsupial
November 28th, 2002, 06:35 AM
Hey thanks mark!

I didn't have much time this week, I'll work on that next week (I need to complete my lua translation...) Anyway, I'll get the missing diodes tonight.

Ok, so you're telling me there is going to be only 14 buttons working? too bad the ring doesn't work all by itself...

anyway I needed 13, still have one extra.



when brought high, the ring indicator continuously fires until the line is released
you mean when the switch is conducting?

I plan on using a momenrary switch. then putting delays in the girder event will do the trick?


anyway thanks a lot mark! this is really appreciated!

Marsupial
November 29th, 2002, 05:23 PM
Hi Mark!

it works fine.

I have the ring problem as you described... Button3 (value 64) is not stable and tends to repeat the release while holded down, and not always show when pressed.
Since it was not stable, I deleted it and used another I didn't use. I need 13, there's 14 left - an EXTRA! I'll figure out a place to use it :D

anyway,
thanks a lot, this is really great.