SkaidonDesigns - phpBB Templates - vBulletin Styles - Website Design  
 
LCD on LED-Lines
Post new topic   Reply to topic    midge.vlad.org.ua Forum Index -> midge english
 
 
View previous topic :: View next topic  
 

 
dl4huf

Joined: 02 Oct 2006
Posts: 28
 
 
PostPosted: Mon Oct 02, 2006 10:09 am    Post subject: LCD on LED-Lines Reply with quote

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
View user's profile Send private message
Back to top
 

 
dl4huf

Joined: 02 Oct 2006
Posts: 28
 
 
PostPosted: Tue Oct 10, 2006 1:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
Back to top
 

 
sWastel

Joined: 08 Nov 2006
Posts: 3
 
 
PostPosted: Thu Nov 09, 2006 1:23 pm    Post subject: Reply with quote

how to connect the D4-D7, RS and EN cable to the LEDs? on + or -?

Can you tell me more?
View user's profile Send private message
Back to top
 

 
dl4huf

Joined: 02 Oct 2006
Posts: 28
 
 
PostPosted: Thu Nov 09, 2006 5:03 pm    Post subject: Reply with quote

First i dos not understand your question, but then i have seen the small + and - on the
board Very Happy
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
View user's profile Send private message
Back to top
 

 
diegos

Joined: 13 Nov 2006
Posts: 6
 
 
PostPosted: Mon Nov 13, 2006 3:30 am    Post subject: 5v to adm5120? Reply with quote

dl4huf wrote:
First i dos not understand your question, but then i have seen the small + and - on the
board Very Happy
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._
View user's profile Send private message
Back to top
 

 
dl4huf

Joined: 02 Oct 2006
Posts: 28
 
 
PostPosted: Mon Nov 13, 2006 12:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
Back to top
 

 
diegos

Joined: 13 Nov 2006
Posts: 6
 
 
PostPosted: Mon Nov 13, 2006 5:44 pm    Post subject: power ip Reply with quote

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.
View user's profile Send private message
Back to top
 

 
Sunspot
Site Admin
Joined: 17 Mar 2006
Posts: 148
Location: New Forest, UK
 
 
PostPosted: Tue Nov 14, 2006 9:09 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Back to top
 

 
dl4huf

Joined: 02 Oct 2006
Posts: 28
 
 
PostPosted: Wed Nov 15, 2006 1:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
Back to top
 

 
Sunspot
Site Admin
Joined: 17 Mar 2006
Posts: 148
Location: New Forest, UK
 
 
PostPosted: Wed Nov 22, 2006 9:40 pm    Post subject: Reply with quote

Thanks! - it works!
Have you a done a version for 4 lines by 20 characters?

(hoping to avoid spending ages with the data sheet and my poor c skills)
_________________
http://www.sunspot.co.uk/Projects/sweexproject.htm
View user's profile Send private message Visit poster's website
Back to top
 

 
dl4huf

Joined: 02 Oct 2006
Posts: 28
 
 
PostPosted: Thu Nov 23, 2006 8:54 am    Post subject: Reply with quote

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
View user's profile Send private message
Back to top
 

 
Sunspot
Site Admin
Joined: 17 Mar 2006
Posts: 148
Location: New Forest, UK
 
 
PostPosted: Thu Nov 23, 2006 9:51 pm    Post subject: Reply with quote

I have managed to make the modifications so that the code works with a 4 line by 20 character display.

I have put my notes as menu item 10 at
http://www.sunspot.co.uk/Projects/sweexproject.htm

Thanks for making this possible!

- now to try your input mode on the leds
_________________
http://www.sunspot.co.uk/Projects/sweexproject.htm
View user's profile Send private message Visit poster's website
Back to top
 

 
Sunspot
Site Admin
Joined: 17 Mar 2006
Posts: 148
Location: New Forest, UK
 
 
PostPosted: Sat Nov 25, 2006 8:02 pm    Post subject: Reply with quote

dl4huf
Thanks - but -
Your new led.c gave many errors when I tried to compile in my (tested and working) tool-chain.
To keep my Newby questions away from this forum I posted the report here -
http://www.sunspot.co.uk/Projects/cgi-bin/ikonboard//topic.cgi?forum=2&topic=15

Perhaps you could email since this is probably my error
http://www.sunspot.co.uk//patandgraham/graham_email.html
_________________
http://www.sunspot.co.uk/Projects/sweexproject.htm
View user's profile Send private message Visit poster's website
Back to top
 

 
dl4huf

Joined: 02 Oct 2006
Posts: 28
 
 
PostPosted: Tue Nov 28, 2006 11:59 am    Post subject: Reply with quote

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
View user's profile Send private message
Back to top
 

Display posts from previous:   
Page 1 of 1 All times are GMT

 
Post new topic   Reply to topic    midge.vlad.org.ua Forum Index -> midge english
 
 

 
Jump to:  
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:
A phpBB Template by SkaidonDesigns   Back to Top