View previous topic :: View next topic |
Author |
Message |
aryan.ir
Joined: 12 Apr 2013 Posts: 3 Location: Persian
|
Use Driver in my compiler |
Posted: Fri Apr 12, 2013 10:44 am |
|
|
How can i use some driver that another person wrote them? For example how can i add flex_lcd.c driver in my compiler ? Is it needed to write this in new source and save it in drivers folder ?
Code: |
// flex_lcd.c
//#define LCD_DB4 PIN_D4
//#define LCD_DB5 PIN_D5
//#define LCD_DB6 PIN_D6
//#define LCD_DB7 PIN_D7
//#define LCD_E PIN_E1
//#define LCD_RS PIN_E0
//#define LCD_RW PIN_E2
// If you only want a 6-pin interface to your LCD, then
// connect the R/W pin on the LCD to ground, and comment
// out the following line.
//#define USE_LCD_RW 1
|
http://www.ccsinfo.com/forum/viewtopic.php?t=24661 |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Fri Apr 12, 2013 11:19 am |
|
|
edit for use with your schematic pin out
and save anywhere you can link to it at compile time. |
|
|
aryan.ir
Joined: 12 Apr 2013 Posts: 3 Location: Persian
|
|
Posted: Fri Apr 12, 2013 12:24 pm |
|
|
THX.But how can i call it in my program? is this true???
#include <flex_lcd.c>
I wrote this in my program but it gave me undefined identifier error.
Code: | #include <16F877A.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOBROWNOUT //No brownout reset
#use delay(clock=8000000)
#define LCD_DATA_PORT getenv("SFR:PORTD")
#include <flex_lcd.c>
void main()
{
lcd_init();
delay_ms(10);
lcd_gotoxy(2,1);
lcd_putc("!Hello!");
delay_ms(10);
lcd_gotoxy(1,2);
lcd_putc("Welcome");
} |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 12, 2013 12:27 pm |
|
|
Quote: | #define LCD_DATA_PORT getenv("SFR:PORTD")
#include <flex_lcd.c> |
The line in bold is not part of the flex_lcd.c file. The line in bold is from
the CCS lcd driver file, which is in this directory:
Quote: | c:\program files\picc\drivers\lcd.c |
Do not try to mix together lines from flex_lcd.c and lcd.c. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Fri Apr 12, 2013 2:08 pm |
|
|
also...
Be sure to copy the original source, save as 'my_flex_lcd.c' or similar.
Then edit THAT file, NOT the original!
Obviously in your programs you'll include your version not the original.
hth
jay |
|
|
aryan.ir
Joined: 12 Apr 2013 Posts: 3 Location: Persian
|
|
Posted: Sat Apr 13, 2013 12:45 pm |
|
|
THX |
|
|
|