Page 1 of 2

External buttons - LPT - 25.07.2007

Posted: October 17th, 2006, 9:09 pm
by Szakalit
Update: Buttons 1.2 (25.07.2007)

After update to 5.4 first function dont work properly,
instead of $dll(buttons,1,0,0) pls use $dll(buttons,2,$379,0)



Update: Buttons 1.2 (22.11.2006)

New:
- LED status on COM Port
- Writing to custom I/O port

Use:
LED status on COM Port:

$dll(buttons,3,COM1,1) - turn on D1 (pin 3)
$dll(buttons,3,COM1,10) - turn off D1 (pin 3)
$dll(buttons,3,COM1,2) - turn on D2 (pin 4)
$dll(buttons,3,COM1,20) - turn off D2 (pin 4)
$dll(buttons,3,COM1,3) - turn on D3 (pin 7)
$dll(buttons,3,COM1,30) - turn off D3 (pin 7)

You can also use COM2 - $dll(buttons,3,COM2,1)

Rx on schematic you have to chose by your self its depend on what type and colour of LED you are using, for example you can chose 1 Kohm.

Writing to custom I/O port:

$dll(buttons,4,$400,$45) - here you are writing value $45 on port $400, values are in hex.


If someone have other ideas how to upgrade this plugin or write something else pls write.



************************************************************

Update:

New:
- custom port function

Use:
$dll(buttons,2,$379,0) - you can change '$379' with port that you whant to use.


This is my first plugin :)
Its very simple.

Connection:
I used only 2 free pins of (10,11) but i think that you can use others too (12,13).

Plugin:
Copy buttons.dll to plugin folder.

Use:
$dll(buttons,1,0,0) this will give you result of reading at $379

Write $dll(buttons,1,0,0) at first line press apply and then pres one of your button's , this will show you the code of your button.
Now go to "actions" and add action like this:
$dll(buttons,1,0,0) = "code of your button" and the action.

If you have some problems/questions just write :)

(plugin hosted here on forums - login and download it)

Is there a dll file to download?

Posted: October 20th, 2006, 9:05 pm
by santa8claws
Hi, I was interested in this too, but didn't see any sources for attachment. Also would it be possible to add in an option to read from a custom I/O port for additional "button" logic inputs? That way I could use an extra digital input I/O port for keypad input.
Thanks again!
-- S8C

Posted: October 24th, 2006, 4:39 am
by mihajlo
Great idea, Szakalit!
Use:
$dll(buttons,1,0,0) this will give you result of reading at $379
Will it still work for a different port address?

Posted: October 24th, 2006, 11:09 am
by Szakalit
mihajlo wrote:Great idea, Szakalit!
Thx
santa8claws wrote:Also would it be possible to add in an option to read from a custom I/O port for additional "button" logic inputs? That way I could use an extra digital input I/O port for keypad input.
mihajlo wrote:Will it still work for a different port address?
I will add "custom port function" today :)

Posted: November 4th, 2006, 4:58 pm
by twhyman
did any one tried connecting more buttons?

this one shows the use of pin 12 too.

Image

cause my lcd i got pins 10-13,15,17 free maybe we can use them for more buttons?

or using serial port fo buttons?

i would of tried but iam afraid to break somthing :oops:

thanks
Twhyman

Posted: November 4th, 2006, 6:09 pm
by Szakalit
twhyman wrote:did any one tried connecting more buttons?

this one shows the use of pin 12 too.


cause my lcd i got pins 10-13,15,17 free maybe we can use them for more buttons?

or using serial port fo buttons?

i would of tried but iam afraid to break somthing :oops:

thanks
Twhyman
Yes you can connect 12 and 13 - this will give you 4 buttons.

If someone need more buttons write and i will show how.

Posted: November 4th, 2006, 7:40 pm
by twhyman
ok so i just hook 4 buttons like the other 2 to pin 10-13, and use your plugin?

is thats it?


thanks alot
twhyman

Posted: November 4th, 2006, 8:38 pm
by Szakalit
twhyman wrote:ok so i just hook 4 buttons like the other 2 to pin 10-13, and use your plugin?

is thats it?
Yes :)

Posted: November 4th, 2006, 9:21 pm
by twhyman
Szakalit wrote:
twhyman wrote:ok so i just hook 4 buttons like the other 2 to pin 10-13, and use your plugin?

is thats it?
Yes :)
Man, you jusy made my day :)

Buttons in a matrix with buttons.dll ?

Posted: November 16th, 2006, 10:59 pm
by wilbert
Szakalit tnx for riting this plugin.

Is it possible to conect the buttons in a matrix? I'm using a homemade keypad with 10 buttons and want to use them al.

Thanks!

Posted: November 17th, 2006, 4:48 pm
by Szakalit
Simple connection of 15 buttons.

