📄 main.c
字号:
#ifndef __STDIO_H
#include <stdio.h>
#endif
#ifndef __BIOS_H
#include <bios.h>
#endif
#ifndef __DOS_H
#include <dos.h>
#endif
#ifndef __STDLIB_H
#include <stdlib.h>
#endif
#ifndef __STRING_H
#include <string.h>
#endif
#ifndef __CONIO_H
#include <conio.h>
#endif
#ifndef __TIME_H
#include <time.h>
#endif
#ifndef __ALLOC_H
#include <alloc.h>
#endif
#ifndef __PROCESS_H
#include <process.h>
#endif
#ifndef __MENU_H
#include "menu.h"
#endif
#ifndef __MONIWAVE_H
#include "moniwave.h"
#endif
#ifndef __VIDEO_H
#include "video.h"
#endif
#ifndef __DISCHAR_H
#include "dischar.h"
#endif
#ifndef __RUNKEY_H
#include "runkey.h"
#endif
#ifndef __INTERUPT_H
#include "interupt.h"
#endif
#ifndef __PRINTLST_H
#include "printlst.h"
#endif
#ifndef __PRINT_H
#include "print.h"
#endif
//---------------------心跳显示----------------------------
#define DrawHeart(); if(oldHeartsta!=heartsta){oldHeartsta=heartsta;out_heart(60, 576, LIGHTRED, BLACK, oldHeartsta);}
//-------------------结束心跳显示--------------------------
int *monitor_demo; //MONDEMO->value
int *ECGW_revise; //ECGWREVISE->value
int *second_lead; //SECLEAD->value
int *SPO2_revise; //SPO2REVISE->value
int *SYST_revise; //SYSTREVISE->value
int *MEAN_revise; //MEANREVISE->value
int *DIAS_revise; //DIASREVISE->value
int *TEMP1_revise; //TEMP1REVISE->value
int *TEMP2_revise; //TEMP2REVISE->value
int *RESP_check; //RESPCHK->value
int *TEMP1_check; //TEMP1CHK->value
int *TEMP2_check; //TEMP2CHK->value
void main(void)
{
Keycode key;
char Quit=1;
int WavePointCount=0;//每次画波形时所需要画的点数;
char tempstr[20];//临时字符存放缓冲
int i_i, j_j, k_k, intvar;//循环计数用
unsigned Edr_cus=0,Rdr_cus=0;//波形数据读指针
unsigned Esave[3];
unsigned E_ALLdw_cus=0;//计算其他导联时用的指针
unsigned char EF2=0;
//unsigned EF2=0, PF2=0;//ECG PLETH 波形第一次填充标志
unsigned char listcount=0;//波形速度计数
int Esampling[7], Epointy[7], Psampling, Ppointy;
unsigned baserow, plethrow;
//int ECGrow=ECG_IENDY;//记录ECG行数
unsigned char oldHeartsta=0xff;//心电显示
MonData ListData; //呼吸关时列表数据
struct time ListTime; //呼吸关时列表数据的时间记录
unsigned char Listcount=0xff; //列表显示计数器
unsigned char Listoldsec=0; //列表时间
unsigned char Listtimecount=0;//列表时间计数器
monitor_demo=&(MONDEMO->value);
ECGW_revise=&(ECGWREVISE->value);
second_lead=&(SECLEAD->value);
SPO2_revise=&(SPO2REVISE->value);
SYST_revise=&(SYSTREVISE->value);
MEAN_revise=&(MEANREVISE->value);
DIAS_revise=&(DIASREVISE->value);
TEMP1_revise=&(TEMP1REVISE->value);
TEMP2_revise=&(TEMP2REVISE->value);
RESP_check=&(RESPCHK->value);
TEMP1_check=&(TEMP1CHK->value);
TEMP2_check=&(TEMP2CHK->value);
if ( (DataHand=(MonData far *)farcalloc(1,sizeof(MonData)*MONDATAL))==NULL) exit(1);
if ((ECGcache[0]=(unsigned char far*)farmalloc(EcacheL))==NULL) exit(2);
if ((ECGcache[1]=(unsigned char far*)farmalloc(EcacheL))==NULL) exit(3);
if ((ECGcache[2]=(unsigned char far*)farmalloc(EcacheL))==NULL) exit(4);
if ((ECGcache[3]=(unsigned char far*)farmalloc(EcacheL))==NULL) exit(5);
if ((ECGcache[4]=(unsigned char far*)farmalloc(EcacheL))==NULL) exit(6);
if ((ECGcache[5]=(unsigned char far*)farmalloc(EcacheL))==NULL) exit(7);
if ((ECGcache[6]=(unsigned char far*)farmalloc(EcacheL))==NULL) exit(8);
if ((ECGcache2[0]=(unsigned char far*)farmalloc(EcacheL))==NULL)exit(9);
if ((ECGcache2[1]=(unsigned char far*)farmalloc(EcacheL))==NULL)exit(10);
if ((ECGcache2[2]=(unsigned char far*)farmalloc(EcacheL))==NULL)exit(11);
if ((ECGcache2[3]=(unsigned char far*)farmalloc(EcacheL))==NULL)exit(12);
if ((ECGcache2[4]=(unsigned char far*)farmalloc(EcacheL))==NULL)exit(13);
if ((ECGcache2[5]=(unsigned char far*)farmalloc(EcacheL))==NULL)exit(14);
if ((ECGcache2[6]=(unsigned char far*)farmalloc(EcacheL))==NULL)exit(15);
if ((ECGdata[0]=(unsigned char *) malloc(ECGN))==NULL) exit(16);
if ((ECGdata[1]=(unsigned char *) malloc(ECGN))==NULL) exit(17);
if ((ECGdata[2]=(unsigned char *) malloc(ECGN))==NULL) exit(18);
if ((ECGdata[3]=(unsigned char *) malloc(ECGN))==NULL) exit(19);
if ((ECGdata[4]=(unsigned char *) malloc(ECGN))==NULL) exit(20);
if ((ECGdata[5]=(unsigned char *) malloc(ECGN))==NULL) exit(21);
if ((ECGdata[6]=(unsigned char *) malloc(ECGN))==NULL) exit(22);
if ((PLETHcache = (unsigned char *) malloc(EcacheL)) == NULL) exit(23);
if ((PLETHcache2 = (unsigned char *) malloc(EcacheL)) == NULL) exit(24);
if ((PLETHdata=(unsigned char *)malloc(PLETHN))==NULL) exit(25);
if ((RESPdata=(unsigned char *) malloc(RESPN))==NULL) exit(26);
if ((RealData_Sta=(REALTIMEDATA far *)farcalloc(1,sizeof(REALTIMEDATA)*REALDATALEN))==NULL) exit(27);
disable();
outportb(0x21,0); //初始化8259A的IMR(中断屏蔽寄存器)
oldIQR8=getvect(INT8); //时间中断
setvect(INT8,newIQR8);
oldIQR4=getvect(INT0c);
setvect(INT0c, newIQR4); //com1中断
oldIQR3=getvect(INT0b);
setvect(INT0b, newIQR3); //com2中断
InitCOM1();
InitCOM2();
enable();
outportb(0x3f9,0x01); //接收信息有效中断启动
outportb(0x2f9,0x01);
for(i_i=0;i_i<7;i_i++)
memset(ECGdata[i_i], 128, ECGN);
memset(PLETHdata, 0, PLETHN);
memset(RESPdata, 0, RESPN);
for(i_i=0; i_i<7; i_i++)
_fmemset(ECGcache[i_i],128,EcacheL);
memset(PLETHcache, 0, EcacheL);
for(i_i=0;i_i<MONDATAL;i_i++){
(DataHand+i_i)->HR=(DataHand+i_i)->PR=(DataHand+i_i)->SYST=(DataHand+i_i)->MEAN=
(DataHand+i_i)->DIAS=(DataHand+i_i)->SPO2=(DataHand+i_i)->RESP=255;
(DataHand+i_i)->ST=127; (DataHand+i_i)->TEMP2=(DataHand+i_i)->TEMP1=455;
}
for(i_i=0;i_i<REALDATALEN;i_i++){
(RealData_Sta+i_i)->DATA.HR=(RealData_Sta+i_i)->DATA.PR=\
(RealData_Sta+i_i)->DATA.SYST=(RealData_Sta+i_i)->DATA.MEAN=\
(RealData_Sta+i_i)->DATA.DIAS=(RealData_Sta+i_i)->DATA.SPO2=\
(RealData_Sta+i_i)->DATA.RESP=255;
(RealData_Sta+i_i)->DATA.ST=127;
(RealData_Sta+i_i)->DATA.TEMP2=(RealData_Sta+i_i)->DATA.TEMP1=455;
(RealData_Sta+i_i)->TIME=0;
}
setvgamode(0x6a);//设置显示模式800X600X16
//setvgamode(0x114);//设置显示模式800X600X16
ReadNvmemory();//发读心电模块NVmemory数据命令
//////////////////////////////////////////////////////////////////////////////
////for(i_i=0; i_i<=0x3f; i_i++){ ////////
//// sprintf(tempstr,"0x%02x ",NVmemmap[i_i]); ////////
//// outtext((i_i/8)*20, (i_i%8)*48+120, tempstr, YELLOW, BLACK, FONT10);///
////} ////////
////getch(); ////////
//////////////////////////////////////////////////////////////////////////////
if(Edw_cus||Rdw_cus)//if have IQR, then read NVmem
GetNVmemorToMap();
initface();//初始化数据和界面
/*---------------
for(i_i=0; i_i<=0x3f; i_i++){
sprintf(tempstr, "0x%2x", NVmemmap[i_i]);
outtext(20+(i_i/8)*20, 40+(i_i%8)*56, tempstr, YELLOW, BLACK, FONT10);
}
getch();
----------------*/
Edr_cus=E_ALLdw_cus=Edw_cus;
Rdr_cus=Rdw_cus;//数据指针拉平
DataSampling();//HR,PR,ST..数据先取样一次
do{
//---------------------键盘处理-------------------
if(bioskey(1)!=0){
key.w=bioskey(0);
switch(key.b? key.b : key.w){
case 'v':
case 'V':
case F1_K: key_code=F1_K; break;
case 'p':
case 'P':
case F2_K: key_code=F2_K; break;
case 'f':
case 'F':
case F3_K: key_code=F3_K; break;
case 's':
case 'S':
case F4_K: key_code=F4_K; break;
case 'r':
case 'R':
case F5_K: key_code=F5_K; break;
case 't':
case 'T':
case F6_K: key_code=F6_K; break;
case 'w':
case 'W':
case F8_K: key_code=F8_K; break;
case 'a':
case 'A':
case LEFT_K: key_code=LEFT_K; break;
case 'd':
case 'D':
case RIGHT_K: key_code=RIGHT_K; break;
case 'o':
case 'O':
case ENTER_K: key_code=ENTER_K; break;
case 'q':
case 'Q': Quit=0; break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -