unsigned int newtic=10947,oldtic=65535L;// new tic for 100,1 in second
init_azp(azp,"kanal1.dat");
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
outst=fopen("masp.res","w");
if(outst==NULL){
puts("Anable open file\n");
exit(1);
}
fprintf(outst,"\t\t\t\tРезультаты обработки \n");
fprintf(outst,"\n");
fprintf(outst," Период\t\t\t\tПараметры сигнала \n");
setbkcolor(0);
setcolor(1);
cleardevice();
line(1,100,640,100);
line(1,200,640,200);
line(1,300,640,300);
line(1,400,640,400);
line(1,1,1,400);
setcolor(15);
outportb(0x43,0x36);
outportb(0x40,newtic&0x00ff);
outportb(0x40,newtic>>8);
oldhandler = getvect(INTR);
setvect(INTR, handler);
while (stop==1)
{
}
setvect(INTR, oldhandler);
outportb(0x43,0x36);
outportb(0x40,oldtic&0x00ff);
outportb(0x40,oldtic>>8);
fclose(outst);
getch();
closegraph();
}
void init_azp(int mas[][Meanings],char filename[])
{
int i=0,j;
unsigned int *tmp;
FILE *f;
char mode[]="rt";
f=fopen(filename,mode);
if(f==NULL){
puts("Anable open file\n");
exit(1);
}
for(i=0;i<4;i++)
{
for(j=0;j<500;j++)
{
fscanf(f,"%d",tmp);
mas[i][j]=*tmp;
}
rewind(f);
}
fclose(f);
}
Результати роботи програми