M
monicca86
Guest
# Include <pic.h>
# Include <stdio.h>
# Include <delay10.c>
statinio void nutraukti IntRoutine ();
negaliojančiu send ();
trumpas int Flg = 0;
int CNT = 0, Oflow = 0, Mytime = 0, Adval, HBc, ħĦbr;
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; / / Įjungti Timer1
PEIE = 1;
GIE = 1;
TMR1IF = 0;
TMR1IE = 1;
TMR1L = 0xaf;
TMR1H = 0x3c;
TMR1ON = 1;
už (;
<img src="http://www.edaboard.com/images/smiles/icon_wink.gif" alt="Mirktelėti" border="0" />(
if (Oflow)
(
Oflow = 0;
Mytime ;
)ADCON0 = 0x81;
DelayUs (50);
ADGO = 1;
while (ADGO) ir toliau;
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;
jei (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);
Siųsti ();
DelayMs (2);
)
)
statinio void nutraukti IntRoutine ()
(
if (TMR1IF)
(
TMR1IF = 0;
CNT ;
jei (CNT> = 50)
(
CNT = 0;
Oflow = 1;
)
TMR1ON = 0;
TMR1L = 0xaf;
TMR1H = 0x3c;
TMR1ON = 1;
)
)
# Include <stdio.h>
# Include <delay10.c>
statinio void nutraukti IntRoutine ();
negaliojančiu send ();
trumpas int Flg = 0;
int CNT = 0, Oflow = 0, Mytime = 0, Adval, HBc, ħĦbr;
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; / / Įjungti Timer1
PEIE = 1;
GIE = 1;
TMR1IF = 0;
TMR1IE = 1;
TMR1L = 0xaf;
TMR1H = 0x3c;
TMR1ON = 1;
už (;
<img src="http://www.edaboard.com/images/smiles/icon_wink.gif" alt="Mirktelėti" border="0" />(
if (Oflow)
(
Oflow = 0;
Mytime ;
)ADCON0 = 0x81;
DelayUs (50);
ADGO = 1;
while (ADGO) ir toliau;
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;
jei (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);
Siųsti ();
DelayMs (2);
)
)
statinio void nutraukti IntRoutine ()
(
if (TMR1IF)
(
TMR1IF = 0;
CNT ;
jei (CNT> = 50)
(
CNT = 0;
Oflow = 1;
)
TMR1ON = 0;
TMR1L = 0xaf;
TMR1H = 0x3c;
TMR1ON = 1;
)
)