View previous topic :: View next topic |
Author |
Message |
janiga
Joined: 10 Apr 2006 Posts: 22
|
2x8 LCD problems |
Posted: Mon Apr 10, 2006 2:31 pm |
|
|
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
|
|
Posted: Mon Apr 10, 2006 2:42 pm |
|
|
First, I hope you got CCS permission to publish their copyrighted code on a public web forum ....
... I thought not !!!
I suggest you read the 'CCS Forum Policy and Guidelines' very carefully.
Secondly, move the...
...statement to BEFORE the...
as you only want to initialize the display once, not every second !! _________________ Regards,
Simon. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 10, 2006 2:57 pm |
|
|
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
|
Thanks! |
Posted: Mon Apr 10, 2006 2:58 pm |
|
|
Code changed to initialize display only once. |
|
|
sjbaxter
Joined: 26 Jan 2006 Posts: 141 Location: Cheshire, UK
|
|
Posted: Mon Apr 10, 2006 3:00 pm |
|
|
Did it fix your problem ? _________________ Regards,
Simon. |
|
|
janiga
Joined: 10 Apr 2006 Posts: 22
|
Thanks a million! |
Posted: Mon Apr 10, 2006 3:04 pm |
|
|
Disabled the static mode and it works!
It sure helps to receive info from someone who knows their stuff!
It works!
Thanks alot! |
|
|
|