Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How To prevent LCD displaying funny charcter?

Status
Not open for further replies.

Mithun_K_Das

Advanced Member level 3
Advanced Member level 3
Joined
Apr 24, 2010
Messages
899
Helped
24
Reputation
48
Reaction score
26
Trophy points
1,318
Location
Dhaka, Bangladesh, Bangladesh
Visit site
Activity points
8,254
LCD shows funny characters while Timers are used to generate clock pulses.

Its a long time problem to me. I tried with many suggested things. But all are almost same result. Specially when internal crystal is used. But I saw many systems working fine with lower crystal values with clock pulses.

Then what is error or mistake I'm doing? Or What should I do while LCD and Timers are used in PIC microcontroller?

index.jpg
 

According to your previous thread:
https://www.edaboard.com/threads/310166/
I see some problems.

First of all:
It's almost impossible using a 100uS interrupt while the interrupt routine may be longer than 100uS.

Secondly:
There may be also an RMW problem since the LCD_RS and the interrupt-controlled clock outputs are on the same port (PORTC). It's not a good practice, define the LCD_RS for example at RB2_bit.

But ... your main problem is the first (the IT timing) since the LCD is a very slow device (for example a simple cursor positioning is 5 mS long) and also uses timings.

Please attach your complete (RAR-ed) project folder and the schematic. If you have the proteus DSN file, too.
 

I've included the picture. while the circuit is being simulated, it works fine. But in hardware it goes wrong in most of the time. But if it works once... it keep working well. Only problem is when the Timer is turned on.


00.jpg

asf.png

But another point is, When I use 18F series of PIC micro-controllers, this problem goes off. Even while using fast Timer interrupt. This problem is mostly related with 16F series.

Here is some part of the full code that is related with the LCD and interrupt secti

Code:
// LCD module connections
sbit LCD_RS at RC6_bit;
sbit LCD_EN at RC3_bit;
sbit LCD_D4 at RC4_bit;
sbit LCD_D5 at RC5_bit;
sbit LCD_D6 at RA4_bit;
sbit LCD_D7 at RA5_bit;

sbit LCD_RS_Direction at TRISC6_bit;
sbit LCD_EN_Direction at TRISC3_bit;
sbit LCD_D4_Direction at TRISC4_bit;
sbit LCD_D5_Direction at TRISC5_bit;
sbit LCD_D6_Direction at TRISA4_bit;
sbit LCD_D7_Direction at TRISA5_bit;
// End LCD module connections

Code:
void interrupt()
{
   if(T0IF_bit)
   {
       //LCD_EN = 0;
       T0IF_bit = 0;//clear flag
       cnt++;
       TMR0 = 55;
       if(cnt>Clock_target1) RB7_bit = 1;

   }
   if(INTF_bit)
   {
       INTF_bit = 0;//clear flag
       RB7_bit = 0;
       cnt = 0;//clear count
      
   }

}

Code:
void InitTimer0()
{
     OPTION_REG  = 0x88;
     TMR0 = 50;
     INTCON  = 0xA0;
}

The main disappointment to me is, I found many circuits with same MCU and timing, LCD. They have no such a problem like this. Then what wrong I'm doing here...? :( I must find it out.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top