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.

MPLAB to MIKROC microcontroller program

Status
Not open for further replies.

Janeera

Newbie level 3
Joined
Mar 11, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
India
Activity points
1,300
Can anyone please convert this code from MPLAB to MIKROC v8.1...


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[i]=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;
	}
	
}

It is a program using PIC 16F877 to get the data from an ECG, respiration rate, pressure and heart rate circuit and display the output in an LCD and further serial communication is done via zigbee to view it on a laptop.

and which software should I use to burn the program on the chip?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top