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

2x8 LCD problems

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



Joined: 10 Apr 2006
Posts: 22

View user's profile Send private message

2x8 LCD problems
PostPosted: Mon Apr 10, 2006 2:31 pm     Reply with quote

Hello,
this is my first time at LCD interfacing, PLEASE HELP!
I am trying to get my PIC16f914 to interface with a Crystalfontz 2x8 lcd character module - 44780 compliant.
I used the CCS wizard for setup of PIC for lcd and selected static mode.
I am using portB and all connections between PIC and LCD are correct.

Do i need to change any other data on lcdd.c for use with 2x8 module, it powers up but just scrols thru erratically on both lines.

Any help would be very appreciated.

LCD module:
[/url]http://www.crystalfontz.com/products/0802a/CFAH0802AGYBJP.pdf

Here is my CODE for testing module.

Code:
#include "C:\Documents and Settings\Pedro\My Documents\Compilertests\NewProcessor\newlcd6.h"
#include <LCD.C>
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES INTRC                    //Internal RC Osc
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOCPD                    //No EE protection
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOIESO                   //Internal External Switch Over mode disabled
#FUSES NOFCMEN                  //Fail-safe clock monitor disabled
#FUSES NODEBUG                  //No Debug mode for ICD
#use delay(clock=4000000)

void main()
{
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_spi(FALSE);
   setup_lcd(LCD_STATIC);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   setup_oscillator(OSC_4MHZ);

lcd_init();

WHILE(TRUE)
{

delay_ms(1000);
lcd_putc("\fHello");

}
}




Last edited by janiga on Mon Apr 10, 2006 2:55 pm; edited 3 times in total
sjbaxter



Joined: 26 Jan 2006
Posts: 141
Location: Cheshire, UK

View user's profile Send private message Visit poster's website

PostPosted: Mon Apr 10, 2006 2:42 pm     Reply with quote

First, I hope you got CCS permission to publish their copyrighted code on a public web forum ....

... I thought not !!! Evil or Very Mad

I suggest you read the 'CCS Forum Policy and Guidelines' very carefully.

Secondly, move the...
Code:

lcd_init();


...statement to BEFORE the...

Code:
while(TRUE);


as you only want to initialize the display once, not every second !!
_________________
Regards,
Simon.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 10, 2006 2:57 pm     Reply with quote

You don't need to use a PIC that has a LCD driver module in it, like the
16F914 to use an LCD module such as the 8x2 Crystalfontz unit.

The 16F914 PIC is meant to drive a segmented LCD like this one:
http://www.varitronix.com/20060310/catalog/lcd_spec/VI402.PDF
The PIC drives the individual segments of that LCD.

The Crystalfontz LCD module that you're using has a controller built
into the unit. It has a microcontroller interface. Any PIC that has
at least 6 i/o pins can talk to the the Crystalfontz LCD. You don't
use the LCD driver in the 16F914 to talk to the Crystalfontz LCD.
You just use the CCS LCD.C driver.

So instead of doing this:
setup_lcd(LCD_STATIC);

You should do this:
setup_lcd(LCD_DISABLED);
janiga



Joined: 10 Apr 2006
Posts: 22

View user's profile Send private message

Thanks!
PostPosted: Mon Apr 10, 2006 2:58 pm     Reply with quote

Code changed to initialize display only once.
sjbaxter



Joined: 26 Jan 2006
Posts: 141
Location: Cheshire, UK

View user's profile Send private message Visit poster's website

PostPosted: Mon Apr 10, 2006 3:00 pm     Reply with quote

Did it fix your problem ?
_________________
Regards,
Simon.
janiga



Joined: 10 Apr 2006
Posts: 22

View user's profile Send private message

Thanks a million!
PostPosted: Mon Apr 10, 2006 3:04 pm     Reply with quote

Disabled the static mode and it works!
It sure helps to receive info from someone who knows their stuff!

It works!

Thanks alot!
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