Advertisement
Electgpl

PIC - Medidor de Ritmo Cardiaco

Jun 19th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.08 KB | None | 0 0
  1. #include <16F628A.h>
  2. #FUSES NOWDT
  3. #FUSES HS
  4. #FUSES NOPUT
  5. #FUSES NOPROTECT
  6. #FUSES NOBROWNOUT
  7. #FUSES NOMCLR
  8. #FUSES NOLVP
  9. #FUSES NOCPD
  10. #use delay(clock=4000000)
  11. #define LCD_ENABLE_PIN  PIN_B7
  12. #define LCD_RS_PIN      PIN_B4
  13. #define LCD_RW_PIN      PIN_B5
  14. #define LCD_DATA4       PIN_B0
  15. #define LCD_DATA5       PIN_B1
  16. #define LCD_DATA6       PIN_B2
  17. #define LCD_DATA7       PIN_B3
  18. #include <LCD.C>
  19. void main(){
  20.    lcd_init();
  21.    lcd_gotoxy(1,1);
  22.    printf(lcd_putc,"Calculando...");
  23.    int16 pulsos;
  24.    while(true){
  25.       set_timer1(0);
  26.       setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);
  27.       delay_ms(10500);
  28.       setup_timer_1(T1_DISABLED);
  29.       pulsos=get_timer1();
  30.       lcd_init();
  31.       lcd_gotoxy(1,1);
  32.       printf(lcd_putc,"Frec.Card.: %3lu",pulsos*6);
  33.       if(pulsos*6>110){
  34.          lcd_gotoxy(1,2);
  35.          printf(lcd_putc,"Taquicardia");
  36.       }else
  37.          if(pulsos*6<70){
  38.             lcd_gotoxy(1,2);
  39.             printf(lcd_putc,"Bradicardia");
  40.          }else{
  41.             lcd_gotoxy(1,2);
  42.             printf(lcd_putc,"Normal");
  43.          }  
  44.    }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement