View Full Version : LCDout Command w/ LCD 4x40 display
beto
- 14th January 2005, 16:09
Hi!
This lcd have 2 Enable lines (e1,e2), anyone know, how these lines to be handled by the pbp compiler?
I buil this circuits but doesn't work ...
Can helpme please? thanks ..... Friends
code) look like this:
DEFINE OSC 10
DEFINE LCD_DREG PORTB
DEFINE LCD_BIT 0
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 7
DEFINE LCD_EREG PORTD
DEFINE LCD_BITS 8
DEFINE LCD_LINES 4
DEFINE LCD_EBIT 6
dsp var portd.5
FLAGS = 0
START:
dsp = 0
LCDOUT $FE,1 :PAUSE 500 : LCDOUT "SYSTEM 1" 'lcd upper
dsp = 1
LCDOUT $FE,1 :PAUSE 500 : LCDOUT "TWO SYSTEM" ' bottom lcd
goto start
mister_e
- 14th January 2005, 16:16
DEFINE OSC 10
DEFINE LCD_DREG PORTB
DEFINE LCD_BIT 0
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 7
DEFINE LCD_EREG PORTD
DEFINE LCD_BITS 8
DEFINE LCD_LINES 4
DEFINE LCD_EBIT 6
dsp var portd.5
FLAGS = 0
START:
dsp = 0
LCDOUT $FE,1 :PAUSE 500 : LCDOUT "SYSTEM 1" 'lcd upper
dsp = 1
LCDOUT $FE,1 :PAUSE 500 : LCDOUT "TWO SYSTEM" ' bottom lcd
goto start
by this code, you're saying that you using the full 8bit for data... right???
1. Be sure you don't revert D0 to D7.
2. IMO you must define a LCD_LINES 2. This is why you have 2 enable lines... BUT I'M REALLY NOT SURE... i just see it's a 4X40 LCD...
3. What about if you play with the voltage on Vo pin??? Is at least you see some black square???
4. AND you didn't set direction of your dsp PIN... TRISD.5=0
5. You may need a startup delay (about .5 to 2 sec) at the begining.
6. Maybe DEFINE LCD_DATAUS and DEFINE LCD_COMMANDUS defines may do something.
beto
- 14th January 2005, 16:16
I have tried to change the LCD_EBIT definition on "Fly"
@#UNDEFINE LCD_EBIT
@#DEFINE LCD_EBIT 6
LCDOUT $FE,1 :PAUSE 500 : LCDOUT "SYSTEM 1" : PAUSE 2000
@#UNDEFINE LCD_EBIT
@#DEFINE LCD_EBIT 5
LCDOUT $FE,1 :PAUSE 500 : LCDOUT "TWO SYSTEM": PAUSE 2000
but it does not work either
beto
- 14th January 2005, 16:21
Hi mister_e
let me explain
the code above works! but only in the first 2 lines of the lcd
the problem is write data on botton lcd ,because I think that this
LCD have two 2 x 40 display sharing only the data and rs/rw lines
the other lines (e1 & e2) are for each part of LCD
mister_e
- 14th January 2005, 16:23
O.k. So what about the TRISD.5=0 ?? Can you monitor ENABLE lines to see if they're adress separately?
beto
- 14th January 2005, 16:34
I put long delay in the code and check with my logic probe to see changes
and yes there are changes (using AND gates) but the lower part of lcd does not even work
Ingvar
- 14th January 2005, 16:43
It's all in the FAQ section.
http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=631
beto
- 14th January 2005, 17:11
thanks Ingvar:
Its exactly tha same circuit (enable2.bmp)
... can be that I need high speed devices since that the pics runs at 10Mhz? , because only 1 lcd is working w/ that schematcs
mister_e
- 14th January 2005, 17:18
No in this case, speed is not an issue. IMO, it's the *FLAGS* trick that you must place at the right place to initialize properly the LCD.
OR the 2nd(bottom) lcd need specific addressing. What type of LCD are you using???
mister_e
- 14th January 2005, 17:29
What about if you revert ENABLE lines? Is now bottom one is working but not the top one ???
NavMicroSystems
- 14th January 2005, 18:18
Beto
You should definitely try what Steve has suggested
Originally posted by mister_e
What about if you revert ENABLE lines? Is now bottom one is working but not the top one ???
to make sure both the controllers on the module are working properly.
I guess the only problem is the initialisation of the second controller.
PBP sends the "INIT" String automatically with the first LCDOUT command issued.
As with your Hardware design only one of the two controllers will be enabled at a time, only one controller will be initialised.
The workaround is the to "RESET" Flags.
So at the beginning of your program (before your MainLoop starts)
you should add:
PAUSE 500
DSP=0
LCDOUT $FE,1
PAUSE 500
FLAGS=0
DSP=1
LCDOUT $FE,1
see my posting in the FAQ section Ingvar has already mentioned:
Click here (http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=631[U)
B.T.W.
here is another useful link:
Click here (http://www.picbasic.co.uk/forum/search.php?s=[U)
regards
Ralph
beto
- 14th January 2005, 20:21
The LCD is a Tianma TM404abcw6 model
when I revert the ENABLE lines , what happens?
the other part of the lcd respond, I mean;
l-----------------------------------------l
l 2 x40 lines upper part l < Controled by e1
l-----------------------------------------l
l-----------------------------------------l
l 2 x40 lineslower part l< Controled by e2
l-----------------------------------------l
NavMicroSystems
- 14th January 2005, 21:41
Beto,
may we assume you have got it working now?
regards
Raplh
mister_e
- 14th January 2005, 23:28
in case not can you try those lines...
start:
dsp=0
lcdout $fe,$38 'lcd mode
lcdout $fe,$0c 'lcd on
lcdout $fe,1 'clear lcd
lcdout "display 1"
dsp=1
lcdout $fe,$38 'lcd mode
lcdout $fe,$0c 'lcd on
lcdout $fe,1 'clear lcd
lcdout "display 2"
here: goto here
NL2TTL
- 18th January 2005, 21:57
Check this post!
http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=996&highlight=nl2ttl
beto
- 19th January 2005, 00:43
At least!
A lot of thank friends...
the problem was, I try to use the enable2.bmp circuit (posted here) but I do not use a real inverter, I mean; i build the inverter circuit (IC 1A) using a low profile NPN transistor (2N3904) as inverter (I have used before and worked very well ) I don't know why in this circuit doesn't work?
the solution?... replace it with a 'real' inverter (i.e. 7404 Series)
and presto Is working....
Thanks Again
mister_e
- 19th January 2005, 00:48
AHHHH damn :)
What was your resistor value around your transistor ?!?
beto
- 19th January 2005, 18:23
10k for the base bias and 1k for the colector (emitter tied to GND)
mister_e
- 19th January 2005, 18:59
It have to work... in case not your 2n3904 don't have the great HFE... probably a die one :-)
Have you try 1k for bias an 1k for the collector?
beto
- 20th January 2005, 15:47
Yes , Efectively changing to your values, the circuit works fine
this 3904 do not have good AC Characteristics?
With these val the base-emiter I is about 5mA and the 2N
have a HFE about 70-100 (limiting Ic val to less of 10mA)
NL2TTL
- 20th January 2005, 15:56
I don't understand anything about teh HFE and resistors,
in my schematic i only use 2 resistors.
mister_e
- 20th January 2005, 16:20
Well since we work in digital, common calculation is to multiply by ten the Base current needed.
If 1K to the collector. Ic = 5/1000 = 5mA
HFE = 70 (take the minimum to ensure...
Ib= (Ic/HFE) * 10 = 0.7ma
Rb = (5 - 0.7) / 0.7mA = 6k at minimum
By the Maths, i figure that 5.6k, 5.1k or 4.7K as base resistor can also work.
In many application you'll see 1k to base, 1k to collector too or same base value as collector one.
NL2TTL
- 20th January 2005, 16:48
Oke that's what i understand, only are you guys realy using a transistor?
mister_e
- 20th January 2005, 17:06
If you're not going to use the other inverter in this IC, why spend PCB space and $. Like the AND gate... if you have extra i/o, forget the AND gate and inverter stuff.
beto
- 20th January 2005, 18:52
MMhh.. Yes I have unused pic pins, How I can Integrate this circuit (and gate & inverter) in my program
mister_e
- 21st January 2005, 01:22
oops forget about me... i'm wrong in that issue. There's probably some tricks to do but... at this time i can't see how to remove all of them...
BTW you can save the inverter stuff using another enable i/o.
PAUSE 500
Enable1 = 1
Enable2 = 0
Lcdout $Fe,1,"I'm on the first one"
pause 500
FLAGS=0
Enable1 = 0
Enable2 = 1
Lcdout $Fe,1,"I'm on the second one"
This have to work and it's suppose to be easy to figure out how to connect to the PIC.
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.