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.

can anyone explain this program???pls..

Status
Not open for further replies.

monicca86

Newbie level 1
Joined
Feb 6, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,299
#include <pic.h>
#include <stdio.h>
#include <delay10.c>

static void interrupt IntRoutine();
void Send();
short int Flg=0;
int Cnt = 0,Oflow=0,Mytime=0,Adval,Hbc,Hbr;
char St1[4],St2[4],St4[3];


void main()
{

TRISB = 0x00;
PORTB = 0x00;
TRISD = 0x00;
PORTD = 0x00;
TRISE = 0x00;
TRISC = 0xbf;

ADCON0 = 0x81;
ADCON1 = 0x82;

SPBRG = 64;

TXEN = 1;
SYNC = 0;
BRGH = 1;
SPEN = 1;
CREN = 1;

DelayMs(200);
DelayMs(200);
DelayMs(200);
DelayMs(200);
DelayMs(200);

LCD_SendCmd(0x01);

LCD_SendCmd(0x80);
LCD_puts("Ebc:");

LCD_SendCmd(0x88);
LCD_puts("Tim:");

LCD_SendCmd(0xc3);
LCD_puts("Ebr: Bpm");

T1CON = 0x00; // Enable Timer1
PEIE = 1;
GIE = 1;

TMR1IF = 0;
TMR1IE = 1;
TMR1L = 0xaf;
TMR1H = 0x3c;
TMR1ON = 1;

for(;;)
{

if(Oflow)
{
Oflow = 0;
Mytime++;
}


ADCON0 = 0x81;
DelayUs(50);
ADGO = 1;
while(ADGO) continue;

Adval = (ADRESH * 256) + ADRESL;

if(Adval < 100 && Flg == 0)
{
Hbc++;
Flg = 1;
}

if(Adval > 100 && Flg == 1)
{
Flg = 0;
}

if(Mytime > 3 && Mytime < 60) RD0 = 0;

if(Mytime >= 60)
{
Mytime = 0;
Ebr = Ebc;
if(Ebc > 15)
{
RD0 = 1;
}
Ebc = 0;
}

sprintf(St1,"%3d",Ebc);
LCD_SendCmd(0x84);
LCD_puts(St1);

sprintf(St2,"%3d",Ebr);
LCD_SendCmd(0xc8);
LCD_puts(St2);

sprintf(St4,"%02d",Mytime);
LCD_SendCmd(0x8c);
LCD_puts(St4);

Send();
DelayMs(2);

}

}





static void interrupt IntRoutine()
{

if(TMR1IF)
{
TMR1IF = 0;
Cnt++;
if(Cnt >= 50)
{
Cnt = 0;
Oflow = 1;
}

TMR1ON = 0;
TMR1L = 0xaf;
TMR1H = 0x3c;
TMR1ON = 1;

}

}
 

where did you found this code from, u need to tell me some details
 

Can you please be more specific on what you need to understand? You want to understand the complete code, or portion of the code..? You need to furnish the required details, so that other people can understand and answer your questions.

Kars
 

You are trying in several forums, it seems with fair to null success.

Why don't you try by yourself?

I could, but we need to agreed on sharing credits after you show results to your instructor.
 

from the above code the following thing is could say is
1. code written in pic c
2. initializations static void ,others variables
3. port b,d,e configured as output
.4 port c configured as 10111111 (1-input 0-output)
5. Adc configuration registers 0-1set to value
6. function that are LCD_send etc are used to write characters on the LCD display connected
.7 clear the displsy, blink the cursor on the initial position
8. value of adc received & displayed on LCD.
 

why do you all bother such a dumb person eh? he does not even know what to ask for.... "explain"~~oh, like i'm really going to explain.....
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top