PDA

View Full Version : How to work with LCD in a mode of 8 bits?



MCU Destroyer
- 1st July 2005, 16:22
Good time All !

For some reasons I LCD is connected to PIC16F877A by means of 8 data lines. That is the mode of 8 bits is used and 3 signals for its management (RS, E and R/W) are still used.

As to me to work in PBP from in such a way connection LCD.

In a mode of 4 bits, on LCD symbols are not deduced all - LCD has not time to accept them and passes symbols. Therefore I have decided to use a mode of 8 bits.

I thank for attention.

Dwayne
- 1st July 2005, 17:03
In a mode of 4 bits, on LCD symbols are not deduced all - LCD has not time to accept them and passes symbols. Therefore I have decided to use a mode of 8 bits.


It sounds like the data is coming too fast on your LCD.

You need a Delay of char command LCDdata, so that the LCDout will not throw out the data too fast for your LCD_DATAUS to slow down that output.

Dwayne

NavMicroSystems
- 1st July 2005, 17:14
MCU Destroyer,

as Dwayne already mentioned: it is most likely a timing problem.
And I doubt the 8bit Mode will solve that problem.

Could you tell us what brand and model the LCD is?

And could you also post your schematic and code?

Luciano
- 1st July 2005, 17:46
Hi,

From the manual:

PBP defaults to using a 4MHz oscillator.

Adding the statement DEFINE OSC 8 near the beginning of the PicBasic Pro program tells
PBP an 8MHz oscillator will be used instead. The acceptable oscillator definitions are:

3(3.58) 4 8 10 12 16 20 24 25 32 33 40

Telling PBP the oscillator frequency allows it to compensate and produce
the correct timing for COUNT, DEBUG, DEBUGIN, DTMFOUT, FREQOUT,
HPWM, HSERIN, HSEROUT, I2CREAD, I2CWRITE, LCDOUT, OWIN, OWOUT,
PAUSE, PAUSEUS, SERIN, SERIN2, SEROUT, SEROUT2, SHIFTIN,
SHIFTOUT, SOUND, XIN and XOUT.

* * *
Luciano

MCU Destroyer
- 1st July 2005, 18:11
Please look my code:

++++++++++++++++++++++++++++++++++++++
define osc 20
Define LCD_DREG PORTA
Define LCD_DBIT 0
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1
DEFINE LCD_RWREG PORTE
DEFINE LCD_RWBIT 2

ADCON1 = 7
Pause 3000
loop: Lcdout $fe, 1
Pause 9000

Lcdout "Hello"
Pause 9000

Lcdout $fe, $c0, "World"
Pause 9000

Goto loop
End
++++++++++++++++++++++++++++++++++++++++++++++++
LCD model: MT-16S2H (v.3) - this LCD full combine on conclusions with any LCD (for example Data Vision). And I use PIC16F877A, quartz 20 MHz (mode HS for PIC).

Probably really wash PIC works too quickly but how I then can increase a delay of commands for LCD? I have not found suitable commands...

Luciano
- 1st July 2005, 18:33
From the PBP manual
5.39. LCDOUT

‘ Set command delay time in us
DEFINE LCD_COMMANDUS 2000

‘ Set data delay time in us
DEFINE LCD_DATAUS 50


Luciano

mister_e
- 1st July 2005, 19:10
how about PORTA.4??? is this pin tie with pull-up resistor???

Not sure if PBP handle the R/W pin for you. Can you add a LOW PORTE.0 and post results...

MCU Destroyer
- 1st July 2005, 20:24
Great thank All !

Now all worked.

When I use commands

DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50

and increased delays by 30 %, LCD has earned in a mode 4 bits.

But nevertheless it is possible in PBP to work with LCD in a mode 8 bits?

NavMicroSystems
- 1st July 2005, 20:53
But nevertheless it is possible in PBP to work with LCD in a mode 8 bits?

DEFINE LCD_BITS 8

But why would you want to waste 4 Port Bits?

MCU Destroyer
- 1st July 2005, 21:10
Now I any more do not wish to spend all for nothing a bits of port. It simply question for the my general development - became already interestingly can-whether PBP work with LCD in a mode 8 bits.

Once again all many thanks !