| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Yull Guest
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				| Only 8 characters on my 2x16 LCD!! |  
				|  Posted: Fri Sep 24, 2004 7:52 am |   |  
				| 
 |  
				| 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
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Fri Sep 24, 2004 3:00 pm |   |  
				| 
 |  
				| 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
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Fri Sep 24, 2004 3:05 pm |   |  
				| 
 |  
				| 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
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Fri Sep 24, 2004 3:11 pm |   |  
				| 
 |  
				|  	  | 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
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Fri Sep 24, 2004 3:24 pm |   |  
				| 
 |  
				| Thanks for the replies, I will be trying those on Monday (week end now).   
 For information my LCD is put on PortB because the 16F873 don't have D port.
  |  | 
	
		|  | 
	
		| Mark 
 
 
 Joined: 07 Sep 2003
 Posts: 2838
 Location: Atlanta, GA
 
 
			      
 
 | 
			
				|  |  
				|  Posted: Fri Sep 24, 2004 4:43 pm |   |  
				| 
 |  
				| Dear All, 
 I tested his code and it worked just fine.
 |  | 
	
		|  | 
	
		| PCM programmer 
 
 
 Joined: 06 Sep 2003
 Posts: 21708
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Fri Sep 24, 2004 4:49 pm |   |  
				| 
 |  
				|  	  | 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
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Mon Sep 27, 2004 1:20 am |   |  
				| 
 |  
				| 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
  |  | 
	
		|  | 
	
		| PCM programmer 
 
 
 Joined: 06 Sep 2003
 Posts: 21708
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Mon Sep 27, 2004 1:43 am |   |  
				| 
 |  
				| 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:
 
 |  | 
	
		|  | 
	
		| Yull Guest
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Mon Sep 27, 2004 1:47 am |   |  
				| 
 |  
				| You're right, but the problem still remains...  |  | 
	
		|  | 
	
		| Yull Guest
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Mon Sep 27, 2004 5:42 am |   |  
				| 
 |  
				| Not sure, but my LCD seems to be dead  |  | 
	
		|  | 
	
		| Mark 
 
 
 Joined: 07 Sep 2003
 Posts: 2838
 Location: Atlanta, GA
 
 
			      
 
 | 
			
				|  |  
				|  Posted: Mon Sep 27, 2004 6:18 am |   |  
				| 
 |  
				| Did you make this board?  If not, whose board is it? |  | 
	
		|  | 
	
		| Guest 
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Mon Sep 27, 2004 7:15 am |   |  
				| 
 |  
				| Yes it's my board, i'm waiting for a new LCD to test my code  |  | 
	
		|  | 
	
		| Will Reeve 
 
 
 Joined: 30 Oct 2003
 Posts: 209
 Location: Norfolk, England
 
 
			          
 
 | 
			
				|  |  
				|  Posted: Tue Sep 28, 2004 2:59 pm |   |  
				| 
 |  
				| 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
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Wed Sep 29, 2004 4:12 am |   |  
				| 
 |  
				| I've got my 2x16 LCD and I confirm that the last one was dead!!! Grrrrrr
  |  | 
	
		|  | 
	
		|  |