| |
 |
|
 |
| |
|
dl4huf
|
Joined: 02 Oct 2006 Posts: 28
|
|
|
 |
|
 |
| |
Posted: Mon Oct 02, 2006 10:09 am Post subject: LCD on LED-Lines |
|
|
Hello
I have connected an LCD with HD44780 ( or compatiel) Controller on 6 LED-Lines.
The wiring is simple ! Only 4 Lines to D4..D7 and one Line to the RS and EN
Signal. The R/W-Line is connected to GND, only write is possible.
For faster programms you need extra delay of 2..5ms after Init und Clear-commands (see Datasheet).
+5V came also from the Router (USB-Version).
( Attention for LCDs with LED-Backlight ! you need an extra +5V supply )
It works.
But I´m not an C-Programmer, so I have made a PERL-Programm.
The Router has microperl.
The Demoprogramm is very slow but for simple Messages it works.
Is somebody to convert this to C ?
The programm need also extensions for command-switch for INIT, CLEAR, MODE etc.
ronald
---------------------------------------------------------------------
#!/usr/bin/microperl -w
$debug = 0;
$set_led = '/usr/bin/led_setnew';
$bit_low = "$set_led on";
$bit_high = "$set_led off";
#define LED->LCD wiring
$rs = 6;
$en = 12;
$D4 = 8;
$D5 = 9;
$D6 = 10;
$D7 = 11;
sub Nibbel_out{
my ($_nib)= @_;
if (($_nib & 0x01) == 0) {`$bit_low $D4`} else {`$bit_high $D4`};
if (($_nib & 0x02) == 0) {`$bit_low $D5`} else {`$bit_high $D5`};
if (($_nib & 0x04) == 0) {`$bit_low $D6`} else {`$bit_high $D6`};
if (($_nib & 0x08) == 0) {`$bit_low $D7`} else {`$bit_high $D7`};
`$bit_low $en`; # EN high
`$bit_high $en`; # EN low
};
sub Data_out{
my ($_out,$_command) = @_;
if ($_command == 1) {`$bit_low $rs` } else {`$bit_high $rs`};
if ($debug == 1) {printf "\n Output: %08b, $_command \n",$_out};
Nibbel_out($_out >> 4);
Nibbel_out($_out);
};
sub String_out{
my ($_sout) = @_;
for ($i=0; $i<length($_sout); $i++) {
if ($debug == 1) {printf substr($_sout,$i,1)};
Data_out(ord(substr($_sout,$i,1)),0);
};
};
sub LCD_Init{
`$bit_low $rs`; # set RS-Line to low
`$bit_low $en`; # set EN-Line to low
# Init
Nibbel_out(0x03);
Nibbel_out(0x03);
Nibbel_out(0x03);
Nibbel_out(0x02);
Data_out(0x28,1); # display function (4-bits, 2 Line)
Data_out(0x0c,1); # blinking off, cursor off
Data_out(0x01,1); # display clear
Data_out(0x06,1); # entry mode. cursor moves
}
# Main
LCD_Init;
$input = "";
chop($input = <STDIN>);
String_out("$input"); _________________ 2x Edimax BP6104K + USB-Mod
I2C-Bus with 40x2 LCD, RTC, ADC, DAC |
|
|
| Back to top |
|
|
 |
|
 |
 |
|
 |
| |
|
dl4huf
|
Joined: 02 Oct 2006 Posts: 28
|
|
|
 |
|
 |
| |
Posted: Tue Oct 10, 2006 1:11 pm Post subject: |
|
|
Hello
I have transferred with help from my son and many trial and error the perl-program to C. It works now very fast.
I have learnt any over C and the toolchain for the Edimax-Router.
A example can download from http://www.ipb-halle.de/~ronald/ADM5120/LED-LCD/.
This example has not the ability as lcd4linux. You can only
init the display, home, clear, select line 2 and print text.
The benefit is, that you do not need to solder the very thin SMD-contacts for
GPIO1 and GPIO3 (with I2C-Module). _________________ 2x Edimax BP6104K + USB-Mod
I2C-Bus with 40x2 LCD, RTC, ADC, DAC |
|
|
| Back to top |
|
|
 |
|
 |
 |
|
 |
| |
|
sWastel
|
Joined: 08 Nov 2006 Posts: 3
|
|
|
 |
|
 |
