| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		
			PCM programmer
 
 
  Joined: 06 Sep 2003 Posts: 21708
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Sat Oct 04, 2008 12:31 pm     | 
				     | 
			 
			
				
  | 
			 
			
				 	  | Quote: | 	 		  | 2. Compiler version: 4.013  | 	  
 
Your version is at best, a Beta version of the vs. 4 compiler.
 
If your version has the bug that you describe, then it should display '00'
 
at the end of the output, with the test program shown below.  
 
I don't have 4.013 to test, but vs. 4.014 and later, do not put a '00' at
 
the end.  This is the output from a good version of the compiler:
 
 	  | Quote: | 	 		  | 48 65 6C 6C 6F 20 57 6F 72 6C 64  | 	  
 
 	  | Code: | 	 		  
 
#include <16F877.H>
 
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP 
 
#use delay (clock=4000000) 
 
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS) 
 
 
void lcd_putc(char c)
 
{
 
printf("%X ", c);
 
}
 
 
//=================================
 
void main() 
 
{ 
 
 
lcd_putc("Hello World"); 
 
 
while(1);
 
} | 	 
  | 
			 
		  | 
	
	
		  | 
	
	
		
			DavidW
 
 
  Joined: 26 Oct 2008 Posts: 1
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Sun Oct 26, 2008 3:50 pm     | 
				     | 
			 
			
				
  | 
			 
			
				Hello PCM. I just want to say thanks for this custom LCD.C driver. I been having a tough time figuring out the CCS LCD driver since I am a beginner with PIC programming. I made some modifications to your original code to fit the I/O pins that were available on my PIC but when I compile the code I get an error 
 
 
Error 128 "flex_lcd.c" Line 28(1,42): A #DEVICE required before this line
 
 
and the line with the error is in flex_lcd.c:
 
int8 const LCD_INIT_STRING[4] =
 
 
Do you know why I am getting this error?
 
 
I am using a PIC16F877A and a 2x16 HD44780 LCD display. Here are the only modifications I made to flex_lcd.c:
 
 
#define LCD_DB4   PIN_B4
 
#define LCD_DB5   PIN_B5
 
#define LCD_DB6   PIN_B6
 
#define LCD_DB7   PIN_B7
 
 
#define LCD_E     PIN_C1
 
#define LCD_RS    PIN_C2
 
#define LCD_RW    PIN_C3
 
 
A little bit more information, I am using version 4.064 for the CCS C compiler. Thanks for your help! | 
			 
		  | 
	
	
		  | 
	
	
		
			PCM programmer
 
 
  Joined: 06 Sep 2003 Posts: 21708
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Sun Oct 26, 2008 4:19 pm     | 
				     | 
			 
			
				
  | 
			 
			
				 	  | Quote: | 	 		  | A #DEVICE required before this line  | 	  
 
This type of question belongs in the main forum.  If the following
 
information doesn't fix the problem, then post the question in the
 
main forum:
 
  
 
 
Are you using MPLAB ? If so, see these links: 
 
 
How to use multiple source files with MPLAB: 
 
http://www.ccsinfo.com/forum/viewtopic.php?t=34046 
 
 
More detailed information on using multiple files with MPLAB. 
 
Read all the links in this thread: 
 
http://www.ccsinfo.com/forum/viewtopic.php?t=32221 | 
			 
		  | 
	
	
		  | 
	
	
		
			ishmael
 
 
  Joined: 02 Jun 2009 Posts: 4
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				| hello again | 
			 
			
				 Posted: Tue Jun 02, 2009 3:05 pm     | 
				     | 
			 
			
				
  | 
			 
			
				my question dissapeared.
 
can portA be used with this driver for a pic16f648A ? i port B is occupied with USART and 32khz.
 
Thank you. | 
			 
		  | 
	
	
		  | 
	
	
		
			PCM programmer
 
 
  Joined: 06 Sep 2003 Posts: 21708
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Sat Jun 06, 2009 11:56 am     | 
				     | 
			 
			
				
  | 
			 
			
				Read the instructions in the first post.   Any pin can be used, provided
 
that it has full i/o capabilities.    Don't use input-only pins.   If the pin
 
is open-drain, then an external pull-up resistor must be used on that pin. | 
			 
		  | 
	
	
		  | 
	
	
		
			BotBoy
 
 
  Joined: 06 Nov 2009 Posts: 6
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Tue Nov 10, 2009 1:15 pm     | 
				     | 
			 
			
				
  | 
			 
			
				 	  | Code: | 	 		  lcd_putc("\fHello World\n");
 
lcd_putc("Line Number 2");  | 	  
 
 
Is possible after put these two lines on LCD...
 
write some word only on line 2 without clean line 1? | 
			 
		  | 
	
	
		  | 
	
	
		
			PCM programmer
 
 
  Joined: 06 Sep 2003 Posts: 21708
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Tue Nov 10, 2009 1:46 pm     | 
				     | 
			 
			
				
  | 
			 
			
				 	  | Quote: | 	 		  Is possible after put these two lines on LCD... 
 
write some word only on line 2 without clean line 1? | 	  
 
Call the following function in the LCD driver to set the cursor position.
 
The Origin is (1, 1) and it's in the upper left corner of the LCD.
 
 	  | Quote: | 	 		  | void lcd_gotoxy(int8 x, int8 y) | 	  
 
 
