Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing temperature sensor using PICC

Status
Not open for further replies.

areeckal

Member level 2
Joined
Jan 22, 2011
Messages
42
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,567
I am building a project on interfacing temperature sensor with pic16f877a. I am using PICC compiler. I am just getting started with PIC programming. Are there any good resources using PICC? I need to use the ADC of PIC also.
 

Thanks..
I tried this much code. It is showing unidentified identifier ADGO.
Code:
#include<16F877A.h>

unsigned short result;

void read_adc(void)
{
   ADGO = 1;
   while(ADGO==1);
   result = ADRESH;
   result=result<<8;
   result= result|ADRESL;

}
void main()
{
   TRISA = 0x01;
   TRISC = Ox00;
   TRISD = 0; 
   setup_adc_ports(all_ANALOG);
   setup_adc(ADC_clock_internal);
   set_adc_channel(0);
   
   while(1)
   {
      read_adc();
      PORTC =result;
      
   }
}
 

Hi areeckal,

You may not use ADGO,
See the sample file "EX_ADMM" in your PICC installation folder (PICC\Examples). It's clear and simple. (You can find all samples of above 2nd link in here)
 
Thanks a lot..
I used the code from Examples.
But when I am compiling it, iam getting an error "Undefined Identifier TRISD"
Code:
#include<16F877A.h>
#include<pic.h>
#include "delay.h"
#include "lcd.h"
//#device *=16 ADC=10 
#use delay(clock=20000000)


void main()
{
   int i;
   long value;

   setup_port_a( ALL_ANALOG );
   setup_adc( ADC_CLOCK_INTERNAL );
   set_adc_channel( 0 );
   
   TRISD=0X00;
   PORTD=0;
   
   lcd_init(); //LCD initialized
   lcd_line1(0); //LCD address specified AT LINE 1
   lcd_string("INTERFACING LCD"); //Displays message "LCD INTERFACING"
   lcd_line2(0); //LCD address specified AT LINE 2
   lcd_string(" PIC 16F877A");//Displays message " PIC 16F877A"
   
   while(1)
   {
      delay_ms(100);
      value = Read_ADC();
      LCDWriteInt(value,4);
   }
}


---------- Post added at 11:03 ---------- Previous post was at 10:19 ----------

I am trying to interface lcd display to pic 16f877a. I searched over the net but couldn't find proper materials. Can anyone help me over this?
 

Hi,

It's not the way of handling I/O in PICC,
Check functions listed in "General Purpose I/O" in help.
Hope thi helps you,
 
Hope you are using Hi-Tech and not CCS C. Please look at the include headers. It contains #include 16F877.h" which is not used in Hi-Tech. Please remove this and the code should function.
Thankyou

---------- Post added at 09:21 ---------- Previous post was at 09:19 ----------

Also select proper PIC device form device menu.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top