| |
Posted: Thu Nov 09, 2006 1:23 pm Post subject: |
|
|
how to connect the D4-D7, RS and EN cable to the LEDs? on + or -?
Can you tell me more? |
|
|
| Back to top |
|
|
 |
|
 |
 |
|
 |
| |
|
dl4huf
|
Joined: 02 Oct 2006 Posts: 28
|
|
|
 |
|
 |
| |
Posted: Thu Nov 09, 2006 5:03 pm Post subject: |
|
|
First i dos not understand your question, but then i have seen the small + and - on the
board
You must connect to the "-" on the led.
The wiring is :
| Code: |
------------+ o +3.3V
ADM5120 | LED resistor |
led-port o----o--|<---===----+
| |
: +-- to LCD
|
------------+
|
Its not needed to remove the LED. _________________ 2x Edimax BP6104K + USB-Mod
I2C-Bus with 40x2 LCD, RTC, ADC, DAC |
|
|
| Back to top |
|
|
 |
|
 |
 |
|
 |
| |
|
diegos
|
Joined: 13 Nov 2006 Posts: 6
|
|
|
 |
|
 |
| |
Posted: Mon Nov 13, 2006 3:30 am Post subject: 5v to adm5120? |
|
|
| dl4huf wrote: | First i dos not understand your question, but then i have seen the small + and - on the
board
You must connect to the "-" on the led.
The wiring is :
| Code: |
------------+ o +3.3V
ADM5120 | LED resistor |
led-port o----o--|<---===----+
| |
: +-- to LCD
|
------------+
|
Its not needed to remove the LED. |
-----------------------------------------------------------------------------------
Can working this??
| Code: |
------------+ o +3.3V
ADM5120 | LED resistor |
led-port o----o--|<---===----+
| |
: +-- to Led 5mm--- resistor 1k-----+12v
|
------------+
|
or de adm5120 will destroy???
Thanks._ |
|
|
| Back to top |
|
|
 |
|
 |
 |
|
 |
| |
|
dl4huf
|
Joined: 02 Oct 2006 Posts: 28
|
|
|
 |
|
 |
| |
Posted: Mon Nov 13, 2006 12:54 pm Post subject: |
|
|
Your ADM5120 will be killed .
12V is definitively to mutch ! The maximum is 3.6V.
Also a second LED is to mutch. The LED on the board has 5mA current.
I think no more current is possible.
Why 12V for the LED ?
You can move the current LED with longer wire or change the LED.
If you need more bright LEDs (more current) you must use a transistor.
Also for higher voltage.
p.s. for up to 10 inputs see my site http://www.ipb-halle.de/~ronald/ADM5120/led/ _________________ 2x Edimax BP6104K + USB-Mod
I2C-Bus with 40x2 LCD, RTC, ADC, DAC |
|
|
| Back to top |
|
|
 |
|
 |
 |
|
 |
| |
|
diegos
|
Joined: 13 Nov 2006 Posts: 6
|
|
|
 |
|
 |
| |
Posted: Mon Nov 13, 2006 5:44 pm Post subject: power ip |
|
|
| dl4huf wrote: | Your ADM5120 will be killed .
12V is definitively to mutch ! The maximum is 3.6V.
Also a second LED is to mutch. The LED on the board has 5mA current.
I think no more current is possible.
Why 12V for the LED ?
You can move the current LED with longer wire or change the LED.
If you need more bright LEDs (more current) you must use a transistor.
Also for higher voltage.
p.s. for up to 10 inputs see my site http://www.ipb-halle.de/~ronald/ADM5120/led/ |
I whant connect a fototriac in the router for use as power-ip device. The fototriac need 5v for exite the diode. You have a idea?? how?? wath transistor?? thanks. |
|
|
| Back to top |
|
|
 |
|
 |
 |
|
 |
| |
|
Sunspot Site Admin
|
Joined: 17 Mar 2006 Posts: 148 Location: New Forest, UK |
|
|
 |
|
 |
