PIC 16f877 header file

Thread Starter

Janeera

Joined Mar 9, 2011
4
I am programing PIC using MPLAB Sim. but I need the header file pic.h for pic 16f877. can anyone give me the code :confused:?

I have the other 3 header files- pic_lcd8.h, pic_serial.h and pic_adc.h

This is my program... to display ecg, pressure, pulse, respiration rate.

Rich (BB code):
#include<pic.h>
#include"pic_lcd8.h"
#include"pic_serial.h"
#include"pic_adc.h"

#define pulse1 RB1
//#define pulse2 RB2

unsigned char i,j,v[10],f,g,h,re,time=0,sec=0,aa=0,bb=0,pul,sec1=0,pulse,count,count1,beat,Temp;    
int pressure;

void main()
{
    TRISC=0xC0;
    TRISD=0x00;
    TRISB=0x03;
    lcd8_init();
    Serial_Init(9600);
    
    GIE=1;                        
    PEIE=1; 
//    INTE=1;
//    INTEDG=1;
    TMR1IE=1;
    TMR1H=60;
    TMR1L=235;
    T1CON=0X00;
    TMR1ON=0;
    Receive(0);
    lcd8_display(0x80," Cardiopulmonary ",16);
    lcd8_display(0xc0," Activity Monitor ",16);
    delay(65000);delay(65000);
    lcd8_display(0x80,"Pre:     R:      ",16);
    lcd8_display(0xc0,"E:    P:    S:  ",16);
    delay(65000);delay(65000);

    while(1)
    {
        TMR1ON=1;    
        Temp=Adc8_Cha(0);//value reading for temperature
        pressure=Adc8_Cha(1);//value reading for pressure
    //    if(!pulse2 && !bb)    { bb=1;     }
    //    if(pulse2 && bb)    { bb=0; pulse++; }
    
        if(!pulse1 && !aa)    { aa=1;     }
        if(pulse1 && aa)    { aa=0; pul++; }

        lcd8_decimal2(0xce,sec);
        lcd8_decimal3(0x84,pressure);    
        lcd8_decimal3(0x8b,pul);
        lcd8_decimal3(0xC2,Temp);    
        lcd8_decimal3(0xC8,pulse);
    
        if(sec>59)
        {
            delay(65000);delay(65000);
            TMR1ON=0;
            sec=0;
            pul=pulse=0;
        }
        
    
    }

}     
         
void interrupt ser_int(void) 
{
    if(RCIF) //reciever interrupt flag
    {
        RCIF=0;
        v=RCREG;i++;        
    }
    if(INTF)/interrupt flag
    {
        INTF=0;
        pulse++;
    }
    if(TMR1IF==1)
    {
        TMR1ON=0;
        TMR1IF=0;
        count1++;
        if(count1>=20){sec++;count1=0;}
        TMR1H=60;
        TMR1L=235;
        TMR1ON=1;
    }
    
}

 
Last edited by a moderator:

someonesdad

Joined Jul 7, 2009
1,583
What compiler are you using? If you e.g. downloaded and installed the C18 compiler from Microchip, that include file should already be present.
 

AlexR

