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 CCS Technical Support

Only 8 characters on my 2x16 LCD!!
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Yull
Guest







Only 8 characters on my 2x16 LCD!!
PostPosted: Fri Sep 24, 2004 7:52 am     Reply with quote

Hello, I've programmed my 2x16 hitachi powered LCD using LCD.c and I can't display "123456789ABCDEF" on the first line, I have just "12345678"!!!

Here is my code :

lcd_init();
delay_ms( 20 );
lcd_gotoxy(1,1);
delay_ms( 20 );
lcd_putc("\f123456789ABCDEF\n123456789ABCDEF");

Thanks by advance for your help

P.S.: I'm using a PIC16F873
RICHARD
Guest







PostPosted: Fri Sep 24, 2004 3:00 pm     Reply with quote

Dear Friend,

I am afriad you will have to submit the complete program list, including all the header configuration information!!!!

have you called the lcd.c --file??
is the lcd connected up correctly via port D??

Hope this helps
Richard
Guest







PostPosted: Fri Sep 24, 2004 3:05 pm     Reply with quote

Dear friend,

I am afraid that you can not have a "\n" operator,
if you want to operate on the next line you will have to have:

lcd gotoxy(x,y) //first line
lcd_putc("zzz")
lcd gotoxy(x,y) // second line
lcd_putc("zzz")


The \f, \n operator only works in the printf command!!

Regards,
jds-pic



Joined: 17 Sep 2003
Posts: 205

View user's profile Send private message

PostPosted: Fri Sep 24, 2004 3:11 pm     Reply with quote

Richard wrote:

if you want to operate on the next line you will have to have:

lcd gotoxy(x,y) //first line
lcd_putc("zzz")
lcd gotoxy(x,y) // second line
lcd_putc("zzz")

Regards,



or simply enable auto-wraparound in the LCD controller.

jds-pic
Yull
Guest







PostPosted: Fri Sep 24, 2004 3:24 pm     Reply with quote

Thanks for the replies, I will be trying those on Monday (week end now). Rolling Eyes

For information my LCD is put on PortB because the 16F873 don't have D port. Embarassed
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Sep 24, 2004 4:43 pm     Reply with quote

Dear All,

I tested his code and it worked just fine.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 24, 2004 4:49 pm     Reply with quote

Quote:
I am afraid that you can not have a "\n" operator,


The lcd_putc() function does support '\n'. See the code
from the CCS driver file, LCD.C, below:
Code:
void lcd_putc( char c) {
   switch (c) {
     case '\f'   : lcd_send_byte(0,1);
                   delay_ms(2);
                                           break;
     case '\n'   : lcd_gotoxy(1,2);        break;
     case '\b'   : lcd_send_byte(0,0x10);  break;
     default     : lcd_send_byte(1,c);     break;
   }
}
Yull
Guest







PostPosted: Mon Sep 27, 2004 1:20 am     Reply with quote

Thanks a lot again for your help.
As requested, I put the entire source here :

#include "C:\Documents and Settings\xxx\Mes documents\PCW TEST\TEST.h"
#include <stdio.h>
#include <lcd.c>


void main()
{

setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
set_tris_a (0);

lcd_init();
delay_ms( 20 );
lcd_putc("\f");
lcd_gotoxy(1,0);
delay_ms( 20 );
printf(lcd_putc,"\f123456789ABCDEF\n123456789ABCDEF");
//lcd_putc("\f123456789ABCDEF\n123456789ABCDEF");
delay_ms( 3000 );
lcd_putc("\f");

while(1)
{
output_low(LED0);
output_low(LED1);
delay_ms( 1000 );
output_low(LED0);
output_high(LED1);
delay_ms( 1000 );
output_high(LED0);
output_low(LED1);
delay_ms( 1000 );
output_high(LED0);
output_high(LED1);
delay_ms( 1000 );
}
}


and my "test.h" :

#include <16F873.h>
#device adc=8
#use delay(clock=11059200)
#fuses HS, NOWDT, NOPROTECT, NOLVP, BROWNOUT, PUT
#define LED0 PIN_A0
#define LED1 PIN_A1

Thanks for help Smile
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 27, 2004 1:43 am     Reply with quote

Quote:
lcd_gotoxy(1,0);

The 2nd parameter value of 0 is not allowed by the CCS driver.
The lowest allowable value for each parameter is 1.
Here is the statement by CCS, from the LCD.C driver file:
Quote:

lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1)

You should change your code to this:
Code:
lcd_gotoxy(1, 1);
Yull
Guest







PostPosted: Mon Sep 27, 2004 1:47 am     Reply with quote

You're right, but the problem still remains... Crying or Very sad
Yull
Guest







PostPosted: Mon Sep 27, 2004 5:42 am     Reply with quote

Not sure, but my LCD seems to be dead Evil or Very Mad
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Sep 27, 2004 6:18 am     Reply with quote

Did you make this board? If not, whose board is it?
Guest








PostPosted: Mon Sep 27, 2004 7:15 am     Reply with quote

Yes it's my board, i'm waiting for a new LCD to test my code Embarassed
Will Reeve



Joined: 30 Oct 2003
Posts: 209
Location: Norfolk, England

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

PostPosted: Tue Sep 28, 2004 2:59 pm     Reply with quote

Not sure if it will help but the 1 x 16 line display I have just used is a bit of a pain! The first 8 characters are located at 0x00 to 0x07 in the LCD memory and the next 8 were located at 0x40 to 0x47 (usually where line 2 is stored!). Might be worth checking with the LCD manufacturer where the LCD text memory is located.
YulL
Guest







PostPosted: Wed Sep 29, 2004 4:12 am     Reply with quote

I've got my 2x16 LCD and I confirm that the last one was dead!!!
Grrrrrr Twisted Evil
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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