Posted: November 17th, 2006, 7:27 pm
by mattcro
Check the schematic - shouldn't the diodes be the other way round?

For some parallel ports, it may be necessary to add pull-up resistors to +5V of around 10k ohms.

Posted: November 17th, 2006, 10:49 pm
by Szakalit
mattcro wrote:Check the schematic - shouldn't the diodes be the other way round?
Yes of course :oops: :oops: :oops: i have changed schematic.

mattcro wrote: For some parallel ports, it may be necessary to add pull-up resistors to +5V of around 10k ohms.
Yes you have right :D

How about LED outputs?

Posted: November 20th, 2006, 11:44 pm
by santa8claws
Hi,
I wanted to say thanks for this plugin. It has a great potential and seems very useful but I'd like to try a few other things.
Would it be possible to add an IO port output function for setting an output pin high so that you can read it back as an input?
For example to use pin 17 (SelectOutput)
write to port 0x37A with bit 3 set to output a high through open-collector outputs, which can then be pulled low and "read" using an input to port 0x37A
Additionally, would it be possible to perform an IO write to an alternate port address for setting some external LEDs such as a Red or Green status indicator.
How easy is it to change your code for this? Is this something you are willing to share?
Thanks!

Posted: November 21st, 2006, 6:48 am
by IFR
hey I like the idea of an external LED support. :idea:

Maybe Szakalit can modify the code to add this extra feature.

Posted: November 21st, 2006, 7:35 am
by limbo
IFR wrote:hey I like the idea of an external LED support. :idea:

Maybe Szakalit can modify the code to add this extra feature.
Yeah, something like GPO feature on Matrix Orbital. Using a pin and command it like an output

Re: How about LED outputs?

Posted: November 21st, 2006, 12:38 pm
by Szakalit
santa8claws wrote: Would it be possible to add an IO port output function for setting an output pin high so that you can read it back as an input?
For example to use pin 17 (SelectOutput)
write to port 0x37A with bit 3 set to output a high through open-collector outputs, which can then be pulled low and "read" using an input to port 0x37A
Hmm i think i don't know what exactly you want to do.
You want to put HI or LOW on Pin 17 (0x37A) and then read it back by 10,11,12,13 or 15 Pin (0x379) :?:

santa8claws wrote: Additionally, would it be possible to perform an IO write to an alternate port address for setting some external LEDs such as a Red or Green status indicator.
How easy is it to change your code for this? Is this something you are willing to share?
Thanks!
No its not hard to do that i think i will make this today with LPT and COM support :D

Re: How about LED outputs?

Posted: November 21st, 2006, 5:45 pm
by santa8claws
Szakalit wrote:
santa8claws wrote: Would it be possible to add an IO port output function for setting an output pin high so that you can read it back as an input?
For example to use pin 17 (SelectOutput)
write to port 0x37A with bit 3 set to output a high through open-collector outputs, which can then be pulled low and "read" using an input to port 0x37A
Hmm i think i don't know what exactly you want to do.
You want to put HI or LOW on Pin 17 (0x37A) and then read it back by 10,11,12,13 or 15 Pin (0x379) :?:
Some parallel parts require setting an output pin to a logic high before they can then be used as an "input" by reading back the status of the pin. If the port is EPP compatible, then the pin is an Input/Output and would be fine to just use as an input.

As a second idea, I was wondering about being able to perform basic output to set a bit and control an external LED. So for example, I could also just use a parallel pin as only an "output " and use it as a status indicator.
Szakalit wrote:
santa8claws wrote: Additionally, would it be possible to perform an IO write to an alternate port address for setting some external LEDs such as a Red or Green status indicator.
How easy is it to change your code for this? Is this something you are willing to share?
Thanks!
No its not hard to do that i think i will make this today with LPT and COM support :D

In thinking about the idea to make it more general purpose, I'm wondering if you can read or write to any IO port. For example I have a digital IO Port at address 0x140 that I can output 4 signals and read in 4 inputs. Wiring it up to a few keypad buttons and an LED indicator, I can use this plugin and it can control the LCD display pages and blink a few lights!

Re: How about LED outputs?