Joined Jan 16, 2008
732
A bit more information from you would help!
If you are programming for a PIC16F877 you obviously can't be using the C18 compiler so which compiler are you using? Basic information like that will get you a much better response to your query.
Also when posting code go into "Advanced" mode and wrap the code in code (#) tags so that any formatting gets preserved and makes the code easier to read.

As a wild guess I think you might be using HitechC in which case you don't have to include the pic.h file. Everything gets done through the htc.h file so what you need to do is place "#include <htc.h>" as your first #include statement followed by your other include statements. If the header pic.h is needed it will get called from the htc.h header file.
Incidental the pic.h file along with htc.h and various other header files is on your PC amongst the HiTech program files under the "include" subdirectory.
 

t06afre

Joined May 11, 2009
5,934
If you are using the HI-Tech C compiler. You should read the quickstart.pdf. In the compiler install folder under the docs dir. That Should be something like this path
C:\Program Files\HI-TECH Software\PICC\9.81\docs
 

AlexR

Joined Jan 16, 2008
732
Its MPLAB IDE v8.00

and anyway, I found the header file in http://www.bknd.com/cc5x/download.shtml
The question was which compiler are you using not which IDE, MPLAB is an IDE and it supports many different compilers and programming languages.
Header files are very much compiler specific so if you are using the cc5x compiler those files will be fine but if you are using any other compiler then those files will not work.
 

t06afre

Joined May 11, 2009
5,934
Your code looks very like HI-Tech C hence the header file from cc5x will not do you any good. Your program will be a nightmare do find out of. If you just uncritical use any code found on internet. And include it in your project
 

karthik_dm

Joined Oct 16, 2008
27
I am programing PIC using MPLAB Sim. but I need the header file pic.h for pic 16f877. can anyone give me the code :confused:?

I have the other 3 header files- pic_lcd8.h, pic_serial.h and pic_adc.h

This is my program... to display ecg, pressure, pulse, respiration rate.

Rich (BB code):
#include<pic.h>
#include"pic_lcd8.h"
#include"pic_serial.h"
#include"pic_adc.h"

#define pulse1 RB1
//#define pulse2 RB2

unsigned char i,j,v[10],f,g,h,re,time=0,sec=0,aa=0,bb=0,pul,sec1=0,pulse,count,count1,beat,Temp;    
int pressure;

void main()
{
    TRISC=0xC0;
    TRISD=0x00;
    TRISB=0x03;
    lcd8_init();
    Serial_Init(9600);
    
    GIE=1;                        
    PEIE=1; 
//    INTE=1;
//    INTEDG=1;
    TMR1IE=1;
    TMR1H=60;
    TMR1L=235;
    T1CON=0X00;
    TMR1ON=0;
    Receive(0);
    lcd8_display(0x80," Cardiopulmonary ",16);
    lcd8_display(0xc0," Activity Monitor ",16);
    delay(65000);delay(65000);
    lcd8_display(0x80,"Pre:     R:      ",16);
    lcd8_display(0xc0,"E:    P:    S:  ",16);
    delay(65000);delay(65000);

    while(1)
    {
        TMR1ON=1;    
        Temp=Adc8_Cha(0);//value reading for temperature
        pressure=Adc8_Cha(1);//value reading for pressure
    //    if(!pulse2 && !bb)    { bb=1;     }
    //    if(pulse2 && bb)    { bb=0; pulse++; }
    
        if(!pulse1 && !aa)    { aa=1;     }
        if(pulse1 && aa)    { aa=0; pul++; }

        lcd8_decimal2(0xce,sec);
        lcd8_decimal3(0x84,pressure);    
        lcd8_decimal3(0x8b,pul);
        lcd8_decimal3(0xC2,Temp);    
        lcd8_decimal3(0xC8,pulse);
    
        if(sec>59)
        {
            delay(65000);delay(65000);
            TMR1ON=0;
            sec=0;
            pul=pulse=0;
        }
        
    
    }

}     
         
void interrupt ser_int(void) 
{
    if(RCIF) //reciever interrupt flag
    {
        RCIF=0;
        v=RCREG;i++;        
    }
    if(INTF)/interrupt flag
    {
        INTF=0;
        pulse++;
    }
    if(TMR1IF==1)
    {
        TMR1ON=0;
        TMR1IF=0;
        count1++;
        if(count1>=20){sec++;count1=0;}
        TMR1H=60;
        TMR1L=235;
        TMR1ON=1;
    }
    
}


Hi bro, i'm doing the same ECG hardware using PIC16F877A, for that i need "pic_lcd8.h"
"pic_serial.h"
"pic_adc.h"
Kindly help me with that files if you have..
Thanks....
 
Top