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

lcd problem

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



Joined: 01 Apr 2011
Posts: 17

View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger

lcd problem
PostPosted: Fri Apr 01, 2011 7:09 am     Reply with quote

hello guys , what's up ?
i have a problem when i want to use lcd
for example this is the simplest code ever :
pic16f876a
Code:

#include "lcd4447.h"

#define LCD_ENABLE_PIN PIN_B0
#define LCD_RS_PIN PIN_B1
#define LCD_RW_PIN PIN_B3
#define LCD_TYPE 1
#include <lcd.c>

void main()
{
   lcd_init();

   lcd_putc("\fReady...\n");

   while (TRUE) {
      k=kbd_getc();
      if(k!=0)
        if(k=='*')
          lcd_putc('\f');
        else
          lcd_putc(k);
   }

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1););
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

   // TODO: USER CODE!!

}

But when I compile it many errors will appear like this one:
an Expression must be a constant or simple variable
Code:

  BYTE const LCD_INIT_STRING[4] = {0x20 | (lcd_type << 2), 0xc, 1, 6};
                             // These bytes need to be sent to the LCD
                             // to start it up.


                             // The following are used for setting
                             // the I/O port direction register.

Maybe compiler did not know these functions :
lcd_init(),lcd_putc()....etc or #include <lcd.c>
So, what I have to do ?
Thanks
_________________
REPTILE404

55AA55AA55
Ttelmah



Joined: 11 Mar 2010
Posts: 19343

View user's profile Send private message

PostPosted: Fri Apr 01, 2011 8:21 am     Reply with quote

Are you compiling directly in CCS, or under MPLAB?.
If the latter, you _must_ only include your main program code file in the list of files to compile. If you add the 'lcd.c' file, MPLAB tries to compile this on it's own, and then lacks the processor definitions etc., and gives the errors you are describing.

Best Wishes
reptile404



Joined: 01 Apr 2011
Posts: 17

View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger

hello
PostPosted: Fri Apr 01, 2011 11:22 am     Reply with quote

thanks for respond.
I've compiled it using both ccs directly and under mplab
and had same problem.
_________________
REPTILE404

55AA55AA55
temtronic



Joined: 01 Jul 2010
Posts: 9163
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Apr 01, 2011 11:32 am     Reply with quote

if that's your entire program, then it's missing the
#include ..processortype line

which should be the first line of code....
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