Posted: November 21st, 2006, 6:57 pm
by Szakalit
santa8claws wrote: Some parallel parts require setting an output pin to a logic high before they can then be used as an "input" by reading back the status of the pin. If the port is EPP compatible, then the pin is an Input/Output and would be fine to just use as an input.
Yes you have right, but in LPT only D0-D7 are bidirectional.
santa8claws wrote: As a second idea, I was wondering about being able to perform basic output to set a bit and control an external LED. So for example, I could also just use a parallel pin as only an "output " and use it as a status indicator.
I have started working on that but on standard LCD (2x16,2x20...) connection you have only 1 Pin free if you not using it to something else,
and that's why i want to add ComPort support, with COM you can add 3 LED's.
santa8claws wrote: In thinking about the idea to make it more general purpose, I'm wondering if you can read or write to any IO port. For example I have a digital IO Port at address 0x140 that I can output 4 signals and read in 4 inputs. Wiring it up to a few keypad buttons and an LED indicator, I can use this plugin and it can control the LCD display pages and blink a few lights!
Yes i can read or write to any IO port. But i need some information, in your example first 4 bytes are output or input? or output bytes are on 0x140 ind input on 0x140+1 ? If you will write me this information's i think i can help you :)


********************************************
Update:

Now i know that it's impossible to to control LED with the same LPT port that LCD is connected because Smartie always overwrite commands that i want to send :( So now it will be possible only with COM Ports or second LPT port but who wave 2 LPT ports in this times ?

Re: How about LED outputs?

Posted: November 28th, 2006, 8:17 pm
by santa8claws
Szakalit wrote:
santa8claws wrote: Some parallel parts require setting an output pin to a logic high before they can then be used as an "input" by reading back the status of the pin. If the port is EPP compatible, then the pin is an Input/Output and would be fine to just use as an input.
Yes you have right, but in LPT only D0-D7 are bidirectional.
santa8claws wrote: As a second idea, I was wondering about being able to perform basic output to set a bit and control an external LED. So for example, I could also just use a parallel pin as only an "output " and use it as a status indicator.
I have started working on that but on standard LCD (2x16,2x20...) connection you have only 1 Pin free if you not using it to something else,
and that's why i want to add ComPort support, with COM you can add 3 LED's.
Hmm, well presumably you could sacrifice a few parallel (button) inputs and make them outputs?
Szakalit wrote:
santa8claws wrote: In thinking about the idea to make it more general purpose, I'm wondering if you can read or write to any IO port. For example I have a digital IO Port at address 0x140 that I can output 4 signals and read in 4 inputs. Wiring it up to a few keypad buttons and an LED indicator, I can use this plugin and it can control the LCD display pages and blink a few lights!
Yes i can read or write to any IO port. But i need some information, in your example first 4 bytes are output or input? or output bytes are on 0x140 ind input on 0x140+1 ? If you will write me this information's i think i can help you :)


********************************************
Update:

Now i know that it's impossible to to control LED with the same LPT port that LCD is connected because Smartie always overwrite commands that i want to send :( So now it will be possible only with COM Ports or second LPT port but who wave 2 LPT ports in this times ?
That's too bad that Smartie takes over the LPT port.

Thanks for adding the function to output data over a specific IO port, whether it be serial com, second lpt, joystick port, or alternate digital io port. That seems to help the most since I'm looking to read/write to IO port 0x123 with an 8-bit value with 4 bits input and 4-bits output.

Happy Coding!

Posted: June 7th, 2007, 12:17 pm
by kostassite
Hi,I just updated to 5.4 Lcd smartie and this plugin don't work
when I write $dll(buttons,1,0,0) and press apply the programm close.and if i open it again when it goes to that screen it closes again so i have to change the screen text through config.ini
Why???Whats wrong with the latest release???

Posted: June 10th, 2007, 8:37 am
by shah81
kostassite wrote:Hi,I just updated to 5.4 Lcd smartie and this plugin don't work
when I write $dll(buttons,1,0,0) and press apply the programm close.and if i open it again when it goes to that screen it closes again so i have to change the screen text through config.ini
Why???Whats wrong with the latest release???
Got the same problem. Have to revert back to 5.3.2 for this plugin to work. Now I don't have that SSL option for email :(

Posted: June 20th, 2007, 3:23 pm
by kostassite
Hi,I just updated to 5.4 Lcd smartie and this plugin don't work
when I write $dll(buttons,1,0,0) and press apply the programm close.and if i open it again when it goes to that screen it closes again so i have to change the screen text through config.ini
Why???Whats wrong with the latest release???

Can anyone answer me??????????????????????

Posted: July 16th, 2007, 11:52 am
by shah81
kostassite wrote:Hi,I just updated to 5.4 Lcd smartie and this plugin don't work
when I write $dll(buttons,1,0,0) and press apply the programm close.and if i open it again when it goes to that screen it closes again so i have to change the screen text through config.ini
Why???Whats wrong with the latest release???

Can anyone answer me??????????????????????
I've pm Szakalit about this problem and he gave me a solutio
Hi

if you are using function $dll(buttons,1,0,0) and program is closing
use this function $dll(buttons,2,$379,0) and it will work
I've tried it and it worked for me. Now I can use version 5.4 :D

Posted: July 18th, 2007, 1:59 pm
by kostassite
thanks
I will try it