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 support@ccsinfo.com

How to use LCD with PICDEM 2 PLUS 2006

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Supernova
Guest







How to use LCD with PICDEM 2 PLUS 2006
PostPosted: Fri Apr 18, 2008 2:35 am     Reply with quote

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







PostPosted: Fri Apr 18, 2008 2:47 am     Reply with quote

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







PostPosted: Fri Apr 18, 2008 3:06 am     Reply with quote

Thanks a lot Matro. That solved one problem.
I'll be back later cos it's not quit working yet.

Jonathan
Matro
Guest







PostPosted: Fri Apr 18, 2008 3:22 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 18, 2008 10:25 am     Reply with quote

Quote:
i'm trying to use the LCD with my board

See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=34385
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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