DAY_C1_COURSWORK (Рабочие материалы к курсам лекций)
Описание файла
Файл "DAY_C1_COURSWORK" внутри архива находится в следующих папках: STEFANOVICH_MGUPI, STEFANOVICH_MGUPI_DAY_C1_PROGDOC. Документ из архива "Рабочие материалы к курсам лекций", который расположен в категории "". Всё это находится в предмете "программирование и алгоритмизация" из 5 семестр, которые можно найти в файловом архиве РТУ МИРЭА. Не смотря на прямую связь этого архива с РТУ МИРЭА, его также можно найти и в других разделах. Архив можно найти в разделе "лекции и семинары", в предмете "программирование и алгоритмизация" в общих файлах.
Онлайн просмотр документа "DAY_C1_COURSWORK"
Текст из документа "DAY_C1_COURSWORK"
ФЕДЕРАЛЬНОЕ АГЕНСТВО ПО ОБРАЗОВАНИЮ ГОУВПО
МОСКОВСКИЙ ГОСУДАРСТВЕННЫЙ УНИВЕРСИТЕТ ПРИБОРОСТРОЕНИЯ И ИНФОРМАТИКИ
Факультет ИС
«Интеллектуальные информационные системы»
Кафедра ИС-4
«Мехатроника производственных систем»
КУРСОВАЯ РАБОТА ПО ДИСЦИПЛИНЕ
ПРОГРАММИРОВАНИЕ
«ПРОГРАММНЫЙ ИМИТАТОР ЭЛЕКТРОННЫХ СХЕМ»
Дисциплина: 3403. Специальность: 0718
Форма обучения: дневная.
Работу выполнила студентка: Доронина Л.В.
Код: 94505.
Группа: ИС-4-9402.
Руководитель: доцент кафедры ИС-4, к.т.н.
________________А.Е. Стефанович.
МОСКВА
2006
CОДЕРЖАНИЕ.
СТР | |
| 3 |
| 4 |
| 5 |
| 19 |
ТИТУЛЬНЫЙ ЛИСТ ПРОГРАММЫ.
ЭЛЕКТРОННАЯ СХЕМА.
ИСХОДНЫЙ ТЕКСТ ПРОГРАММЫ.
/*######################################################*/
/*Copyright (C) 2006 by A.E.Stefanovich tel. 268-3916, 236-2729
Moscow State Academy of the Instrumentation and Informatics MGAPI
Chair Mechatronics of the systems industrial TI-4
*/
/*######################################################*/
/* File: imMG.c
Imitator of the schemes electronics */
/*############################################## LEGEND */
/* <=### CHANGE ###
Moscow State Academy of the Instrumentation and Informatics MGAPI
Chair Mechatronics of the systems industrial TI-4
---------------
Student: L.V. Doronina
Code: 94505
Group: I-4-9402
---------------
Discipline: Programming 3403
Specialty: 0718
Teacher: A.E. Stefanovich
---------------
Year: 2006
---------------
DEVICE LVD
Entrances: X1,X2,X3;
Or1=Y2Y1X3+Y1Y3X2+Y3Y2X1+X1X2X3
Or2=X3X2+X3X1+X2X1
Exits:Z1, Z2
*/
/*############################################## PROGRAMME */
/*============================= Includes */
#include <c:\TURBOC.3_0\include\stdio.h>
#include <c:\TURBOC.3_0\include\conio.h>
#include <c:\TURBOC.3_0\include\stdlib.h>
#include <c:\TURBOC.3_0\include\graphics.h>
/*============================= Declarations */
int graph_regime();
int text_regime();
int title_sheet();
int draft(int mode); /* <=### CHANGE ### */
int entry_x(); /* <=### CHANGE ### */
int bit(int x,int y,int bit); /* 0 or 1 */
/*============================= Global constants */
#define LF cprintf("\n")
#define CR cprintf("\r")
#define HT cprintf("\t")
#define VT cprintf("\v")
#define BS cprintf("\b")
#define BELL cprintf("\a")
/* */
#define STOP getch()
#define STOP_DRAFT bioskey(0)
#define ALERT_SIGNAL cprintf("\a\a\a")
#define ROW 25
#define COL 80
#define ROW_D 36 /* <=### CHANGE ### */
#define COL_D 50 /* <=### CHANGE ### */
/* */
#define DISPLAY 1
#define WORK 0
/*============================= Global variable */
/*----------------------------- Device */ /* <=### CHANGE ### */
unsigned int X1,X2,X3; /* Entrances */
unsigned int Y1,Y2,Y3; /* Invert. Entrances */
unsigned int And1,And2,And3,And4,And5,And6,And7; /* 1 range */
unsigned int Or1,Or2; /* 2 range */
/*------------------------------ Global graphic variables */
int Font[8]; /* NN user characters */
int Maxx,Maxy; /* Max. dimensions of the screen in the pixels */
/*----------------------------- Text */ /* <=### CHANGE ### */
char *title_1=
" Moscow State Academy of the Instrumentation and Informatics (MGAPI) ";
char *title_2=
" I M I T A T O R - LVD ";
char *title_3=
" Student: L.V. Doronina ";
char *title_4=
" Group: TI-4-94-02 (d); Code: 94505 ";
char *title_5=
" Discipline: Programming and bases of algorithms (3401) ";
char *title_6=
" Specialty: 2102 ";
char *title_7=
" Chair Mechatronics of the systems industrial (TI-4) ";
char *title_8=
" Teacher: A.E. Stefanovich ";
char *title_9=
" Year: 2003-2004 ";
/*------------- Text (device) */
char *title_10=
" Z1=Y2Y1X3+Y1Y3X2+Y3Y2X1+X1X2X3 ";
char *title_11=
" Z2=X3X2+X3X1+X2X1 ";
/*############################################## MAIN */
main()
{
/*----------------------------- Variables */
char work_exit[2];
/*-----------------------------*/
title_sheet();
/* */
draft(DISPLAY);
/* */
while(1)
{/*----------------------------- Top while(1) */
for(;;)
{/*------------ Top for(;;) */
clrscr();
gotoxy(20,12);
cprintf
(" Input 1 (for Work) or 0 (for Exit) --> ");
cscanf("%s",&work_exit);
if(work_exit[0]=='0')
exit(EXIT_SUCCESS); /* -> EXIT SUCCESS */
if(work_exit[0]=='1')
break; /* -> to START */
ALERT_SIGNAL;/* ERROR of the Input and ^ */
}/*------------ Down for(;;) */
/*----------------------------- START */
entry_x();
/* */
draft(WORK);
}/*----------------------------- Down while(1) */
}
/*############################################## SUB_PROGRAMMS */
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int graph_regime()
{
/*----------------------------- Variables */
int gdriver=DETECT,gmode,errorcode;
/*----------------------------- Graph. initialisation */
initgraph(&gdriver,&gmode,"C:\\TURBOC.3_0\\BGI");
errorcode=graphresult();
if(errorcode != grOk)
{
gotoxy(1,24);
textattr(LIGHTRED+(BLACK<<4));
cprintf("GRAPHICS ERROR: %s\n",grapherrormsg(errorcode));
STOP;
exit(EXIT_SUCCESS);
}
Maxx=getmaxx();
Maxy=getmaxy();
/*----------------------------- Installuserfont */
Font[0]=installuserfont("bold");
Font[1]=installuserfont("euro"); /* Cyr */
Font[2]=installuserfont("lcom"); /* Cyr */
Font[3]=installuserfont("litt");
Font[4]=installuserfont("sans");
Font[5]=installuserfont("scri"); /* Cyr manuscript */
Font[6]=installuserfont("simp"); /* Cyr */
Font[7]=installuserfont("tscr"); /* Cyr manuscript */
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
text_regime()
{
closegraph();
restorecrtmode();
textbackground(BLACK);
textcolor(WHITE);
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int title_sheet()
{
/*----------------------------- Variables */
int x,y;
int kx; /* Scale of the title sheet */
int ky;
/*----------------------------- Graph. initialisation */
graph_regime();
/*----------------------------- Scale of the title sheet */
kx=Maxx/COL;
ky=Maxy/ROW;
/*----------------------------- Title 1 */
setcolor(YELLOW);
setbkcolor(BLACK);
settextstyle(SMALL_FONT,HORIZ_DIR,5);
settextjustify(CENTER_TEXT,CENTER_TEXT);
x=Maxx/2;
y=1*ky;
outtextxy(x,y,title_1); /* MGAPI */
/*----------------------------- Frame */
setcolor(WHITE);
setlinestyle(SOLID_LINE,0,THICK_WIDTH);
x=1*kx;
y=2*ky;
rectangle(x,y,Maxx,Maxy);
setfillstyle(SOLID_FILL,BLUE);
x=Maxx/2;
y=Maxy/2;
floodfill(x,y,WHITE);
/*----------------------------- Text */
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(YELLOW);
settextstyle(SMALL_FONT,HORIZ_DIR,7);
x=Maxx/2;
y=19*ky;
outtextxy(x,y,title_4); /* Group, Code ... */
settextstyle(SMALL_FONT,HORIZ_DIR,5);
x=Maxx/2;
y=4*ky;
outtextxy(x,y,title_7); /* TI-4... */
settextstyle(SMALL_FONT,HORIZ_DIR,5);
setcolor(LIGHTGRAY);
x=Maxx/2;
y=21*ky;
outtextxy(x,y,title_6); /* Speciality... */
x=Maxx/2;
y=22*ky;
outtextxy(x,y,title_5); /* Discipline... */
x=Maxx/2;
y=23*ky;
outtextxy(x,y,title_8); /* Teacher... */
x=Maxx/2;
y=24*ky;
outtextxy(x,y,title_9); /* Year... */
settextstyle(TRIPLEX_FONT,HORIZ_DIR,0);
setusercharsize(1,1,3,2);
settextjustify(CENTER_TEXT,CENTER_TEXT);
x=Maxx/2;
y=11*ky;
setcolor(BLACK);
outtextxy(x,y,title_2); /* IMITATOR... */
setcolor(WHITE);
outtextxy(x+4,y+4,title_2);
setcolor(WHITE);
settextstyle(SMALL_FONT,HORIZ_DIR,7);
settextjustify(CENTER_TEXT,CENTER_TEXT);
x=Maxx/2;
y=14*ky;
outtextxy
(x,y,"(Imitator of the schemes electronics)");
setcolor(YELLOW);
settextstyle(SMALL_FONT,HORIZ_DIR,7);
settextjustify(CENTER_TEXT,CENTER_TEXT);
x=Maxx/2;
y=18*ky;
outtextxy(x,y,title_3); /* Student... */
/*----------------------------- Happy work */
settextstyle(SMALL_FONT,HORIZ_DIR,7);
settextjustify(CENTER_TEXT,CENTER_TEXT);
x=Maxx/2;
y=16*(Maxy/ROW);
while(bioskey(1)==0)
{
setcolor(random(16));
outtextxy(x,y," HAPPY WORK ");
}
STOP_DRAFT;
/*----------------------------- Return to text mode */
text_regime();
/* */
return 0;
}
/*IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/
int draft(int mode) /* <=### CHANGE ### */
{
/*----------------------------- Variables */
int x,y;
int kx; /* Scale of the title sheet */
int ky;
/*----------------------------- Graph. initialisation */
graph_regime();
/*----------------------------- Scale of the title sheet */
kx=Maxx/COL_D;
ky=Maxy/ROW_D;
/*----------------------------- Frame */
setbkcolor(BLACK);
setcolor(LIGHTGRAY);
setlinestyle(SOLID_LINE,0,NORM_WIDTH);
rectangle(0,0,50*kx,36*ky);
/*----------------------------- Title 1 */
settextstyle(SMALL_FONT,HORIZ_DIR,7);
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(YELLOW);
outtextxy(25*kx,1*kx,title_2);
/*----------------------------- Devices */
settextstyle(Font[2],HORIZ_DIR,1);
setlinestyle(SOLID_LINE,0,NORM_WIDTH);
setcolor(WHITE);
/*------------- Devices Invertor */
/* invertor 1 */
rectangle(38*kx,7*ky,40*kx,11*ky);
circle(39*kx,11*ky,3);
setcolor(YELLOW);
outtextxy(39*kx,8*ky,"1");
setcolor(LIGHTGRAY);
outtextxy(39*kx,10*ky,"1");
/* invertor 2 */
rectangle(42*kx,7*ky,44*kx,11*ky);
circle(43*kx,11*ky,3);
setcolor(YELLOW);
outtextxy(43*kx,8*ky,"1");
setcolor(LIGHTGRAY);
outtextxy(43*kx,10*ky,"2");
/* invertor 3 */
rectangle(46*kx,7*ky,48*kx,11*ky);
circle(47*kx,11*ky,3);
setcolor(YELLOW);
outtextxy(47*kx,8*ky,"1");
setcolor(LIGHTGRAY);
outtextxy(47*kx,10*ky,"3");
/*------------- Devices And */
/* And 1*/
rectangle(4*kx,17*ky,8*kx,21*ky);
setcolor(YELLOW);
outtextxy(6*kx,18*ky,"&");
setcolor(LIGHTGRAY);
outtextxy(6*kx,20*ky,"1");
/* And 2 */
rectangle(9*kx,17*ky,13*kx,21*ky);
setcolor(YELLOW);
outtextxy(11*kx,18*ky,"&");
setcolor(LIGHTGRAY);
outtextxy(11*kx,20*ky,"2");
/* And 3 */