Discussion in "8051 Discussion Forum" started by    karthikdm    Feb 6, 2011.
Tue Feb 08 2011, 09:27 AM
#11
its ok dear dont be sorry we will w8 for your updates.... best of luck
Wed Feb 09 2011, 01:49 PM
#12
Here is the working code for Heart Beat Counter...
#include<reg52.h>

#include<intrins.h>

void _nop_(void);

#define delay_us _nop_(); //generates 1 microsecond
#define LCD P1

sbit RS=P2^5; //connect p0.0 to rs pin of lcd
sbit EN=P2^7; //connect p0.1 to en pin of lcd
sbit RW=P2^6;

sbit PULSE=P0^0; //pulse input from heart beat sensor
sbit LED=P3^0;   //led indicator for pulse indication

void integer_lcd(int);

void init_lcd(void);
void cmd_lcd(unsigned char);
void write_lcd(unsigned char);
void delay_ms(unsigned int);

unsigned int num=0;
unsigned int num1=0;
unsigned int dig_1,dig_2,dig_3,dig_4,test=0;
unsigned int dig_11,dig_21,dig_31,dig_41,test1=0,test2=0;
unsigned char k=0;


void main(void)
{

				init_lcd();		
				LED=0;
				write_lcd('H');
				write_lcd('E');
				write_lcd('A');
				write_lcd('R');
				write_lcd('T');
				write_lcd(' ');
				write_lcd('B');
				write_lcd('E');
				write_lcd('A');
				write_lcd('T');
				write_lcd(' ');
				write_lcd(' ');
				write_lcd(' ');
				write_lcd(' ');
				write_lcd(' ');
				write_lcd(' ');
				cmd_lcd(0xc0);
				write_lcd(' ');
				write_lcd(' ');
				write_lcd(' ');
				write_lcd(' ');
				write_lcd(' ');
				write_lcd(' ');
				write_lcd(' ');
				write_lcd(' ');
				write_lcd('C');
				write_lcd('O');
				write_lcd('U');
				write_lcd('N');
				write_lcd('T');
				write_lcd('E');
				write_lcd('R');
				delay_ms(300);
				cmd_lcd(0x01);
				write_lcd('B');
				write_lcd('e');
				write_lcd('a');
				write_lcd('t');
				write_lcd('s');
				write_lcd(':');
				write_lcd(48);
				write_lcd(48);
				write_lcd(48);
				write_lcd(48);
														    
	while(1) 
	{   
	if(PULSE==1)  //check for input pulse from sensor
     {
	 	  cmd_lcd(0x01);	
	   	  test++;
	      num=test;
	        dig_4=num%10;
	      num=num/10;
	        dig_3=num%10;
	      num=num/10;
	        dig_2=num%10;
	      dig_1=num/10;
	      if(test==9999)
	     test=0;
				write_lcd('B');
				write_lcd('e');
				write_lcd('a');
				write_lcd('t');
				write_lcd('s');
				write_lcd(':');
				write_lcd(dig_1+48);
				write_lcd(dig_2+48);
				write_lcd(dig_3+48);
				write_lcd(dig_4+48);
				
				LED=1;
				delay_ms(50);
				LED=0;

    }
	}
	}

////////////////////////////////////////////////////////////////

void init_lcd(void)
{                            
delay_ms(10); //delay 10 milliseconds

cmd_lcd(0x38); //8 bit initialize, 5x7 character font, 16x2 display
cmd_lcd(0x0e); //lcd on, cursor on
cmd_lcd(0x06); //right shift cursor automatically after each character is displayed
cmd_lcd(0x01); //clear lcd
}

//transmit command or instruction to lcd
void cmd_lcd(unsigned char c)
{
EN=1;
RW=0;//set enable pin
RS=0; //clear register select pin
LCD=c; //load 8 bit data 
EN=0; //clear enable pin
delay_ms(2); //delay 2 milliseconds
}

//transmit a character to be displayed on lcd
void write_lcd(unsigned char c)
{

EN=1; //set enable pin
RW=0;
RS=1; //set register select pin
LCD=c;  //load 8 bit data
EN=0; //clear enable pin
delay_ms(2); //delay 2 milliseconds
}

//generates delay in milli seconds
void delay_ms(unsigned int i)
{
unsigned int j;
	while(i-->
0)
	{
		for(j=0;j<500;j++)
		{
			;
		}
	}
}

This code can only provide counting...for measuring Heart Rate; pulse counted should be compared with specific time interval...i need help of you great minds in solving timing part of the code
Thu Feb 10 2011, 08:13 AM
#13
@ karthikdm
why ur not using timer as a counter for measuring pulses
use timer as a counter and produce delay of 1sec after that registers of timer has value of no of pulses per sec
Thu Feb 10 2011, 02:44 PM
#14
@majoka
since heart pulses are very slow i'm planning to measure the counts for every 20seconds and convert it for per minute value..
I know only producing delays using 8051 timers..but i have no knowledge on using the interrupts and counters ..while using timers for delays,any other operations are not performed by the microcontroller during the delay period;so the pulses are counted only after the end of delay time..
Fri Feb 11 2011, 05:40 PM
#15
counter can also be used if pulses r slow or fast and it is better option when u use timer as a counter then there is no need of polling it it automatically increments contents of timer registers on each pulse so it is good option u not need to wait for pulses
 karthikdm like this.
