Claims (13)
1. Noninvasieve, continue bloeddrukbewakings-inrichting, gekenmerkt door een optische omzetter voor het detecteren van informatie, die samenhangt met de hoeveelheid bloed die in een bloedvat stroomt en door middelen, die in responsie op een uitgangssignaal van de optische omzetter een uitgangsindicatie voor de systolische en diastolische bloeddruk leveren.A non-invasive, continuous blood pressure monitor, characterized by an optical converter for detecting information associated with the amount of blood flowing into a blood vessel and by means which provide an output indication for the systolic in response to an output signal from the optical converter and deliver diastolic blood pressure.
2. Inrichting volgens conclusie 1, m e t het kenmerk, dat de genoemde middelen een direkte uit- > gangsindicatie voor zowel de systolische als de diastolische bloeddruk leveren.2. Device according to claim 1, characterized in that said means provide a direct output indication for both systolic and diastolic blood pressure.
3. Inrichting volgens conclusie 1 of 2, met het kenmerk, dat de genoemde middelen de gemiddelde bloeddruk meten door het integreren van het uitgangssignaal i van de optische omzetter.Device according to claim 1 or 2, characterized in that said means measure the mean blood pressure by integrating the output signal i of the optical converter.
4. Inrichting volgens één der voorgaande conclusies, gekenmerkt door een weergeeforgaan voor het weergeven van de golfvorm van het uitgangssignaal van de optische omzetter, waardoor de hartklepfuncties kunnen i worden gemeten.4. Device as claimed in any of the foregoing claims, characterized by a display for displaying the waveform of the output signal of the optical converter, whereby the heart valve functions can be measured.
5. Inrichting volgens één der voorgaande conclusies, met het kenmerk, dat de inrichting onvertraagd werkt.Device according to any one of the preceding claims, characterized in that the device operates without delay.
6. Inrichting volgens één der voorgaande conclu- ! sies, gekenmerkt door middelen voor het calibreren van de middelen voor het verschaffen van een uitgangsindicatie.6. Device according to one of the preceding claims! characterized by means for calibrating the means for providing an output indication.
7. Inrichting volgens conclusie 6, m e t het kenmerk, dat de middelen voor het calibreren een elektrische manchet omvatten.7. Device according to claim 6, characterized in that the means for calibration comprise an electric sleeve.
8. Inrichting volgens conclusie 6, gekenmerkt door een toetsenbord voor het met de hand invoeren van calibratie-informatie.Device according to claim 6, characterized by a keyboard for manually entering calibration information.
9. Werkwijze voor het noninvasief continu bewaken van de bloeddruk, met het kenmerk, dat optisch informatie wordt gedetecteerd, die samenhangt met de hoeveelheid bloed, welke in een bloedvat stroomt, waarbij in responsie op de optisch gedetecteerde informatie een uit-gangsindicatie wordt verschaft van de systolische en diasto-lische bloeddruk.A method of noninvasively continuously monitoring blood pressure, characterized in that optically detecting information related to the amount of blood flowing into a blood vessel, providing an output indication in response to the optically detected information the systolic and diastolic blood pressure.
10. Werkwijze volgens conclusie 9, m e t het kenmerk, dat een direkte uitgangsindicatie van zowel de systolische als de diastolische bloeddruk wordt verschaft.10. A method according to claim 9, characterized in that a direct starting indication of both systolic and diastolic blood pressure is provided.
11. Werkwijze volgens conclusie 9 of 10, m e t het kenmerk, dat de gemiddelde bloeddruk wordt berekend door het integreren van de optisch verkregen informatie.11. Method according to claim 9 or 10, characterized in that the mean blood pressure is calculated by integrating the optically obtained information.
12. Werkwijze volgens één der conclusies 9-11, met het kenmerk, dat de golfvorm van de optisch gedetecteerde informatie wordt weergegeven, waardoor de hartklep-functies kunnen worden gemeten.Method according to any one of claims 9-11, characterized in that the waveform of the optically detected information is displayed, whereby the heart valve functions can be measured.
13. Werkwijze volgens één der conclusies 9-12, m e t het kenmerk, dat de bloedstroom in een arterie optisch wordt gedetecteerd. ! L.E. OPTRDNICS (CC) I /XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX * Pile keycn 1. e * * Name main - main caller -far X X CM1BP eo-ftware system * X X X Usene· - X * * X Prototype in - cnibp.H X X * X Description main caller for system, X •X handling; user input, X X data acquisition, data * X processing, and data X X display. X X. * X. Return value none X X X X Calls graphic_init X X init X X 5ta.rt_cnibp X X work_mode X X gotoxy X c key_inp X X X X Called by none X X X xxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxx/ ¥inc1ude <dos.h > ♦linelude <cnibp_in.h> me i n() t i n t i n i t (i n t) , int num = l; /X variables declarations X/ char- key_ch; struct time tm; graphic_init() ; /X initialize graphic mode X/ tm.ti_hour=0! /X set clock to 0 */ t Tt>. t i _m i n=0; tm.t i_sec=0; tm.t i_hund=0? sett ime(fetm)ΐ while (1) C switch(num) /X case */ t /X X/ case 59 : init <tmode) 1 /X <Fl>restore graphic mode It X/ ex i t(0)5 /X exit. *t case 60 : /X <F2>system calibration (cnibp) It */ if(hartx>220) num=60i else ( start_cnibp()| no_cycle * -11 num *= 1i ) work_mode()i /X work*mode (sensor). X^ break I /X X/ case 61 !num * 1l /X <F3>trend on blood pressure. X/ break} /* ·*/ cue 62 : if(alarm^flag » 0) /* <F4>set systolic high limit *7 set_alarm()} /# that turn on alarm system. *7 else /* */ rewrite_main_menu()} /# */ num * 1} /* */ break} /* */ case 63 :if(alarm_flag == 1)£ /* <F5>increment of systolic */ high_sys +«10} /* high limit by ten units. */ gotoxy(23,23)} /* */ printf(”%3d",high_sys)} num = lj break}} case 64 : if (alarir._+ lag == 1)£ /# <F6>decrement of systolic *7 high_sys -=10} /* high limit by ten units. #7 gotoxy(23,23)} printf C%3d",high_sys)} num = 1; break)} case 65 : if ((alarm_flag) & (alarm_switch == 1))£ gotoxy(1,23)} printfC<F7>ALARM OFF")} alarm_switch = 0}} else if (alarm_flag) £alarm_switch = 1} gotoxy(1,23)I printf("<F7>ALARM ON "))> num = 1; break} case 68 :outportb(0x61,speaker_reset)) /# <F10>stop speaker. #/ num = i| break} case 1 :work_mode()} /* 1 :work-mode (sensor). */ break} /·* default :work_mode()} /* default:work-mode (sensor). */ if (num «« 1) num « key_inp()j M ί . L.E. OPTRONICS (CC) I /XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX * File key_inp.c X * Name call the keys from new X * keyboard X * X X Usage - X * X X Prototype in - DOS.H * * KEY.H * * X X Description Read data from appropri—X X ate address and trans la—X· X te it to ASCII codes. * * * X Return value num - ASCII code X X X X Calls inportb X X X X Cal led by none χ X X xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/ «include <dos.h> «include <key.h> int key_inp() { static prev_key = OxFFFF; char key_ch} int num» key_ch =inportb( KEYPORT ) ; switch (key_ch) t case Fl: num =59» break» case FZ: num = 60; break» case F3: if (prev_key != F3) num = 61; else num = l; break; case F4: if (prev_key != F4) num = 621 else num=l; break; c**e F5: if (prev_key != F5) num = 63; else num = l; break; case F6: if Cprev_key != F6) num = 64J else num = l; break; case F7'. if (prev_key != F7) num = 65; else num = l; break) case F10; if <prev_key !* F10) num = 68( else num = l; break; default: num * 1) > prev_key * key_ch; return (num)) J ! L.E. OPTRONICS (CO * File beep.c * * N's’re beep * * * * * * Usage void beep (int,intJ; * * * * Prototype in cnibp.h * * * * Description turn on the speaker # * until <F10> is * * pressed. * * Return none. * * * * Calls none. # * * * Called by write results. # * * *********************#******#***·*#***#**/ ♦♦include <dos.h> extern int speaUer_resetj void beep(int divl,int div2) ( i nt cv!,j Ϊ speel.er_reset = inportb (0x61) J c·.' tpor tb (0x43,0xB6) J ci'tpor tb (0x42, d i v2) ; O'jtportb(0x42,divl); cvl = (speel.er_reset 3); outpor tb(0x61,cvl)j } '*........-.----------------------------------------------------------Ί ! L.E. OFTROKI CS (CC) --------------------------------------------------------------------4(/ /**************************************** * File calc_new.c * * Name calc_new_factor - * * computes cal ibratiori * * ί actor * * * * Usage void calc_new_(actor- () 5 * * * * Prototype in cas.h * * * * Description compute factor against * * calibration results, for* * data processing. * * * * Return value none * * * * Calls none * * * * Called by work_mode * * * ************ ****************************/ extern int max, min5 extern int maxi,mini; extern float factor_s; extern int after_calibj extern float systolic,diastolic; void calc_new_factor () < int temp; maxi = max; mini = min; if ( (temp = max-mini == 0 ) factor_s = 0.0; else C factor_s = (systolic-diastolic)/temp; /* systolic factor = */ after^calib = 0; /* Reset after-ealib flag. */ > ! L.E. OPTRONICS (CC) I /**********-***** ************************* * File clear_w.c * * Name clear_window * * * * Usage * * * * Frototype in * * * * Description * * * * Return value *· * # * Calls * * * * Called by * * * **************************************#-*/ /* x = column y = raw wid = width o+ window hght = height of window */ «include <dos.h> «include <videa.h> extern unsigned xaddr 16401, ysddr C20015 void clear_w i ndow(x,y,w id,hght) unsigned int x,y,wid,hght; r union REGS regsj regs.x.ax = 0x0600» regs.h.bh = Oi regs.x.cx = CyaddrCyJ << 8) ! xaddrCxlj regs.x.dx * (ty + hght) << 5) ! xaddrtx + widl; i nt86 (VIDEO, S<regs, Lregs) ; > ί L.E. OPTRONICS (CC) | /**************************************** * File count_hp.c * * Name count_h_pulse * * * * * * Usa^e void count_h_pu1se(5} * * * * Prototype in casS.h * * * * Description Calculate the heart * * pulse. * * * Return none * * * * Calls none * * * * Called by disp1ay_value * * * * * ******************** X·******************* / extern int heart_p; extern int no_cycle> extern -float o 1 d_t irne, new_t ime; void count_h_pu1se() float h_pulse> i-f ( (new_t ime == old_time) !! (no_cycle == -1)) heart_p = 05 else { h_pulse = (60.0 * no_cycle/2.0)/(new_time - old-time); heart_p = h_pulsej } > J · L.E. OPTRONICS (CC) I /************** ********** **************** * File disp_val.c * * Nare display_value - diep leys* * values graphically. * * * * Usege void display_value # * (int point)I* * * * Prototype in * * * * Description displays a value graph- * * icelly, in the -form of * * dot, and a line drawn * * from it to the last di— * * awn dot. * * * * Return value none * * * * Calls draw_line * * count_h_puises * * * * Called by work_mode * * * fHHHHMHMHHHHHHHHHHHUHHHHHHHHHHHHHHHHHHHHf/- ♦(include <time.h> ♦♦include <hart_w.h> ♦(include <dos.h> «define X_DIST 2 extern float old_time,new_timel extern int c1r,no_cycle,hartx1 extern float mean,systolic,factor_sJ extern int max_acc,min_accJ extern int *ax_eounter,maxi{ void display_value(int point) C int newy,i,j,oldx,ref(window_hight * HART_Y2 - HART_Ylj float epsilon“lE-5j struct time time_o!d,time_newl static int print_rate*3j static int oldy*-l, x*HART_Xl+l| static long mean_point « OJ static float sum_mean 0.0J static float y_]#vel*0.0! static int cycle_x HART_X1+1, eycle^point * 01 newy point/HART_SCALEl /* Translate the signal to the dimensions*/ newy » HART_Y2 - newyl /* of the display-window. */ if (oldy * -1) oldymnewyi c leer_wiridow(x + d,HART_Yl,0,window>_hight) 1 if (newy < HART_Y1) newy * HART~Ylj oldx - x - >:_riSTi if (oldx < HAPT_X1) oldx»HART_XlJ elr II draw_line(oldx,oldy,x,newyl| /* Draw the next connecting line. */ draw_line(oldx,HAPT_YI-I»xfHART_Y|-l)f draw_J ir,e(Old> , HAF T_Y2, x, HART_Y2) I if (cvstolic ) epsilon) /* after calibration */ ( *va_«»eai» + point) ntean_paiHL rt| > if ( ( (y_level >oldy) &&(y_level<=newy) ) ! ! ( (y_level <oldy) 8*&: < y_ieve 1 >=newy) ) ) { if <no_cycle == -1) { gettime(6<time_old); old_time = time_old.ti_hour * 3600.0 + time_old.ti_min * 60.0} old_time = ald_time + time_old.ti_sec + time_o1d.ti_hund/100.0} } if t(x-eycle_x) > cycle_point/4) C no_cyc1e++; gett ime (8ct ime_new) ; new_time = time_new.ti_haur # 3600.0 + time_new.ti_min * 60.0» new_time = new_time + time_new.ti_sec + time_new.ti_hund/100.0; cycle_x = xj } > x += x_dist; oldy = newyj if (x > HART_X2> /* If it reached the end of the *f i /* display-window l *,/ courit_h_pulse () I /# Calculate hear t pulse. y_level = (0.5*<max_acc - min_acc) + min_acc)/max_counter; y_level = HART_Y2 - y_level/HART_SCALE; if (systolic>epsiIonJ mean = systolic + factor_s * (sum_mean / mean_point) - factor__s * maxi; sum_mean = 0.0J mean_point » 0; write_results<)5 /* Write measuring results. */ trend<); /# Write systolic trend. */ if (no_cycle > 0) eyele_point = (HART_X2 - HART_X1) / no_cycle; else cycle_point = <HART_X2 - HART_X1) / 11; no_cycle = -1; ' x=HART_Xl+15 /* */ c1ear_w i ndow(x+3,HART_Y1,X_DIST,windaw_h ight); draw_box(HART_X1,HART_Y1-1,HART_X2 + 1,HART_Y2> 5 cycle_x = xl pr i nt_rate+ + 5 if ((print_rate%3)==0) pr i nt_results(>; print_rate = 0; } } /* > */ h a r t x = x» ! L.E. OPTRONICS (CO Λ*------------------------- heêder -files included -----------------------#/ extern unsigned yaddrt2001; extern unsigned xaddrt6401; extern char shi-ftC6403j extern char pointtó40]J extern int clr> extern char -far iscrn! /If****^*********·*##**#*****#*^********#** * File dot.c * *· Name dot - draws a dot. * * * * Usage void dot (int x,int y); * * * * Prototype in cas.h # * * * Description computes the o-f-fset in * * the screen bu-ffer o-f * * the bit to be set. * * * * Return value none * * * * Cal Is none * * # ¥ Called by dmw_l ine * * * ****************************************/ void dot ( int x, int y) { unsigned totalJ total = xaddrlxl + yaddrtyl» scrnEtotalJ = (dr << shiftlxl) i (scrnttotall k pointCxj); > ! L.E. OPTRONICS (CC) | / **************** ********** ************** * File draw_l.c * * Name draw_line - draws a line* * * * Usage void draw_line * * (int xl,yl,x2,y2)f * * * * Prototype in casS.h * * * * Description draws line -from (XI, Yl) * * to (X2,Y2). * * * * Return value none * * * * Calls dot * * * * Called by disp1ay_value * * draw_screen * * draw_bax * * * ****************************************/ void draw_line(int xl,int yl, int x2, int y2) { void dot(int x,int y) ; int x,y,xstep,ystep,dx,dy,direct; x = x 1; y = yl; xstep = l; ystep = lj i-f ( xl > x2 ) xstep = -1; i-f ( yl > y2 ) ystep = -15 dx = abs( x2 - xl )5 dy = abs( y2 - y1 ); it ( dx == 0 ) direct = -15 else direct = 0} while (!( <x==x2) &8c (y==y2) )) ( dot (x,y)5 i-f (direct < 0) ( y = y + ystep; direct = direct + dx; } else { x = x + xstep; direct = direct - dy; } : L.E. OPTRONICS (CCJ /******** #**** ******·*****·**************** * File draw_box.c * * Name draw_box - draws a box. * * * * Usage void draw_box # * (int xl,y1,x2,y2)5* * * * Prototype in cas3.h * * * * Description draws a box bounded by * * colomns XI,X2 and rows * * Y1,Y2. * * * * Return value none * * * * Calls draw_line * * * ·* Called by draw, screen * * * ******** ******************************/ void draw_boxiint xl,int yl, int x2,int y2) { void di'aw_line (int xl,int yl,int x2,int y2) ! d r a w_ 1 i ne (x 1, y 1, x2, y 1) 5 dr aw_line(x2,yl,x2,y2)5 di-aw_l ine (x2, y2, xl, y2) 5 drat"_l i ne (,v 1, y2, xl, yl > ï } ! L.E. OPTEONICS (CO ! /****+**************************+******++ + File draw_Ecr.c * + Name dran_5creen - draws the * * functional screen. * * * + Usage void draw_screen()i * * * * Prototype in trend_w.h, hart_w.h * * * + Description draws all the windows * * far graphic and numeric * + displays of parameters. + * + * Return value none * * * + Calls draw_box + * draw_line + * gotoxy * * rewrite_main_menu * * * * Called by graphic_init + * * **************************+*****++***+**/ ♦♦include <trend_w.h> ♦♦include <hart_w.h> void draw_screen() { i n t i; draw_box(HART_Xl,HART_Yl-l,HART_X2+l,HART_Y2) ; /* Graph window. */ draw_box(TREND_X1,TREND_Y1,TREND_X2+1,TREND_Y2); /* History-graph window.*/ draw_box(0,ISO,500,195)ί /* Menu window. */ gotoxy(1,21)J /* trend scale mark */ printfC 0"); gotoxy(1,16)> printf("120"); gotoxy(1,11)1 printf("240")5 for (i=0j i <3; i + +) draw_line (TREND_X1-10,110+20*i,TREND_X1,110+20*i)( draw_box(540>13,611,27)t /* Systolic window. */ draw_box(540,53,611,67)I /* Diastolic window. */ draw_box(540,93,611,107)! /* Mean window. */ draw_box<540,133,611,147); /* Heart pulse window. */ draw_box(540,153,634,170){ /* Clock window. */ gotoxy(64,22); printf("ICT LE ISRAEL"); i gotoxy(64,23); printf("CNIBP V:l.00*)J draw_box<505,172,635,195)1 /* ICT ISRAEL window */ for (i = l; K6S i++) ( gotoxy((3 + 10 * i),21)( printf <"%d",(5 * i));> gotoxy(68,0)t printf("SYSTOLIC"); gotoxy <6S,5)( printf("DIASTOLIC")! gotoxy(6Θ,10)! printf("MEAN EP")! gotoxy(68,15)I printf ("H. RATE"),· rewr 11&_rp j ri_meru 1 ! · ! L.E. OPTRONICS (CC) j /**************************************** * File getmode.c * * Name getmode - gets display * * adapter type and mode. * * * * Usage int getmode()5 * * * * Prototype in casS.h * * * * Description gets mode o-f display ad-* * apter. * * * * Return value mode o-f adapter card. * * * * Calls none * * * * Called by graphic_init * * * *************** *************************/ «include <dcs.h> int getmode() { union REGS inregs,outregs! inregs.h.ah = OxOfJ inregs.h.al = 0; i ntSé (0x10, S<i nregs, ficoutregs) ; return(outregs. h. al) \ } ! L.E. OPTRONICS (CC) /**#*#******#*#*######***###**####*####*# * File gatoxy.c * * Name gatoxy - position cursor# * * # Usage void gotoxy(int x,y)> # # * * Prototype in cas.h # * * # Description position cursor at Χ,Υ # # coordinates. # # * # Return value none * * * * Calls none * * * # Called by many # * # ##****#**#***# *##***##*****#****##*##***/ «include <dos.h> «include <video.h> void gotoxy(int x,int y) £ union REGS regsj regs.h.ah = 2; regs.h.dh = yj regs.h.d1 = x 5 r-egs. h . bh = 0; i r. tS6 (VIDEO, Scregs, kregs ) ; } ! L.E. OPTRONICS ICC) | /**************************************** * File graph_in.c * * Name graphical nit * * * * Usage void graphic_init(); * * * * Prototype in cas8.h * * * * Description initializing hi - res * * graphics on a CGA card, * * and drawing the systems * * -functional screen. * * * * Return value none * * * * Calls init * * draw_screen * * * * Called by main * * * ****************************************/ extern int tmodej void graphic_init() { int getmode()! void startsprinter()J int init(int); void draw_5creen()j /*----------------------------------------------------------------*/ / tmode = getmodeC)j /* Save the current mode. */ / init(6>> /* Initialize graphic mode.*/ / stert_printer ()} draw_sereen()f /* Display system's screen.*/ / } I L.E. OPTRONICS (CC) /******#***##**#**##*#*#*#*#****#**#*###* * File · init.e * * Name init - intialize display# * adapter to graphic mode.# * * # Usage int inittint num)} * # * * Prototype in # * * # Description initializes CGA card to # # hi-res graphic mode. # # * * Return value mode adapter card is in.# * * # Calls none # * # # Called by main # # grahpic_init * # * ♦(include <das.h> ♦♦include <video.h> extern unsigned yaddrE2003) extern unsigned xaddr£6401) extern char shiftC6403) extern char pointC6401) extern char -far #scrn) int inittint num) { int indx * 0, indx2 = 0} static int max_cl r, max_x, max_y, sh if ter; unsigned clr„wid,mask; union REGS inregs,outregsj if (num >6) { puts ("inval id mode.\x07")} exit(0)} y switch (num) { case 4 : max_clr 3( max_x 320) max_y * 200; shifter = 4) clr_wid 2) break) case 5 ) max_clr “ 1) max_x * 320) max_y - 200) shifter 4) clr_wid 2) break) case 6 : max_clr * 1) max_x * 640) max_y 200) shifter » 8) c1r_w i d « 11 oreax? } if (nuM > 3) { /#For graphics modes only*/· while (indx < max_y) C /^-calculate al 1 y offsets #/ yaddrCindxl 80 * indx2S ++indx? yaddrC indxl * <80 * indx2) + 0x20005 ++indxj ++indx2? > for (indx * 0} indx < max^x? ++indx) < mask * 0x80 >> (clr_wid * (indx X shifter))? if (nun ά) { /*· Medium resolution offsets */ mask 1= (mask >> 1)? shiftCindxl » 6 - (clr_wid * (indx * shifter)); } else High resolution offsets */ shiftCindxl = 7 - (indx X shifter)? pointCindxl * ~mask; xaddrCindxl * indx / shifter? > inregs.h.ah “ 0? inregs.h.al * numl int86(VIDE0,8iinregs,ldOutregs) ? return(num)| > /* end of init */ i L.E. OPTRONICS (CC) * Fi le pr int_rs.c * * Name print_results # * * * * * Usage void print_results(); * * * * Prototype ir. cas.h * * * # Description Print blood pressure * i results. * * * i Return none * * * * Cal 1 s none ff * * * Called by disp1ay_value * * * * * ****************************************/ «include <bios.h> «include <time.h> extern int systo,diast,heart_p; extern -float mean» pr i nt_results() { int i,at 813,mean_val; long timelj char #str_now» for <i=0ji<81ji+ + ) atil = ’ ’ ; et813 = ’/O’i time(ktimel); Etr_now = ct ime (let imel) 5 for (i = l5 i<9j i++) at i3 = *(str_now+10+i); at 17 3 = ’0’ + systo/100J a 118 3 = '0' + (systo%100)/105 at 193 » ’0’ + systo%105 mean_val = mean; aC283 = Ό’ + mean_val/100; at293 = ’0’ + (mean_val%100)/10; at303 = ’0’ + mean_val%105 at393 = 48 + diast/100; at403 = 48 + (diasty.100) /10; at 413 = 48 + diast'AlOJ at503 = 43 + heart_p/100; e 1513 = 48 + (heart_p%100>/10; at523 = 48 + heart_p%10; at0 3 «= 10! if ( biosprint(2,0,0) == 0x90 ) write(4,a,160); } ! L.E. OPTRONICS (CC) | /*************************************** File rewrite, c * * Name rewrite_main_menu # * * * # * Usage void rewr i te_main_mer.u () ;* * * * Prototype in * * * K Description * * * * * * Return none. * * * * Calls none # * * * Called by * * * ****************************************/ extern int c1r, alarm_f1agj rewr i te_mai n_menu() { void draw_line(int xl,int yl,int x2,int y2); void gotaxy (int x,int y) ; i nt i; alarn_flag = 0; c1r=0; draw_line(120,181,120,195); draw_li ne(220,181,220,195); dr aw_li ne(290,181,290,195); draw_l i ne (370, 181,370, 195) ,* gotoxy(1,23)1 pr i ntf("FI: EXIT F2.'CALIB F3:HIST0RY F4:SET ALARM "); for (i=i;i<=4;i++) { clr = ljdraw_line(100*i,180,100*i,195);> > ί L.E. OPTRONICS (CC) | /**************************************** * File Bet_al r. c * * Name set_alarm * * * * * * Usage void set_alarm(); * * * * Prototype in * * * * Description Display alarm menu. * * window and set alarm * * -flag. * * Return none. * * * * Calls draw_line,gotoxy * * draw_box. * * Called by work_mode. * * * If***************************************/ ♦(include <ccnio.h> extern int c1r, alarm_f1ag,high_sys,alarm_switch; void set_alarm<) { void gotoxytint x,int y) ; void draw_line(int xl,int yl,int x2,int y2)5 i nt i J alarm_-flag = 1; gotoxy(1,23)5 pr i nt-f (" <F7>ALARM OFF SYS = %3d <F5>UP <F6>D0WN <F4>MAIN MENU", )5 }h igh _SyS c1r=0; for (i = l 5 i<=4; i++) draw_line(100*i,181,100*i,195)5 clr=l; draw_line(120,181,120,195)5 draw_line(220,181,220,195)J draw_li ne(290,181,290,195)J d r aw_1ine(370,181,370,195)5 i-f (alarm_switch) { gotoxy(12,23)5 print-f ("N -) ; } > )i : L. Ε. OPTRONICS (CC) /**************************************** * File smooth_d.c * * Neme smooth_data - smoothes * if converted data * * * * Usage int smooth_data()f * * * * Prototype in cnibp.h * * * * Description smooth_data gets the * * arithmetic average of a * * shifting window of x * * samples at a time, to * * get a smoothed curve of * * the sampled data. * * * * Return value smooth_data returns the * if value of the new V coo- * * rdinate of the smoothed * * sample. * * * * Calls none * * * if Called by work_mode * * * ****************************************/ ♦•include <dos.h> «include <ipcrt.h> extern int Atl03} int smooth_data() { int i, sum = 0,max_A,min_A; ΑΓ43 = inportb(IPORT)5 /* Recieve the sixth sample. */ if ((AC43 > ZAO) ll (AC43 < 1)) AC43 = inpartb(ÏP0RT)! for < i —0» i<5| i++) /* Sun up the last six samples. */ sum = suit. + Ati3S for (i=05 i<45 i++) ΑΓ i 3 = AIi +13 5 retur n (suir/5) 5 /* Return average of last six samples*/ 3 ! L. E. OFTP.ONICS (CC) ! /**f^*-)(********·******·******************·** * File start_pr.c * * Name start_printer * * * * * * Usage * * * * * * Prototype in cas.h # * * * Description # * * * * * * * * * * * Return value none # * * * Calls * * * * * * * * Cal led by * K # ****************************************/ ♦(include <conio.h> ♦♦include <bios.h> st=>rt_printer () C che** ilSOl = ” \r."J char ataoi = " ICT Ltd Rehovo t, ISRAEL\n“{ char crSOl = " BPTEST PRO J E C T\n"; char dCeoi = " date:\n'j char· eCeoi = ” nameitn"! char bCEOl = H notes:\n " J char gC803 = » TIME SYSTOLIC MEAN DIASTOLIC HEART RATE \n 5 if ( biosprint(2,0,0) == 0x90 ) { write (4, + ,80)! wr i te(4,a,80)> wr i te(4,c,80)5 wr ite(4,d,80)I wr i te(4,e,80){ wr i te(4,b,80)} write(4,9,80)f > ) ; L.E. OFTRONICS (CC) | /**************************************** * F j ! e trend.c * * Neme trend * f * * * * Usage void tr end O{ * * * ·* Prototype in * * * * Description Print blood pressure * * trend. * * * * Return none * * * * Cells trend_draw * * * ·* Celled by displey_value * * * * * **************************************** / ♦(include <trend_w.h> extern int sy£to,diast; extern int c1r,ca 1ib_flag» extern -float meen» void trend O { void trend_drew(int, int, int)} static x « TREND_X15 static int odd_val=0, int meen_vel» int i» i-f (x « TREND_X2) x = TREND_X15 c1r=0} for (i — 1» i<55 i++) /* clear window -for trend display*/ i-f ( (x+ i) < TREND_X2) draw_line(x+i,TREND_YH1»x +i,TREND_Y2-2>J clr = l; i-f (celib_-flag == 1) ( draw_ 1 i ne (x, TREND_Y1 +1, x, TREND_Y2-2) ,* calib_-flag = 0} } i-f (odd_val == 0) ( trend_draw(0, x, systo)} odd_vel * 1» 5 else ( trend_dr#.w (1, x, diast), odd_vaI * 0} } *rear._v?l * meen} trend_drew(2, x, meen_vel)5 ,·· ·* * ï j ! L.E. OFTRONICS (CC) /FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFüFFFFFFFF* •F File trer.d_dr.c F if l'lEme trend_draw * if if * if •F Usage void trend_draw if if (int num, int x,int val) if F if F Prototype in trend_w.h F F F F Description Print blood pressure F F trend. F F F F Return none F F F F Calls draw„_line F F F F Called by trend F F F F F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/ Finclude <trend_w.h> extern int clr; void trend_draw(int num, int x, int value) { static int yC3) = (0,0,0); int nexty; clr = IS nexty = TREND_Y2 - value/3; i-f <nexty<TREND_Yl) nexty=TREND_Yl; i-f <nexty>TREND_Y2) nexty=TREND_Y2; i-f (ytnuml == 0) ytnum) = nexty! draw_li ne(x,ytnum),x+2,nexty); ytnum) = nexty; > ï L.E. OPTRONICS (CC) I /**************************************** * File WORK.MODE.C * * Name work_mode - acquires * If processes and displays * * converted data. * * * * Usage void wark_mode()| * * * * Prototype In cnibp.h If * * * Description acquire data -from sensor* * process it, display the # * results graphically and * * numerically. * * * * Return value none * * * * Calls smooth.data * * display, value * * calc_new_factor * * wr ite.results * * * * Called by main * * * ****************************************/ «include <iport.h> «include <funct.h> extern int At 101, max,min,max.counter, af ter.cal ib; extern int max_acc,min_aec,end_calibrat ion) extern -float y.level} vo i d wor l._tnode () { int smooth_data()! int i,point} i-f (*end_ce 1 ibrat ion) start.cnibp()} •for (i=0> i<4} i++) /* Read the first five samples from the */ ACil= i nportb (IPORT) J /* sensor. #/ for ti=li i<*60} i + +) /* For i = l to 60 do: #/ { /* t */ point«smaath_data<M /* Enter a new sample and smooth it, */ min=MIN.OF(point,inin)} /* */ max=MAX_0F(point,max)} if (i%3 “* 0) /* Display every third sample. */ display.value (point)} /* */ ) /* > */ max.acc * max.acc + max) min.acc * min.acc + min} ire.x_counter + + } /* calculations. */ gotoxyf70,20); /* Go to clock window. */ CLOCK(IS /# Display current time. */ i-f (ef ter.cel ib) /* If after calibration then calculate */ ca 1 c_new_f actor () } /* the new factor of systolic It diastolic.*/ ) /* end of work mode */ ! L.E. OPTRONICS <CC> I * Pile- ·' write_rs.c # * Neme write_results - displays# * results numerically. # * * * ÜEc^e void wr i te_r-esu 11 s () » # * * * Description displays numerical res- # * ults in the appropriate * * pieces on the screen. # * * * Return value none * * * * Calls gotoxy * * * * Called by worl<_mode # * * ******************************·**********/ extern int max, min,max_counter,alarm_switch, maxi; extern int max_acc,min_ace{ extern int prev_max_e.cc, prev_min_acc, prev_max_cou.nter; extern int systD,diast,heart_p,hi9h_sys; extern -float systol ic, diastol ic, mean; extern -float fe.ctor_s; void write_resu1ts() { void gotoxy(int,int); int imean5 max = rnax_acc/max_counter, min = mi ri_acc/max_counter 5 , systo = systolic + f e.ctor-_s# (max - maxi) 5 /* Syet *= syst_-f actor * sys ’ t(frorn sensor) */ diast = systolic + factor_s#(min - maxi); /# Diast * d i ast_-f actor * d iast(-from sensor·)·#/ max = 0; min = 300» i-f ( (alarm_st-.'i tch) 6< (max >= high_sys)) /* If systolic over limit*/ the systolic high beep(9,76)» /* turn on alarm system. X/ gotoxy(71,2); printf("%3d",systo); /# Numerical display of systolic. ¥>! goto.:y(71,7)J pr i ntf (*'%3d", d iast) ( /# Numerical display of diastolic. */ gotoxy(71,12)5 imean = mean; pr i ritf ("%3d", imean) ; /# Numerice.1 display of mean. */ gotoxy(71,17); pr-intf (”%3d", hear-t_p) { /# Numerical display of pu lse rate. prev_max_acc = max_acc; pr-ev_mi n_acc *= min_acc; prev_mex_counter *= msx_counter! mex_ecc - 0? mex_counter· = 0; min_ecc = 0; ' L.E. OPTRONICS (CC) | * File St*rt_c.c * * etart_cnibp - star te host* * to cnibp communications.* * * * Usage void start_cnibp(); * * * * Prototype- in logic.h * * * * Description main caller tor host to * * cnibp communication driv-* * ers and protocol. * * * * Return value none * * * * Cells com_setup * * send_msg * * get_m * * get_msg * * disp_cal_res * * * * Called by main (casS.c module) * * * ****************************************/ ^include <dos.h> * include <logic.h> extern int atter_cal ib, cal ib_t lag,end_cal ibration; void stert_cnibp() { int i I long n,ir; struct time tmj i-f (end_cel ibration) { gett ime (Ertm) J CDm_setup()l /* setup communications at 9600,n,S,l */ atter_calib = 1$ /* initialize flag */ prepare_msg(1)t /* prepare START command to cnibp */ send_msg()5 /* send the commend to cnibp */ } e-nd_cal ibration = FALSE; nhile (end_calibration == FALSE! end__cal ifcretion = get_m()| /* pressure. */ •f (erd^cal ibration) r p^epere_msg(lB)J /* prepare DATA REQUEST command to cnibp */ send_msg(>i /* send the command to cnibp -*/ get„msg()| /* receive calibration data trom cnibp *7 disp_cal_res()« /* display data on screen */ c*lib_tleg * 1» set t itre (ttmM /* just tor cal-stop version */ } ! L.E. OFTRONICS (CC) | / * ¥ * ¥ ** * Μ**·***************************** * File corn_Eet.c * * Name com_Eetup - setup com * * parameters. * * * * Usage void com_B6tup() * * * * Description setup communicatioriB at * * 9600,n,8,1. * * * * Return value none ·* * * # Calls none * * * * Called by start_cnibp * * * ****************iHt********************##/ ♦t i nc 1 ude <dos. h > ♦(include <regist.h> void com_setup() { outpor-tb (LCR, 0x80) ; f* eet DLAB = 1 */ Dutportb(IER,0x00); E6t Divisor Latch LSE (DLL) tD 0 */ outpor-tb (RER, 12) 5 '* set Divisor Latch MSB (DLM) to 12 */ outportb(LCR,0x03)! ** set ε bits, 1 stop bit no par ity */ outportb(IER,0) ; reset Interrupt Enable Register */ ': L.E. OPTRONICS (CC) j /*************1Ηί·******************#****** * File Send_msg.c # * Neme send_msg - RS232 output * * driver * * * * Usage void send_msg() * * * * Description driver for sending mes- * * sages over the serial * * communication port. * * * # Return value none # * * * Calls none * * * * Called by start_cnifap # * * ****************************************/ «include <ia.h> extern char msgC83} void send_msg() { i nt i,j 5 for (i=0; i<=75 i++){ /* loop for sending 8 bytes of message */ write(3,(msg + i),l)i /# TXing the bytes via RS23Z part ·*/ for(j=0> j<=400> j++)} /* delay loop for syncronization #/ } 8902/46 : L.E. OPTRONICS (CC) I /**************************************** * File disp_cal.c * * Name d isp_cal—res - displays * * calibration results * * * * Usage void disp_cal_res() * * * * Prototype in comm_cas.h * * * * Description displays calibration * *' results on the system’s * * display. * * * * Return value none * * * * Calls none * * * * Called by start_cas * * 3( ***************************** *********** / extern -float systo 1 i c, d i asto 1 i c, mean; extern int heart_p; void disp_ca1_res() { gotoxy(71,2)j printf("%3.Of ",systolic); gotoxy(71,7)5 pr i ntf ( "V.3. Of " , d iastol ic) } cntcxy(71,12); printf("%3.Of ", mean )5 gotoxy(71,17)5 pr' i ntf ( "%d " ,heart_p)J } 38 'τ l L.E. OPTRONICS (CC> /**************************************** * File get_jn.c * * Neme get_m reads real time * * cuff pressure. * * * * Usage int get_m() * * * * Description reads real time cuff * *' pressure. * * * * Return value TRUE or FALSE ff * # * Calls none * * * * Called by start_enibp * * * ****************************************/ ♦(include <dos.h> ♦♦include <logic.h> ♦(include <regist.h> int get_in() ( char ch» static int tri_9_flag=0{ while (inportb(LSR) tc 0x01) { /ft while bit 0 of Line Control Register */ outportb(NCR,0x00)j /# is on, disable DTR or RTS */ ch * jnportb(RBR); /# gat character form receive buffer */ if (tri_9_flag > 2 Be ch == /# if last 4 characters are "959I9ICR" */ 13){ tri_9_t Jag * 0; /* reset flag indicating 3 *9"*s ·*/ return(TRUE)l /# terminate caller's while loop */ > if (ch == 57) { /* count successive ’^'s */ tr i_9_flag+ + | pr intf ( “ ", tr i^9_f lag) I } /* Λ necessary oddity ff/ els€ /* if no successive “P"*s reset flag tri_9_flag » 0$ outportb(MCR,0x02)I Be^ R-j-g ff/ > return(FALSE)l j /# wait for next character V 1 '*...............................-.....-........................i i L.E. OPTRONICS <CC) | --------------------_-----------------------------------------** /**************************************** * File prep_msg.c * * Neme prepere_mEg - prepares * * e message for trensmi- * * scion to cnibp. X * * * Usage void prepare_msg (int in)* * * * Description prepares a. message for * * transmission by setting * * the proper sequence of * * characters of a command.* * * * Return value none * * * * Calls none * * * * Called by start^cnibp * * * ****************************************/ extern char msgC81S void prepare_msg(int in) { int i{ char chs£18IC23={<0x44,0x37>, <0x44,0x38>, <0x44,0x391, <0x44,0x411, <0x44,0x421, <0x44,0x431, <0x44,0x441, <0x44,0x451, <0x44,0x461, <0x44,0x371, <0x44,0x381, <0x44,0x391, <0x44,0x411, <0x44,0x421, <0x44,0x431, <0x44,0x441, <0x44,0x451, <0x44,0x46111 char cmdtl81t23«=<<0x30, 0x311, <0x30,0x321, <0x30,0x331, <0x30,0x341, <0x30,0x351, <0x30,0x361, <0x30,0x371, <0x30,0x381, <0x30,0x391, <0x31,0x301, <0x31,0x311, <0x31,0x321, <0x31,0x331, <0x31,0x341, <0x31,0x351, <0x31,0x36), {0:31,0x371, {0x31,0x38 J} I I ***-****** *·** *******************·********** * p'.>ts the sprapriate characters in msg # *************^*******#*******************/ j * (in > 0){ m=gtl3 = cmdtin - 13t03; rrsgt23 = cmdtin - 13tl3} msgC53 = chstin - 13 C 031 msg[63 = chstin - 13tl3| J 3 *....................................................................1 I L.E. OPTRONICS (CC) I ____________________________________________________________________*/ /**************************************** * File get_msg.c * * Name get_msg - RS232 input # * driver. * * * * Usage int get_msg() * * * * Description driver for receiving * * messages over the serial* * communication port. * * * * Return value 0 if RX successful. * * NOSTX if no text RXed * * * * Calls none * * * * Called by start_cnibp * * * ****************************************/ «include <des.h> «include <time.h> «include <regist.h> «include <logic.h> «include <text.h> «include <hart_w.h> extern -float systol i c, d i astol ic, mean» extern int heart_p> exter n int dr ί extern int prev_max_acc, prev_min_acc, prev_max_eounterJ int get_msgt) t int re-f_up, re-f_bot> int i,j, done,ref} char rmsgt37),aC801 ; int line; long timei; char *str_now; for <i*Oii<80)i + +) aCil = 32J done = FALSE; /* set initial condition for whi le loop */ i = O; /* initialize message index */ whilet(done) l /* while no ETX receive characte rs */ it (inportblLSR) fc 0x01)t /* it bit 0 ot Line Control Regi ster! on*/ outportb(MCR.OxOO); /* no DTR or RTS */ rmsgti) « inportb(RBR); /* read character trom R eceive Buffer */ ittrmsgCil ** ETX) /* if ETX terminate while loop */ done = TRUE; + + i1 /* otherwise increment m essage index */ } ootpor tb (MCP, 0-.-02) { /# set F.T3 /a********#***#******##***#***##·### # display rtciivid dat· on screen * ff·##·##·#*##*#*#####***#***##*******#/ syttolic ~ 100#(rmsgl133-48) ♦ 10#(rmsgl143-46) +(rmsgl153-4£*>5 .gj ' ^ * dieftDlic = 100 * (rmsgtlól - 40) + 10 # (rmsgI173 - 4ó) + (rκ&^1 . _ 4ó> ’ mean * 100 * <rmsgtl93 - 46) * 10 * (rh)sgC203 - 46) + (rmsgTZi3 heart_p * 100#<rmsg1243-48) + 10#(rmsgt253-46) +(rmsg!263-46)» scree* for (1 = 1J i<HART_Xl| i*+) /·# clean previous marfc£ on #/ c 1 r=05 draw_l i ne < i, HAF.T_Y1, i , HART_Y25 ! 3 c 1 r = 1 { d raw_1i ne(HART_X1-1,HART_Y1,HART_X1-1,HART_Y2)J r#f_up = HART_Y2 - (prev_max_*cc/prev_max_cour»ter) /HART_SCALES re#_bot * HART_Y2 - (prev_min_acc/prev_max_counter) /HART_SCALE5 ref*systolicS Iine=ref_up/10 » gotoxy <1,1i ne)} print# (“%3d*. re-f) I ref=diastolic! 1ine=ref_bot/10 + 2ΐ gotoxy(1,1ine)! pr i ntf (“%3d , ref ) { draw_line(3,ref_up,HART_Xl-l,ref_up> 5 draw_li ne(3,ref_bot,HART_X1-1,re#_bot > 5 •103 = 10J t ime (l?t imel); str_non * et ime (L-t imel) J for (i = 3{ i<9} i++) at »3 * #(str_now+10.i) I al!73 = rmsgl133 » aC183 = rmsg(I43; •1193 = rmsg(153> a 1283 * rmsgl1935 el29] = rmsgl2035 el303 = rmsgI213l a!393 = rmsgl163» a(403 = rmsgll735 •1413 * rmsgl183; a1503 * rmsgl243} • 1513 *= rmsgl2531 •1523 “ ?msgt263l a 1603 <= 361 if (biosprint(2,0,03 ** 0x90) write(4,a,60)5 return(O)1 3 _bss . segment stack ’stack’ DW 128 DUP(?) _bss ends dgroup group _data,_bss _data segment ascii_tab db "0123456789" hour dw ?,’Φ’ minute dw ?,’$’ second dw ?, ’$’ separat db ten db 10 thu dw 1092 eight db 18 cur_pos dw 163+h toprint db 1 dup(’d’),’*’ _data ends _print_string macro mov ah,9 int 21h endm ; Code segment containing the main and subroutines. !================================================================= _text SEGMENT PUBLIC assume cs:_text,ds:dgroup pub lie _CLOCK _CL0CK proc near mov ax,dgroup «establish data segment mov ds,ax j ΐ ; blank cursor and get time from system clock j + get_t ime! mov ch,0ffh 5trans+er cursor blanking code mov ah,l f~ ta BIOS int lOh J mov ah,0 iget time o+ day int lah Jusing BIOS j-------- lea bx,ascii_tab Iget address ai translation tabl e » “ i translate returned value for hour into ASCII ; + hi: mov ax,cx Iget value +or hour in AX div ten tdivde by 10 to convert to decim al 1 xlat ascii_tab {translate to ASCII xchg ah,al {exchange AH and AL xlat ascii_tab Itrnaslate the remainder to ASCI xchg al,ah {get back in right order +or dim play mov hour,ax (save value for display I tr»nel*te rHurntd vtlut for minutes into ASCII 1 + ml: mov ax,dx ( xor dx,dx div thu div ten xlat ascii_tab xchg ah,al xlat ascii_tab xchg a I, ah mov minute,ax 1 - i translate returned value for seconds into ASCII t + si: mov ax,dx div eight xor ah,ah div ten xlat ascii_tab xchg ah,al xlat ascii_tab xchg al,ah mov second,ax mov dx,cur_pos mov ah,2 int lOh disp_h: mov ax,hour push ax lea bx,toprint mov Cbx3,al mov dx,bx _print_etring pop ax xchg ah,al lea bx,toprint mov [bx3,al mov dx,bx _print_string lea dx,separat _print_*tring disp^mi mov ax,minute push ax lea bx.toprint mov rbxl,al mov dx,bx _print_*tring pop ax xchg ah,al lea bx,toprint mov Cbx3,al mov dx,bx _print_string lea dx,separat _print_*tring d i 5p_s: mov ex,second pufch ax lea bx,toprint moV (bxl,al mov dx,bx _print_etring pop ax xchg ah,al lea bx,toprint mov tbxJ,al mov dx,bx _prlnt_etrlng ret _CLOCK endp _text ends END13. A method according to any one of claims 9-12, characterized in that the blood flow in an artery is detected optically. ! L.E. OPTRDNICS (CC) I / XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX * Pile keycn 1.e * * Name main - main caller -far XX CM1BP eo-ftware system * XXX Usene · - X * * X Prototype in - cnibp.HXX * X Description main caller for system, X • X handling; user input, X X data acquisition, data * X processing, and data X X display. X X. * X. Return value none X X X X Calls graphic_init X X init X X 5ta.rt_cnibp X X work_mode X X gotoxy X c key_inp X X X X Called by none X X X xxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxx / ¥ inc1ude <dos.h> ♦ linelude <cnibp_in.h> me i n () t i n t i n i t (i n t), int num = l; / X variables declarations X / char-key_ch; struct time tm; graphic_init (); / X initialize graphic mode X / tm.ti_hour = 0! / X set clock to 0 * / t Tt>. t i _m i n = 0; tm.t i_sec = 0; tm.t i_hund = 0? sett ime (fetm) ΐ while (1) C switch (num) / X case * / t / X X / case 59: init <tmode) 1 / X <Fl> restore graphic mode It X / ex i t (0) 5 / X exit. * t case 60: / X <F2> system calibration (cnibp) It * / if (hartx> 220) num = 60i else (start_cnibp () | no_cycle * -11 num * = 1i) work_mode () i / X work * mode (sensor). X ^ break I / X X / case 61! Num * 1l / X <F3> trend on blood pressure. X / break} / * · * / cue 62: if (alarm ^ flag »0) / * <F4> set systolic high limit * 7 set_alarm ()} / # that turn on alarm system. * 7 else / * * / rewrite_main_menu ()} / # * / num * 1} / * * / break} / * * / case 63: if (alarm_flag == 1) £ / * <F5> increment of systolic * / high_sys + «10} / * high limit by ten units. * / gotoxy (23.23)} / * * / printf (”% 3d", high_sys)} num = lj break}} case 64: if (alarir ._ + lag == 1) £ / # <F6> decrement of systolic * 7 high_sys - = 10} / * high limit by ten units. # 7 gotoxy (23.23)} printf C% 3d ", high_sys)} num = 1; break)} case 65: if ((alarm_flag) & (alarm_switch == 1)) £ gotoxy (1,23)} printfC <F7> ALARM OFF ")} alarm_switch = 0}} else if (alarm_flag) £ alarm_switch = 1} gotoxy (1.23) I printf (" <F7> ALARM ON "))> num = 1; break} case 68: outportb (0x61, speaker_reset)) / # <F10> stop speaker. # / num = i | break} case 1: work_mode ()} / * 1: work-mode (sensor). * / break} / · * default: work_mode ()} / * default: work-mode (sensor). * / if (num «« 1) num «key_inp () j M ί. L.E. OPTRONICS (CC) I / XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX * File key_inp.c X * Name call the keys from new X * keyboard X * XX Usage - X * XX Prototype in - DOS.H * * KEY.H * * XX Description Read data from appropri —XX ate address and trans la — X · X te it to ASCII codes. * * * X Return value num - ASCII code X X X X Calls inportb X X X X Cal led by none χ X X xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx / «include <dos.h> «include <key.h> int key_inp () {static prev_key = OxFFFF; char key_ch} int num »key_ch = inportb (KEYPORT); switch (key_ch) t case Fl: num = 59 »break» case FZ: num = 60; break »case F3: if (prev_key! = F3) num = 61; else num = l; break; case F4: if (prev_key! = F4) num = 621 else num = l; break; c ** e F5: if (prev_key! = F5) num = 63; else num = l; break; case F6: if Cprev_key! = F6) num = 64J else num = l; break; case F7 '. if (prev_key! = F7) num = 65; else num = l; break) case F10; if <prev_key! * F10) num = 68 (else num = l; break; default: num * 1)> prev_key * key_ch; return (num)) J! L.E. OPTRONICS (CO * File beep.c * * N'sre beep * * * * * * Usage void beep (int, intJ; * * * * Prototype in cnibp.h * * * * Description turn on the speaker # * until <F10> is * * pressed. * * Return none. * * * * Calls none. # * * * Called by write results. # * * ********************* # ****** # *** · * # *** # ** / ♦♦ include <dos.h> extern int speaUer_resetj void beep (int divl, int div2) (i nt cv!, j Ϊ spel.er_reset = inportb (0x61) J c. 'tpor tb (0x43,0xB6) J ci'tpor tb (0x42, ie v2); O'jtportb (0x42, divl); cvl = (play.er_reset 3); outpor tb (0x61, cvl) j} '* ........-.---- -------------------------------------------------- ---- Ί! LE OFTROKI CS (CC) -------------------------------------- ------------------------------ 4 (/ / **************** ************************ * File calc_new.c * * Name calc_new_factor - * * computes cal ibratiori * * ί actor * * * * Usage void calc_new_ (actor- () 5 * * * * Prototype in cas.h * * * * Description compute factor against * * calibration results, for * * data processing. * * * * Return value none * * * * Calls none * * * * Called by work_mode * * * ************ **************************** / external int max, min5 extern int maxi, mini; extern float factor_s; extern int after_calibj extern float systolic, diastolic; void calc_new_factor () <int temp; maxi = max; mini = min; if ((temp = max-mini == 0) factor_s = 0.0; else C factor_s = (systolic-diastolic) / temp; / * systolic factor = * / after ^ calib = 0; / * Reset after-ealib flag. * />! LE OPTRONICS (CC) I / ********** - ***** ************************ * * File clear_w.c * * Name clear_window * * * * Usage * * * * Frototype in * * * * Description * * * * Return value * · * # * Calls * * * * Called by * * * *** *********************************** # - * / / * x = column y = raw wid = width o + window hght = height of window * / «include <dos.h> «include <videa.h> externally unsigned xaddr 16401, ysddr C20015 void clear_w i ndow (x, y, w id, hght) unsigned int x, y, wid, hght; r union REGS regsj regs.x.ax = 0x0600 »regs.h.bh = Oi regs.x.cx = CyaddrCyJ < <8)! xaddrCxlj regs.x.dx * (ty + hght) < <5)! xaddrtx + widl; i nt86 (VIDEO, S <regs, Lregs); > ί L.E. OPTRONICS (CC) | / **************************************** * File count_hp.c * * Name count_h_pulse * * * * * * Usa ^ e void count_h_pu1se (5} * * * * Prototype in casS.h * * * * Description Calculate the heart * * pulse. * * * Return none * * * * Calls none * * * * Called by disp1ay_value * * * * * ******************** X ******************* / extern int heart_p; extern int no_cycle> extern -float o 1 d_t irne, new_t ime; void count_h_pu1se () float h_pulse> if ((new_t ime == old_time) !! (no_cycle == -1)) heart_p = 05 else { h_pulse = (60.0 * no_cycle / 2.0) / (new_time - old-time); heart_p = h_pulsej}> JLE OPTRONICS (CC) I / ************** **** ****** **************** * File disp_val.c * * Nasty display_value - deep leys * * values graphically. * * * * Usege void display_value # * (int point) I * * * * Prototype in * * * * Description displays a value graph- * * icelly, in the -form of * * dot, and a line drawn * * from it to the last di— * * awn dot. * * * * Return value none * * * * Calls draw_line * * count_h_puises * * * * Called by work_mode * * * fHHHHMHMHHHHHHHHHHHUHHHHHHHHHHHHHHHHHHHHf / - ♦ (include <time.h> ♦♦ include <hart_w.h> ♦ (include <dos.h> «define X_DIST 2 extern float old_time, new_timel extern int c1r, no_cycle, hartx1 extern float mean, systolic, factor_sJ extern int max_acc, min_accJ extern int * ax_eounter, maxi {void display_value (int point) C int newy, i, j, oldx, ref (window_hight * HART_Y2 - HART_Ylj float epsilon “lE-5j struct time time_o! d, time_newl static int print_rate * 3j static int oldy * -l, x * HART_Xl + l | static long mean_point« OJ static float sum_mean 0.0J static float y _] # sheet * 0.0! static int cycle_x HART_X1 + 1, eycle ^ point * 01 newy point / HART_SCALEl / * Translate the signal to the dimensions * / newy »HART_Y2 - newyl / * of the display- window. * / if (oldy * -1) oldymnewyi c leer_wiridow (x + d, HART_Yl, 0, window> _hight) 1 if (newy <HART_Y1) newy * HART ~ Ylj oldx - x ->: _ riSTi if (oldx <HAPT_X1) oldx »HART_XlJ elr II draw_line (oldx, oldy, x, newyl | / * Draw the next connecting line. * / Draw_line (oldx, HAPT_YI-I» xfHART_Y | -l) f draw_J ir, e (Old>, HAF T_Y2, x, HART_Y2) I if (cvstolic) epsilon) / * after calibration * / (* va _ «» eai »+ point) ntean_paiHL rt | > if (((y_level> oldy) && (y_level <= newy))! ! ((y_level <oldy) 8 * &: <y_ieve 1> = newy))) {if <no_cycle == -1) {gettime (6 <time_old); old_time = time_old.ti_hour * 3600.0 + time_old.ti_min * 60.0} old_time = ald_time + time_old.ti_sec + time_o1d.ti_hund / 100.0}} if t (x-eycle_x)> cycle_point / 4) C no_cyc1e ++; gett ime (8ct ime_new); new_time = time_new.ti_haur # 3600.0 + time_new.ti_min * 60.0 »new_time = new_time + time_new.ti_sec + time_new.ti_hund / 100.0; cycle_x = xj}> x + = x_dist; oldy = newyj if (x> HART_X2> / * If it reached the end of the * f i / * display-window l *, / courit_h_pulse () I / # Calculate hear t pulse. y_level = (0.5 * <max_acc - min_acc) + min_acc) / max_counter; y_level = HART_Y2 - y_level / HART_SCALE; if (systolic> epsiIonJ mean = systolic + factor_s * (sum_mean / mean_point) - factor__s * maxi; sum_mean = 0.0J mean_point »0; write_results <) 5 / * Write measuring results. * / trend <); / # Write systolic trend. * / if (no_cycle> 0) eyele_point = (HART_X2 - HART_X1) / no_cycle; else cycle_point = <HART_X2 - HART_X1) / 11; no_cycle = -1; x = HART_Xl + 15 / * * / c1ear_w i ndow (x + 3, HART_Y1, X_DIST, windaw_h ight); draw_box (HART_X1, HART_Y1-1, HART_X2 + 1, HART_Y2> 5 cycle_x = xl pr i nt_rate + + 5 if ((print_rate% 3) == 0) pr i nt_results (>; print_rate = 0;}} / *> * / hartx = x »! LE OPTRONICS (CO Λ * ------------------------- heêder -files included --------- -------------- # / extern unsigned yaddrt2001; extern unsigned xaddrt6401; extern char shi-ftC6403j extern char pointtó40] J extern int clr> extern char -far iscrn! / If **** ^ ********* · * ## ** # ***** # * ^ ******** # ** * File dot.c * * Name dot - draws a dot . * * * * Usage void dot (int x, int y); * * * * Prototype in cas.h # * * * Description computes the of-fset in * * the screen bu-ffer of * * the bit to be set. * * * * Return value none * * * * Cal Is none * * # ¥ Called by dmw_l ine * * * *********************** ***************** / void dot (int x, int y) {unsigned totalJ total = xaddrlxl + yaddrtyl »scrnEtotalJ = (dr < <shiftlxl) i (scrnttotall k pointCxj); >! L.E. OPTRONICS (CC) | / **************** ********** ************** * File draw_l.c * * Name draw_line - draws a line * * * * Usage void draw_line * * (int xl, yl, x2, y2) f * * * * Prototype in casS.h * * * * Description draws line -from (XI, Yl) * * to (X2, Y2). * * * * Return value none * * * * Calls dot * * * * Called by disp1ay_value * * draw_screen * * draw_bax * * * ********************* ******************* / void draw_line (int xl, int yl, int x2, int y2) {void dot (int x, int y); int x, y, xstep, ystep, dx, dy, direct; x = x 1; y = yl; xstep = 1; ystep = 1j i-f (xl> x2) xstep = -1; i-f (yl> y2) ystep = -15 dx = abs (x2 - xl) 5 dy = abs (y2 - y1); it (dx == 0) direct = -15 else direct = 0} while (! ( <x == x2) & 8c (y == y2))) (dot (x, y) 5 i-f (direct <0) (y = y + ystep; direct = direct + dx;} else {x = x + xstep; direct = direct - dy;}: LE OPTRONICS (CCJ / ******** # *** * ****** · ***** · **************** * File draw_box.c * * Name draw_box - draws a box. * * * * Usage void draw_box # * (int xl, y1, x2, y2) 5 * * * * Prototype in cas3.h * * * * Description draws a box bounded by * * colomns XI, X2 and rows * * Y1, Y2. * * * * Return value none * * * * Calls draw_line * * * · * Called by draw, screen * * * ******** ******************* *********** / void draw_boxiint xl, int yl, int x2, int y2) {void di'aw_line (int xl, int yl, int x2, int y2)! dra w_ 1 i ne ( x 1, y 1, x2, y 1) 5 dr aw_line (x2, yl, x2, y2) 5 di-aw_l ine (x2, y2, xl, y2) 5 drat "_l i ne (, v 1, y2, xl, yl> ï}! LE OPTEONICS (CO! / **** + ************************** + ***** * ++ + File draw_Ecr.c * + Name dran_5creen - draws the * * functional screen. * * * + Usage void draw_screen () i * * * * Prototype in trend_w.h, hart_w.h * * * + Descri ption draws all the windows * * far graphic and numeric * + displays of parameters. + * + * Return value none * * * + Calls draw_box + * draw_line + * gotoxy * * rewrite_main_menu * * * * Called by graphic_init + * * ****************** ******** + ***** ++ *** + ** / ♦♦ include <trend_w.h> ♦♦ include <hart_w.h> void draw_screen () {i n t i; draw_box (HART_X1, HART_Y1-1, HART_X2 + 1, HART_Y2); / * Graph window. * / draw_box (TREND_X1, TREND_Y1, TREND_X2 + 1, TREND_Y2); / * History-graph window. * / Draw_box (0, ISO, 500,195) ί / * Menu window. * / gotoxy (1.21) J / * trend scale mark * / printfC 0 "); gotoxy (1.16)> printf (" 120 "); gotoxy (1.11) 1 printf (" 240 ") 5 for (i = 0j i <3; i + +) draw_line (TREND_X1-10,110 + 20 * i, TREND_X1,110 + 20 * i) (draw_box (540> 13,611,27) t / * Systolic window. * / draw_box (540,53,611,67) I / * Diastolic window. * / Draw_box (540,93,611,107)! / * Mean window. * / Draw_box <540,133,611,147); / * Heart pulse window. * / draw_box (540,153,634,170) {/ * Clock window. * / gotoxy (64.22); printf ("ICT LE ISRAEL"); gotoxy (64.23); printf ("CNIBP V: l.00 *) J draw_box <505,172,635,195) 1 / * ICT ISRAEL window * / for (i = l; K6S i ++) (gotoxy ((3 + 10 * i), 21) (printf <"% d", (5 * i));> gotoxy (68,0) t printf ("SYSTOLIC"); gotoxy <6S, 5) (printf ("DIASTOLIC")! Gotoxy (6Θ, 10)! Printf ("MEAN EP")! Gotoxy (68,15) I printf ("H. RATE"), · rewr 11 & _rp j ri_meru 1 ! ·! LE OPTRONICS (CC) j / **************************************** * File getmode.c * * Name getmode - gets display * * adapter type and mode. * * * * Usage int getmode () 5 * * * * Prototype in casS.h * * * * Description gets mode of display ad- * * apter. * * * * Return value mode of adapter card. * * * * Calls none * * * * Called by graphic_init * * * *************** ***** ******************** / «include <dcs.h> int getmode () {union REGS inregs, outregs! inregs.h.ah = OxOfJ inregs.h.al = 0; i ntSé (0x10, S <i nregs, ficoutregs); return (outregs. h. al) \}! L.E. OPTRONICS (CC) / ** # * # ****** # * # * ###### *** ### ** #### * #### * # * File gatoxy.c * * Name gatoxy - position cursor # * * # Usage void gotoxy (int x, y)> # # * * Prototype in cas.h # * * # Description position cursor at Χ, Υ # # coordinates. # # * # Return value none * * * * Calls none * * * # Called by many # * # ## **** # ** # *** # * ## *** ## ***** # **** ## * ## *** / «include <dos.h> «include <video.h> void gotoxy (int x, int y) £ union REGS regsj regs.h.ah = 2; regs.h.dh = yj regs.h.d1 = x 5 r-egs. h. bh = 0; i r. tS6 (VIDEO, Scregs, kregs); }! L.E. OPTRONICS ICC) | / **************************************** * File graph_in.c * * Name graphical nit * * * * Usage void graphic_init (); * * * * Prototype in cas8.h * * * * Description initializing hi - res * * graphics on a CGA card, * * and drawing the systems * * -functional screen. * * * * Return value none * * * * Calls init * * draw_screen * * * * Called by main * * * ************************ **************** / extern int tmodej void graphic_init () {int getmode ()! void startsprinter () J int init (int); void draw_5creen () j / * ------------------------------------------- --------------------- * / / tmode = getmodeC) j / * Save the current mode. * / / init (6 >> / * Initialize graphic mode. * / / stert_printer ()} draw_sereen () f / * Display system's screen. * / /} I LE OPTRONICS (CC) / ****** # * ** ## ** # ** ## * # * # * # * # **** # ** # * ### * * File · init.e * * Name init - intialize display # * adapter to graphic mode. # * * # Usage int inittint num)} * # * * Prototype in # * * # Description initializes CGA card to # # hi-res graphic mode. # # * * Return value mode adapter card is in. # * * # Calls none # * # # Called by main # # grahpic_init * # * ♦ (include <das.h> ♦♦ include <video.h> extern unsigned yaddrE2003) extern unsigned xaddr £ 6401) extern char shiftC6403) extern char pointC6401) extern char -far #scrn) int inittint num) {int indx * 0, indx2 = 0} static int max_cl r, max_x , max_y, sh if ter; unsigned clr „wid, mask; union REGS inregs, outregsj if (num> 6) {puts ("invade id mode. \ x07")} exit (0)} y switch (num) {case 4: max_clr 3 (max_x 320) max_y * 200; shifter = 4) clr_wid 2) break) case 5) max_clr “1) max_x * 320) max_y - 200) shifter 4) clr_wid 2) break) case 6: max_clr * 1) max_x * 640) max_y 200) shifter» 8) c1r_w id «11 oreax? } if (nuM> 3) {/ # For graphics modes only * / while (indx <max_y) C / ^ - already calculate 1 y offsets # / yaddrCindxl 80 * indx2S ++ indx? yaddrC indxl * <80 * indx2) + 0x20005 ++ indxj ++ indx2? > for (indx * 0} indx <max ^ x? ++ indx) <mask * 0x80 >> (clr_wid * (indx X shifter))? if (nun ά) {/ * · Medium resolution offsets * / mask 1 = (mask >> 1)? shiftCindxl »6 - (clr_wid * (indx * shifter)); } else High resolution offsets * / shiftCindxl = 7 - (indx X shifter)? pointCindxl * ~ mask; xaddrCindxl * indx / shifter? > inregs.h.ah “0? inregs.h.al * numl int86 (VIDE0,8iinregs, ldOutregs)? return (num) | > / * end of init * / i L.E. OPTRONICS (CC) * Fi le pr int_rs.c * * Name print_results # * * * * * Usage void print_results (); * * * * Prototype ir. Cas.h * * * # Description Print blood pressure * i results. * * * i Return none * * * * Cal 1 s none ff * * * Called by disp1ay_value * * * * * ************************ **************** / «include <bios.h> «include <time.h> extern int systo, diast, heart_p; extern -float mean »pr i nt_results () {int i, at 813, mean_val; long timelj char #str_now »for <i = 0ji <81ji + +) atil = ""; et813 = "/ oi time (ktimel); Etr_now = ct ime (let imel) 5 for (i = l5 i <9j i ++) at i3 = * (str_now + 10 + i); at 17 3 = '0' + systo / 100J a 118 3 = '0' + (systo% 100) / 105 at 193 »'0' + systo% 105 mean_val = mean; aC283 = Ό + + mean_val / 100; at293 = "0" + (mean_val% 100) / 10; at303 = "0" + mean_val% 105 at393 = 48 + diast / 100; at403 = 48 + (diasty.100) / 10; at 413 = 48 + diast'AlOJ at503 = 43 + heart_p / 100; e 1513 = 48 + (heart_p% 100> / 10; at523 = 48 + heart_p% 10; at0 3 «= 10! if (biosprint (2,0,0) == 0x90) write (4, a, 160); }! LE OPTRONICS (CC) | / *************************************** File rewrite , c * * Name rewrite_main_menu # * * * # * Usage void rewr i te_main_mer.u (); * * * * Prototype in * * * K Description * * * * * * Return none. * * * * Calls none # * * * Called by * * * **************************************** / external int c1r, alarm_f1agj rewr i te_mai n_menu () {void draw_line (int xl, int yl, int x2, int y2); void gotaxy (int x, int y); i nt i; alarn_flag = 0; c1r = 0; draw_line ( 120,181,120,195); draw_li ne (220,181,220,195); dr aw_li ne (290,181,290,195); draw_l i ne (370, 181,370, 195), * gotoxy (1,23) 1 pr i ntf ("FI: EXIT F2." CALIB F3: HIST0RY F4: SET ALARM "); for (i = i; i <= 4; i ++) {clr = ljdraw_line (100 * i, 180,100 * i, 195);>> ί L.E. OPTRONICS (CC) | / **************************************** * File Bet_al r. c * * Name set_alarm * * * * * * Usage void set_alarm (); * * * * Prototype in * * * * Description Display alarm menu. * * window and set alarm * * flag. * * Return none. * * * * Calls draw_line, gotoxy * * draw_box. * * Called by work_mode. * * * If *************************************** / ♦ (include <ccnio.h> extern int c1r, alarm_f1ag, high_sys, alarm_switch; void set_alarm <) {void gotoxytint x, int y); void draw_line (int xl, int yl, int x2, int y2) 5 i nt i J alarm_-flag = 1; gotoxy (1.23) 5 pr i nt-f (" <F7> ALARM OFF SYS =% 3d <F5> UP <F6> D0WN <F4> MAIN MENU ",) 5} h igh _SyS c1r = 0; for (i = l 5 i <= 4; i ++) draw_line (100 * i, 181,100 * i, 195) 5 clr = 1; draw_line (120,181,120,195) 5 draw_line (220,181,220,195) J draw_line (290,181,290,195) J dr aw_1ine (370,181,370,195) 5 if (alarm_switch) {gotoxy (12,23) 5 print-f ("N -);}>) i: L. OPTRONICS (CC) / **************************************** * File smooth_d .c * * Neme smooth_data - smoothes * if converted data * * * * Usage int smooth_data () f * * * * Prototype in cnibp.h * * * * Description smooth_data gets the * * arithmetic average of a * * shifting window of x * * samples at a time, to * * get a smoothed curve of * * the sampled data. * * * * Return value smooth_data returns the * if value of the new V coo- * * rdinate of the smoothed * * sample. * * * * Calls none * * * if Called by work_mode * * * ********************************** ****** / ♦ • include <dos.h> «include <ipcrt.h> extern int Atl03} int smooth_data () {int i, sum = 0, max_A, min_A; ΑΓ43 = inportb (IPORT) 5 / * Recieve the sixth sample. * / if ((AC43> ZAO) ll (AC43 <1)) AC43 = inpartb (ÏP0RT)! for <i —0 »i <5 | i ++) / * Sun up the last six samples. * / sum = suit. + Ati3S for (i = 05 i <45 i ++) ΑΓ i 3 = AIi +13 5 retur n (suir / 5) 5 / * Return average of last six samples * / 3! L. E. OFTP.ONICS (CC)! / ** f ^ * -) (******** · ****** · ****************** · ** * File start_pr. c * * Name start_printer * * * * * * Usage * * * * * * Prototype in cas.h # * * * Description # * * * * * * * * * * * Return value none # * * * Calls * * * * * * * * Cal led by * K # ************************************** ** / ♦ (include <conio.h> ♦♦ include <bios.h> st => rt_printer () C che ** ilSOl = ”\ r." J char ataoi = "ICT Ltd Rehovo t, ISRAEL \ n" {char crSOl = "BPTEST PRO J E C T \ n"; char dCeoi = "date: \ n'j char · eCeoi =” nameitn "! char bCEOl = H notes: \ n "J char gC803 =» TIME SYSTOLIC MEAN DIASTOLIC HEART RATE \ n 5 if (biosprint (2,0,0) == 0x90) {write (4, +, 80)! wr i te (4, a, 80)> wr i te (4, c, 80) 5 wr ite (4, d, 80) I wr i te (4, e, 80) {wr i te (4, b, 80) } write (4,9,80) f>); LE OFTRONICS (CC) | / ****************************** ********** * F j! E trend.c * * Neme trend * f * * * * Usage void tr end O {* * * · * Prototype in * * * * Description Print blood pressure * * trend. * * * * Return none * * * * Cells trend_draw * * * · * Celled by displey_value * * * * * ********************** ****************** / ♦ (include <trend_w.h> extern int sy £ to, diast; extern int c1r, ca 1ib_flag »extern -float meen» void trend O {void trend_drew (int, int, int)} static x «TREND_X15 static int odd_val = 0, int meen_vel» int i »if (x« TREND_X2) x = TREND_X15 c1r = 0} for (i - 1 »i <55 i ++) / * clear window -for trend display * / i-f ((x + i) <TREND_X2) draw_line (x + i, TREND_YH1 »x + i, TREND_Y2-2> J clr = l; if (celib_-flag == 1) (draw_ 1 i ne (x, TREND_Y1 +1, x, TREND_Y2-2 ), * calib_-flag = 0}} if (odd_val == 0) (trend_draw (0, x, systo)} odd_vel * 1 »5 else (trend_dr # .w (1, x, diast), odd_vaI * 0} } * rear._v? l * meen} trend_drew (2, x, meen_vel) 5, ·· · * * ï j! LE OFTRONICS (CC) / FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFüFFFFFFFFFF * • F File trer.d_dr.c F if l'lEme trend_draw * if if * if • F Usage void trend_draw if if (int num, int x, int val) if F if F Prototype in trend_w.h FFFF Description Print blood pressure FF trend. FFFF Return none FFFF Calls draw „_line FFFF Called by trend FFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF / Finclude <trend_w.h> extern int clr; void trend_draw (int num, int x, int value) {static int yC3) = (0,0,0); int nexty; clr = IS nexty = TREND_Y2 - value / 3; i-f <nexty <TREND_Yl) nexty = TREND_Yl; i-f <nexty> TREND_Y2) nexty = TREND_Y2; i-f (ytnuml == 0) ytnum) = nexty! draw_li ne (x, ytnum), x + 2, nexty); ytnum) = nexty; > ï L.E. OPTRONICS (CC) I / **************************************** * File WORK. MODE.C * * Name work_mode - acquires * If processes and displays * * converted data. * * * * Usage void wark_mode () | * * * * Prototype In cnibp.h If * * * Description acquire data -from sensor * * process it, display the # * results graphically and * * numerically. * * * * Return value none * * * * Calls smooth.data * * display, value * * calc_new_factor * * wr ite.results * * * * Called by main * * * *********** ***************************** / «include <iport.h> «include <funct.h> extern int At 101, max, min, max.counter, af ter.cal ib; extern int max_acc, min_aec, end_calibrat ion) extern -float y.level} vo i d wor l._tnode () {int smooth_data ()! int i, point} i-f (* end_ce 1 ibrat ion) start.cnibp ()} • for (i = 0> i <4} i ++) / * Read the first five samples from the * / ACil = i nportb (IPORT) J / * sensor. # / for ti = li i <* 60} i + +) / * For i = l to 60 do: # / {/ * t * / point «smaath_data <M / * Enter a new sample and smooth it, * / min = MIN.OF (point, inin)} / * * / max = MAX_0F (point, max)} if (i% 3 “* 0) / * Display every third sample. * / display.value (point)} / * * /) / *> * / max.acc * max.acc + max) min.acc * min.acc + min} ire.x_counter + +} / * calculations. * / gotoxyf70.20); / * Go to clock window. * / CLOCK (IS / # Display current time. * / If (ef ter.cel ib) / * If after calibration then calculate * / ca 1 c_new_f actor ()} / * the new factor of systolic It diastolic. * /) / * end of work mode * /! L.E. OPTRONICS <CC> I * Pile- · 'write_rs.c # * Neme write_results - displays # * results numerically. # * * * ÜEc ^ e void wr i te_r-esu 11 s () »# * * * Description displays numerical res- # * ults in the appropriate * * pieces on the screen. # * * * Return value none * * * * Calls gotoxy * * * * Called by worl <_mode # * * ****************************** ********** / external int max , min, max_counter, alarm_switch, maxi; extern int max_acc, min_ace {extern int prev_max_e.cc, prev_min_acc, prev_max_cou.nter; extern int systD, diast, heart_p, hi9h_sys; extern-float systol ic, diastol ic, mean; external -float fe.ctor_s; void write_resu1ts () {void gotoxy (int, int); int imean5 max = rnax_acc / max_counter, min = mi ri_acc / max_counter 5, systo = systolic + f e.ctor-_s # (max - maxi) 5 / * syet * = syst_-f actor * sys' t (frorn sensor) * / diast = systolic + factor_s # (min - maxi); / # Diast * d i ast_-f actor * d iast (-from sensor ·) # / max = 0; min = 300 »i-f ((alarm_st -. 'i tch) 6 <(max> = high_sys)) / * If systolic over limit * / the systolic high beep (9.76) »/ * turn on alarm system. X / gotoxy (71.2); printf ("% 3d", systo); / # Numerical display of systolic. ¥>! goto.:y(71,7)J pr i ntf (* '% 3d ", d iast) (/ # Numerical display of diastolic. * / gotoxy (71,12) 5 imean = mean; pr i ritf ("% 3d ", imean); / # Numerice.1 display of mean. * / Gotoxy (71.17); pr-intf (”% 3d ", hear-t_p) {/ # Numerical display of pulse rate. Prev_max_acc = max_acc ; pr-ev_mi n_acc * = min_acc; prev_mex_counter * = msx_counter! mex_ecc - 0? mex_counter · = 0; min_ecc = 0; 'LE OPTRONICS (CC) | * File St * rt_c.c * * etart_cnibp - star te host * * to cnibp communications. * * * * Usage void start_cnibp (); * * * * Prototype- in logic.h * * * * Description main caller tor host to * * cnibp communication driv- * * ers and protocol. * * * * Return value none * * * * Cells com_setup * * send_msg * * get_m * * get_msg * * disp_cal_res * * * * Called by main (casS.c module) * * * ************* *************************** / ^ include <dos.h> * include <logic.h> extern int atter_cal ib, cal ib_t lag, end_cal ibration; void stert_cnibp () {int i I long n, ir; struct time tmj if (end_cel ibration) {gett ime (Ertm) J CDm_setup () l / * setup communications at 9600, n, S, l * / atter_calib = 1 $ / * initialize flag * / prepare_msg (1) t / * prepare START command to cnibp * / send_msg () 5 / * send the commend to cnibp * /} e-nd_cal ibration = FALSE; nhile (end_calibration == FALSE! end__cal ifcretion = get_m () | / * pressure. * / • f (erd ^ cal ibration) rp ^ epere_msg (lB) J / * prepare DATA REQUEST command to cnibp * / send_msg (> i / * send the command to cnibp - * / get „msg () | / * receive calibration data trom cnibp * 7 disp_cal_res ()« / * display data on screen * / c * lib_tleg * 1 »set t itre (ttmM / * just tor cal-stop version * /}! LE OFTRONICS (CC) | / * ¥ * ¥ ** * Μ ** · *********************** ****** * File corn_Eet.c * * Name com_Eetup - setup com * * parameters. * * * * Usage void com_B6tup () * * * * Description setup communicatioriB at * * 9600, n, 8.1. * * * * Return value none · * * * # Calls none * * * * Called by start_cnibp * * * **************** iHt ********** ********** ## / ♦ ti nc 1 ude <dos. h> ♦ (include <regist.h> void com_setup () {outpor-tb (LCR, 0x80); f * eat DLAB = 1 * / Dutportb (IER, 0x00); E6t Divisor Latch LSE (DLL) tD 0 * / outpor-tb (RER, 12) 5 '* set Divisor Latch MSB (DLM) to 12 * / outportb (LCR, 0x03)! ** set ε bits, 1 stop bit no parity * / outportb (IER, 0); reset Interrupt Enable Register * / ': L.E. OPTRONICS (CC) j / ************* 1Ηί · ****************** # ****** * File Send_msg. c # * Neme send_msg - RS232 output * * driver * * * * Usage void send_msg () * * * * Description driver for sending mes- * * sages over the serial * * communication port. * * * # Return value none # * * * Calls none * * * * Called by start_cnifap # * * *************************** ************* / «include <ia.h> external char msgC83} void send_msg () {i nt i, j 5 for (i = 0; i <= 75 i ++) {/ * loop for sending 8 bytes of message * / write (3, (msg + i), l) i / # TXing the bytes via RS23Z part * / for (j = 0> j <= 400> j ++)} / * delay loop for syncronization # /} 8902/46: L.E. OPTRONICS (CC) I / **************************************** * File disp_cal. c * * Name d isp_cal — res - displays * * calibration results * * * * Usage void disp_cal_res () * * * * Prototype in comm_cas.h * * * * Description displays calibration * * 'results on the system's * * display. * * * * Return value none * * * * Calls none * * * * Called by start_cas * * 3 (************************** *** *********** / extern-float systo 1 ic, di asto 1 ic, mean; extern int heart_p; void disp_ca1_res () {gotoxy (71.2) j printf ("% 3 .Or ", systolic); gotoxy (71.7) 5 pr i ntf (" V.3. Of ", d iastol ic)} cntcxy (71.12); printf ("% 3.Of ", mean) 5 gotoxy (71.17) 5 pr 'i ntf ("% d", heart_p) J} 38' τ l LE OPTRONICS (CC> / ******************* ********************* * File get_jn.c * * Neme get_m reads real time * * cuff pressure. * * * * Usage int get_m () * * * * Description reads real time cuff * * 'pressure. * * * * Return value TRUE or FALSE ff * # * Calls none * * * * Called by start_enibp * * * ************** ************************** / ♦ (include <dos.h> ♦♦ include <logic.h> ♦ (include <regist.h> int get_in () (char ch »static int tri_9_flag = 0 {while (inportb (LSR) tc 0x01) {/ ft while bit 0 or Line Control Register * / outportb (NCR, 0x00) j / # on, disable DTR or RTS * / ch * jnportb (RBR); / # gat character form receive buffer * / if (tri_9_flag> 2 Be ch == / # if last 4 characters are "959I9ICR" * / 13) {tri_9_t Jag * 0; / * reset flag indicating 3 * 9 "* s · * / return (TRUE) l / # terminate caller's while loop * /> if (ch == 57) {/ * count successive '^' s * / tr i_9_flag + + | pr intf (“", tr i ^ 9_f lag) I} / * Λ necessary oddity ff / els € / * if no successive “P" * s reset flag tri_9_flag »0 $ outportb (MCR, 0x02) I Be ^ Rjg ff /> return (FALSE) lj / # wait for next character V 1 '* .............................. .-.....-........................ ii LE OPTRONICS <CC) | --------------------_----------------------------- ------------ ** / *********************************** ***** * File prep_msg.c * * Neme prepere_mEg - prepares * * e message for trensmi- * * scion to cnibp. X * * * Usage void prepare_msg (int in) * * * * Description prepares a. Message for * * transmission by setting * * the proper sequence of * * characters of a command. * * * * Return value none * * * * Calls none * * * * Called by start ^ cnibp * * * ************************************ **** / external char msgC81S void prepare_msg (int in) {int i {char chs £ 18IC23 = { <0x44.0x37>, <0x44.0x38>, <0x44.0x391, <0x44.0x411, <0x44.0x421, <0x44.0x431, <0x44.0x441, <0x44.0x451, <0x44.0x461, <0x44.0x371, <0x44.0x381, <0x44.0x391, <0x44.0x411, <0x44.0x421, <0x44.0x431, <0x44.0x441, <0x44.0x451, <0x44,0x46111 char cmdtl81t23 «= < <0x30, 0x311, <0x30.0x321, <0x30.0x331, <0x30.0x341, <0x30.0x351, <0x30.0x361, <0x30.0x371, <0x30.0x381, <0x30.0x391, <0x31.0x301, <0x31.0x311, <0x31.0x321, <0x31.0x331, <0x31.0x341, <0x31.0x351, <0x31.0x36), {0: 31.0x371, {0x31.0x38 J} II *** - ****** * ** **************** *** ********** * p '.> Ts the sprapriate characters in msg # ************* ^ ******* # ** ***************** / j * (in> 0) {m = gtl3 = cmdtin - 13t03; rrsgt23 = cmdtin - 13tl3} msgC53 = chstin - 13 C 031 msg [63 = chstin - 13tl3 | J 3 * ............................................... ..................... 1 I LE OPTRONICS (CC) I ____________________________________________________________________ * / / **************************************** * File get_msg.c * * Name get_msg - RS232 input # * driver. * * * * Usage int get_msg () * * * * Description driver for receiving * * messages over the serial * * communication port. * * * * Return value 0 if RX successful. * * NOSTX if no text RXed * * * * Calls none * * * * Called by start_cnibp * * * *************************** ************* / «include <des.h> «include <time.h> «include <regist.h> «include <logic.h> «include <text.h> «include <hart_w.h> extern-float systol ic, di astol ic, mean »extern int heart_p> exter n int dr ί extern int prev_max_acc, prev_min_acc, prev_max_eounterJ int get_msgt) t int re-f_up, re-f_bot> int i, j , done, ref} char rmsgt37), aC801; int line; long timei; char * str_now; for <i * Oii <80) i + +) aCil = 32J done = FALSE; / * set initial condition for whi le loop * / i = O; / * initialize message index * / whilet (done) l / * while no ETX receive characte rs * / it (inportblLSR) fc 0x01) t / * it bit 0 ot Line Control Region! on * / outportb (MCR.OxOO); / * no DTR or RTS * / rmsgti) «inportb (RBR); / * read character trom R eceive Buffer * / ittrmsgCil ** ETX) / * if ETX terminate while loop * / done = TRUE; + + i1 / * otherwise increment m essage index * /} ootpor tb (MCP, 0 -.- 02) {/ # set F.T3 / a ******** # *** # **** ** ## *** # *** ## · ### # display rtciivid dat on screen * ff ### ## · # * ## * # * ##### *** # * ** ## ******* # / syttolic ~ 100 # (rmsgl133-48) ♦ 10 # (rmsgl143-46) + (rmsgl153-4 £ *> 5 .gj '^ * dieftDlic = 100 * (rmsgtlól - 40) + 10 # (rmsgI173 - 4ó) + (rκ & ^ 1. _ 4ó> 'mean * 100 * <rmsgtl93 - 46) * 10 * (rh) sgC203 - 46) + (rmsgTZi3 heart_p * 100 # <rmsg1243-48) + 10 # (rmsgt253-46) + (rmsg! 263-46) »scree * for (1 = 1J i <HART_Xl | i * +) / · # clean previous marfc £ on # / c 1 r = 05 draw_l i ne <i, HAF.T_Y1, i, HART_Y25! 3 c 1 r = 1 {d raw_1i ne (HART_X1-1, HART_Y1, HART_X1-1, HART_Y2) J r # f_up = HART_Y2 - (prev_max_ * cc / prev_max_cour »ter) / HART_SCALES re # _bot * HART_Y2 - (prev_min_acc / prev_max_counter) / HART_SCALE5 ref * systolicS Iine = ref_up / 10 »gotoxy <1,1i ne)} print # (“% 3d *. Re-f) I ref = diastolic! 1ine = ref_bot / 10 + 2ΐ gotoxy (1.1ine)! pr i ntf (“% 3d, ref) {draw_line (3, ref_up, HART_Xl-l, ref_up> 5 draw_li ne (3, ref_bot, HART_X1-1, re # _bot> 5 • 103 = 10J t ime (l? t imel); str_non * et ime (Lt imel) J for (i = 3 {i <9} i ++) at »3 * # (str_now + 10.i) I al! 73 = rmsgl133» aC183 = rmsg (I43; • 1193 = rmsg (153> a 1283 * rmsgl1935 el29] = rmsgl2035 el303 = rmsgI213l a! 393 = rmsgl163 »a (403 = rmsgll735 • 1413 * rmsgl183; a1503 * rmsgl243} • 1513 * = rmsgl2531 • 1523”? Msgt263l a 1603 <= 361 if (biosprint (2.0.03 ** 0x90) write (4, a, 60) 5 return (O) 1 3 _bss. segment stack 'stack' DW 128 DUP (?) _Bss ends dgroup group _data, _bss _data segment ascii_tab db "0123456789" hour dw?, 'Φ' minute dw?, '$' second dw?, '$' separat db ten db 10 thu dw 1092 eight db 18 cur_pos dw 163 + h toprint db 1 dup ( 'd'), '*' _data ends _print_string macro mov ah, 9 int 21h endm; Code segment containing the main and subroutines.! ===================== ============================================ _text SEGMENT PUBLIC assume cs: _text, ds: dgroup pub lie _CLOCK _CL0CK proc near mov ax, dgroup «establish data segment mov ds, ax j ΐ; blank cursor and get time from system clock j + get_t ime! mov ch, 0ffh 5trans + er cursor blanking code mov ah, lf ~ ta BIOS int lOh J mov ah, 0 iget time o + day int lah Jusing BIOS j -------- lea bx, ascii_tab Iget address ai translation tabl e »“ i translate returned value for hour into ASCII ; + hi: mov ax, cx Iget value + or hour in AX div ten tdivde by 10 to convert to decim al 1 xlat ascii_tab {translate to ASCII xchg ah, al {exchange AH and AL xlat ascii_tab Itrnaslate the remainder to ASCI xchg al, ah {get back in right order + or dim play mov hour, ax (save value for display I tr »nel * te rHurntd vtlut for minutes into ASCII 1 + ml: mov ax, dx (xor dx, dx div thu div ten xlat ascii_tab xchg ah, al xlat ascii_tab xchg a I, ah mov minute, ax 1 - i translate returned value for seconds into ASCII t + si: mov ax, dx div eight xor ah, ah div ten xlat ascii_tab xchg ah, al xlat ascii_tab xchg al, ah mov second , ax mov dx, cur_pos mov ah, 2 int lOh disp_h: mov ax, hour push ax lea bx, toprint mov Cbx3, al mov dx, bx _print_etring pop ax xchg ah, al lea bx, toprint mov [bx3, al mov dx , bx _print_string lea dx, separat _print_ * tring disp ^ mi mov ax, minute push ax lea bx.toprint mov rbxl, al mov dx, bx _print_ * tring pop ax xchg ah, al lea bx, toprint mov Cbx3, al mo v dx, bx _print_string lea dx, separat _print_ * tring di 5p_s: mov ex, second pufch ax lea bx, toprint moV (bxl, al mov dx, bx _print_etring pop ax xchg ah, al lea bx, toprint mov tbxJ, al mov dx, bx _prlnt_etrlng ret _CLOCK endp _text ends END