![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
buckeyes1997 Guest
|
problems getting lcd420.c to work |
Posted: Thu Dec 16, 2004 7:07 pm |
|
|
well ive been using the CCS lcd.c driver but wanted to actually try using all 4 lines of my lcd so i started a new project for my 16f628 using the lcd420.c and then four lcd_putc("blah") lines with the last three having \n to goto a new line. i get a blank lcd when i run the program.
here is the code:
Code: | #include "C:\Documents and Settings\Administrator\My Documents\microcontroller\16f628\lcd420.h"
// #include <math.h>
#include <stdio.h>
//#include <stddef.h>
//#include <stdlib.h>
#include <lcd420.c>
void main()
{
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DIV_BY_1,255,1);
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
lcd_init();
while(1){
delay_ms(10);
lcd_putc("this is");
lcd_putc("\na test of");
lcd_putc("\nall four");
lcd_putc("\nlines!!!!!");
}
}
|
|
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
Re: problems getting lcd420.c to work |
Posted: Thu Dec 16, 2004 9:44 pm |
|
|
Code: | #include "C:\Documents and Settings\Administrator\My Documents\microcontroller\16f628\lcd420.h"
// #include <math.h>
#include <stdio.h>
//#include <stddef.h>
//#include <stdlib.h>
#include <lcd420.c>
void main()
{
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DIV_BY_1,255,1);
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
lcd_init();
while(1){
delay_ms(10);
lcd_putc("\fthis is");
lcd_putc("\na test of");
lcd_putc("\nall four");
lcd_putc("\nlines!!!!!");
}
}
|
I don't know why you continually write the data to the display but I would put a \f in there to make sure it starts from the begining each time. Does the LCD.C file work for you? |
|
![](templates/subSilver/images/spacer.gif) |
buckeyes1997 Guest
|
|
Posted: Thu Dec 16, 2004 10:20 pm |
|
|
yes the lcd.c file works fine for the two lines. i looked thru the 420 driver and it looks to be a drop in replacement right? when i try to use the 420 version i get a completely blank screen without anything at all.
why do i keep displaying the same thing over and over?? haha cuz im not a very good programmer....yet.
thanks mark |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Dec 17, 2004 8:37 am |
|
|
They are pretty much the same except for two functions.
Code: |
void lcd_gotoxy( BYTE x, BYTE y) {
BYTE address;
switch(y) {
case 1 : address=0x80;break;
case 2 : address=0xc0;break;
case 3 : address=0x94;break;
case 4 : address=0xd4;break;
}
address+=x-1;
lcd_send_byte(0,address);
}
void lcd_putc( char c) {
switch (c) {
case '\f' : lcd_send_byte(0,1);
lcdline=1;
delay_ms(2);
break;
case '\n' : lcd_gotoxy(1,++lcdline); break;
case '\b' : lcd_send_byte(0,0x10); break;
default : lcd_send_byte(1,c); break;
}
}
|
Try replacing these 2 functions in your LCD.C file and see if it works.
Code: |
void lcd_gotoxy( BYTE x, BYTE y) {
BYTE address;
// Make sure we have a valid line
if (y>4)
y=1;
// Need to make sure we update the lcdline for the next \n
lcdline = y;
switch(y) {
case 1:
address=0x80;
break;
case 2:
address=0xc0;
break;
case 3:
address=0x94;
break;
case 4:
address=0xd4;
break;
}
address+=x-1;
lcd_send_byte(0,address);
}
void lcd_putc( char c) {
switch (c) {
case '\f' : lcd_send_byte(0,1);
lcdline=1;
delay_ms(2);
break;
case '\n' : lcd_gotoxy(1,++lcdline); break;
case '\b' : lcd_send_byte(0,0x10); break;
default : lcd_send_byte(1,c); break;
}
} |
|
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|