This text file contains two programs that can be run under GWBASIC. To do this, make two copies of this file and, using a text editor, chop out everything exept the program you want to run and save the result as a file with a .BAS extention. Repeat this with the other copy, only keeping the program part that you removed in the first copy. Again, rename with the .BAS extention and then both files can be run under GWBASIC Graham Cattley Project Designer Electronics Australia 18/04/96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Notes on MONITOR.BAS This short BASIC program is to be used with the PC Electrocardiogram described in Electronics Australia - July 1995. It is written for GWBASIC and does not run under QBASIC without modification. The program's purpose is to provide a real time ECG trace similar to that which is used in the operating room environment. The most interesting modification is seen in line 5600. In it, an instruction of the assembly language subroutine has been modified so that the routine gets ONE data point at a time. This is in contrast to the 640 points that the original software collects between screen updates. This enables real time display of the data using the BASIC code in lines 7200 to 8600. The user will have to tweak this program to accommodate his machine's: 1. Parallel port address (line 1500) 2. The speed of the machine (lines 1600 & 8000), and 3. The screen mode (lines 3200 & 3400) The details are left to the reader. Please provide me with feedback and/or questions relating to your use of this program. I would likewise be interested in seeing YOUR modifications of the original PC-ECG software. Robert Witriol, M.D. c/o Anaesthesia Associates of Rochester 1400 Portland Avenue Rochester, New York 14621 USA email: witr @ uhura.cc.rochester.edu 70701.777@compuserve.com 1000 'SAVE "MONITOR" ,A 1100 REM ........................................ 1200 CLEAR, &HFBFF 1300 DEF SEG 'upper limit for BASIC program; subroutine starts at &HFC00 1400 DEFINT A-Z 1500 PORT= &H278' or &H378 1600 DELAY = 1 1700 S=&HFC00 'address of beginning of machine language subroutine 3000 REM ........................................ 3200 SCREEN 9 ' or 2 3400 COLOR 14 ' rem out this line if in screen mode 2 3600 CLS 3800 DEF SEG 4000 REM ........................................ 4200 FOR I=0 TO 78: READ D: POKE S+I,D :NEXT 4400 DATA &H55,&H89,&HE5,&H8B,&H76,&H08,&H8B,&H14 4600 DATA &H8B,&H76,&H06,&H8B,&H2C,&HBB,&H4F,&HFC 4800 DATA &HB9,&H00,&H00,&H42,&HED,&H4A,&H25,&H80 5000 DATA &H00,&H74,&H06,&H41,&HE8,&H1D,&HOO,&HEB 5200 DATA &HF2,&H89,&H0F,&H42,&HED,&H4A,&H25,&H80 5400 DATA &H00,&H75,&H06,&H41,&HE8,&H0D,&H00,&HEB 5600 DATA &HF2,&H43,&H81,&HFB,&HCE,&HFE,&H90,&H90 5800 DATA &H5D,&HCA,&H04,&H00,&HB0,&HFF,&HEE,&HE8 6000 DATA &H07,&H00,&HB0,&HFE,&HEE,&HE8,&H01,&H00 6200 DATA &HC3,&H89,&HE8,&H48,&H75,&HFD,&HC3 6400 REM ........................................ 6600 FOR X=0 TO 639 6800 CALL S(PORT,DELAY) 7000 Y=PEEK(&HFC4F)-110 'address of datum is beyond end of subroutine 7200 IF X=0 THEN PSET(X,Y) ELSE LINE -(X,Y) 7400 C2B=(X+20) MOD 640 7600 LINE (C2B,O)-(C2B, 199),0 7800 PSET (X,Y) 8000 FOR WASTTIM=1 TO 50 'amount of time to waste between data acquisitions 8200 IF INKEY$<>"" THEN SYSTEM 8400 NEXT WASTTIM 8600 NEXT X 8800 GOTO 6600 Notes on HOLTER.BAS This short BASIC program is to be used with the PC Electrocardiogram described in Electronics Australia - July 1995. It is written for GWBASIC and does not run under QBASIC without modification. The program's purpose is to write 4000 sampled ECG measurements to the file "HOLTER.TXT". It simultaneously provides a real time ECG trace similar to that which is used in the operating room environment. The file "HOLTER.TXT" may be opened with Microsoft Excel, which may then be used to create a line graph which will in fact be an ECG tracing. The output thus displayed is very nice indeed. My version of Excel has an upper limit of 4000 data points when creating a line graph. This is why I elected to collect 4000 data points. I have adjusted the program's timing so that on my machine this takes about a minute. The program also records the elapsed time as the final data point (the 4001th datum). This is useful in adjusting the timing and determining the heart rate. I have used output formatted in this way to capture my wife's numerous ventricular premature contractions ("skipped heartbeats") on paper. When presented to her family doctor, the graph was sufficient evidence to justify a referral to a cardiologist. The most interesting modification is seen in line 1600. In it, an instruction of the assembly language subroutine has been modified so that the routine gets ONE data point at a time. This is in contrast to the 640 points that the original software collects between screen updates. This enables real time display of the data using the BASIC code in lines 7200 to 8600. The user will have to tweak this program to accommodate his machine's: 1. Parallel port address (line 1200) 2. The speed of the machine (line 1200) 3. The screen mode (line 1850), and 4. The name of the desired output file (line 1800). Be careful not to overwrite this file with the output of the program (in case they have been given the same name). The details are left to the reader. Please provide me with feedback and/or questions relating to your use of this program. I would likewise be interested in seeing YOUR modifications of the original PC-ECG software. Robert Witriol, M.D. c/o Anaesthesia Associates of Rochester 1400 Portland Avenue Rochester, New York 14621 USA email: witr@uhura.cc.rochester.edu 70701.777@compuserve.com 1000 'SAVE "HOLTER" ,A 1050 'RENUM 1000,,50 1100 CLEAR, &HFBFF: DEF SEG 1150 DEFINT A-Z 1200 PORT=&H278: DELAY=1: S=&HFC00 1250 FOR I=0 TO 78: READ D: POKE S+I,D :NEXT 1300 DATA &H55,&H89,&HE5,&H8B,&H76,&H08,&H8B,&H14 1350 DATA &H8B,&H76,&H06,&H8B,&H2C,&HBB,&H4F,&HFC 1400 DATA &HB9,&H00,&H00,&H42,&HED,&H4A,&H25,&H80 1450 DATA &H00,&H74,&H06,&H41,&HE8,&H1D,&H00,&HEB 1500 DATA &HF2,&H89,&H0F,&H42,&HED,&H4A,&H25,&H80 1550 DATA &H00,&H75,&H06,&H41,&HE8,&H0D,&H00,&HEB 1600 DATA &HF2,&H43,&H81,&HFB,&HCE,&HFE,&H90,&H90 1650 DATA &H5D,&HCA,&H04,&H00,&HB0,&HFF,&HEE,&HE8 1700 DATA &H07,&H00,&HB0,&HFE,&HEE,&HE8,&H01,&H00 1750 DATA &HC3,&H89,&HE8,&H48,&H75,&HFD,&HC3 1800 OPEN "HOLTER.TXT" FOR OUTPUT AS #2 1850 SCREEN 2 1900 CLS 1950 DIM ROW(639) 2000 ITER= 1 2050 DEF SEG 2100 REM ............................................ 2120 TIMO!=TIMER 2150 FOR COL=O TO 639 2200 CALL S(PORT,DELAY) 2250 ROW(COL)=PEEK(&HFC4F)- 110 2300 IF COL=O THEN PSET(COL,ROW(COL)) ELSE LINE -(COL,ROW(COL)) 2350 LASTCOL=COL 2400 LASTROW=ROW(COL) 2450 LASTROW2=155-LASTROW 2500 WRITE#2,LASTROW2 2550 IF LASTCOL<620 THEN COL2BLAN=LASTCOL+20 ELSE COL2BLAN=LASTCOL620 2600 FOR K=0 TO 199:PRESET (COL2BLAN,K):NEXT K 2650 PSET (COL,ROW(COL)) 2700 ITER=ITER+1 2750 IF ITER>4000 THEN GOTO 2950 2800 NEXT COL 2850 GOTO 2150 2900 REM ....................................................... 2950 TIM1!=TIMER 2960 ELAPSED!=TIM1!-TIMO! 2965 WRITE#2,ELAPSED! 2970 CLOSE #2 3000 SYSTEM