CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Problems making the Flexible LCD driver work

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

Problems making the Flexible LCD driver work
PostPosted: Fri Mar 30, 2007 7:36 am     Reply with quote

Colleagues,

I’m trying to make PCM’s flexible LCD driver work with a Microtips 2x8 LCD (KS0066 controller or equivalent). Unfortunately, nothing appears on the screen – not even garbage. I’m using PCM’s code, which I found here without any modifications, except for the pin assignments:
Code:
 #define LCD_DB4   PIN_D0
#define LCD_DB5   PIN_D1
#define LCD_DB6   PIN_D2
#define LCD_DB7   PIN_D3

// D0-D3 are left unconnected

#define LCD_RS          PIN_B3   // Data/Instruction register select
#define LCD_RW          PIN_B1   // Read/Write select
#define LCD_E           PIN_B2   // Enable


LCD connection (ribbon cable) has been checked and re-checked

My main() looks like this:
Code:
 void main()
{

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF|ADC_TAD_MUL_0);
   setup_psp(PSP_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   setup_oscillator(OSC_8MHZ);
   
   lcd_init();
   
   // Clear the LCD.
   printf(lcd_putc, "\f");
   delay_ms(500);

   while (1)
   {
      strobe_RF_WDT  ();
      output_high(RF_LED);
      delay_ms(500);
      output_low(RF_LED);
      delay_ms(500);

      printf(lcd_putc, "Alpha"); // this doesn't appear on the LCD
   }
}


PIC18LF4220 edit: 8MHz internal oscillator
Vcc = +5V
CCS v3.240

Can anyone spot the problems?

Thanks!
Nick


Last edited by kender on Fri Mar 30, 2007 8:32 am; edited 3 times in total
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Fri Mar 30, 2007 7:47 am     Reply with quote

Nick,

You may have checked this, but if you haven't... Does the LCD init properly? i.e. Can you flash an LED in your main loop to ensure it's not hanging in the init? If there is problem with the LCD and the PIC gets stuck waiting for the BUSY flag it can really make troubleshooting difficult.

Good luck,

John

EDIT:

Disregard.... On closer examination it doesn't look like that'd be an issue....
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Fri Mar 30, 2007 7:58 am     Reply with quote

jecottrell wrote:
Does the LCD init properly?

I don't know how tp check that the truly LCD inits properly.

jecottrell wrote:
i.e. Can you flash an LED in your main loop to ensure it's not hanging in the init? If there is problem with the LCD and the PIC gets stuck waiting for the BUSY flag it can really make troubleshooting difficult.

The LED (RF_LED) that is toggled in the main loop does blink properly. The execution doesn't get stuck in lcd_init(). I haven't commented out the
Code:
#define USE_LCD_RW   1   

in the PCM's code. The code should be polling for the BUSY flag successfully (since it doesn't get stuck).
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Fri Mar 30, 2007 8:03 am     Reply with quote

You replied before I made my edit....

Typical problem with init is hanging on a while statement checking the Busy Flag. If it does, the PIC never makes it to the main loop... obviously.

Other problem I've had, is using standard drivers with an extrremely fast PIC. What speed are you running the PIC at? I've modified all my drivers to eliminate the delay_cycles statements and used delay_us(1) in their place.

Try that next.
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Fri Mar 30, 2007 8:09 am     Reply with quote

jecottrell wrote:
Other problem I've had, is using standard drivers with an extrremely fast PIC. What speed are you running the PIC at?

8MHz internal oscillator

jecottrell wrote:
I've modified all my drivers to eliminate the delay_cycles statements and used delay_us(1) in their place.

I just tried delay_us(1) instead of delay_cycles, but it didn't make any visible change.


Last edited by kender on Fri Mar 30, 2007 10:19 am; edited 1 time in total
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Fri Mar 30, 2007 8:14 am     Reply with quote

Sorry,

I've used up my very small resevoir of knowledge....

Only other things are pretty basic:

Swap out part with same part.

Swap out part with different type LCD.

Try different driver.

....all the standards to try to isolate the problem...

Good luck,

John
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Fri Mar 30, 2007 9:18 am     Reply with quote

jecottrell wrote:
I've used up my very small resevoir of knowledge....

It's propelling the problem towards solution anyways.

jecottrell wrote:
Swap out part with same part.
Tried that. No change.

jecottrell wrote:
Try different driver.
Could you recommend a different driver? Unfortunately, CCS' standard LCD.c will not work, because all 7 pins aren't on the same port.

jecottrell wrote:
Good luck
Thanks, i need it.
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Fri Mar 30, 2007 9:51 am     Reply with quote

I just caught your post regarding Vo. If I remember correctly a Vo of Vdd will yield a display that looks totally inop and a Vo of Vss will end up with dark pixels.

So, before you do anything else, put a pot in or something to bring Vo down to where PCM recommends and I bet your problem is solved.

John
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

SOLVED
PostPosted: Fri Mar 30, 2007 9:55 am     Reply with quote

jecottrell wrote:
I just caught your post regarding Vo. If I remember correctly a Vo of Vdd will yield a display that looks totally inop and a Vo of Vss will end up with dark pixels.

So, before you do anything else, put a pot in or something to bring Vo down to where PCM recommends and I bet your problem is solved.


Yes.

It was a hardware problem. Most of the time the LCD was doing the right things, but I couldn’t see the text, because there was no contrast. I read in one of PCM’s posts that the contrast voltage Vcont should be 0 to +0.5V. I didn’t know about that, and I have tied Vcont to Vcc. As soon as I made a Vcont = +0.4V with a voltage divider, I’ve got contrast.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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


Powered by phpBB © 2001, 2005 phpBB Group