| |
Posted: Tue Nov 14, 2006 9:09 am Post subject: |
|
|
dl4huf
what is the "BGA-Chip-Version" that you say can have 8 inputs?
Are you actually using the LED lines (not the 4 GPIO) as inputs now?
diegos
To buffer an output connect the router LED or GPIO pin to a resistor (any from 2.2 to 3.3 K ohm will do) and connect that to the base of any small signal npn transistor.
Connect the emitter to ground and connect the collector to the load resistor which in turn goes to +5 or +12.
With 3.3v feeding current to the base the transistor conducts and is like a switch that is ON. if you give it zero volts it is high resistance like a switch that is OFF
The load resistor must be chosen to pass a current no more than the transistor can handle. Try 5 or 10 K ohm to test it. The resistor could be a relay coil but then connect a diode across the coil to catch the inductive surge when the current switches. (cathode to + , connected so there is no current through the diode normally)
If you connect a bulb remember they have a low resistance when cold and can blow a transistor.
A power LED must be in series with a resistor big enough to limit the current to the design level (Ohms Law!)
Investigate a power MOSFET for big DC power. See bits of -
http://www.sunspot.co.uk/Projects/SWEEX/telepresence/powerswitch.html
also see item 6 on the pull down menu at
http://www.sunspot.co.uk/Projects/sweexproject.htm _________________ http://www.sunspot.co.uk/Projects/sweexproject.htm |
|
|
| Back to top |
|
|
 |
|
 |
 |
|
 |
| |
|
dl4huf
|
Joined: 02 Oct 2006 Posts: 28
|
|
|
 |
|
 |
| |
Posted: Wed Nov 15, 2006 1:13 pm Post subject: |
|
|
The ADM5120 is available in two packages, the BGA with 324 "pins" and
the PQFP with only 208 pins.
As result of the missing pins the PQFP-version has only 4 GPIO and no PCI-Bus. See http://www.linux-mips.org/wiki/Adm5120
Yes, i can use 10 of the 15 LED lines as input or output or for ethernet-port.
The driver is working but not completed. I will rewrite the code to set up all 15 LEDs as input, output or for port-mode ( link, traffic, 10/100Mbit ...) and
for clearly use.
The first version can you download from my site http://www.ipb-halle.de/~ronald/ADM5120/led
The original driver from Sergio Aguayo support the 8 GPIO, so i will support this also. _________________ 2x Edimax BP6104K + USB-Mod
I2C-Bus with 40x2 LCD, RTC, ADC, DAC |
|
|
| Back to top |
|
|
 |
|
 |
 |
|
 |
| |
|
Sunspot Site Admin
|
Joined: 17 Mar 2006 Posts: 148 Location: New Forest, UK |
|
|
 |
|
 |
| |
|
|
 |
|
 |
 |
|
 |
| |
|
dl4huf
|
Joined: 02 Oct 2006 Posts: 28
|
|
|
 |
|
 |
| |
Posted: Thu Nov 23, 2006 8:54 am Post subject: |
|
|
Im glad. Do you use the latest version with led-lines for input or my
(sample)program from my first/second post in this thread?
Sorry, no.
The lcd connect direct to led-lines was my first trial with C.
The second was the i2c-driver to use lcd4linux,
so i have not improved the direct version.
Also i have not tested a 20x4 display with lcd4linux.
Please note, display with 4 lines are often displays with two controllers.
So this displays have two enable lines and have to use separately.
Unfortunately often is controller 1 for line 1 and 3 and controller 2 for line 2 and 4.
So you must manage scrolling by your software if you need. _________________ 2x Edimax BP6104K + USB-Mod
I2C-Bus with 40x2 LCD, RTC, ADC, DAC |
|
|
| Back to top |
|
|
 |
|
 |
 |
|
 |
| |
|
Sunspot Site Admin
|
Joined: 17 Mar 2006 Posts: 148 Location: New Forest, UK |
|
|
 |
|
 |
| |
|
|
 |
|
 |
 |
|
 |
| |
|
Sunspot Site Admin
|
Joined: 17 Mar 2006 Posts: 148 Location: New Forest, UK |
|
|
 |
|
 |
| |
|
|
 |
|
 |
 |
|
 |
| |
|
dl4huf
|
Joined: 02 Oct 2006 Posts: 28
|
|
|
 |
|
 |
| |
Posted: Tue Nov 28, 2006 11:59 am Post subject: |
|
|
Sorry.
Please remove the "(" at position 53 from line 96 or use the corrected file
from my site. _________________ 2x Edimax BP6104K + USB-Mod
I2C-Bus with 40x2 LCD, RTC, ADC, DAC |
|
|
| Back to top |
|
|
 |
|
 |
| Page 1 of 1 |
All times are GMT
|
 |
|
 |
| |
|
|
 |
|
 |
| |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
 |
|
 |
|
|
Adv:
|
|
|
|