SINGLE POSITION NON-INVASIVE CALIBRATION TECHNIQUE FOR RESPIRATION MONITORING APPARATUS

Abstract: Method for non-invasively measuring respiration volume whereby weighting factors are non-invasively determined by (a) totaling delta values over a baseline period of substantially steady state breathing for obtaining a rib cage signal, (b) totaling delta values over a baseline period of substantially steady state breathing for obtaining an abdominal signal, (c) dividing the average variability of the mean of the total of the delta values for one of either the rib cage or abdomen signals by the average variability of the mean of the total of the delta values for the other of either the rib cage or abdomen signals; and (d) multiplying the other signal by the quotient derived from step (c).

Description: STNGLE POSITION NON-INVASIVE CALIBRATION TECHNIQUE FOR RESPIRATION MONITORING APPARATUS £L Te.chnical Field This invention pertains to methods and apparatus for measuring respiration volume and, more particularly, to such methods and apparatus which measure respiration vol- 5 ume by separately measuring and then summing the contribu¬ tions from a plurality of torso portions, such as the rib cage ana abdomen. Most particularly, this invention 10 pertains to a calibration technique for weighting signals mαicative of the contriDutions from the torso portions w ' nereoy the sum of the signals is proportional to respira- 15 tion volume. Background Art ϋniteα states Patent No. 4,3Gδ,S72 of January 5, 19fa2, entitled Method And Apparatus For Monitoring Respi¬ 20 ration, the contents of which are incorporated herein by reference in their entirety, discloses a metnod and appa¬ ratus for quantitatively measuring respiration volume. 25 The method disclosed in that patent comprises looping first and second extensible conductors scout the r b cage and abdomen, separately and simultaneously measuring tne 30 inductances of the conductors curi g :escicaticn, weighting the measured inductances _o reflect the differ¬ ent contributions of tne no cage and acco en to respira¬ tion volume, and summing tne weighted rr.easured inductances 35 to obtain actual respiration volume. As noted, practice of tne tecn ue disclosed in tne patent requires weighting or calibrating tne inductances 40 measured by the aodomen ano rib cage conductors. To effect calibration it is necessary to determine the weighting . factors and L to satisfy tne following equa- 45. tion: V » -RC + L-AB LEQUATIQN A] where V is total respiration volume, RC is the rib cage 50 5 SAD ORIGINAΪ. 1 contcioution to respiration volume as measured at the rib c*q conductor and AS is the abdominal contribution as measured at the abαominal conductor. Patent No. 4,3Q8,S72 . discloses a specific tecnmque for determining tne values for the weighting factors K ana . In accordance with that disclosure, a spirometer is employed during the calibration procedure, ith the 10 patient in a first position, such as standing, a simulta¬ neous set of readings are recorded from the outputs of the spirometer, tne no cage conductor, and the abdominal con- 15 ductor. This is repeated with the patient * in a second position such as supine. At this point, there are two sets of values o V, RC, and AB which satisfy Equation A. 20 Thus, two equations having two unknowns, the constants K and , may :e -πtten. From these, the weighting factors and L may ce cetecmmed by employing well known techniques toe solving simultaneous equations. Thus: 25 K - AB-_ • V 2 - AB 2 . V χ (EQUATION a. RC 2 AB-, - RC--_ AB i EQUA ION CJ 35 The denominators or Equations ~ i.-.: may, depending upon the recorded values, acproacr. _: equal zero. Clearly, wnen this happens, tne va.-es r ai e cor X a a L will be inaccurate, thereoy so i g an measurement 40 based on su we ghting factors. T ' nus, eacr. time the denominators of Equations 3 and C apprcacn or equal zero, a new set of readings must be taxe.n, tnereoy increasing 45 the time required for calibration. In U.S. Patent No. 4,373,534 of Fecr.uary 15, 19&3, entitled Metr.oα And Apparatus For ai .orating Respiration 50 Monitoring System, tne contents ot which are also incor¬ porated herein oy reference in their entirety, an alter¬ nate method ano apparatus for a. graphmg-based technique for determining tne weighting factors and is 55 disclosed. As in the simultaneous equation technique of BAD ORFGINAL 1 U.S. Patent No. 4,308,872, a spirometer or other device foe independently measuring respiration volume is employed during the calibration procedure. With the subject in a 2 first position, readings from the spirometer, the rib cage conductor and the abdominal conductor are simultaneously recorded for a plurality of breaths, preferably at least three in numoer. This is repeated with the subject in a 0 second position. For each breath, the rib cage and abdom¬ inal readings are divided by the spirometer reading. That is, the values RC/V and AB/V are obtained for each breath, where V is the respiration volume as measured by the spirometer, RC is the rib cage reading from the uncali- brated rib cage conductor, and AB is the abdominal reading Q from the uncalibrated abdominal conductor. The points (RC/D, AB/V) for each breath are next plotted on a graph whose axes are RC/V and AB/V, and a line approximation is drawn through these points. The line may be drawn by vis¬ 5 ual approximation, although preferaoly it is determined by the least squares technique. The .me is then extended through the x ano y axes. The reciprocals of the x and y 0 intercepts define tne weighting factors K and L; i.e. the reciprocal of tne intercept of tne RC/V axis defines the weighting factor K for the no cage ano the reciprocal of 5 the intercept ot the AB/V axis defines tne weighting fac¬ tor L for the abdomen. Preferaoly, ail or tne foregoing calculations are carried out by a microp ocessor or ether 0 data processor which performs tne calculations and yields values for tne weighting factors d _,. A drawback of the methods and apparatus disclosed in U.S. Patents Nos. 4,308,872 and 4,373,534 is the require¬ 5 ment that sets of data points or values -- from the abdom¬ inal and rio cage conductors and from the spirometer or other respiration volume measurement device -- be obtained 0 with the subject for two different distributions of venti¬ lation — i.e. in two separate positions. Where a sub¬ ject's physiological condition prevents or dictates - - against movement from one position to another, however, calibration of the rib cage and abdominal conductor 60 wit the known methods. → -~Another drawback of these prior art methods and appara- '•sSr tu_6 i«- that in certain applications, such as neo-natal monitoring, it is not practical to calibrate the apparatus using an independent respiration volume measuring device such as a spirometer. For example, since the above *-- υ calibration techniques require airway connection to a spirometer or other similar device, significant time is required to carry out the procedure. This is often 15 unacceptable to new-born nursery staff where time is at a premium. Yet another problem with these calibration techniques and apparatus is that they rely on the 20 assumption that all air movement in the respiratory system is between the rib cage and spirometer or the abdomen and the spirometer. In fact, there also exists movement of " air between the rib cage and the abdomen during normal respiration. This RC-AB exchange of air is pendelluft that occurs continuously and with varying degree in respi- 30 ration. The known methods do not incorporate an allowance for pendelluft. 35 40 45 50 3 3 60 Another known quantitative calibration technique is described Single Position Tidal Breathing Calibration of the Respiratory Inductive Plethysmograph, Watson et al, A er. Rev of Respirato Diseases, Vol. 129, p. A256 (1984). According to that technique, with the subject in a single position or posture, readings from a spirometer (SP) , the rib cage conductor (RC) , and the abdominal conductor (AB) are simultaneously recorded f a predetermined period of preferably at least one full breath. The curves (SP, RC) and (SP, AB) are then plotted from the recorded data and each resulting curve is closed by a straight line connecting its beginning and end point. The resulting lo areas are then calculated as by integration. Then, using any selected data points simultaneously recorded from the spiromet (SP) and from the rib cage (RC) and abdominal (AB) conductors, weighting factors (for the rib cage scaling amplifier and/or f the abdomen scaling amplifier) may be determined. This calibration technique also suffers from the drawback that it i invasive in the sense that it requires a spirometer or other device measuring respiration volume at the mouth. Brief Description Of The Drawings In the drawings, wherein like reference numberals denote similar elements throughout the several views: FIG. 1 is a diagrammatic representation of a portion of a system for non-invasively monitoring respiration volume; FIG. 2 is a block diagram of a complete system for non-invasively monitoring respiration; and FIG. 3 is a graphic representation illustrating the delta values for the rib cage and abdominal signals. Best Mode For Carrying Out The Invention Referring now to the drawings, apparatus for measuring respiration volume of the type disclosed in U.S. Patent No. 4,306,872 is shown in FIGS. 1 and 2. Two extensible conductiv loops 12, 14 are secured in any suitable fashion to elastic tubes 16, 18, respectively, such that the conductors 12 and 14 extend respectvely about the rib cage and abdomen of the subje 10. As the subject 10 breathes, the elastic tubes 16, 18 and conductive loops 12, 14 expand and contract, resulting in changes in the inductances of the loops. After the inductance of each loop is converted to a proportional signal, the signal are calibrated and then summed to provide a signal indicative tidal volume. Calibration of the signals from the rib cage an abdomen conductors 12 and 14, respectively, is necessary beca the relative contributions of the rib cage and abdomen to tida volume vary from subject to subject and even in a single subje with different postures, e.g. standing, supine, etc. Suitable apparatus for converting the inductances of the conductors 12 and 14 to proportional electrical signals, calibrating those signals to reflect the proper relative contributions, and then summing those signals to provide a signal indicative of tidal volume are known to those of ordin skill in the art. One such apparatus is disclosed in U.S. patent no. 4,306,872. Another suitable apparatus is marketed Ni s, Inc., Miami Beach, Florida under the model designation Respigraph ™. Such apparatus are generically illustrated in block diagram form in FIG. 2, where the blocks 20, 22 represe respectively, appropriate circuitry for converting the inductances o e signals suitable for further processing. The scaling amplifiers 24, 26 represent circuitry for calibrating the signals from the rib cage and abdomen, respectively, to reflect the relative contributions of the rib cage and abdomen to tidal volume. Onc the scaling amplifiers 24, 26 are properly calibrated, the resulting signals may be summed, as by the summing- amplifier 28 in FIG. 2, to yield a signal indicative of tidal volume. The output signal from the summing amplifier 28 as well as the output signals from the two scaling amplifiers 24 and 26 may then be displayed as on a graphic recorder 30 or a digital voltmeter 32. Optionally, a microprocessor 34 may be incorporated in the apparatus for summing the signals from the scaling amplifiers 24, 26 and/or further processing those signals for diagnostic purposes, all in accordance with techniques known to those of ordinary skill in the art. If the microprocessor 34 is used to sum the signals from the scaling amplifiers, the summing amplifier 28 may be eliminated. The present invention is for an improved method for calibrating the signals from the rib cage and abdomen such that their sum produces a signal indicative of tidal volume. As is noted above, while various calibration techniques are known to those of ordinary skill in the art, all the known techniques possess drawbacks. Turning to the calibration technique of the invention, from Equation A it is known that: V =- (_XRC)+(LXAB) where V is total respiration volume or tidal volume, RC is t rib cage contribution to respiration volume as measured by t rib cage conductor and AB is the abdominal contribution to respiration volume as measured by the abdominal conductor. and L are calibration factors for the rib cage ?.nd abdomen, respectively. Another way of expressing this relationship i V ■ = Mx[(ZxRC)+AB] [EQUATION D] where MxZ is equal to and M is equal to L. It will be apparent that Equation D separates the calibration component into a preoortionality factor 2 and a scaling factor M. Usi this approach, calibration may be viewed as a two step proce The first " step is the determination of the correct proportionality factor Z satisfying Equation D, such that V - (ZxRC)+AB [EQUATION E] In other words, the proportionality factor Z defines the correct relative contributions of the rib cage (RC) and abdo (AB) to tidal volume (V) . Classically, determination of the proportionality factor Z is determined by an isovolume calibration technique in which the subject breathes against closed airway i.e. with no volume movement at the mouth, whe V=0. In other words, during an isovolume anuver, the only movement of volume is between the rib cage and abdomen compartments, i.e. pendelluft, since no air escapes through mouth. Under these conditions. Equation D becomes: 0=»(ZxRC) + AB [EQUATION F] so, the readings from the rib cage and abdomen conductors during the isovolume manuver, the proportionality factor Z can be determined from Equation G. Once Z is determined, the quantity (ZxRC)+AB can be calculated for any point in time from tlie recorded values of the rib cage and abdomen conductors. Since we know from Equation Ξ that (ZxRC)-i-AB is always proportional to tidal volume V, a determination of that quantity provides a valuable diagnostic tool. For example, as those of ordinary skill in the art will appreciate, from this quantity obstructive and central apneas can be diagnosed, RC as a percent of tidal volume V can be calculated, and increases and decreases in relative tidal volu V can be assessed. The difficulty with, this approach is that an isovolume manuver requires breathing against a closed airway, which is n always practical, as in neo-natal and critical care applications. if, on e o e an , .β p an ence the quantity(ZxRC)+AB is to be determined without an isovolume manuver, it would appear from Equation E that a measurement of tidal volume must be taken, otherwise there will be a single equation with two unknowns, namely, proportionality factor Z an tidal volume V. In accordance with the present invention, this problem is solved as follows. The rib cage (RC) and abdomen (AB) signals ' . are recorded for a large number of breaths during an initial baseline period. For example, 250 breaths may be measured " during quiet breathing over a 10 minute interval. Actually, breathing during the baseline period need not be quiet, as long as it is steady state. For example, the baseline could be derived from breaths recorded during 10 minutes of exercise. During this baseline period, the uncalibrated signals from the rib cage (RC) and abdomen (AB) conductors are recorded. Referring to FIG. 3, for each of these signals, two values or breath "deltas" are calculated for each breath, ( -, ) being the difference between the signal at the beginning and end of inspiration, the other ( 2 ) being the difference between the beginning and end of expiration. These delta values are then totaled separately for each signal. Assuming 250 breaths duri baseline, and since there are two delta values for each breath, the total for each signal will be computed by adding 500 delta values. Where the delta values described above are preferred, it should be appreciated that the delta values are employed to provide a parameter indicative of the relative amplitude for each breath of the uncalibrated rib cage and abdomen signals 0 taken during baseline. Accordingly, as used herein, the term delta values means any parameter of the uncalibrated rib cage 5 and abdomen signals which provides this information. as by spirometry, and the deltas for tidal volume totaled and the mean determined, the following relationship would apply: Mean SP =- Mean RC + Mean AB [EQUATION H] Where SP is actual tidal volume as determined, e.g. by spirometry. Since the mean values in Equation H are derived from uncalibrated signals, calibration factors are required if the lefthand side in Equation H is to equal the righthand side. The standard deviations (SD) of the mean values for the tidal volume (SP) rib cage (RC) and abdomen (AB) signals can be calculated. Herein, these will be expressed, respectively, as SD (SP) , SD (RC) , and SD (AB) . If tidal volume (SP) is constan for all breaths recorded during baseline. Equation H can still be computed and the standard deviation of tidal volume, SD (V) , is 0. This situation is analogous to Equation F which, as explained above, applies to the isovolume manuver where V=0. I particular, by considering the standard deviation of a constant tidal volume SD (V) , which is also 0, the pendulluft occurring during normal breathing creates a situation analogous to the isovolume situation of Equation F, and taking the variance (Var) of both sides, yields: Var (ZxRC) = Var (AB) [EQUATION J] Where variance (Var) is equal to (SD) 2 . Equation J may be expressed as Z 2 xVar (RC) = Var (AB) [EQUATION K] By taking the square root of both sides ZxSD (RC) = SD (AB) [EQUATION L] Which yields Z = SD (AB) / SD (RC) [EQUATION M] -^s_ε^ i-f ■ should be appreciated that the standard deviations of t means of the rib cage and abdomen signals is indicative of the average variability of those signals. Accordingly,1 any analysis that provides an indication of average variability of those signals may be used in lieu of computing standard deviations. , the proportionality constant Z for solution of Equation E can b calculated, assuming constant tidal volume breathing during baseline, from the ratio of the standard deviations of AB and R in a manner analogous to the isovolume manuver, but without the requirement that the airway be blocked. Of course, taking spirometry readings with a spirometer during baseline defeats an objective of the calibration technique in accordance with the invention, namely, to calibrat non-invasively. However, baseline constant tidal volume assumption required to practice the calibration technique of the invention without invasively recording actual tidal volumes can be satisfied by removing wild points from the 500 delta values of AB and RC computed during baseline as by eliminating values outside of 1. standard deviations of the uncalibrated sum of the RC and AB components. With those delta values excluded, the remaining delta values for RC and AB are separately totaled, the means determined, and the standard deviations for the means calculated. The proportionality factor Z can then be calculate from Equation M. Once the proportionality factor Z is known, the quantity (ZxRC)+ AB will always be proportional to actual tidal volume. See Equation E. This quantity can be continuously monitored on a real time basis from the real time rib cage and abdomen signals generated by the apparatus of FIG. 2. Preferably, this quantity is expressed as a percent of (ZxMean RC)+Mean AB where Mean RC and Mean AB are, respectively, the means of the totals of the uncalibrated RC and AB delta values generated at baseline, but exluding the wild points. This is sufficient for the bulk of diagnostic work, such as detecting obstructive and central apneas, hypoapeneas, and variations in tidal volume, t latter being important as a diagnostic tool in a wide variety disorders. initially been set to unity gain, once the proportionality factor Z is determined, the scaling amplifier 24 for the rib 10 cage is adjusted to Z. From Equation E, we then know that the sum of the signals from the scaling amplifiers at the output of 15 the summing amplifier 28 will be preportional to tidal volume. This completes the calibration procedure. While for most purposes a quantatitive determination of Z0 tidal volume is not necessary, quantitive calibration can be achieved once the proportionality factor Z is known. In 25 particular, referring to Equation D, by taking a single measurement of actual tidal volume V, the scaling factor M can be calculated, since ZxRC and AB are available, respectively, a 30 the output of the rib cage arid abdomen scaling amplifiers. In other words, there is then only a single unknown in Equation D, 35 the scaling factor M, which is calculated as: M = V/[(ZxRC)+AB] . [EQUATION N] One simple way to take a measurement of actual tidal volume is 40 to simply have the subject inhale a known quantity of air, as from a syringe. Before the subject inhales, this quantity is 45 input to the apparatus of FIG. 2 ' at the "spirometer", input. The microprocessor 34 can then perform the calculation of Equation N from the values of Z, RC and AB at the end of 50 inspiration from the syringe. The scaling factor M may be set in the FIG. 2 apparatus by 55 multiplying the gain of the summing amplifier 28 by scaling factor M, whereupon the output of the summing amplifier will b a semi-quantatitive indication of tidal volume. The term 60 semi-quantatitive is used because it has been determined that tidal volume computed in this fashion is ± 10% of actual tidal 65 volume as determined by spirometry. Desirably, the accuracy of the proportionality factor Z i continuously monitored by repeatedly recalculating the proportionality factor at five minute intervals and printing the resulting value. After the initial calibration procedure the recalculated value for the proportionality factor Z durin each subsequent five minute interval should be 1.0. In the event of a change in the position of the patient or other condition that varies the proportionality factor Z, that will exhibit itself as a reading of Z above or below 1.0. If thβ- variations are too large, i.e. if Z is less than about .7 or greater than about 1.3, the calibration routine can be rerun. Suitable visual or audio alarms can be incoporated in the apparatus of FIG. 2 to indicate such excessive variations. -18- jiϋrnoted above, the calibration technique in accordance wit the present invention is currently utilized in connection with an apparatus for monitoring respiration sold by Nims, Inc., Miami Beach, Florida, under their model designation Respigraph ™. The Respigraph incorporates a microprocessor. Preferably, the microprocessor is programmed to carry out the calibration technique in accordance with the present invention. A program listing for a suitable program for carrying out the calibration function appears below in Table A. The program is in assembly language for a Z80 microprocessor as manufactured zylog. Inc. FILE: QDC.ASM 1 . IDENT QDC .INSERT SP80.ASM .INSERT FPMAC.SRC .INSERT CALCOM, .ASM . INSERT CKCOM.i-.SM .INSERT -.ΓΓCCOM .INSERT SELCOM .ASM .INSERT VARCOM .CCC . INSERT GLQCOM .INSERT 3YC0M . INSERT PKCOM .INSERT EFFCOM .INSERT SIOCCM .INSERT HROCOM .EXTERN VALCOL,','ALFNO,TVON,SAVECL,LPON,LPOFF,TVOFF .EXTERN FIND .EXTERN 0ERIV5.PRTIME .EXTERN SAVECL .EXTERN UAL .ENTRY QDC1 ,QDC2,LQDC1 .ENTRY BASE .EXTERN RTON,RTOF,RTICK .EXTERN QDCAL,SYST,ANSOUT .EXTERN SRTINIT.SRTPLOT.EXEC .EXTERN LABEL .EXTERN TDHE .EXTERN PTRUPD,GETP2, ROUND FINIT QDC: iTHESE JUMPS MUST BE ■ HE 1ST THINGS: JMP QDC1 JMP QDC2 JMP VAL JMP LQDC1 JMP I30V1 JMP BASE QDC. SM IS0O1: XRA A STA BSEFLG MVI A,0FFH STA ISOFLG MVI A,0 STA UTFLG JMP QDCCOL BASE: M I A.OFFH STA BSEFLG MVI A.OFFH STA UTFLG XRA A STA ISOFLG JMP QDC3C0L QDC1 XRA A STA BSEFLG M I A,0 STA UTFLG STA ISOFLG JMP QDCCOL LQDC1 XRA A STA BSEFLG WI A,OFFH STA WTFLG RA A STA ISOFLG JMP QDCCOL QDCCOL: XRA A CMA STA QUALFLG 5QUALITATIVE XRA A STA BSEFLG FILE : QDC . ASM QDC3C0L : START THE DATA COLLECT I ON • <RA A STA VALFLG STA P0S1 iNOT IN SINGLE POSITION LXI H,0 SHLD NBERS ;* VALUES IN XVALUES -St YVALUES LXI H,0 SHLD TIME LXI H,0 SHLD MAXCNT LDA BSEFLG IF < .A, IS,ZERO ") jNOT COLLECTING BASELINE jINIT THE TRANSDUCESERS MVI A,10 CALL SYST ;THIS RESETS CALS TO 1 AND 1 SO AFTER THIS IS EXECUTED, ALL OTHER ; CALIBRATIONS ARE NULLIFIED XRA A STA CALTYPE STA LASTCAL jRIGHT NOW UNCALBRATED STA GQQDBASE jNO LONGER HAS GOOD BASELINE CALL LPON FPRN RES,RESPT CALL LPOFF ENDIF CALL SETUP CALL SRTINIT ; INIT RT. 1 LOOP CALL SRTPLOT LDA BFLG IF <.A, 1S.NZERO) ;UPDATE tt DELTAS AND ELAPSED TIME MVI A,3 STA OPCODE CALL ANSOUT ELSE LDA SECFLG IF < .A, ,IS,NZERO) MVI A,3 STA OPCODE F1LE: QDC. SM CALL ANSOUT LDA FLSHFLG DCR A STA FLSHFLG IF v. A,IS,ZERO) LXI H-TOPLFT+53 LDA BSEFLG IF < .A- IS, ERO) LDA ISOFLG IF < .i *, IS,ZERO ) LXI D.CLBMESS ELSE LXI D.ISOMESS ENDIF ELSE LXI D.BSEMESS ENDIF CALL LABEL MVI A,2 STA FLSHFLG ELSE LXI H.TOPLFT+53 LXI D,BLANKS CALL LABEL ENDIF Er : ENDIF LDA GFLG := OFFH THEN CLOCK iSTILL ON EXITIF ( .A-IS.ZERO) ENDLOOP NOW DATA COLLECTION PHASE HAS BEEN COMPLETED MAXCNT HOLDS THE NUMBER OF MAX POINTS COLLECTED IRSRV USES CHANNEL SPBUFF FOR DETECTIONS SPMAX HOLDS THE DELTAS FROM SPBUFF RCMAX HOLDS THE DELTAS FROM RCBUFF ABMAX HOLDS THE DELTAS FROM ABBUFF CLEAR THE SCREEN CALL TVON CALL TVOFF LDA BSEFLG IF (.A,IS,ZERO) LDA ISOFLG IF ..A,IS,NZERO) :TH1S WAS fit* ISOVOLUME MANUEVER JMP ISOCALC QDC . SM ENDIF ENDIF LHLD MAXCNT LXI 0,3 ORA A DS8C D IF <PSW, IS,CARFfl ') LDA UTFLG IF (.A, IS,ZERO) MVI A,l STA OPCODE iNOT ENOUGH DELTAS CALL ANSOUT MVI A,0 STA OPCODE iPRINT MENU ON SCREEN CALL ANSOUT ENDIF STC RET ENDIF THERE ARE 2*<MAXCNT -1. ) FLOATIND PT VALUES IN XV-LUES AND YVALUES FOR THIS RUN LHLD MAXCNT SHLD NBERS jTOTAL » STORED CALL QDCAL RETURN WITH CARRY SET IF BAD FOR ANY REASON ORA A MVI A,0 STA OPCODE ;PRINT MENU ON SCREEN CALL ANSOUT RET ISOCALC: LDA WRAPF IF (.A, IS.NZERO) ; ; ' THEN 400 PTS AND RIPT PTS TO 1ST jDATA PT LI H,400 SHLD CNT LHLD RIPT SHLD ROPT ELSE ;TIME HOLDS * OF DATA POINTS AND 1ST PT AT OFFSET = 0 LHLD TIME SHLD CNT FILE: QDC. ASM LXI H,0 SHLD ROPT ENDIF FFOA 0 FSTA XSUM FSTA YSUM FSTA XXSUM FSTA XYSUM FSTA XCNT CALL GETX CALL GETY CALL XYPAIR LHLD ROPT LXI B.RSIZE CALL PTRUPD SHLD ROPT DSKZ CNT,L00P1 CALL LSTFIT FLDA SLOPE FABS FSTA ABCAL FFOA 1 FSTA RCCAL ; PRINT IT ON SCREEN MVI A, STA OPCODE CALL ANSOUT CALL SAVECL IF (PSU ,1S,NCARRY ) ;THEN GOOD VALUES MVI A, 3 ;ISOV QUAL STA CALTYPE MVI A,0FFH STA LASTCAL ;G00D CALIBRATION XRA A CMA STA QUALFLG CALL LPON CALL PRTIME FPRN ISV.ISVPT CALL LPOFF ORA A ENDIF RET FILE: QDC. SM ISV: .ASCIS ' QUALITATIVE ISOVOLUME CALIBRATION RCCAL = 3D3 ABCAL = 3D3 ISVPT: .WORD RCCAL, A8CAL GETX: LXI H,ABBUFF LDED ROPT DAD D MOV E,M I NX H MOV D,M SDED XVAL FILA XVAL FLOT FSTA XVAL RET GETY: LXI H,RCBUFF LDED ROPT DAD 0 MOV E,M I NX H * MOV D,M SDED YVAL FILA YVAL FLOT FSTA YVAL RET XYPAIR: FLDA XVAL FLCfB XSUM FAOO FSTA XSUM FLDB YVAL FLDA YSUM FADD FSTA YSUM FLDB XVAL FLDA XVAL FMUL FLDB XX SUM FADD FSTA XXSUM F1LE: QDC. SM FLDB XVAL FLDA YVAL FMUL FLDB XYSUM FADD FSTA XYSUM FLDB XCNT FFOA 1 FADD FSTA XCNT RET LSTFIT: FLDA XSUM FLDB XSUM FMUL FPSH FLDA XCNT FLDB XXSUM FMUL FSWP FPOP FSUB FPSH FLDA XSUM FLDB YSUM FMUL FPSH FLDA XCNT FLDB XYSUM FMUL FSWP FPOP FSUB FSWP FPOP FDIV FSTA SLOPE RET QDC2: ;THIS CAN BE DONE AFTER EITHER A QDC1 (CALTYPE = 1/2) ; OR AFTER AN ISOVOLUME (CALTYPE = 3/4) {IF CALTYPE = 0, THEN H-AVEN'T CALIBRATED THE RC TO A8 FIL£.: QDC. ASM LDA CALTYPE IF < .A,IS,ZERO) MVI A,2 STA OPCODE CALL ANSOUT RET ENDIF * • NOW COLLECT DATA AS IF VALIDATING CALL υALCOL LHLD MAXCNT LXI 0,2 ORA A DSBC D IF CPSU ,IS,CARI ;THEN LESS THAN 2 BREATHS MVI A,l STA OPCODE CALL ANSOUT MVI A,0 STA OPCODE ;PRINT MENU ON SCREEN CALL ANSOUT RET ENDIF jNOU FIND THE RATIOS OF SUM/KNOWN VOLUME CALL VALFND jRETURNS WITH AREG=* OF VALUES USED IN SUMMATION FSTA FCNT NOW XVALUES HOLDS ALL OF THE RATIOS, XSUM ' HOLDS SUM OF ALL XVALUES XXSUM HOLS SUM OF SQUARES OF ALL XVAUES, AND FCNT HOLS THE NUMBER OF VALUES USED IN THE SI_m.TION COMPUTE THE MEAN RATIO FLDB XSUM FLDA FCNT FDIV FSTA MEAN jNOU KNOU THAT SUM NEEDS TO BE MULTIPLIED BY 1/MEAN, SO RCCAL = CURRENT RC GAIN (RCGNF) * 1/MEAN ABCAL = CURRENT AB GAIN (ABGNF) * 1/MEAN FFOA 1 FATB FLDA MEAN FDIV FLDB RCGNF FMUL FSTA RCCAL FFOA FILE: QDC . ASM FATB FLDA MEAN FDIV * FLDB ABGNF FMUL FSTA ABCAL MVI A,4 STA OPCODE CALL ANSOUT CALL SAVECL IF (PSW ,IS,NCARRY) ;THEN GOOD CALL LPON CALL PRTIME FPRN VL2.VL2PT CALL LPOFF LXI H,0 SHLD NBERS XRA A STA QUALFLG jNOT QUALITATIVE, IT I S QUANTITATIVE CAL LDA CALTYPE I F ( .A , LT , 3) ;THEN QDC METHOD MVI A , 2 ;NOU ITS QDC QUANT STA CALTYPE MVI A , 0FFH STA LASTCAL i GOOD CAL ELSE ; I SOVOLUME METHOD MVI A, STA CALTYPE ;NOT ITS 130V QUANT MVI A,OFFH STA LASTCAL ;GOOD CAL ENDIF MULT THE CURRENT VALUE OF VTLIMIT BY l/MEAN SO WILL 8E SCALED OK NOTE: VTLIMIT IS INITIALLY SET WHEN DOING QDC1 THIS IS FOR INITIALLIZING THE HYPOPNEA VOLUME FOR THE 1ST 5 MINUTES: FLDB VTLIMIT FLDA MEAN FDIV FSTA VTLIMIT ********* ■ »***•»*•»#*********#*********»**********#** • »****♦*****#* PROBLEM: WHAT IF DID ISOVOLUME BEFORE HERE, THEN VTLIMIT WAS NOT EVER INITITALIZED ???? a**************************************************** ENDIF -29- FILE: QDC. SM ;MVI A,0 ;STA OPCODE ;PRINT MENU ;CALL ANSOUT RET VL2: .ASCIS • ' QUANTITATIVE CAL FACTORS RC CAL = 3D3 AB CAL = 3D3 VL2PT: .WORD RCCAL, BCAL NOTE: MCA VALUES OF RCINVOL, ABINVOL, AND SMVOL WILL BE STORED BEGINNING AT ADDR = XVALUES XVALUES + YVALUES = lόOO BYTES I WILL STORE UP TO 1500 BYTES == > 500 DELTAS = 250 INSP DELTAS * ό BY7 . = 1500 BYTES MCAADDR = ADDRESS OF NEXT TO STORE SETUP: THIS IS ONLY USED WHEN CALIBRATING QDC METHOD SETUP THE CLOCK SAMPLE AT 20 PTS PER SEC PUSH H IN1T REAL-TIME BUFFER POINTERS MODIFIED 09-24-81 FOR PEAK FLOWS: LXI H.DLTIMES SHLD TMPTR LXI H,0 SHLD TTPOS SHLD TTNEG SHLD TEMPK SHLD TTPTM SHLD TTNTM SHLD PKTIME LXI H,0 SHLD DLT1PTR (OFFSET T XRA A STA DLTFULL :DELTA RI FILE: QDC. SM STA FSTMN LXI H,XVALUES ;UILL USE THIS BUFFER TO SHLD MCAADDR ;MCA VALUES LXI H,0 SHLD SPTEMP XRA A STA FRSTMX ; 1ST MAX NOT FOUND LXI H,TMBUFF MVI M,0 INX H MVI M,0 MVI A,2 STA FLSHFLG XRA A STA WRAPF STA SECFLG CMA STA BFLG LXI H-,0 SHLD ELPTM SHLD ELPMIN SHLD SECONDS LXI H,0 SHLD RIPT SHLD ROPT SHLD ODRIPT LXI H,0 SHLD TIME VARIABLES FOR PIC XRA A STA MAXB STA PTF jjSTART BY LOOKING FOR MAX PT STA SLOPEF ;,INIT MAX NOT FOUND XRA A STA INTFLG CMA STA GFLG ; {INDICATES CLOCK ON LXI H,IRSRV CALL RTON : {TURN ON CLOCK POP -31- FILE. QDC.ASM RET CLKSTP: jSTOP DATA COLLECTION jTURN CLOCK OFF • MODIFIED 09- ■ 24-81 CALL RTOF ;TURN OFF CLOCK XRA A STA GFLG POP D POP H POP B POP PSW RET IRSRV: ; INTERRUPT SERVICE ROUTINE PUSH PSW PUSH B PUSH H PUSH D CALL RTICK jSERVICE INTERRUPT ' LDA INTFLG IF ( .A, IS,NZERO) {THEN INTERRU NOP ELSE CMA STA INTFLG ;SET FLAG ENDIF i * LHLD ELPTM INX H SHLD ELPTM LDED SFREQ CALL TDHE IF (PSW ,IS,ZERO) {THEN 1 SECON LXI H,0 SHLD ELPTM LHLD SECONDS 1NX H SHLD SECONDS XRA A FILE: QDC. SM CMA STA SECFLG LXI 0,60 CALL TDHE IF (PSW,IS,ZERO) ;THEN 1 MINUTE LXI H,0 SHLD SECONDS LHLD ELPMIN INX H SHLD ELPMIN jIF COLLECING BASELINE : THEN STOP AT 5 MINUTES LDA BSEFLG IF (.A,IS,NZERO) LXI D,5 LHLD ELPMIN CALL TDHE IF (PSW ,IS,ZERO) JMP CLKST ENDIF ELSE WHILE CALIBRATING: IF REACH 10 MINUTES BEFORE 50. DELTAS, THEN AUTOMATICALLY STOP LXI D, 10 LHLD ELPMIN CALL TDHE IF ( PSW, IS, ZERO) ;HAVE REACHED 10 MINUTES JMP CLKSTP ENDIF ENDIF ENDIF ENDIF ALWAYS COLLECT RC INTO RCBUFF, AB INTO ABBUFF, NOTE: ALWAYS USES DATA IN SPBUFF FOR DETECTION LHLD RCAD ;R1B CAGE VALUE MOV A,H CMA ANI OFH MOV H,A MOV A,L CMA MOV L,A SHLD DATA SHLD RCV FILE: QDC. SM LHLD RIPT LXI D,RCBUFF CALL PRNG LHLD ABAD jABDOMEN VALUE MOV A,H c ANI OFH MOV H,A MOV A,L CMA MOV L-A SHLD DATA SHLD ABV LHLD RIPT LXI D.ABBUFF CALL PRNG | SUM INTO SPBUFF— TO PICK OFF BREATHS LHLD RCV LDED ABV DAD 0 SHLD DATA LHLD RIPT LXI D,SPBUFF CALL PRNG INCREMENT RIPT FOR NEXT TIME LHLD TIME INX H SHLD TIME SHLD DATA LHLD RIPT LXI D.TMBUFF CALL PRNG LHLD RIPT SHLD ODRIPT LXI B,RSIZE LHLD RIPT CALL PTRUPD SHLD RIPT FILE: QDC. ASM LDA WRAPF IF ( .A, IS, ZERO) {SEE IF RIPT RESET TO 0 LXI D,0 LHLD RIPT CALL TDHE IF (PSW, IS, ZERO) MVI A,0FFH STA WRAPF ENDIF ENDIF LDA BSEFLG IF .A, IS,ZERO) LDA ISOFLG IF (.A,IS,NZERO) {THEN NO PEAK DETECTION JMP EXIT ENDIF ENDIF LDA SLOPEF IF (.A, IS,ZERO) ;THEN INIT POINTS NOT COLLΞITED YET CALL GETP2 ;RETURNS C IF < 5 PTS IN B'.-FER • THIS JUST MAKES S.RE EXTRA ;POINTS IN BUFFER JC EXIT {NOT ENOUGH POINTS IN BUFFER NOTE: GETP2 INITIALLIZES ROPT TO LINE UP WITH DERIV STUFF SKIP 1ST 3 POINTS IN 8UFFER LXI H,ό iOFFSET POINTING TO POINT 4 SHLD ROPT fxVI A.OFFH STA SLOPEF ENDIF CALL DERIV5 ♦ ■ a******************************* MUST ADD THE CODE TO DO PEAK DETECTION HERE TOO ! ! LDA FRSTMX IF (.A,IS,ZERO) {HAVE NOT FOUND 1ST MAX POINT FILE: QDC.ASM LHLD ROPT CALL FIND IF (PSW,IS,NCARRY ;N A MAX JMP OUTER ENDIF HAVE 1ST MAX LDA FRSTMX CMA STA FRSTMX SHLD SPTEMP iTEMP CRΠ POINT SDED RCTEMP SBCD ABTEMP LDA PTF CMA STA PTF ;NOW LOOK FOR MIN JMP OUTER ENDIF LHLD ROPT CALL FIND IF (PSW, IS,CARRY) SHLD SPVALUE SDED RCVALUE SBCD ABVALUE LDA PTF IF (.A, IS,ZERO) ;i " THIS IS A MAX POINT LHLD RCVALUE SHLD RCMXVAL LHLD ABVALUE SHLD ABMXVAL CALL DLTSTORE iONLY STORE THE MCA VARIABLES AT A MAX (ONLY WANT FOR INSP) CALL MCASTORE {IF DLTIPTR = 1000, THEN EXIT LHLD DLTIPTR LXI D, 1000 CALL TDHE IF (PSW , IS,ZERO) MVI A,0FFH STA DLTFULL LXI H,0 SHLD DLTIPTR JMP CLKSTP ENDIF ELSE iTHIS IS MIN POINT LHLD RCVALUE SHLD RCMNVAL P1LE-. QDC .ASM LHLD ABVALUE SHLD ABMNVAL LDA FSTMN IF ( .A,IS,NZERO) iTHIS IS THE 1ST MIN, DO NOT STORE LDA FSTMN CMA STA FSTMN ELSE iSTORE THE DELTA CALL DLTSTORE IF DLTIPTR = 1000, THEN EXIT LHLD DLTIPTR LXI D.1000 CALL TDHE IF (PSW,IS,ZERO) MVI A.OFFH STA DLTFULL LXI H,0 SHLD DLTIPTR JMP CLKSTP ENDIF ENDIF ENDIF LDA PTF CMA STA PTF ENDIF - OUTER: UPDATE ROPT FOR NEXT TIME LHLD ROPT LXI B-RSI2E CALL PTRUPD SHLD ROPT EXIT: LOOK FOR ENTER CALL CSTS IF ( PSW,IS,NZERO) CALL CINP IF ( .A,EQ,0DH) j IF ENTER JMP CLKSTP ENDIF ENDIF XRA A FILE: QDC . ASM STA INTFLG POP D POP H POP B POP PSW RET « MCASTORE: LHLD MCAADDR LDED RCINVOL MOV M.E INX H MOV M,D INX H LDED ABINVOL MOV M,E 1NX H MOV M,D INX H LDED SMVOL MOV M,E INX H MOV M,D INX H SHLD MCAADDR RET DLTSTORE: LHLD RCMXVAL LDED RCMNVAL ORA A DSBC D ;HL = INSP * VOLUME ;RC SHLD RCVALUE DELTA RC LHLD DLTIPTR OFFSET TO STORE LXI D,RCDATA DAD D LDED RCVALUE MOV M,E INX H MOV M,D LHLD ABMXVAL LDED ABMNVAL ORA A DSBC D iHL = INSP VOLUME ;AB SHLD ABVALUE {DETLA AB LHLD DLTIPTR {OFFSET TO STORE LXI D.ABDATA FILE: QDC.ASM DAD D LDED ABVALUE MOV M.E INX H MOV M,D LHLD DLTIPTR INX H INX H SHLD DLTIPTR LHLD MAXCNT INX H SHLD MAXCNT XRA A CMA STA BFLG {STORE THE TIMES LHLD TMPTR LXI D,DLTEND CALL TDHE IF (PSW , IS,ZERO ) 5NO ROOM RET ENDIF LHLD TMPTR LDED CPTIME {TIME OF THE CP MOV M,E INX H MOV M,D INX H LDED PKVALUE {TIME OF THE PEAK FLOW MOV M,E INX H MOV M,D INX H SHLD TMPTR {FOR NEXT TIME RET PRNG: I {HL HOLDS THE RING INPUT PTR {DE HOLDS ADDR OF RING DAD D LDED DATA MOV M,E INX H MOV M,D RET ISOMESS: . .AASSCCIS 'Isovolume' BSEMESS: ..AASSCCIS 'Baseline-' RLE: QDC .ASM CLBMESS: .ASCIS 'Cal i brat i ng-' BLANKS: .ASCIS ' RES: .ASCIS / AT 31:31:31 Cal -.actor. reset to 1 and 1 RESPT: .WORD HOUR,Mir* J.SEC .EXTERN QDCOM .LOC QDCOM MAXB: .BLKB 1 RCCU .8LKB 2 ABCU .BLKB 2 3PCU .BLKB 2 RC : .BLKB 2 ABV: .BLKB 2 MEAN: .BLKB 4 FCNT: .BLKB 4 FRSTMX: .BLKB 1 RCMXVAL: .BLKB 2 RCMNVAL: .BLKB 2 A3MXVAL: .BLKB 2 ABMNVAL: .BLKB 2 FSTMN: .BLKB 1 FLSHFLG: .BLKB 1 ISOFLG: .BLKB 1 -(CNT: .BLKB 4 QDCEXTRA: .BLKB 9 {EXTRA LOCS .RELQC .END QDC .IDENT QDCAL .INSERT FPMAC.SRC .INSERT SP80 FINIT .INSERT VTCCOM .INSERT CALCOM .INSERT OLQCOM •INSERT CKCOM .INSERT VARCOM.CCC .INSERT SYCOM .INSERT EFFCOM .INSERT SIOCOM .INSERT QDl . SM .INSERT PKCOM .EXTERN CMPSTATS .ENTRY QDCAL .EXTERN TDHE.ROUND .EXTERN SAVECL.ANSOUT,LPON, POFF .ENTRY V2 5SO CAN LOOK AT MAP! .EXTERN PRTI E .EXTERN WT3AVECL .EXTERN TV Q N.TUOFF QDCAL: LDA BSEFLG IF .A.IS.NZΞRO) {BASELINE JMP 8C0MP ENDIF {ENTERED HERE. THEN IN CALIBRATE MODE (NOT LONG TERM' CALL CMPSTATS RC {CARRY SET IF BAD CAL ;BECAUSE NOT ENOUGH DATA COLLECTED iA8CAL = RCSTD / ABSTD FLDB RCSTD FLDA ABSTD FDIV FSTA ABCAL {RCCAL = 1 FFOA 1 FSTA RCCAL I {MUST STORE THE GAINS, BECAUSE RESCALE ASSUMES 30 !! LDA WTFLG FILE: QDCAL. SM IF .A,IS,ZERO) :UANT TO PRINT ERROR CODE IF BAD CALL SAVECL ELSE CALL UT3AUECL ENDIF IF ■ PSW, IS,CARRY ) ;THEN BAD CALS MVI A.O iNO GOOD CALIBRATION (WHEN 3E3-N THIS RUN, »E3E T BTA CALTYPE ;CAL3 TO 1 AND 1 MVI A,0 STA LASTCAL iNO GOOD CAL STA G00DBA3E : Q GOOD BASELINE NOW {PRINT OUT WHAT THE SAO CALS WERE AND THE STQS CALL BDCALS STC iBAD CALS N CALL PESCALΞ LDA WTFLG IF ' s . , IS,ZERO) MVI A-4 STA OPCODE CALL ANSOUT IDISPLAY THE CALS ON THE ■ QR ENDIF LDA WTFLG IF ( .A, IS,ZERO) iWANT TO PRINT ERROR CODE Ii ?AD CALL SAVECL ELSE CALL WTSAVECL ENDIF IF (PSW .IS.NCARRY) ;THEN GOOD CALS CALL LPON CALL PRTIME FPRN V1.V1.PT CALL LPOFF CALL CMPMCA ; COMPUTE MCA AT CALL LPON FPRN V2-V2PT CALL PRTHYP CALL LPOFF MVI A,l ;QDC QUAL STA CALTYPE MVI A,OFFH STA LASTCAL ORA A {GOOD CALS ELSE MVI A,0 ;N0 GOOD CALIBRATION (WHEN BEGAN THIS RUN, RESET STA CALTYPE iCALS TO 1 AND 1 FILE: QDCAL.A MVI A.O STA LASTCA ;N0 GOOD CAL STA GOODBASE ;N0 GOOD BASELINE OW iPRINT OUT -4 HT THE BAD CALS WERE AND THE CALL BDCALS FFOA 1 FSTA RCCAL FSTA ABCAL CALL MPMCA iϋMPUTE MCA/ 1 CALL LPON FPRN V2-V2P " CALL PRTHYP CALL TXTYP CALL LPOFF STC -0 CALS ENDIF RET BDCALS! CALL LPON LXI H.STARS ' CALL TXTYP CALL PRTIME FPRN 8ADCBA0PT CALL LPOFF RET PRTHYP: FPRN HYP.HYPPT LDA QUALFLG IF CA-IS.NZERO. ;QUAL LXI H.RHYP ELSE jQUANT LXI H,AHYP ENDIF CALL TXTYP RET BCOMP: HIS COMPUTE MEAN VT AND IF I30V WAS QUALITATIVE, CALT"?E = 3, THEN IT SCALES IT TO VTMA 10 FILE: QDCAL. ASM CALL CMF 3 STATS IF (PSW ■IS -ZERO ) iNOT ENOUGH DATA XRA A STA GO 1 .DB SE iNOT A GOOD BASELINE STC RET ENDIF -r-l_ >E3CAL= i τ HIS WILL u GE --ALL-E OF RCCAL AND ECAL DA L T' F iSAVE CALS ,-NOW MUST USE THE ■ " ■ EAN M EASURED ~ " SCALE HE CAL FAC'-JRS SO ; MEAN = VTMX 1D . IF (PSU,IS,NCAPR V) {THEN GOOD CALS "!V: A,5 ilSC-QUAL WITH BASELINE ._ STA__ L" ' *oE MVI ,0FP» STA LASTCML i OOD CAL CALL -PON CALL PRTIME FPRN B31 ,BS1PT CALL LPOFF CALL CMPMCA {COMPUTE MCri/VT CALL LPON CALL PRTHYP CALL LPOFF MVI A.OFFH STA GC0D8ASE {GOOD SASSLINE ■• -^fJA-A- " {GOOϋ CALS ELSE FFOA 1 FSTA RCCAL FSTA A8CAL CALL CMPMCA jCOMPUTE MCAAT CALL LPON LXI H, STARS CALL TXTYP CALL PRTIME FPRN 3SBAD,BSBPT FPRN V2.V2PT CALL PRTHYP LXI H, STARS CALL TXTYP CALL LPOFF MVI A,0 STA GOODBASΞ ;8AD BASELINE FILE: QDCAL.ASM STC iBAD CALS ENDIF CALL PPTIME FPRN 533.3S3PT CALL i _r,s: iCALS DO NOT CHANGE FFOA 1 FSTA RCCAL FSTA A3CAL CALL P C ;COMPUTE MCA/VT CALL LPON FPRN 2, PT CALL PRTHYP CALL 1 =ΌF? MVI A.QF'H STA GOODBASE iSOOO BASELINE ORA A ;GQQD CALS ELSE IF (.A,EQ,7) ;T--PED IN CALS, QUANT, JUS "" GETTING BASELINE STUFF LDA QUALFLG IF ( .A,IS, ERO' CALL PON CALL PRTIME FPRN B BP7PT CALL LPOFF {CALS DO NOT CHANGE FFOA 1 FSTA RCCAL FSTA ABCAL CALL CMPMCA ;COMPUTE MCA/VT CALL LPON FPRN ■ V2-V2PT CALL PRTHYP CALL LPOFF MVI A.OFFH STA GOODBASE iGOOD BASELINE ORA A {GOOD CALS ELSE ;TYPED IN CALS,QUAL 30 WILL CHANGE CALS SAVE CALS NOW MUST USE THE MEAN VT MEASURED TO SCALE THE CAL FACTORS SO MEAN VT = VTMX/10 \ CALL WTSAVECL IF (PSW,I3,NCARRY> ;THEN GOOD CALS CALL LPON FILE: QDCAL. ASM CALL PRTIME FPRN V?,'.7PT CALL LPOFF CALL CMPMCA ; COMPUTE MCA VT CALL LPON CALL PRTHYP CALL LPOF P ■ " ■ VI A, ,QPPW 5TA GOCDBMS Ξ iGOOD BASELINE ORA A ;__3D CALS ELSE F=OA 1 " STA ABCAL CALL CMPMCA ; COMPUTE MCA/'-T CALL LPON CALL P° T IME FPRN 3S8AD.3S8PT CALL PR T H(P CALL _ 3 :FF MVI A ,0 STA G( .ODBAS ■ E iBAD BASELINE STC :BAD CALS ENDIF : • * • * ENDIF ENDIF ENDIF END IP SET I CMPMCA: COMPUTE MEAN MCA/VT MUST REMEMBER THAT ALL RC VALUES MUST BE MULT BY RCCAL AND ALL A8 VALUES MUST BE MULT BY A8CAL NOTE: WILL NOT BE ABLE TO COMPUTE MCA/VT THE CLEAN WAY OF USING THEN SUM OF THE SUM'S DERIV BECAUSE THE THE CAL ^ACTOR PROBLEM SO WILL HAVE TO DIVIDE BY RC DELTA « RCCAL + AB DELTA * ABCAL LXI H, VALUES SHLD ADDR1 LDA DLTFULL IF ( .A,IS,NZERO; ;FULL LHLD DLTIPTR SHLD OFFSET ELSE LXI H,0 SHLD OFFSET ENDIF FFOA 0 FSTA VTSUM FSTA MCASUM FSTA XCNT LOOP LHLD ADDR1 LDED MCAADDR CALL TDHE IF PSW , IS,ZERO) RET ENDIF iGET :A VALUE LHLD ADDP1 OV E,M INX H MOV D,M SDED RCMCA INX H MOV E.M INX H MOV D,M SDED ABMCA INX H MOV E.M INX H MOV D,M SDED SMMCA INX H SHLD ADDR1 FILA ■RCMCA FLOT FLDB RCCAL FMUL FPSH FILA A8MCA FLOT FLDB ABCAL FMUL FAT8 FPOP FADD FAT8 FFOA 15 iBECAUSE OF 9 PT DERIV 60 5/4 BECAUSE OF DIVISION WHEN COLLECTED FDIV FLDB CCS FILE: QDCAL. ASM FMUL FSTA MCAVALUE ■ GET VT VALUE LHLD OFFSET LXI O.RCDATA DAD D MO 1 -., 1 E.M INX H MOV D.M '_">*** r ! FRC LHLD OFFSET LXI D .ABDATA DAD 0 MOV E.M INX ■ H MOV D.M SDED FAB FILA FRC FLOT FLDB RCCAL FMUL FPSH F L FAB FLOT C LDB ABCAL- FMUL FAT3 FPOP FADD FLDB CCS F MUL FSTA VTVALUE jMCASUM = SUM OF MCAVALUE, ' 'LVALUE FLDB MCAVALUE FLDA VTVALUE FDIV ilF 1 , THEN MAKE = 1 FPSH FATB FFOA 1 FSUB FT ST AREG,LT IF (PSW , IS, ZERO) FPOP FFOA 1 ELSE FPOP FILE: QDCAL.ASM ENDIF FLDB MCASUM FADD FSTA MCASUM FLDB VT-'AL'JE FLDA VTSUM FADD FSTA VTSUM FLDB XCNT FFOA 1 FADD FSTA XCNT LHLD OFFSET INX INX H SHLD OFFSET LDED DLTIPTR CALL TDHE IF (PSW , IS,ZERO RET ENDIF NOW OFFSET POINTS TO EXP DELTA- LHLD OFFSET INX H INX H SHLD OFFSET LDED DLTIPTR CALL TDHE IF (PSW , IS,ZERO) RET ENDIF ENDLOOP * 1 i FLDB VTSUM FLDA XCNT FDIV FSTA VTVALUE FLDB MCASUM FLDA XCNT FDIV FSTA MCAVT , ! iMEAN MCA/VT = MEAN MCA FILE: QDCAL.ASM FLDB MCAVALUE FLDA VTVALUE FDIV ilF 1 , THEN SET = 1 FPSH FATB FFOA 1 FSUB r~~ zST APEG.LT IF (PSW ,13,ZERO ) FPOP FFQA 1 ELSE FPOP ENDIF FSTA MCAVT COMPUTE THE MEAN VALUE OF -. TIME τ 0 PEAK INSP PLOW AND MEAN VALUE OF ". T IMΞ TO PEAK EXP FLOW LHLD TMPTR LXI D.DLTIMES CALL TDHE IF (PSW ,13,ZERO: iNGNE LXI H.O SHLD PCNUMBERS RET ENDIF FFOA 0 FSTA PKISUM FSTA PKESUM FSTA TISUM LXI H,0 SHLD PCNUMBERS LXI H-DLTIMES SHLD ADDR1 .ununro MAKE SURE THAT ADDR1+10< TMPTR LHLD ADDR1 LXI D, 10 DAD D LDED TMPTR ORA A DSBC D IF (PSW ,IS,NCARRY THEN ALL DATA NOT τ '-iEPE RET ENDIF {ASSUME THAT ADDR1 PT3 TO MINI LHLD ADDR1 MOV E,M INX H MOV D.M SDED TMINl { GET PKE, Mf=iX, PKI , Ml !N2 VALUES INX H MOV E.M" INX H MOV D.M SDED PKE ;F.F. LAST BREATH INX H MOV E.M H OV D.M SDED TMAX INX H MOV E.M INX H MOV D.M SDED PKI INX H SHLD ADDR1 i'ΞO NEXT TIME ADDR1 MOV E,M INX H MOV D,M SDED TM1N2 T\ | V u MOV E.M INX H MOV D.M SDED PKE {FOR THIS BREATH TO PEAK INSP FLOW = (PKI-TMINl " .- -' .'MA. ΓM T W I I * ' dr.'.- LHLD TMAX LDED TMINl ORA A SHLD TTΞMP LHLD PKI LDED TMINl ORA A DSBC D SHLD TT2EMP FILA TT2EMP FLOT FATB FILA TTEMP FLOT FDIV FATB FFOA 100 FMUL TO PEAK INSP FLOW FLDB PKISUM FADD QDCAL .ASM FSTA PKISUM y. T TO PEAK EXP FLOW: * :PKE-TMAX) ' TMIN2-TMAX) • * 100 LHLD PKE LDED MrtX C' RA - DS3C D SHLD TTEMP LHLD TM IM2 LDED TMA.< _ O ~ SHLD TT2EM >- , "C P FATB ' . .-i ■ ; ^ l£zz^rPr FLOT - I ' - ■ ' FATB FFOA 100 FMUL PEAK EXP FL 'U " L- 3 P-Ε3UM ■ 3 ~ "A Pi-ESUM ϊTI = T MA - TMINl / 3FREQ LHLD TMAX uDE TMINl ORA A DSBC D SHLD T TEMP FILA TTEMP FLOT FATB FILA SFREQ FLOT FDIV ;AREG = Tl * FLDB TISUM FADD FSTA TI3UM LHLD PCNUMBERS INX H SHLD PCNUMBERS ENDLOOP FLDB PKISUM FILA PCNUMBERS FLOT . FDIV F3TA PK1AVG FLDB PKE3UM FILA PCNUMBERS FLOT FDIV rM_HV_ FLDB TISUM FILA PCNUMBERS PLOT 5=J f LDA QUALFLG IF ( .A,IS,ZERO. ;QUANT 30 IN ML FLDA VTLIMIT FSTA riYPOPV iHYPOP IN ML ELSE iQUAL SO PRINT IN TERMS OF FLDB VTMX F= A 10 FDIV iAREG = CONTROL VALUE IN ML FLDB VTLIMIT iHYPOP VOL'JME IN ML FDIV FATB FFOA 100 FMUL FSTA HYPOPV jHYPOP IN OF CONTROL ENDIF RET STARS: .ASCIS ' FILE: QDCAL.ASM 8SBAD: .ASCIS ' « • * BAD ISOVOLUME SCALING CALIBRATION: TRYED TO SCALE TO 3D3 ML RETRY WITH Y-SCALING AT LOWER VALUE ' 8S3PT: .WORD ONEHUNO 3ADC: .ASCIS *** BAD QUALITATI ' ■Ε CALI3RA T RC STD = 3D3 AB STD 3D3 ϋ DELTAS = 301 MEAN RC = 3D3 MEAN AB = 3D3 3ADPT: .WORD RCST: I :NT,FRC,F 8 BASELINE: QUALITATIVE 30V0LUME CALIBRATION: From 3D1 del Us: RC CAL = 30-3 AB CAL = 3D3 Breathing. Freq = 3D3 Bths/min 8S3: ,ASCIS ' BASELINE WITH QUANTITATIVE ISOVOLUME CALIBRATION: Breathing Freq = 3D3 Bths/min 333PT: .WORD FREQCONTRL BS7: .ASCIS ' BASELINE WITH GAINS TYPED IN QUANTITATIVELY Breathing Freq = 3D3 Bths/min FILE : QDCAL . ASM 8S7PT: .WORD FREQCGNTRL Ul: .ASCI3 ' QUALITATIVE CALISRATION: From 3D1 _ei _s: RC CAL = 3D3 AB CAL = 303 3reathrng Freα = 303 Bths/min 7: .ASCIS • ' BASELINE WITH GAINS TYPED IN QUALITATIVELY From 3D1 de! tas: RC CAL -= 303 A3 CAL -= 3D3 areathing Freq = 3D3 Bths/min 111, .Ab ' Lii From 3D1 breaths: Mean MCA/VT = 3D3 Mean XT PK INSP FL = 3D3 V. Mean XT P* Ξ. - -L = 303 Mean Tl = 3D3 sec HYP: .ASCIS ' Hypopnea volume = 3D3 AHYP: .ASCIS -'ml RHYP: .ASCIS "λ o+ basel ine HYPPT: .WORD HYPOPV 831=- V7PT: V1PT: .WORD XCNT,RCCAL,ABCAL .WORD FREQCONTRL ϊ V2PT : .WORD -(CNT •WORD MCAVT FILE: QDCAL.ASM .WORD PKIAVG.PKEAVG .WORD TICONTROL RESCALE -LD VTMX F S T A CNEHL ' MD j ' HIS T HE THE VOLUME SCALING TO iCOMPUTE THE ' ■■ REG. 30 CAN COMPUTE THE VMIN F3R CONTROL FI A SECONDS FLOT FATS FFCA .0 FDIV FATB F LA ELPMIN FLOT FADD iARΞG = •* MINUTES FOR COLLECTION pςy LHLD MAXCNT ;-t CF DEL'AS SRAR H ARP L ;MAXCNT/2 == * SREAT ' -S SHLD ITEMP FILA 1TEMP FLOT FATB ;# 3REATHS F 3 OP !» MINUTES FDIV FSTA FREQCONTRL FLDB ONEHUND ;100 V. VOLUME FLDA FREQCONTRL ;FREQ FMUL FSTA VMINCCNTRL iVMIN OF . GtJNTROL FLDA CCS FMUL FSTA MEAN iMEAN VT IN ML LDA QUALFLG I F ( .A . I S .N2ER0. ) i QUALITAT IVE FI E: QDCAL.ASM SO INIT VTLIMIT TO ONEH ND * VTPCL FLDB VTPCL FFOA 100 FDIV FLDB CNEHUND FMUL FSTA VTLIMIT !*R HYPOPNEA DETECTION ELSE QUANTITATIVE, USE MEAN T INSTEAD OF ONEHUND FLDB VTPCL .-"'vA 100 FDIV FLDB MEAN iMEAN VT IN ML FMUL FSTA VTLIMIT ;? R HYPOPNEA DETECTION ENDIF FLDB VTMX FFOA 10 FDIV FLDB MEAN FSWP FDI i ;RRAATT10 OF ' ' VTMX/10) / MEAN VT FSTA M1EEAANN iRCCAL = CURRENT RC GAIN (RCGNF. * MEAN iASCAL = CURRENT AB GAIN T.3GNF) * MEAN FLDA MEAN FLDB RCGNF ;CAL FROM INITIAL CALCS FMUL FSTA RCCAL * FLDA MEAN FLD8 ABGNF ;CAL FROM INITIAL CALCS FMUL FSTA ABCAL * {NOW THE CAL FACTORS ARE SCALED SO VTMX 10 WILL APPEAR AS 100 V. DURING i LONG TERM RET .EXTERN QD2 .LOC QD2 RCMCA: .BLKB 2 ABMCA: .BLKB 2 SMMCA: .BLKB - ADDRl: .8LKB 2 MCAVALUE: HYPOPV: .3LKB 4 1 .1 ! FILE: QDCAL. ASM VTVALUE : .BLKB 4 MCAVT: .BLKB 4 VTSUM: .BLKB 4 CASUM: .BLKB 4 PKI VQ: .BLKB 4 PKEAVG: .BLKB - * " -SUM: .BLKS 4 .PELOC ,END . I DENT VSETUP .INSERT SP80.ASM .INSERT FPMAC.SRC .INSERT CALCOM.ASM .INSERT CKCOM .INSERT SELCOM .INSERT BAGCOM .INSERT VARCOM.CCC .INSERT SYCOM .INSERT HRDCOM • EXTERN APBP,ZALL.AUDEN .EXTERN RTON,RTOF,RTICK .EXTERN TDHE .EXTERN DERIV5 .EXTERN PTRUPD,GETP2.FIND,ROUT.D .EXTERN SPON.SPOF .ENTRY SETUP CR ODH FINIT SETUP: SETUP THE CLOCK FOR VALIDATION SAMPLE AT 20 PTS PER SEC PUSH H { INIT REAL-TIME BUFFER POINTERS ; MODIFIED 09-24-81 MVI A,3 STA WAITFLG XRA A STA WRAPF STA SECFLG CMA STA BFLG XRA A STA VFRSTMX LXI H,0 SHLD ELPTM CHLD ELPMIN SHLD SECONDS SHLD CPPTR FILE : VSETUP .ASM LXI H,0 SHLD RIPT SHLD ODRIPT SHLD SPTEMP SHLD PNSUM LXI H,8 {SKIP THE 1ST 4 DATA POINTS SHLD ROPT LXI H-TMBUFF MVI M,0 INX H MVI M,0 LXI H,0 SHLD TIME INIT VARIABLES FOR PICKING MAX AND MINS XRA A STA PTF {START BY LOOKING FOR MAX PT STA SLOPEF {INIT MAX NOT FOUND XRA A STA INTFLG CMA STA GFLG INDICATES CLOCK ON CALL AUDEN CALL AP8P CALL 2ALL LXI H,IRSRV MVI A,20 {CLOCK RATE CALL RTON {TURN ON CLOCK ' LDA BAG IF .A,IS,ZERO) {USING SPIROMETER CALL SPON ENDIF POP RET CLKSTP: {STOP DATA COLLECTION {TURN CLOCK OFF {MODI FI ED 09- ■ 24-81 CALL RTOF {TURN OFF CLOCK LDA BAG IF .A,IS,ZERO) {USING SPIROMETER CALL SPOF ENDIF XRA A STA GFLG CALL AUDEN CALL APBP j******************** POP PSW POP H POP D POP 8 RET IRSRV: INTERRUPT SERVICE ROUTINE PUSH 8 PUSH D PUSH H PUSH PSW CALL RTICK {SERVICE INTERRUPT LDA INTFLG IF (.A,IS,NZERO) {THEN INTERRUPT INTERRUPT NOP ELSE CMA STA INTFLG {SET FLAG ENDIF CALL CLKTIK CALL SAMPLE LDA SLOPEF IF (.A, IS,ZERO) CALL GETP2 {RETURNS C IF < 5 PTS IN BUFFER {THIS JUST MAKES SURE EXTRA {POINTS IN BUFFER JC EXIT ;NOT ENOUGH POINTS IN BUFFER FILE : VSETUP .ASM MVI A,0FFH STA SLOPEF ENDIF CALL DERIV5 LDA VFRSTMX IF (.A. IS,ZERO) {HAVE NOT FOUND 1ST I MAX LHLD ROPT CALL FIND IF .PSW-IS-NCARRY) ;NOT MAX LHLD ROPT LXI B.RSIZE CALL PTRUPD SHLD ROPT JMP EXIT ENDIF ;MAX FOUND LDA VFRSTMX CMA STA VFRSTMX LDA PTF CMA STA PTF SHLD SPTEMP {TEMP CRIT PT SDED RCTEMP iCORRESPONDING RC PT SBCD ABTEMP {CORRESPONDING AB PT LHLD ROPT LXI B,RSIZE CALL PTRUPD SHLD ROPT JMP EXIT ENDIF 5 1 5 INIT MAX FOUND LHLD ROPT CALL FIND {UPDATE ROPT FOR NEXT TIME PUSH PSW PUSH D PUSH 8 PUSH H LHLD ROPT LXI B,RSI2E CALL PTRUPD SHLD ROPT POP H POP 8 : . POP D POP PSW FIND RETURNED C SET IF CP FOUND AND HL HOLDS SP PT VALUE AND DE HOLDS RC PT VALUE AND BC HOLDS AB PT VALUE IF (PSW, IS,CARRY) SHLD SPVALUE SDED RCVALUE SBCD ABVALUE LDA PTF IF ( .A,IS,ZERO) iTHEN MAX FOUND XRA A CMA STA BFLG LXI D.SPMAX LHLD CPPTR DAD Q LDA BAG IF (.A.IS,ZERO) iTHEN USING SPIROME'ER, AND {SPVALUE HOLDS SPI=CMETER VALUE LDED SPVALUE ELSE { {UUSSIINNGI SPIROBAG.SO FIXCU HOLDS VALUE LDED FIXCU ENDIF MOV M,E INX H MOV M,D LHLD CPPTR LXI D.RCMAX DAD 0 LDED RCVALUE MOV M,E INX H MOV M,D LHLD CPPTR LXI D.ABMAX DAD D IF VALIDATING AND IF USING SPIROBAG THEN SPVALUE HOLDS ' ΓHE SUM MAX LDA BAG IF (.A ,IS,NZERO) {THEN USING SPIROBAG LDED SPVALUE { SUM VALUE JMP L1001 ENDIF LDED ABVALUE MOV M,E INX H MOV M,D LHLD MAXCNT INX H SHLD MAXCNT LHLD CPPTR INX H INX H SHLD CPPTR LHLD MAXCNT LXI D.BRTHMX ORA A DSBC D IF (PSW ,IS,ZERO) {THEN BUFFER FULL JMP CLKSTP ENDIF ELSE LHLD CPPTR LXI D.SPMIN DAD D LDA BAG IF (.A, IS,ZERO) {THEN USING SPIROMETER, AND {SPVALUE HOLDS SPIROMETER VALUE LDED SPVALUE ELSE {USING SPIROBAG,SO MIN = 0 LXI D,0 ENDIF MOV M.E INX H MOV M,D LHLD CPPTR LXI D,RCMIN DAD D LDED RCVALUE MOV M-E INX H MOV M,D LHLD CPPTR LXI D.ABMIN DAD 0 . LHLD DATA MOV A,H CMA ANI OFH MOV H,A MOV A,L CMA MOV L,A SHLD DATA ENDIF RET PRNG : HL HOLDS THE RING INPUT PTR DE HOLDS ADDR OF RING DAD D LDED DATA MOV M,E INX H MOV M,D RET .END FILE: QDCSTATS.ASM .IDENT QDSTATS .INSERT FPMAC.SRC .INSERT SP80 FINIT .INSERT VTCCOM .INSERT CALCOM .INSERT OLQCOM .INSERT CKCOM .INSERT VARCOM.CCC .INSERT SYCOM .INSERT QD1.ASM .EXTERN TDHE,ROUND .ENT Y PRTQDC .ENTRY CMPSTATS PRTQDC: {THIS IS THE ENTRY POINT FROM LONG TERM CALL CMPSTATS RC FLDB RCSTD FLDA ABSTD FDIV FSTA ABCAL FPRN QDCV,QDCPT RET QDCV: .ASCIS . ' QDC = 3D3: » DELTAS = 3DI MEAN STD COV RC: 303 303 3D3 AB: 3D3 3D3 3D3 • ' QDCPT; : .WORD ABCAL,XCNT .WORD FRC,RCSTD,CQVRC .WORD FAB, BSTD,COVAB NODELTS: .ASCIS ' NO QDC DELTAS AVAILABLE CMPSTATS: RCDATA AND ABDATA HOLD THE DELTAS FOR RC AND AB COMPUTE THE MEAN AND STD OF RC, AB AND RC+AB FILE : QDCSTATS .ASM LHLD DLTIPTR SHLD DLTOFF {SAVE IT INCASE IT CHANGES IN THE {MIDDLE OF THIS DURING LONG TERM LDA DLTFULL IF (.A,IS,ZERO) {RING NOT FULL YET LXI H,0 SHLD OFFSET LDED DLTOFF CALL TDHE IF (PSW,IS,Z! Q, {THEN NO DELTAS LXI H.NODELTS CALL TXTYP src RET ENDIF ELSE iRING IS FULL LHLD DLTOFF {POINTS TO NEXT PLACE TO PUT, SO WILL BE {THE OLDEST VALUE SHLD OFFSET ENDIF 1ST TIME THRU THE DATA COMPUTE MEAN AND STD OF JJ3T SUM 2ND TIME THUR THE DATA ONLY USE DATA WHERE SUM IS WITHIN +-QDCSTD OF MEAN OF SUM FFOA 0 FSTA SMSUM FSTA SMXXSUM FSTA XCNT • LOOP LHLD OFFSET LXI D,RCDATA DAD D MOV E,M INX H MOV D,M SDED IRCV LHLD OFFSET LXI D,ABDATA DAD D MOV ε,M INX H MOV D,M SDED IABV F ILE : QDCSTATS .ASM CALL SUMMERS ! LHLD OFFSET I X H INX H SHLD OFFSET LXI D.1000 CALL TDHE IF (PSW ,13,ZERO ) LXI H-O SHLD OFFSET ENDIF i {QUIT WHEN OFFSET = DLTOFF LHLD OFFSET LDED DLTOFF CALL TDHE IF (PSW , IS,ZERO ) RET iEXIT LOOP ENDIF ENDLQOP {COMPUTE MEAN AND STD OF SUM FLDB SMSUM FLDA XCNT FDIV FSTA SMMEAN ! FLDB SMSUM _DA SMSUM FMUL FATB FLDA :(CNT FDIV FLDB SMXXSUM FSUB FATB FLDA XCNT FDIV FSQR FSTA SMSTD {HIGH LIMIT = SMMEAN + QDC3TD * *SMSTD i LOW LIMIT = SMMEAN - QDCSTD * *SMSTD FLDB QDCSTD FLDA SMSTD FMUL FLDB SMMEAN FADD FSTA SMHIGH FLD8 QDCSTD FILE: Q . FLDA SMSTD FMUL FLDB SMMEAN FSUB FSTA SMLOW NOW COMPUTE MEAN AND STD OF RC ANO AB FOR ALL PAIRS WHERE RC÷AB < SMHIGH AND RC+AB > SMLOW LDA DLTFULL IF (.A, 13,ZERO) {RING NOT FULL YET LXI H,0 SHLD OFFSET ELSE {RING IS FULL LHLD DLTOFF {POINTS TO NEXT PLACE TO PUT, SO WILL BE iTHE OLDEST VALUE SHLD OFFSET ENDIF FFOA 0 FSTA RCSUM FSTA RCXXSUM FSTA A8SUM FSTA ABXXSUM FSTA XCNT « LOOP LHLD OFFSET LXI D,RCDATA DAD 0 MOV E,M INX H MOV D,M SDED IRCV ! LHLD OFFSET LXI 0, BDATA DAD D MOV E,M INX H MOV D,M SDED IABV ! CALL RASUMMERS 1 LHLD OFFSET INX H INX H SHLD OFFSET LXI 0,1000 FILE: QDCSTATS.ASM CALL TDHE IF ( PSW, IS. ERO) LXI H,0 SHLD OFFSET ENDIF {QUIT WHEN OFF SET = DLTOFF LHLD OFFSET LDED DLTOFF CALL TDHE IF (PSW , IS,ZERO) RET {EXIT LOOP ENDIF ΞNDLOOP ;IF XCNT < 2, THEN NO GOOD DATA FLDB XCNT FFOA 2 FSUB FTST AREG.LT IF (PSW , IS, ERO) LXI H.NODELTS CALL TXTYP STC RET ENDIF {COMPUTE MEAN OF RC AfvID AB FLDB RCSUM FLDA XCNT FDIV FSTA FRC FLDB ABSUM FLDA XCNT FDIV FSTA FAB {COMPUTE STD OF RC AND STD OF A FLDB RCSUM FLDA RCSUM FMUL FATB FLDA XCNT FDIV FLD8 RCXXSUM FSUB FATB FLDA XCNT FDIV F3QR : QDCSTATS .ASM FSTA RCSTD FLDB ABSUM FLDA A8SUM FMUL FATB FLDA XCNT FDIV FLDB ABXXSUM FSUB FATS FLDA XCNT FDIV FSQR FSTA ABSTD {MAKE VALUES ML FLDB FRC FLDA CCS FMUL — -- -- FSTA FRC „, - FLDB FAB FLDA CCS . FMUL FSTA FAB- i FLDB ABSTD FLDA CCS FMUL FSTA ABSTD FLDB RCSTD FLDA CCS FMUL FSTA RCSTD i * ; CQV = STD/MEAN FLDB RCSTD FLDA FRC FDIV FATB FFOA 100 FMUL FSTA COVRC FLDB ABSTD FLDA FAB FDIV FATB FFOA 100 FMUL FILE: QDCSTATS.ASM FSTA COVAB ORA A RET RASUMMERS: FILA IRCV FLOT FSTA FRC FILA IABV FLOT FSTA FAB ;D0 NOT USE IF FRC+FAB > SMHIGH OR IF FRC+FAB < SMLOW FLDB FRC FLDA FAB FADD FATB FLDA SMHIGH FSUB FTST AREG.GT IF (PSW ,13,ZERO) RET ENDIF ( FLDB FRC FLDA FAB FADD FATB FLDA SMLOW FSUB FTST AREG.LT IF (PSW ,IS, ERO) RET ENDIF FLDA FRC FLDB RCSUM FADD FSTA RCSUM FLDB FRC FLDA FRC FMUL FLDB RCXXSUM FADD FSTA RCXXSUM FLDA FAB F.LE : QDCSTATS .ASM FLDB A8SUM FADD FSTA ABSUM FLD8 FAB FLDA FAB FMUL FLDB A8XXSUM FADD FSTA ABXX3UM FLDB XCNT FFOA 1 FADD FSTA XCNT RET SUMMERS: FILA IRCV FLOT FATB FILA IABV FLOT FADD FSTA FSUM FLDA FSUM FLDB SMSUM FADD FSTA SMSUM FLDA FSUM FLDB FSUM FMUL FLDB SMXXSUM FADD FSTA SMXXSUM J FLDB XCNT FFOA 1 FADD FSTA XCNT RET FILE: QDCSTATS.ASM .END .IDENT CFIND .INSERT SP80.ASM . INSERT CALCOM . INSERT SELCOM . INSERT EFFCOM . INSERT DRVCOM . INSERT SIOCOM •INSERT FPMAC.SRC . INSERT PKCOM.ASM .ENTRY FIND.GETP2, :ΈP.I 5 .EXTERN TDHE,PTRUPD FINIT FIND: HL = OFFSET OF CURRENT PT ON ENTRANCE ON EXIT: IF CP FOUND, THEN CARRY SET AND HL = SPIROMETER PT DE = RIB CAGE PT BC = ABDOMEN PT SHLD CUROFF LHLD CUROFF LXI D,SPBUFF DAD r> MOV E.M INX H MOV D,M SDED CURSP LHLD CUROFF LXI D.RC3UFF DAD D MOV E,M INX H MOV D,M SDED CURRC LHLD CUROFF LXI D.ABBUFF DAD D MOV E,M INX H MOV D.M SDED CURAB LHLD CUROFF LXI D.TMBUFF DAD D MOV E,M I X H MOV D.M . SDED CURTM CALL GTSIGN {CHECK SIGNS OF DERIVATIVES LDA PTF IF ( .A.IS.NZERO ) .OO FOR MIN LHLD 3PTEMP LDED CURS? ORA A DSBC D IF ''PSW.IS.NCARRY' ;! NEW TMP MIN FOUND LHLD UϋrdP SHLD 3FTΞMP LHLD C ' JRRC SHLD RCTEMP LHLD CURAB SHLD STEMP LHLD CUROFF SHLD CF TEMP LHLD CURTM SHLD TMTEMP 1. ADD CURRENT RCDERV °T TO RC COUNTS 2. ADD RCTCNT TO RC C UNTS 3. RCTCNT :== 0 4. ADD CURRENT ABDERV TO AB COUNTS 5. ADO ABTCNT TO AB COUNTS ό. ABTCNT .== 0 CALL UPDT1 ORA A RET ELSE ;POSSIBLE CP SO CHECK SLOPE BETWEEN {CURRNT PT AND TEMP PT LHLD CURSP LDED SPTEMP ORA A DSBC D {NOW HL HOLDS DIFFERENCE LDED M1NCC ORA A DSBC D IF (PSW, IS .NCARRY) {THEN SPTEMP IS CP LHLD QFFTEMP SHLD CPOFF LHLD SPTEMP PUSH H LHLD RCTEMP PUSH H LHLD ABTEMP PUSH H . LHLD CURSP SHLD SPTEMP LHLD CURRC SHLD RCTEMP LHLD CURA8 SHLD ABTEMP LHLD CUROFF SHLD OFFTEMP LHLD TMTEMP SHLD CPTIME i T IME OF TH I S CP LHLD C ' -R M SHLD TMTEMP ;NEW TEMP RC COUNTS <== RCTCNT RCTCNT <== 0 STORE A3 COUNTS A8 COUNTS <== ABTCNT ABTCNT <== 0 CALL -JPOT 2 POP 3 ;A8 VALUE POP D ;RC VALUE POP H iSP VALUE 3TC • •■ F T CARRY B£T ELSE ;NOT A LARGE ENOUGH SLOPE 1. ADO RCDERV TO RCTCNT 2. ADD ABDERV TO ABTCNT CALL UPDT3 ORA A RET ENDIF ENDIF ELSE iLQOK FOR MAX LHLD SPTEMP LDED CURSP XCHG ORA A DSBC D IF ( PSW.IS.NCARRY) ; ; {TTHHEE1N CURRENT )= SPTEMP LHLD CURSP SHLD SPTEMP LHLD CURRC SHLD RCTEMP LHLD CURAB SHLD ABTEMP LHLD CUROFF SHLD OFFTEMP . LHLD CURTM SHLD TMTEMP CALL UPDT1 ORA A RET ELSE ;POSSIBLE Z? LHLD SPTEMP ORA A DSBC D iNQW HL = DIFF ORA A DSBC D IF (PSW, 13 NCriP-" ' {THEN SPTEMP IS LHLD -jCC CM 5HLD IPC'FF LHLD - ZZ— ϊ' z PUSH "i HLD PC T EMF PUSH ~ LHLD >-*3 τ Ξ P PUSH LHLD TXTCMp SHLD ■ := "" IME {TIME OF CP LHLD I' PSP SHLD SPTEMP LHLD CURRC SHLD RCTEMP LHLD CUPAB SHLD HΘTE P LHLD CUROFF SHLD OFF EMP LHLD CURTM SHLD TMTEMP CALL UPDT2 POP 8 ;AB VALUE POP D {RC VALUE POP H ;3P VALUE STC RET ELSE iNO" LARGE ENOUGH SLOPE CALL UPD T 3 ORA A RET ENDIF ENDIF ENDIF . GETP2: SEE IF AT LEAST 5 POINTS !N RING BUFFER LHLD RIPT LXI D.IO ORA A DSBC D IF (PSW, 13,CARRY' ; T HEN : 5 PTS STC ELSE GRA A ENDIF RET UP0T1 : 1. ADD CURRENT ASSeCDERV- PT TO RC COUNTS 2. ADD RCTCNT TO RC COUNTS 3. RCTCNT <== 0 4. ADO CURRENT A83(A80ER > TO A3 COUNTS 5. ADD A8TCNT TO A8 COUNTS _. ABTCNT (== 0 NOTE : DO NOT SEPEATAE INPHASE AND GUT "OF •.-*-«•«* LHLD A8SRCD LDED RCIN DAD D SHLD RCIN LHLD RCIN LDED RCTICNT DAD 0 SHLD RCIN LXI H.O SHLD RCTICNT LHLD ABSABD LDED ABIN DAD D : . SHLD ABIN LHLD ABIN LDED ABTICNT DAD 0 SHLD ABIN LXI H.O SHLD ABTICNT SUM: DO NOT SEPERATE INPHA3E AND CUT OF PHASE VALUES LHLD ABS3MD LDED SMIO DAD 0 3HLD SMIO LHLD SMIO LDED SM T CNT DAD i SHLD SM T CNT LXI SHLD SMTCNT FOP PEAK FLOW STUFF: SMDERV = CURRENT FLOW, ABSSMD = ABS(SMDERV) ;IF ON INSP SIDE:, LOOKING FOR MAX LDA -TF IF ( .A,IS,ZERO) {ON INSP SIDE {IF CURRENT FLOW > 0, OR IF ABSSMD = 3MDERV LHLD ABSSMD LDED SMDERV CALL T QHE IF ( PSW, IS,ZERO) ΓHEN CURRENT FLOW ; o ilF CURRENT FLOW > TEMPK LHLD TEMPK LDED SMDERV ORA A DSBC D IF (PSW ,13,CARR" f t {CURRENT FLOW - TEMPK LHLD SMDERV SHLD TEMPK LHLD CURTM 3HLD PKTIME ENDIF ENDIF IF TTPOS : TEMPK . LHLD TEMPK LDED TTPOS ORA A DSBC D IF (PSW, IS, .CARRY) iTTPOS > TEMPK LHLD TTPOS SHLD TEMPK LHLD TTPTM SHLD PKTIME ENDIF LXI H,0 SHLD TTPOS SHLD TTNEG LHLD CURTM SHLD TTP""M SHLD TTNTM ELSE ON THE EXP SIDE (LOOKING FOR MIN ilF CURRENT FLOW < 0, OP. IF ABSSMD NGT= SMDERV LHLD ABSSMD LDED SMDERV CALL TDHE IF (PSW, IS, ,NZEPO) iTHEN CURRENT F ;IF ABS(CURRENT FLOW) . TEMPK LHLD TEMPK LDED ABSSMD ORA A DSBC D IF (PSW, 13,CARRY) ;ABS<CU, TEMPK LHLD ABSSMD SHLD TEMPK LHLD CURTM SHLD PKTIME ENDIF ENDIF ;IF TTNEG > TEMPK •LHLD TEMPK LDED TTNEG ORA A DSBC D IF (PSW, IS, .CARRY) {TTNEG > TEMPK LHLD TTNEG SHLD TEMPK LHLD T T NT SHLD PKTIME ENDIF LXI H,0 SHLD TTPOS SHLD TTNEG LHLD CURTM : . SHLD TTPTM SHLD TTNTM ENDIF RET UPDT: i . STORE RC COUNTS RC COUNTS •:= ■ = RCTCNT RCTCNT == 0 4. STORE AB COUNTS c • A8 COUNTS -:== ABTCNT ό. ABTCNT == 0 LHLD RCIN SHLD RCINVOL LHLD RCTICNT SHLD RCIN LXI H,0 SHLD RCTICNT LHLD ABIN SHLD ABINVOL LHLD ABTICNT SHLD ABIN LXI H,0 SHLD ABTICNT iSUM: DO NOT SEPERATE INPHASE AND OUT OF PHASE LHLD SMIO SHLD SMVOL LHLD SMTCNT SHLD SMIO LXI H,0 SHLD SMTCNT [FOR PEAK FLOW STUFF: ;SMDERV = CURRENT F_. -1-MD = ABS(SMDERV) ;IF ON INSP SIDE:, LOOKING FOR MAX (PTF=0) LDA PTF IF ( .A, IS.ZERO) ;0N INSP SIDE iTEMPK IS THE PEAK FLOW. AND PKTIME 13 THE TIME OF IT iSTORE THE TIME OF THE PEAK FLOW CALL PKSTORE LHLD TTNEG ;NOW WILL 3E ON EXP SIDE SHLD TEMPK LHLD TTN7M SHLD PKTIME LXI n,0 SHLD TTPOS SHLD TTNEG LHLD CURTM 3HLD TTPTM SHLD TTNTM ELSE iON Ξ P SIDE iTEMPK IS THE PEAK FLOW, AND PKTIME IS THE TIME OF IT {STORE THE TIME OF THE FLOW CALL PKSTORE LHLD TTPOS ;NCW WILL SΞ ON INSP SIDE SHLD TEMPK LHLD TTPTM SHLD PKTIME LXI .4,0 SHLD TTPGS SHLD TTNEG LHLD CURTM SHLD TTPTM SHLD TTNTM ENDIF UPDT3: ;1. ADD ABS(RCDERV) TO RCTCNT ,BS(ABDERV) TO ABTCNT LHLD ABSRCD LDED RCTICNT DAD D SHLD RCTICNT LHLD ABSA8D LDED ABTICNT DAD D SHLD ABTICNT FILE : CFIND .ASM iSUM; DO NOT SEPERATE INPHASE ANO OUT OF PHASE LHLD ABSSMD LDED SMTCNT DAD D SHLD SMTCNT FOR PEAK FLOW STUFF: SMDERV = CURRENT -LOW. AbSSMD = AβS SMDERV) IF CURRENT FLOW '• 0 LHLD SMDERV LDED ABSSMD CALL TDHE IF -PSW.13.ZERO \ THEN CURRENT FLOW . 0 {IF CURRENT FLOW > TTPOS LHLD TTPOS LDED SMDERV ORA A DSBC D IF (PSW, IS,CARRY' LHLD 3MDEPV SHLD TTPOS LHLD CUP™ SHLD "TPTM ENDIF ELSE ilF ABS(CURRENT FLOW) > TTNEG LHLD TTNEG LDED ABSSMD ORA A DSBC D IF (PSW, IS.CARRY) LHLD ABSSMD SHLD TTNEG LHLD CURTM SHLD TTNTM ENDIF ENDIF RET PKSTORE: LHLD PKTIME SHLD PKVALUE RET FILE: C . GTSIGN: LHLD RCDERV {CURRENT RC DERIV VALUE MOV A,H ANI 30H STA RCSIGN ! LHLD ABDERV iCURRENT A8 DERIV VALUE MOV A,H ANI 30H STA ABSIGN * LHLD SMDERV MOV A.H ANI 30.H STA SMSIGN MOV 8,A LDA RCSIGN IF ( .A ■EQ.,8 ) iTHEN RC INPHASE W/ SUM XRA A CMA STA RCINPHS ELSE XRA A STA RCINPHS ENDIF LDA SMSIGN MOV 3,A LDA A8SIGN IF (.A, ,EQ,.B) {THEN AB INPHASE W/ SUM XRA CMA STA ABINPHS ELSE XRA A ' STA ABINPHS ENDIF RET ! i . > * . 1 i DERIV5: iDERIV USING 9 POINTS FILE: CFIND.ASM DERIVATIVE USING 5 POINTS SRCOFST HOLDS OFFSET TO GET Y5 FROM RAW DATA BUFFERS ASSUME: RCYl ,RCY2,RCY3,RCY4, ABY1 ,ABY2 ,ABY3 ,ABY4 ALREADY SET LXI D.RCSUFF LHLD SRCOFST DAD MOV E-M K H MOV D.M SDED RCY9 LHLD SRCOFST LXI D.ABBUFF DAD 0 MOV E.M INX H MOV D,M SDED 8Y? LXI 3.R3IZE ; UPDATE FOR NE LHLD SRCOFST CALL PTRUPD SHLD SRCOFST = (°-1 ) ***4 + i;3-2 : ') *3 + ''7-3 3) ) - * **2 ό-4) LHLD RCY? LDED RCYl CRA A DSBC D DAD H ; (RCY9-RCY1) * *2 DAD H ; (RCY9-RCY1 '*4 PUSH H LHLD RCY8 . LDED RCY2 ORA A DSBC D MOV E.L MOV D.H DAD H ; * * 2 DAD D ; +3 POP D DAD D PUSH H LHLD RCY7 LDED RCY3 ORA A : . DSBC D DAD H POP D DAD D PUSH H LHLD RCYό LDED RC ' v4 CPA A 033C ' POP 0 DAD D SHLD R ER-. ',+++ ■ ** DIVIDE RCDERV 3Y 4 T ^ fjID OVERFLOW WHEN INTEGRATING IT LHLD RCDERV SPAR H RARR L SPAR H RARR L SHLD F'CDΞRV iDERIV = ■ ?-! ■ . • .4 * 7-3 t*^ *" .ό-4 ) LHLD AB ? LDED ABYl ORA A DS8C D DAD H ! .ABY9-ABYl ) -«2 DAD H i-.ABY9-ABYl.-t4 PUSH H LHLD A8Y8 LDED ABY2 ORA DSBC D MOV E,L MOV D.H DAD H DAD D ; • *_ POP D DAD D PUSH H LHLD ABY7 LDED ABY3 ORA A DSBC D DAD H POP D DAD D PUSH H FILE:- CF1ND.ASM LHLD A8Yό LDED ABY4 QP.A A D38C 0 POP D DAD D SHLD A8DERV -c-QA τ ING IT *-.-*■<-*: OI I: ;E ABDERV BY ' 0 A V 1 OI OVERFLOW W^EN LHLD A8DEP.V SPAR H RARR L SRAR H RARR 1 SHLD ABDERV RESET VALUES FOR NEX T LHLD RCY2 SHLD P CX! LHLD RCY3 S»LD RCY2 LHLD PC";' SHLD FCY3 LHLD PC"''5 SHLD P.CY .HLD RCYo SHLD RCY5 LHLD RCY7 SHLD RCY 6 LHLD RCY3 SHLD RCY7 LHLD RCY9 SHLD RCY3 LHLD ABY2 SHLD ABYl LHLD ABY3 SHLD ABY2 LHLD 8Y4 SHLD ABY3 LHLD ABY5 SHLD ABY4 LHLD ABY6 SHLD ABY5 LHLD ABY7 LHLD ABY9 SHLD ABY8 .ASM LHLD RCDERV LDED ABDERV DAD D SHLD SMDERV E A3SOI .UTE VALUE OF • ' ' - ' ■ ERV .-NO ABDERV, AND SMDERV LHLD RCDERV MO 1 -' ^ , H ANI 30H IF ( .A.IS.NZERO- ' HEN RCDERV . 0 MOV A.L CMA MOV L.A MOV A,H CMA MOV H,A INX H SHLD ABSRCD ELSE 3HL0 A8SRCD ENDIF LHLD A8DEP.V MOV A,H ANI 30H IF ■ : .A. IS.NZΞRG- iTHEN ABDERV MOV A,L CMA MOV L.A MOV A ,H CMA MOV H.A INX H SHLD A8SABD ELSE SHLD ABSABO ENDIF LHLD SMDERV MOV A,H ANI 80H IF ( .A, IS.NZERO. ) iTHEN SMDERV ( 0 MOV A,L CMA MOV L.A MOV A,H CMA MOV H,A INX H SHLD ABSSMD FILE: CFIND.ASM ELSE SHLD A8SSMD ENDIF RET GETP2: .EE IF AT LEAST 10 POINTS IN RING BUFFER LHLD RIPT LXI D,20 ORA A DSBC D IF (PSW , IS.CARRY ) THEN < 10 PTS STC ELSE SET UP INIT VALUES IN °CY1 ,RCY2,RCY3.RCY4 ABYl ,ABY2,ABY3,ABY4,AND SRCOFST LXI H.RCBUFF MOV E.M INX i-l MOV D.M SDED RCYl INX H MOV E,M INX H MOV * D,M SDED RCY2 INX H MOV E,M INX H MOV D.M SDED RCY 3 INX H MOV E,M INX H MOV D.M SDED RCY 4 . INX H MOV E.M INX H MOV D.M SDED RCY5 INX l-i MOV E.M INX H MOV D.M SDED RCY- INX H MOV E.M INX H MOV D.M SDED RCY? INX H MOV C—. ,M> . INX • H MOV D.M SDED RCY8 LXI H.ABBUFF MOV E.M INX H MOV D.M SDED ABYl INX H MOV E.M INX H MOV D.M SDED ABY2 INX H MOV E,M INX H MOV D,M SDED ABY3 INX H MOV E-M INX H •f QV D,M SDED A3 4 INX H MOV E.M I X H FILE: C . MOV D.M SDED A8Y5 INX H MOV E.M INX H MOV D,M SDED ABY. INX H MOV E.M INX H MOV D.M SDED ABY7 INX H MOV E.M INX H MOV D.M SDED ABY8 LXI H.14 OFSET FOR THE ?TH VALUE IN BUFFERS SHLD SRCQF3 ' LXI H,3 iOFFSET OF MIDDLE OF DERI' SHLD ROPT I LXI H.O . SHLD INTGP.C ORA A ENDIF RET .EXTERN CFD .LOC CFD CUROFF: ■BLKB OFFTEMP: •BLKB •RELOC .END . IDENT DKFIND .INSERT SP80.ASM .INSERT CALCOM .INSERT FPMAC.SRC .INSERT EFFCOM .INSERT DKCOM .INSERT DRVCOM .INSERT SIOCOM .ENTRY DKFIND,DKGETP2 .EXTERN TDHE .ENTRY DERIV5 .EXTERN PTRUPD FINIT ASSUME : THAT ALL RC VALUES . A3 VALUES , AND SUM VALUES WI LL HAVE FI RST 4 B ITS = O OOOH COMING FROM A-D . OKFIND i HL = OFFSET OF CURRENT PT ON ENTRANCE ON EXIT: IF CP FOUND. THEN CARRY SET AND HL = SUM PT DE = RI8 CAGE PT BC = ABDOMEN ? τ TVALUE = TIME OF CP PUSH H PUSH H PUSH H LXI D.SPBUFF DAD D MOV E.M INX H MOV D.M SDED CURSP POP H LXI D.RCBUFF DAD D MOV E.M INX H MOV D.M SDED CURRC POP H LXI D.ABBUFF DAD D MOV E.M INX H MOV D.M SDED CURAB POP H LXI D.TMBUFF DAD D MOV E,M INX H MOV D.M R LE : CFIND .ASM SDED CURTM CALL GTSI GN s CHECK S I GNS OF DER IVATIVES LDA PTF IF ( .A,IS,ZERO) iLOOK C 0R MIN LHLD SPTEMP LDED CURSP ORA A DSBC D IF (PSW.IS.NCi -.PRY ) iNEW P MIN FOUND LHLD CURSP SHLD SPTEMP LHLD CUPRC SHLD PC-TEMP LHLD CURAB SHLD CTΞriP LHLD CURTM SHLD SMTIME ! 1 . ADD CURRENT RCDERV PT TQ RC COUNTS ; 2 . ADD RCTCNT TO RC COUNTS ; 3 . RCTCNT <== 0 ;4. ADD CURPENT ABDERV TO AB COUNTS 55. ADD ABTCNT TO AB COUNTS id. ABTCNT <=■= 0 CALL UPDT1 ORA A RET ELSE iPOSSIBLE CP SO CHECK SLOPE BETWEEN iCURRNT PT AND TEMP PT LHLD CURSP LDED SPTEMP ORA A DSBC 0 iNOW HL HOLDS DIFFERENCE LDED MINCC ORA A D38C D IF (PSW.IS.NCARRY iTHEN SMTEMP IS CP LHLD SPTEMP PUSH H LHLD RCTEMP . PUSH H LHLD ABTEMP PUSH H LHLD SMTIME SHLD TVALUE LHLD CURSP SHLD SPTEMP LHLD CURRC SHLD RCTEMP LHLD CJR Θ SHLD MBTΞMP LHLD CURTM SHLD SMTIME 1. STI " C COUNTS -_.. RC COUNTS <== RCTCNT 3. RCTCNT <=•= 0 4. STORE A8 COUNTS 5. AB COUNTS <== ABTCNT 6 . ABTCNT <== 0 :ALL UFDT2 POP ;AB VALUE POP ; RC VALUE z>tz : !0 QPRIATE BIT ON RC VALUE TO INDI CATE A MINIMUM BRTH ' MOV A,D ANI OFH i F I RST 4 3 ITS SHOULD = MOV 0,A POP H ;SM VALUE STC ;SΞT CARRY RET ELSE {NOT A LARGE ENOUGH SLOPE ; 1. ADD RCDERV TO RCTCNT ;2. ADD ABDERV TO ABTCNT CALL UPDT3 ORA RET ENDIF ENDIF ELSE iLOOK FOR MAX LHLD SPTEMP LDED CURSP XCHG ORA A DSBC D FILE : CFIND .ASM IF (PSW,IS,NCARRY) iTHEN CURRENT >= SMTEMP LHLD CURSP SHLD SPTEMP LHLD CURRC SHLD RCTEMP LHLD CURA8 SHLD ABTEMP LHLD CURTM SHLD SMTIME CALL UPDTI CR A PET ELSE iPOSSIBLE CP LHLD SPTEMP DED CURSP ORA A DSSC 0 {NOW HL = DIFF -DED ' f I:ICC ORA A DSBC D IF (PSW.IS.NCARRY.' iTHEN SMTEMP IS Cr LHLD SPTEMP PUSH H LHLD RCTEMP PUSH H LHLD ABTEMP PUSH H LHLD SMTIME SHLD TVALUE LHLD CURSP SHLD SPTEMP LHLD CURRC SHLD RCTEMP LHLD CURA8 SHLD ABTEMP LHLD CURTM SHLD SMTIME CALL UPDT2 POP 8 ;AB VALUE POP D iRC VALUE SET THE APPROPRIATE 8IT ON PC VALUE TO INDICATE A MAXIMUM BRTH MOV A,D ORI 10H iFIRS ' T 4 BITS SHOULD = 00013 MOV D,A POP H iSM VALUE . STC RET ELSE ;NOT LARGE ENOUGH SLOPE CALL UPDT3 ORA A RET ENDI F END I F ENDI F U.PDT1 : il. ADD CURRENT ABS(RCDERV) PT TO RC COUNTS ;2. ADD RCTCNT TO RC COUNTS ;3. RCTCNT • (== 0 ;4. ADD CURRENT ABS(ABDERV) TO AB COUNTS ;5. ADD ABTCNT TO AB COUNTS ;•_. ABTCNT .== 0 LHLD ABSRCD LDA RCINPHS IF ( .A.IS.NZERO) iTHEN RC I τ HASE WITH SUM LDED RCIN DAD D SHLD RCIN ELSE ;RC OUT OF PHASE WITH SUM • LDED RCOUT DAD D SHLD RCOUT ENDIF LHLD RCIN LDED RCTICNT DAD D SHLD RCIN LHLD RCOUT LDED RCTOCNT DAD D SHLD RCOUT LXI H,0 SHLD RCTICNT SHLD RCTOCNT LHLD A8SABD LDA ABINPHS IF (.A,IS,NZERO) {THEN AB INPHASE WITH SUM FILE: . LDED ABIN DAD D SHLD ABIN C!_ .SE ;AB OUT OF PHASE WITH SUM LDED ABOUT DAD 0 SHLD A80UT ENDIF LHLD A3 IN LDED A8T1CNT DAD r. SHLD -BIN LHLD ABOUT LDED <-B T OCNT DAD D SHLD BOUT LX I H, J SHLD ~S~ . CN T SHLD tUM i DO NOT SEPERATE INP -vSΞ iNO OUT OF PHASE -ZZ ADD THEM ALL LHLD ABSSMD LDED SMIO DAD D SHLD SMIO LHLD SMIO LDED SMTCNT DAD D SHLD SMTCNT « LXI H.O SHLD SMTCNT RET UP0T2: 1. STORE RC COUNTS . RC COUNTS (== RCTCNT 3. RCTCNT (== 0 4. STORE AB COUNTS 5. AB COUNTS (== ABTCNT _ , ABTCNT ( == 0 LHLD RCIN SHLD RCINVOL LHLD RCOUT SHLD RCOUTVOL LHLD RCTICNT SHLD RCIN LHLD RCTOCNT SHLD RCOUT LXI H.O SHLD RCTICNT SHLD RCTOCNT LHLD ABIN SHLD ABINVOL LHLD ABOUT SHLD A80UTV0L LHLD ABTICNT SHLD ABIN LHLD A8T0CNT SHLD ABOUT LXI H.O SHLD ABTICNT SHLD A8TQCNT ! {SUM: DO NOT SEPERATE INPHASE AND OUT OF PHASE LHLD SMIO SHLD SMVOL LHLD SMTCNT SHLD SMIO LXI H,0 SHLD SMTCNT RET UPDT3: 1. ADD ABS.RCDERV) TO RCTCNT 2. ADD ABS.ABDERV) TO ABTCNT FILE : CFIND .ASM LDA RCINPHS IF (.A, IS,NZERO) iTHEN INPHASE LHLD A8SRCD LDED RCTICNT DAD D SHLD RCTICNT ELSE LHLD ABSP.CD LDED RCTICNT DAD D SHLD RCTOCNT ENDIF LDA ABINPHS IF .A, IS.NZEP.O ) LHLD ABSABO LDED ABTICNT DAD D SHLD ABTICNT ELSE LHLD ABSABO LDED ABTQCNT DAD D SHLD ABTQCNT ENDIF i3UM: DO NOT SEPERATE INPHASE AND OUT OF PHASE LHLD ABSSMD LDED SMTCNT DAD . SHLD SMTCNT RET ! ! i GTSIGN: LHLD RCDERV {CURRENT RC DERIV VALUE MOV A.H ANI 30H STA RCSIGN LHLD ABDERV {CURRENT AB DERIV VALUE MOV A,H ANI 30H STA ABSIGN LHLD SMDERV FIL : . MOV A,H ANI 80H STA SMSIGN MOV B,A LDA RCSIGN IF >: .A ,ΞQ, . B ' ι iTHEN RC INPHASE W/ SUM XRA A CMA RCINPHS ELSE XRA 1-1 STA RCINPHS ENDIF LDA SMSIGN MOV B,A LDA ASSIGN IF (.A, ,EQ, .3) iTHEN A8 INPHASE W/ SUM XRA CMA STA ABINPHS ELSE XRA A STA ABINPHS ENDIF RET DERIV5: {DERIV USING 9 POINTS ;*****************-*** +* DERIVATIVE USING 5 POINTS ! {SRCOFST HOLDS OFFSET TO GET 5 FROM RAW DATA SUFFERS {ASSUME: RCYl ,RCY2,RCY3,RCY , ABYl ,ABY2,ABY3,ABY4 ALREADY SET LXI D.RC8UFF LHLD SRCOFST DAD 0 MOV E-M INX H CF IND .ASM MOV D,M SDED RCY9 LHLD SRCOFST LXI D.AB8UFF DAD 0 MOV E-M INX H MOV D,M SDED ABY9 LXI B.RSIZΞ iUPDATE FOR NE LHLD SRCOFST CALL PTRUPD SHLD SRCOFST iDERIV = (9-1. *-*4 * (3-: 2)**3 + ''7-3)1* + ( ό-4 ) LHLD RCY9 LDED RCYl ORA A ' DSBC D DAD H ; ■ RC ' -?-RCYl)-*2 DAD H ϊ '.PCΥ ! '—RCYi ■ *^ PUSH H < LHLD RCY3 LDED RCY2 ORA A DSBC D MOV E-.L MOV D,H DAD H ;*2 DAD D ; * 3 POP 0 DAD D PUSH H LHLD RCY7 LDED RCY3 ORA A DSBC D DAD H POP D DAD D PUSH H J LHLD RCYό LDED RCY4 ORA Λ M DSBC D POP 0 DAD D 5HLD RCDERV ;-.****: DIVIDE RCDERV BY 4 TO AVOID OVERFLOW WHEN INTEGRATING IT LHLD RCDERV SRAR H RARR L SRAR H RARR L SHLD RCDERV *♦*.*. "Cβlπ - ,?_ι;. 4 7 -3)*2 + (4-4) LHLD ABY9 LDED ABYl ORA A DSBC D DAD H Α8Y?-ABY1 *2 DAD H ABY 1? -ABY1 •'-♦4 PUSH H LHLD ABY3 LDED ABY2 ORA A DSBC D MOV E.L MOV D.H DAD H ; *2 DAD D : « *^ POP D DAD D PUSH H LHLD ABY7 LDED ABY3 ORA DSBC D DAD H POP D ' DAD. D PUSH H LHLD ABY6 LDED ABY4 ORA A DSBC D POP 0 DAD 0 SHLD ABDERV -.****; DIVIDE ABDERV BY 4 TO AVOID OVERFLOW WHEN INTEGRATING IT LHLD ABDERV SRAR H RARR L . SRAR H RARR L SHLD ABDERV -.** RESET VALUES FOR NEXT TIME LHLD RCY2 SHLD RCYl LHLD RCY3 SHLD RCY2 LHLD RCY4 SHLD RCY3 LHLD RCY5 SHLD RCY4 LHLD RCYό SHLD RCY5 LHLD RCY7 SHLD RCYό LHLD RCY8 SHLD RCY7 LHLD RCY9 SHLD RCY8 LHLD ABY2 SHLD ABYl LHLD ABY3 SHLD A8Y2 LHLD A8Y4 SHLD ABY3 LHLD ABY5 SHLD ABY4 LHLD A8Yό SHLD ABY5 LHLD ABY7 SHLD A8Y- LHLD ABY8 SHLD ABY7 LHLD ABY SHLD ABY8 LHLD RCDERV LDED ABDERV DAD 0 SHLD SMDERV COMPUTE ABSOLUTE VALUE OF RCDERV AND ABDERV, AND SMDERV LHLD RCDERV MOV A,H ANI 80H IF ( .A.IS.NZERO. ;THEN RCDERV MOV A,L CMA MOV L,A MOV A.H CMA MOV ' H.A INX H SHLD AB3RCD ELSE SHLD ABSRCD ENDIF LHLD ABDERV MOV A.H ANI 80H IF .A. IS.NZERO) THEN ABDERV MOV A.L CMA MOV L.A MOV A,H CMA MOV H.A INX H SHLD ABSABO ELSE SHLD ABSABO ENDIF LHLD SMDERV MOV A.H ANI SOH IF ( .A, IS.NZERO) i THEN SMDERV ( 0 MOV A,L CMA MOV L,A MOV A.H CMA MOV H,A INX H SHLD ABSSMD ELSE SHLD ABSSMD ENDIF RET CF IND .ASM DKGETP2 : SEE I F AT LEAST 10 PO INTS IN RING BUFFER LHLD RIPT LXI 0,20 ORA A DSBC D IF .-PSW .IS,CARRY ) 'HEM 10 PTS 3TC ELSE SET UP INIT VALUES IN RCYl ,PCY2,RCY3,RCY4 ABYl ,ABY2,A8Y3,A3Y4,AND SRCOFST LXI H.RCBUFF MOV E*M INX H MOV D.M SDED RCYl INX H MOV E.M INX H MOV D.M SDED RCY2 INX H MOV E.M INX H MOV D.M SDED RCY3 INX H MOV E,M INX Ή MOV D . M SDED RCY4 INX H MOV E.M INX H MOV D.M SDED RCY5 INX H MOV E.M INX H MOV D.M SDED RCYό INX H MOV E-M INX H MOV D,M SDED RCY7 INX H MO 1 -' E.M INX H MOV D.M SDED PC 3 L I H.ABBUFF MQV E.M INX H MQV D.M SDED A8Y1 INX H MQV S.M INX H SDED ABY2 INX μ MOV E.M INX H MOV D.M SDED ABY3 INX H MOV E.M H MOV D.M SDED A8Y4 INX H MOV E,M INX H MOV D.M SDED ABY5 INX H MOV E.M INX H MQV D.M SDED ABYό INX H MOV E.M INX H MOV D.M FILE: CFIND.ASM SDED ABY7 INX H MOV E.M INX H MQV D.M SDED A8Y3 L«I H.14 " z " -CR s-- 3RC3F3 ' L. ( I H,S SHLD _ • H,0 SH_.D INTCF: OPA A ENDIF PET .END . . . IDENT PRNTVAL .INSERT FPMAC.SRC .INSERT SP30.ASM .INSERT CALCOM .INSERT LP2C0M .INSERT SYCGM .EXTERN PRTIME .EXTΞRN L?ON,L?0FF F NIT .EX~ΞRN PQUri0 .ENTRY PRNTVAL THIS ROUTINE PRINTS _ ■ _ " '. :LTA VALUE: SUM SP SUM/3? THERE ARE .MAxf-M " ASSUME : - ' ALUE OF FC. IN --PEG ON ENTRY TO TH1_ : JUT NE r -f. r LHLD MAXCNT OCX H SLAR L RALR H SHLD CNT LI31 4 L-'.- H,XV LUES SHLD X2PTR i - T H.O SHLD CPPTR ; ;iOFFSET FOR SP.RC-A8 XRA A STA PTF ; :0 WHEN 2DD I. TIME THRU LCGP XRA A CMA STA HRDFLG MVI A, 10 STA LCNT iONLY MAKE HARD COPY CALL LPON ;OUTPUT SEVERAL LINE FEEDS LXI H,CRLFS CALL TXTYP CALL PRTIME FPRN HEAD.HDPT CALL LPOFF L0QP1: iGET THE OΞL~A FOR SPIROMETER LHLD CPPTR Λ I D.SPMAX DAD D MOV E.M INX H MOV SDED SPVALUE LHLD CPPTR LDA PTF IF ( .A, .IS.NZERO. ) ■ THEN EVEN ≠ THRI OOP INX INX ri ENDIF LXI D.SPMIN DAD D MOV E.M INX j^ MOV D,M iDE = MIN SP DT LHLD SPVALUE )HL = MAX SP PT ORA A DSBC n SHLD 3PDELT iSP DELTA FILA 3PDELT FLOT FLDB CCS FMUL FSTA SPDELT ;NOW I TE MS OF ML ;NOW GET SUM DELTA VALUE LHLD CPPTR LXI D.ABMAX DAD D MOV E.M INX H MOV D.M SDED ABVALUE LHLD CPPTR FILE: PRNTVAL.ASM -110- LDA PTF IF .A,IS.NZERO) iTHEN EVEN ft THRU LOOP INX H INX - H ENDIF LXI 0,ABMIN DAD D MOV E.M INX H OV 0,M ;DE = MIN SUM PT LHLD ABVALUE ;HL = MAX SUM PT ORA A DS8C D ' SHLD A8DELT ;SUM DELTA VALUE FILA ABDELT FLOT FLD3 CCS FMUL FSTA ABDELT ;NOW IN ML ; ■ NOW GET XVALUE (SUM S P LDQR 2PTR FOWL FSTA XVAL SDQR X2PTP {ONLY MAKE HARD COPY CALL LPON LDA PTF IF • ., A.IS.ZEPO; ) iTHEN IN: L I H, ILAB ELSE LXI H,ELA8 ENDIF CALL TXTYP FPRN DELT,DELT?T CALL LPOFF LDA PTF IF (.A,IS,NZERO) ;THEN EVEN ft THRU LOOP LHLD CPPTR INX H INX H SHLD CPPTR ENDIF LDA PTF CMA STA PTF CNT , LOOP 1 LP 1 1 ;CALUCULATE AND PRINT OUT THE MEAN, STD, ST ERROR, AND V. ERROR FLDB XSUM FLDA FCNT FDIV FSTA MEAN FLDB XSUM -LDA XSUM FMUL FATB FLDA FCNT FDIV FLDB XXSUM FSUB FAT3 FLDA FCNT FDIV FSQR FSTA STDV FLDA FCNT FSQR FLDB STDV FDIV FSTA STΞRR FLDB MEAN FFOA 1 FSUB FATB FFOA 100 F MUL FSTA PCERR FLDA PCERR FABS FATB FFOA 1 FSUB FSTA FTEMP FTST FTEMP.LT IF (PSW , IS,ZERO) iTHEN ABS(ERRGR; FFOA 0 FSTA PCERR ENDIF G02: ■ ONLY MAKE HARD COPY CALL LPON FPRN STATS , STPT ; OUTPUT SEVERAL LINE FEEDS LXI H.CRLFS CALL TXTYP CALL LPOFF RET STATS: .ASCIS ' S.d. 3UM SP = 303 St Err SUM/'SP = 3D3 X ERROR = -DI STPT: .WORD MEAN.3TDV or-coD ILAB: .ASCIS ■ ' (I) ELAB: .ASCIS • ' ( E) DELT: .ASCIS 303 3D3 3D3 "PT. .WORD ABDELT,SPDELT,XVAL HDPT: HEAD: .ASCIS - Val ida ion ; CRLFS: .ASCIS .EXTERN PRT .LOC PRT FTEMP: .BLKB 4 SPDELT: .BLKB 4 RCDELT: .BLKB 4 Y2PTR: .BLKB 2 X2PTR: .BLKB 2 ABDELT: .BLKB 4 LCNT: .BLKB 1 FCNT: .BLKB 4 EAN: .BLKB 4 STDV: .BLKB 4 3TERR: .BLKB 4 PCERR: .BLKB 4 LQOPCNT: .BLKB 1 .RELOC .END IF VALIDATING AND IF USING SPIROBAG THEN SPVALUE HOLDS THE SUM MIN LDA BAG IF (.A,IS,NZERO) jTHEN USING SPIROBAG LDED SPVALUE ;SUM VALUE JMP L2001 ENDIF * LDED ABVALUE L2001: MOV M.E INX H MOV M,D ENDIF LDA PTF CMA STA PTF ENDIF SKIP5: EXIT: ! CALL CSTS IF (PSW ,IS,NZERO) CALL CINP IF (.i ■ .,EQ,CR> ;IF CARRIAGE RETURN JMP CLKSTP ENDIF ENDIF ! XRA A STA INTFLG i POP PSW POP H POP D POP B RET CLKTIK: LHLD ELPTM INX H SHLD ELPTM LDED SFREQ CALL TDHE IF (PSU,IS,ZERO) ;THEN 1 SECON FILE: VSETUP.ASM LXI H,0 SHLD ELPTM LHLD SECONDS INX H SHLD SECONDS XRA A CMA STA SECFLG LXI O.όO CALL TDHE IF (PSW,IS,ZERO ) iTHEN 1 MINUTE L I H,0 SHLD SECONDS LHLD ELPMIN INX H SHLD ELPMIN ENDIF ENDIF RET ς 3f_-_ιMιr 1 ~ • LDA 8AG IF (.A, IS, ZERO ) iTHEN USING SPIROMETER LHLD SMAD iSUM VALUE MOV A,H CMA AN I OFH MOV H,A MOV A.L CMA MOV L,A SHLD DATA LHLD RIPT LXI D.ABBUFF CALL PRNG 1 ! LHLD SPAD ; SPIROMETER VALUE MOV A,H CMA AN I OFH MOV H,A MOV A,L CMA MQV L,A SHLD DATA LDA PNFLAG IF ( .A,IS,NZERO) ;THEN INPUTTING PNEUMOTACH-SO INTEGRATE FILE: VSETUP.ASM •NOTE:**** ASSUME 0 FLOW IS AT 7FFH LHLD DATA LXI D,7FFH ORA A DSBC D DIVIDE BY 3 (SIGNED SHIFT RIGHT ) CHANGE TO SHIFT ONLY 2 TIMES 2BYTES PER INSTRUCTION NOP NOP * NOP NOP ; SRAR H i RARR L SRAR H RARR L SRAR H RARR L LDED PNSUM DAD D SHLD PNSUM ;ADD OFFST SO ALL ft > 0 LXI D,800H DAD D SHLD DATA ENDIF CALL CKFL-I.P LHLD RIPT LXI 0, SPBUFF CALL PRNG * ELSE jUSING FIXED VOLUME iSTORE SUM DATA IN SPBUFF SO WILL BE USED TO PICK OFF 8REATHS LHLD SMAD ;SUM VALUE MOV A,H cm ANI OFH MOV H,A MOV A,L cm MOV L,A SHLD DATA LHLD RIPT LXI D,SPBUFF CALL PRNG ;FILL ABBUFF WITH ZEROES LXI H,0 SHLD DATA LHLD RIPT LXI D,ABBUFF - - FILE: VSETUP.ASM CALL PRNG ENDIF FILL RCBUFF WITH ZEROES LXI H,0 SHLD DATA LHLD RIPT LXI D, RCBUFF CALL PRNG INCREMENT RIPT FOR NEXT TIME LHLD TIME INX H SHLD TIME SHLD DATA LHLD RIPT LXI D.TMBUFF CALL PRNG LHLD RIPT SHLD OORIPT LXI B.RSIZE LHLD RIPT CALL PTRUPD SHLD RIPT LDA WRAPF IF (.A, IS,ZERO) ;SEE IF RIPT RESET TO 0 LXI D,0 LHLD RIPT CALL TDHE IF (PSU,IS,ZERO) MVI A,OFFH STA WRAPF ENDIF ENDIF RET 1 ! CKFLIP: iCHECK IF NEED > TO FLIP LDA FLIPV IF .A, IS,NZERO) -1 1 8- in practice, the Respigraph ™ scaling amplifiers for the rib cage and abdomen signals are initially set at unity gain, 10 minute baseline is then taken. The program automatically computes the delta values for the rib cage and abdomen signals discards thje wild points, computes the mean values for the rib cage and abdomen from the totals of the remaining delta values computes the standard deviations for those means, and then computes the proportionality factor Z from Equation M. The scaling amplifier for the rib cage is then adjusted to the proportionality factor Z. The real time output from the Respigraph ™ representing the sum of the rib cage and abdomen signals is then proportional to tidal volume as explained more fully above. The program also recomputes the proportionality factor Z during each subsequent 5 minute interval. If the recomputed value differs from 1.0 by more than an acceptable amount, the calibration routine can be rerun. The program als computes the scaling factor M from Equation N if instructed to do so upon inputting an actual tidal volume value as derived, e.g., by spirometry. While there has been shown and described herein a preferre embodiment of the present invention and certain suggested modifications thereto, it will be apparent that further change and modifications may be made without departing from the spiri and scope of the invention. Accordingly, the foregoing description should be construed as illustrative and not in the limiting sense, the scope of the invention being defined by th following claims.

Claims: -119- Clai 1 1. In a method for non-invasively measuring a subject's respiration volume of the type including providing a signal responsive to a rib cage dimension indicative of rib cage contribution to respiration volume, providing a signal responsive to an abdominal dimension indicative of abdominal contribution to respiration volume, multiplying at least one said rib cage and abdominal signals by predetermined weightin factors reflecting the relative contributions of said rib cag and abdomen to respiration volume, and summing said weighted signals for providing a signal proportional to respiration volume, the improvement comprising non-invasively determining said weighting factors by ' (a) totaling the delta values for said rib cage sig over a baseline period of substantially steady state breathing; (b) totaling the delta values for said abdomen sign over a baseline period of substantially steady state breathing; (c) dividing the average variability of the mean of the total of said delta values for one of said rib cage abdomen signals by the average variability of the mean of the to of said delta values for the other of said rib cage or abdo signals; and (d) and multiplying said other signal by a weighti factor equaling the quotient derived from step (c) ,

Inventors: WATSON HERMAN, WATSON, HERMAN
Applicants: RESPITRACE CORP, RESPITRACE CORPORATION
Application year: 1987
Main classification: A61B5
IPC codes: A61B5