MikroC Code for-WPS Officehh
MikroC Code for-WPS Officehh
MikroC Code for-WPS Officehh
```
#include <xc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Configuration bits
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = OFF // MCLR Pin Function Select bit (MCLR/VPP pin function is digital I/O)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
#pragma config BOREN = OFF // Brown-out Reset Enable bit (Brown-out reset disabled)
#pragma config CLKOUTEN = OFF // Clock Out Enable bit (CLKOUT function is disabled)
#pragma config IESO = OFF // Internal/External Switchover bit (Internal/External switchover mode is
disabled)
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit (Fail-safe clock monitor disabled)
// LCD pins
// Function prototypes
void init_lcd(void);
void init_max30100(void);
void init_hc05(void);
// Global variables
void main(void) {
// Initialize oscillator
// Initialize LCD
init_lcd();
// Initialize MAX30100
init_max30100();
init_hc05();
while(1) {
ir_buffer[i] = max30100_read_register(MAX30100_REG_FIFO_DATA);
red_buffer[i] = max30100_read_register(MAX30100_REG_FIFO_DATA);
heart_rate = calculate_heart_rate(ir_buffer);
lcd_write_string("SPO2: ");
lcd_write_char(spo2 + '0');
lcd_write_char(heart_rate + '0');
char data[10];
hc05_write_data(data);
__delay_ms(1000);
}
void init_lcd(void) {
LCD_RS = 0;
LCD_RW = 0;
LCD_EN = 0;
LCD_DATA = 0;
// Initialize LCD
```