Hey all, now I'm making a heart rate monitor program into a 68HC11 that input's the frequency generated by a function generator to get output.
Now i know this is embedded system program but what I'm asking is just about c I'm quite bad at it, I'll do the embedded part.
The function generator will sent out a signal to that will calculate the variable "bpm" along with the real time timer, How do I log it into an array and print it out with another function?
This is what needs to be done.
• Heart rate (in beats/minute) averaged over previous 5s.
• Alarm to be sounded if rate is above or below preset limits.
• Alarm conditions to be logged with time data.
• Rate to be logged every 5s for later download.
All variables are global.
In main, this is how I store it, It's wrong so I want to know how to fix it.
Code:
int i;
log[2][100];
main()
{
*/bpm= some equation from func gen*/
If (bpm>=400)
{
printf("ALARM!Rate is too high") ;
log[i+1][secs,mins,hours]=[bpm][secs,mins,hours] ; //[i+1] for alarm status. [i] for normal log
}
If (bpm<=100)
{
printf("ALARM!Rate is too low");
log[i+1][secs,mins,hours]=[bpm][secs,mins,hours] ;
}
}
So far here is my array part program
Code:
datalog()
for (=0;i<
printf("[%d][%d:%d:%d]",log[bpm],log[sec,mins,hours] );
When I get to the function datalog(), how do I print out all the log that is currently stored? I know using some loop but I'm not sure where to go.