View previous topic :: View next topic |
Author |
Message |
Supernova Guest
|
How to use LCD with PICDEM 2 PLUS 2006 |
Posted: Fri Apr 18, 2008 2:35 am |
|
|
Hello i'm trying to use the LCD with my board but i'm pretty lost and don't know how to make it work.
i've included the lcd.c file in to my project but then don't know how to use it. Can any one hlep? Please
Code: | //-----------------------------------------------------------------
//Declaration de librairie
#include "test.h"
#include <stdlib.h>
#include <LCD.c>
//Prototypes
void Init(void);
void Lecture(void);
//-----------------------------------------------------------------
//Déclaration de constante
//-----------------------------------------------------------------
//Déclaration de variables globales
//-----------------------------------------------------------------
//- Fonction : Lecture
//- Description : Sur interuption lis un cractère envoyer sur le port
// série et le renvois en écho plus le caractère 'o'
//-----------------------------------------------------------------
#INT_RDA
void Lecture(void)
{
//Déclaration de variables
Char buf;
//
if (kbhit(sortie))
{
buf=fgetc(sortie); //Reçois un caractère sur le port série
fputc(buf, sortie); //Le renvois sur le port série
fputc('o', sortie); //envois le caractère 0 en confirmation
//Le Delay de 100ms est necessaire pour que l'on puisse capter les valeurs avec TeraTerm
delay_ms(200);
}
}
//-----------------------------------------------------------------
//- Fonction : Lecture
//- Description : Sur interuption lis un cractère envoyer sur le port
// série et le renvois en écho plus le caractère 'o'
//-----------------------------------------------------------------
void Init(void)
{
}
//-----------------------------------------------------------------
//- Programme Principale
//-----------------------------------------------------------------
void main(void)
{
//-----------------------------------------------------------------
//Déclaration de variables
//Active les Interrutions
enable_interrupts(GLOBAL);
enable_interrupts(INT_RDA);
//Initialisation
Init();
lcd_init();
lcd_putc("c");
//Boucle du PIC
while(TRUE)
{
//Envois sur le PORT B
//
OUTPUT_B(0x01); //Uniquement Led 1 s'allume
delay_ms(200);
OUTPUT_B(0x02); //Uniquement Led 2 s'allume
delay_ms(200);
OUTPUT_B(0x04); //Uniquement Led 3 S'allume
delay_ms(200);
OUTPUT_B(0x09); //Uniquement Led 4 et 1 S'allume
delay_ms(200);
}
}
//----------------------------------------------------------------- |
I also allways get this error:
Code: | Executing: "C:\Program files\Picc\CCSC.exe" "Test.c" +FH +DF +LN +T -A +M +Z +Y=9 +EA
>>> Warning 203 "K:\est\EST06TTI\EST06Waite\PicTest\Test.c" Line 64(1,1): Condition always TRUE
>>> Warning 216 "K:\est\EST06TTI\EST06Waite\PicTest\Test.c" Line 78(1,2): Interrupts disabled during call to prevent re-entrancy: @delay_ms1
Memory usage: ROM=3% RAM=2% - 3%
0 Errors, 2 Warnings.
Executing: "C:\Program files\Picc\CCSC.exe" "LCD.C" +FH +DF +LN +T -A +M +Z +Y=9 +EA
*** Error 128 "K:\est\EST06TTI\EST06Waite\PicTest\LCD.C" Line 42(1,1): A #DEVICE required before this line
Halting build on first failure as requested.
BUILD FAILED: Fri Apr 18 10:22:55 2008
|
What do i have to add in the driver? |
|
|
Matro Guest
|
|
Posted: Fri Apr 18, 2008 2:47 am |
|
|
The compiler has to know which device you are using to compile correctly.
A #include is missing. For example, if you use a PIC16F877, you must add at the beginning of your code :
Code: |
#include <16F877.h>
|
Matro. |
|
|
Supernova Guest
|
|
Posted: Fri Apr 18, 2008 3:06 am |
|
|
Thanks a lot Matro. That solved one problem.
I'll be back later cos it's not quit working yet.
Jonathan |
|
|
Matro Guest
|
|
Posted: Fri Apr 18, 2008 3:22 am |
|
|
An important thing is that if you have to post again some code, please comment it in english because it will be easier for everybody. A code is definitely easier to debug if you understand what the program is doing.
And it's a good habit to take especially if it's a professional work.
Matro. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|