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 & pic16f648a

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



Joined: 11 Jun 2007
Posts: 25

View user's profile Send private message MSN Messenger

lcd & pic16f648a
PostPosted: Thu Oct 15, 2009 1:41 am     Reply with quote

I am trying to program the PIC16F48a to drive an LCD to display temperature. The program doesn't compile :(. Are the CCS internal LCD controller functions compatible with the PIC16F648a?

Particularly, I'm realizing a receiver circuit to display the measure of environment temperature.

This is the receiver code:
Code:

#include "C:\Documents and Settings\Administrator\Desktop\ricevitore\16f648.h"
#define LCD_ENABLE_PIN PIN_D0
#define LCD_RS_PIN PIN_D1
#define LCD_RW_PIN PIN_D2
#define LCD_TYPE 2
#include <lcd.c>

int1 stato_bit, stato_id, parita;
int1 vett[48];
int i, j, k1, k2, count, count_k, pos_id;


#int_CCP1
void  CCP1_isr(void)
{
   enable_interrupts(INT_TIMER0);
   enable_interrupts(GLOBAL);
   set_timer0(0);
   
   delay_us(500);
   stato_bit=input_state(pin_B3);
   
   if(stato_bit)
      vett[j]=1;
   else
      vett[j]=0;
   
   if(j==47)
         j=0;
   else
      j++;
   
   if (get_timer0()<255)
      disable_interrupts(INT_TIMER0);
}


#int_TIMER0
void  TIMER0_isr(void)
{
   stato_id=false;
   parita=false;
}

void controllo_id (int1 v[48])
{
   for(k1=0;k1<32;k1++)
   {
      count_k=0;
      for(k2=k1;k2<k1+15;k2++)
      {
         if((v[k2]==1)&&(v[k2+1]==0))
            count_k++;
      }
     
      if(count_k==8)
      {
         stato_id=true;
         pos_id=k1;
      }
      else
         stato_id=false;
   }
}

void controllo_parita (int1 v[48])
{
      for(i=0;i<48;i++)
      {
         if(vett[i]==1)
            count++;
      }
      if(count%2==1)
         parita=false;   
      else
         parita=true;
}


void main()
{
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_8); // va in overflow ogni 2ms
   setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
   setup_timer_2(T2_DISABLED,0,1);
   setup_ccp1(CCP_CAPTURE_RE);
   // set_pwm1_duty(0);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   enable_interrupts(INT_CCP1);
   enable_interrupts(GLOBAL);
   setup_oscillator(OSC_4MHZ);
   
   lcd_init();

   while(TRUE)
   {
     
      controllo_id (vett);
     
      if(stato_id==true)
      {
         controllo_parita(vett);
      }
     
      if((pos_id==0)&&(stato_id==true)&&(parita==true))
         
         
         // comandi lcd
         
         delay_us(1);
     
     
   }

}

And these are the error messages:

Undefinied identifer set_tris_d

about:

set_tris_lcd(LCD_READ); / set_tris_lcd(LCD_WRITE);

Someone can help me?? Thank a lot!
Ttelmah
Guest







PostPosted: Thu Oct 15, 2009 2:49 am     Reply with quote

You are telling the LCD code, to use PORTD for the LCD control:

#define LCD_ENABLE_PIN PIN_D0
#define LCD_RS_PIN PIN_D1
#define LCD_RW_PIN PIN_D2

Your PIC, _does not have a PORTD_.

Yes, the LCD code will work with a 648, if it is setup to use the pins the chip has. _but_, not if you try to use pins that are not there....

Best Wishes
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