Fri Feb 11 2011, 09:02 PM
#16
Well from my experience(made it couple of time) this is not reliable you would see if you insert an abject between the ldr and led.

I would recomend you to put ad620 use adc adn do some real time pulse processing .I did it for making Blood Pressure monitor that logs data on computer
Sat Feb 12 2011, 03:01 AM
#17
hi Afnan
share ur diagram and experience it may help others
Tue Feb 15 2011, 04:30 PM
#18
Hey guys I was just looking at the diagram for this circuit and was wondering what is the photocell being used, I am unfamiliar with a 220E.
Wed Feb 16 2011, 09:08 AM
#19
Hi all
Diagram is lost how ever i will give you an idea

use pic or avr for better adc res now logic is

adc->adc620->same LED and LED without lm 358

in software you have to define a thresh hold for valid pulse.
One thing when you insert an object you get pulse for first time but not for rest so you have to write code accordingly.
If there are any further question please feel free to ask
Wed Feb 16 2011, 10:01 AM
#20


Hey guys I was just looking at the diagram for this circuit and was wondering what is the photocell being used, I am unfamiliar with a 220E.

01000100



D1 is LED which is ultra bright and R1 is LDR value is 220....

this is a scanning mechanism these two are placed together as when you place thumb these two should have to be under your thumb....



LED will illuminate thumb and LDR will detect light and a signal will be generated by lm358..



now when heart pump blood the pressure and volume of blood in thumb will change this will create a change in illumination and LDR will detect a change so the value of lm358 out put at pin 7 will be changed!

so at every Heart beat there will be a change in out put pulse which is generated by lm358.....


[ Edited Wed Feb 16 2011, 10:05 AM ]
Tags working of heartbeat sensorLDR based heart beat sensor

Get Social

Information

Powered by e107 Forum System

Conversation

Sat Feb 01 2020, 10:12 AM
Pearl Olin
Hello,
Wed Jan 22 2020, 06:16 PM
MINU CHAUDHARY
I m getting errors while simulation process during interfacing socket output and lcd... Can i get the report of ur project which is same as us.
Tue Jan 14 2020, 07:08 AM
shubham kharade
when i am trying to simulate the program in Proteus 8 professional, I am getting some errors as cannot find module file dhtxx.md can u help me
Tue Dec 17 2019, 01:44 PM
Devangi
hello..i am programming industrial timer using 8051 with 24lc64 eeprom. i have query in storing the 3 diff value in eeprom with enter button. can anyone share c code ?
Tue Dec 17 2019, 10:30 AM
Andrius
Hello. Can anyone share the code in Bascon and scheme in Proteus?
Thu Nov 21 2019, 12:30 PM
raj2555
how to interface 8051 microcontroller with NRF24L01+ module
ExperimenterUK
Sat Oct 12 2019, 10:23 PM
Log in.. then post your code in the 8051 forum
Sat Oct 12 2019, 10:18 AM
Bhadra Sajikumar
i am doing a countdown timer with 8051 for my project, unfortunately our professor had to take a leave of absence before he could teach us most of it.. can someone explain the .asm code of it for me?
Mon Sep 23 2019, 07:37 AM
Nathaniel
I am doing a project for my schools wireless security system with cameras,sensors and spot lights using 8051 micro controller, could you help me out with the design and its source code.
Wed Sep 18 2019, 08:48 PM
Caryn Kover
Thank you for your time,

Downloads

Comments

sarrahjuzar
Wed Feb 19 2020, 09:13 AM
arun.sapro
Wed Feb 12 2020, 04:47 PM
prathmiyer
Tue Feb 11 2020, 11:12 AM
Just4Fun
Sat Feb 01 2020, 01:29 PM
Deepkumar
Thu Jan 30 2020, 03:52 PM
wounder
Sat Jan 25 2020, 12:09 PM
brucewilliams20
Thu Jan 23 2020, 11:47 AM
Nippy56
Sun Jan 19 2020, 02:13 AM

Online

Guests: 45, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38123
Newest member: sarrahjuzar
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Feb 21 2020, 10:05 PM
ajay_bhargav Avatar
Posted By ajay_bhargav
Fri Feb 21 2020, 09:45 AM
Yes you can do that.1. Create a channel @Thingspea...
ananyagupta Avatar
Posted By ananyagupta
Thu Feb 20 2020, 08:58 AM
With regards to the particular characters sent to ...
sarrahjuzar Avatar
Posted By sarrahjuzar
Wed Feb 19 2020, 09:24 AM
I have a gsm module sim900a and dht22 connected to...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Feb 18 2020, 09:52 PM
figureyang Avatar
Posted By figureyang
Tue Feb 18 2020, 09:59 AM
figureyang Avatar
Posted By figureyang
Tue Feb 18 2020, 09:50 AM
wounder Avatar
Posted By wounder
Mon Feb 10 2020, 08:32 AM
From below sample code for nuvoton 8051 timer0 mod...
Just4Fun Avatar
Posted By Just4Fun
Sat Feb 01 2020, 02:20 PM
If you want to use a CH55x MCU there isn't any adv...
Just4Fun Avatar
Posted By Just4Fun
Sat Feb 01 2020, 01:51 PM
Hi all,I was curious to try out the CH552 MCU (805...