You can ask ordinary LCD questions (like this one) in the main forum. | 
			 
		  | 
	
	
		  | 
	
	
		
			yoda
 
 
  Joined: 22 Dec 2009 Posts: 3
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				| nothing happen | 
			 
			
				 Posted: Tue Dec 29, 2009 5:06 am     | 
				     | 
			 
			
				
  | 
			 
			
				i'm using your flex_lcd and test it using your prog:
 
 
 	  | Code: | 	 		  #include <16F877A.H>
 
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
 
#use delay(clock = 20000000)
 
 
#include <lcd flex driver.c>
 
 
//==========================
 
void main()
 
{
 
lcd_init();  // Always call this first.
 
 
lcd_putc("\fHello World\n");
 
lcd_putc("Line Number 2");
 
 
while(1);
 
}
 
 | 	  
 
 
 	  | Code: | 	 		  and change
 
#define LCD_DB4   PIN_C3
 
#define LCD_DB5   PIN_C2
 
#define LCD_DB6   PIN_C1
 
#define LCD_DB7   PIN_C0
 
 
#define LCD_E     PIN_D0
 
#define LCD_RS    PIN_D2
 
#define LCD_RW    PIN_D1
 
//change bcause of wiring i already made
 
 | 	  
 
It can be compiled and write to the pic but
 
nothing come up to the lcd. I checked the wiring and it all good.
 
I'm using pcw compiler and pic2kit. | 
			 
		  | 
	
	
		  | 
	
	
		
			yoda
 
 
  Joined: 22 Dec 2009 Posts: 3
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Thu Dec 31, 2009 1:23 am     | 
				     | 
			 
			
				
  | 
			 
			
				Ok the problem can be solved by connecting my Vee pin to ground.
 
At first I connect it to the trimpot to vary the lcd contrast. Why is this happening? _________________ help me to help you to help me | 
			 
		  | 
	
	
		  | 
	
	
		
			PCM programmer
 
 
  Joined: 06 Sep 2003 Posts: 21708
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Thu Dec 31, 2009 1:59 am     | 
				     | 
			 
			
				
  | 
			 
			
				| The normal setting for the LCD contrast is about 0.4 to 0.5 volts. | 
			 
		  | 
	
	
		  | 
	
	
		
			gonzalza
 
 
  Joined: 23 Feb 2010 Posts: 12
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				| Re: Flexible LCD driver | 
			 
			
				 Posted: Tue Feb 23, 2010 5:43 pm     | 
				     | 
			 
			
				
  | 
			 
			
				Hi PCM Programmer how are you? I noticed the forum is quite old but, I'm interested on it, well, I'm good at c language and assembly however I have never programmed pic with c language. That's why if I'm doing so simple questions excuse me about it.
 
 
In the first code I saw this " / These pins are for the Microchip PicDem2-Plus board, " and I don't understand this. In fact I just bought a lcd 16x2 and already install the CCS plugin to MPLAB.
 
 
But now what kind of board are you talking about? Without knowing this I can't continue. Thanks. | 
			 
		  | 
	
	
		  | 
	
	
		
			PCM programmer
 
 
  Joined: 06 Sep 2003 Posts: 21708
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		 | 
	
	
		  | 
	
	
		
			gonzalza
 
 
  Joined: 23 Feb 2010 Posts: 12
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Wed Mar 03, 2010 4:32 pm     | 
				     | 
			 
			
				
  | 
			 
			
				Dear PCM Programer
 
 
 
I want to  test the LCD, but im not gonna work with the board from microchip and also i want to use the pic 16f874 or 877, 1.can i use the same port configuration PB and PA .
 
 
 
#define LCD_DB4   PIN_D0
 
#define LCD_DB5   PIN_D1
 
#define LCD_DB6   PIN_D2
 
#define LCD_DB7   PIN_D3
 
 
#define LCD_E     PIN_A1
 
#define LCD_RS    PIN_A3
 
#define LCD_RW    PIN_A2 
 
 
2. apart of it, i just have to use VDD and VSS  Don't I? do i have to use another pin from LCD? | 
			 
		  | 
	
	
		  | 
	
	
		
			PCM programmer
 
 
  Joined: 06 Sep 2003 Posts: 21708
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Wed Mar 03, 2010 4:51 pm     | 
				     | 
			 
			
				
  | 
			 
			
				1. Use any available PIC i/o pins.   (That can do both input and output).
 
 
2. Set the contrast pin on the LCD to about 0.4 volts.  
 
 
 
If you have any more questions on LCDs, post them in the main forum. | 
			 
		  | 
	
	
		  | 
	
	
		
			matheuslps
 
 
  Joined: 29 Sep 2010 Posts: 73 Location: Brazil 
			
			 
			 
			
			
			
			
			 
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Mon Jan 17, 2011 5:17 pm     | 
				     | 
			 
			
				
  | 
			 
			
				Is it possible change the pins that I need to use in the main code off a generic program, before ou after call the "#include <LCD_Flex.C>" without a modification on the original LCD_Flex.C?
 
 
I tried with #ifndef but it did not work.   
 
 
thanks | 
			 
		  | 
	
	
		  | 
	
	
		 |