intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Giáo trình hình thành quy trình điều khiển thiết bị bán dẫn chứa các mạch logic điện tử p9

Chia sẻ: Sdfasf Dsgfds | Ngày: | Loại File: PDF | Số trang:10

46
lượt xem
4
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Tham khảo tài liệu 'giáo trình hình thành quy trình điều khiển thiết bị bán dẫn chứa các mạch logic điện tử p9', kỹ thuật - công nghệ, điện - điện tử phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả

Chủ đề:
Lưu

Nội dung Text: Giáo trình hình thành quy trình điều khiển thiết bị bán dẫn chứa các mạch logic điện tử p9

  1. . 82 LUAÂÄN VAÊN TOÁT NGHIEÄP Maxy = getmaxy(); } //--------------------------------------------------------- void InitValues(char *lpCaption) // Khoi tao cac gia tri cho bien Windows de ve cua so man hinh { int WinWidth, WinHeight; W_CHAR = 8; H_CHAR = 8; // Chieu rong va chieu cao cua mot ki tu W_SIZE = 8; H_SIZE = 20; T_SIZE = 18; MSG_SIZE = 20; COLOR_WINDOW = CYAN; COLOR_BUTTON = LIGHTGRAY; COLOR_BORDER = LIGHTGRAY; COLOR_CAPTION = BLUE; COLOR_TEXT = BLUE; strcpy(MainWindow.sCaption, lpCaption); // Gan gia tri cho WinRect - H.C.nhat chua cua so MainWindow.rWinRect.left = 0; MainWindow.rWinRect.top = 0; MainWindow.rWinRect.right = Maxx; MainWindow.rWinRect.bottom= Maxy; WinWidth = MainWindow.rWinRect.right-MainWindow.rWinRect.left+1; WinHeight= MainWindow.rWinRect.bottom-MainWindow.rWinRect.top+1; // Gan gia tri cho rSys - H.C.nhat chua SystemMenu MainWindow.rSys.left = BORDERSIZE; MainWindow.rSys.top = BORDERSIZE; MainWindow.rSys.right = MainWindow.rSys.left+T_SIZE; MainWindow.rSys.bottom= MainWindow.rSys.top+T_SIZE; // Gan gia tri cho rTitleBar - H.C.nhat chua thong tin thanh tieu de MainWindow.rTitleBar.left = BORDERSIZE+1;//MainWindow.rSys.right+1; MainWindow.rTitleBar.top = BORDERSIZE+1; MainWindow.rTitleBar.right = WinWidth-BORDERSIZE-1; MainWindow.rTitleBar.bottom= MainWindow.rSys.top+T_SIZE; // Gan gia tri cho rMenuBar - H.C.nhat chua thong tin menu // Gan gia tri cho rMessage - H.C.nhat chua thong tin cua cac //thong bao MainWindow.rMessage.left = BORDERSIZE+1; MainWindow.rMessage.right = WinWidth-BORDERSIZE-2; MainWindow.rMessage.top = WinHeight-(BORDERSIZE+2)-MSG_SIZE; MainWindow.rMessage.bottom= MainWindow.rMessage.top+MSG_SIZE; // Gan gia tri cho rViewPort - H.C.nhat chua thong tin ve vung lam viec // thuc su cua cua so MainWindow.rViewPort.left = BORDERSIZE+1; MainWindow.rViewPort.top = MainWindow.rTitleBar.bottom+2;//MainWindow.rMenuBar.bottom+2; MainWindow.rViewPort.right = WinWidth-BORDERSIZE-2; MainWindow.rViewPort.bottom= MainWindow.rMessage.top-2; VP_WIDTH = MainWindow.rViewPort.right-MainWindow.rViewPort.left; VP_HEIGHT = MainWindow.rViewPort.bottom-MainWindow.rViewPort.top; } //---------------------------------------------------------
  2. . 83 LUAÂÄN VAÊN TOÁT NGHIEÄP void OutMessage(char *Msg) // Ghi thong bao Msg ra cua so rMessage { struct fillsettingstype FillInfo; int OldColor; struct viewporttype vp; // luu thong tin cu getfillsettings(&FillInfo); OldColor = getcolor(); getviewsettings(&vp); // xoa thong bao cu setviewport(MainWindow.rWinRect.left, MainWindow.rWinRect.top, MainWindow.rWinRect.right, MainWindow.rWinRect.bottom, 1); setfillstyle(SOLID_FILL, COLOR_BUTTON); setcolor(COLOR_TEXT); bar(MainWindow.rMessage.left, MainWindow.rMessage.top, MainWindow.rMessage.right, MainWindow.rMessage.bottom); // in thong bao moi ra outtextxy(MainWindow.rMessage.left+W_CHAR, MainWindow.rMessage.bottom-H_CHAR-5, Msg); // tra ve trang thai cu setfillstyle(FillInfo.pattern, FillInfo.color); setcolor(OldColor); setviewport(vp.left,vp.top, vp.right, vp.bottom, 1); } //--------------------------------------------------------- void DrawScreenBorder(int left, int top, int right, int bottom) // Ve duong vien cho mot hinh chu nhat co toa do (left, top), (right, bottom) { setfillstyle(SOLID_FILL, COLOR_BORDER); bar(left, top, right, top+BORDERSIZE); bar(left, bottom, right, bottom-BORDERSIZE); bar(left, top, left+BORDERSIZE, bottom); bar(right-BORDERSIZE, top, right, bottom); setcolor(BLACK); rectangle(left, top, right, bottom); rectangle(left+BORDERSIZE, top+BORDERSIZE, right-BORDERSIZE, bottom-BORDERSIZE); } //--------------------------------------------------------- #include void InitScreen(void) // Ve cac thanh phan cua cua so { int x, y; int WinWidth, WinHeight; struct viewporttype vp; getviewsettings(&vp); setviewport(MainWindow.rWinRect.left, MainWindow.rWinRect.top, MainWindow.rWinRect.right, MainWindow.rWinRect.bottom, 1); WinWidth = MainWindow.rWinRect.right-MainWindow.rWinRect.left+1; WinHeight= MainWindow.rWinRect.bottom-MainWindow.rWinRect.top+1; x = (WinWidth-W_CHAR*strlen(MainWindow.sCaption))/2+1; y = BORDERSIZE+(T_SIZE-H_CHAR)/2+1; // Ve duong vien cua hinh chu nhat DrawScreenBorder(0, 0, WinWidth-1, WinHeight-1);
  3. . 84 LUAÂÄN VAÊN TOÁT NGHIEÄP delay(DEMODELAY); // Ve thanh tieu de setfillstyle(SOLID_FILL, COLOR_CAPTION); bar(MainWindow.rTitleBar.left, MainWindow.rTitleBar.top, MainWindow.rTitleBar.right, MainWindow.rTitleBar.bottom); setcolor(WHITE); outtextxy(x, y, MainWindow.sCaption); delay(DEMODELAY); // Ve SystemMenu setfillstyle(SOLID_FILL, COLOR_BUTTON); /* bar(MainWindow.rSys.left+1, MainWindow.rSys.top+1, MainWindow.rSys.right-1, MainWindow.rSys.bottom-1); setcolor(BLACK); rectangle((MainWindow.rSys.left+MainWindow.rSys.right)/2-5, (MainWindow.rSys.top+MainWindow.rSys.bottom)/2-1, (MainWindow.rSys.left+MainWindow.rSys.right)/2+5, (MainWindow.rSys.top+MainWindow.rSys.bottom)/2+1); delay(DEMODELAY); */ // Ve Menu // bar(MainWindow.rMenuBar.left, MainWindow.rMenuBar.top, // MainWindow.rMenuBar.right, MainWindow.rMenuBar.bottom); // outtextxy(MainWindow.rMenuBar.left+8, MainWindow.rMenuBar.bottom- 13, // "Menu of Program is here"); // delay(DEMODELAY); // Ve thanh chua thong bao bar(MainWindow.rMessage.left, MainWindow.rMessage.top, MainWindow.rMessage.right, MainWindow.rMessage.bottom); OutMessage("Welcome to Demo Window Program"); delay(DEMODELAY); // Ve vung lam viec setfillstyle(SOLID_FILL, COLOR_WINDOW); bar(MainWindow.rViewPort.left, MainWindow.rViewPort.top, MainWindow.rViewPort.right, MainWindow.rViewPort.bottom); setcolor(BLACK); rectangle(MainWindow.rViewPort.left-1, MainWindow.rViewPort.top, MainWindow.rViewPort.right+1, MainWindow.rViewPort.bottom); delay(DEMODELAY); // Dat lai viewport la rViewPort setviewport(MainWindow.rViewPort.left, MainWindow.rViewPort.top, MainWindow.rViewPort.right, MainWindow.rViewPort.bottom, 1); } //--------------------------------------------------------- /*void DrawSysCoordinates(void) // Ve he truc toa do { Xc = VP_WIDTH/2; Yc = VP_HEIGHT/2; setcolor(COLOR_TEXT); // ve hai truc toa do line(0, Yc, VP_WIDTH, Yc); line(Xc, 0, Xc, VP_HEIGHT); // ve hai mui ten line(Xc, 0, Xc-5, 5); line(Xc, 0, Xc+5, 5); line(VP_WIDTH, Yc, VP_WIDTH-5, Yc-5); line(VP_WIDTH, Yc, VP_WIDTH-5, Yc+5); // Ve goc toa do outtextxy(Xc-8, Yc+8, "O"); } //--------------------------------------------------------- void SetLineColor(int C)
  4. . 85 LUAÂÄN VAÊN TOÁT NGHIEÄP { LineColor = C; } //--------------------------------------------------------- void SetPixel(int x, int y) { putpixel(Xc+x, Yc-y, LineColor); } //--------------------------------------------------------- void Set2Pixel(int Ox, int Oy, int x, int y) { putpixel(Ox+x, Oy-y, LineColor); putpixel(Ox-x, Oy-y, LineColor); } //--------------------------------------------------------- void Set2PixelHor(int Ox, int Oy, int x, int y) { putpixel(Ox+x, Oy-y, LineColor); putpixel(Ox+x, Oy+y, LineColor); } //--------------------------------------------------------- void ClearViewPort(void) { struct fillsettingstype FillInfo; // luu thong tin cu getfillsettings(&FillInfo); setfillstyle(SOLID_FILL, COLOR_WINDOW); bar(0, 0, VP_WIDTH, VP_HEIGHT); setfillstyle(FillInfo.pattern, FillInfo.color); DrawSysCoordinates(); } */ // End of SCREEN.C //--------------------------------------------------------- #include int OutError(char *s) { void far *buf;//con tro chi vung luu tru man hinh unsigned int size = imagesize(200,150,470,240); LPEVENT lpEvent; int Cx1=280,Cy1=203,Cx2=337,Cy2=223; int Ox1=350,Oy1=203,Ox2=405,Oy2=223; if ((buf = farmalloc(size)) == NULL) { return -1; } else { getimage(200,150,470,240,buf); } setfillstyle(SOLID_FILL,BLUE); HideMouse(); bar(200,150,470,240); setcolor(WHITE); rectangle(200,150,470,240); outtextxy(200+(270-8*strlen(s))/2,170,s); setfillstyle(SOLID_FILL,LIGHTBLUE); bar(Cx1,Cy1,Cx2,Cy2);//280,203,337,223); int OK=0; outtextxy(285,210,"Cancel"); outtextxy(365,210,"OK"); int event; do
  5. . 86 LUAÂÄN VAÊN TOÁT NGHIEÄP { lpEvent=GetEvent(); if(kbhit()) { if((event=getch())==13) { CompleteOk: HideMouse(); putimage(200,150,buf,COPY_PUT); ShowMouse(); farfree(buf); return OK; } if(event==27) { CompleteCancel: HideMouse(); putimage(200,150,buf,COPY_PUT); ShowMouse(); farfree(buf); return 0; } if(event==9) { OK=!OK; Cancel: if(OK==0) { HideMouse(); setfillstyle(SOLID_FILL,BLUE); bar(Ox1,Oy1,Ox2,Oy2);//350,203,405,223); outtextxy(365,210,"OK"); setfillstyle(SOLID_FILL,LIGHTBLUE); bar(Cx1,Cy1,Cx2,Cy2);//280,203,337,223); outtextxy(285,210,"Cancel"); ShowMouse(); } Ok: if(OK==1) { HideMouse(); setfillstyle(SOLID_FILL,BLUE); bar(Cx1,Cy1,Cx2,Cy2);//280,203,337,223); outtextxy(285,210,"Cancel"); setfillstyle(SOLID_FILL,LIGHTBLUE); bar(Ox1,Oy1,Ox2,Oy2);//350,203,405,223); outtextxy(365,210,"OK"); ShowMouse(); } } if(event==0) { event=getch(); if(event==75) { OK=0; goto Cancel; } if(event==77) { OK=1; goto Ok; }
  6. . 87 LUAÂÄN VAÊN TOÁT NGHIEÄP } else flushall(); } if(lpEvent->Msg==1) { if(lpEvent->Posx>=Cx1&&lpEvent->PosxPosy>=Cy1&&lpEvent->PosyPosx>=Ox1&&lpEvent->PosxPosy>=Oy1&&lpEvent->Posy
  7. . 88 LUAÂÄN VAÊN TOÁT NGHIEÄP unsigned int Value1=0,Value2=0; char FindPos,FindValue; int Thoigian=0; FILE *f,*f1; char t,t1,t2,t3,t4; // char St_add[]="0000 Hex",End_add[]="000F Hex"; int end_line; strcpy(OutFile,InFile); i=strlen(OutFile); do { OutFile[i]='\0'; }while(OutFile[--i]!='.'); strcat(OutFile,"tmp");//dat ten cho file se tao ra for (FindPos=3;FindPos>=0;FindPos--) for(FindValue=0;FindValue=0;FindPos--) for(FindValue=0;FindValue
  8. . 89 LUAÂÄN VAÊN TOÁT NGHIEÄP t1=t; } if(DemSpace==1) { t3=t; fread(&t4,1,1,f); Value1++; fwrite(&t3,1,1,f1); fwrite(&t4,1,1,f1); fwrite(&t1,1,1,f1); fwrite(&t2,1,1,f1); DemSpace=0; do { fread(&t,1,1,f); if(t==' ') DemSpace++; }while((t=='\''||t==' ')&&DemSpace2) { end_line=1; } }while(end_line==0); }while(Value1
  9. . 90 LUAÂÄN VAÊN TOÁT NGHIEÄP if(n==0) return dem; for(int z=0;z
  10. . 91 LUAÂÄN VAÊN TOÁT NGHIEÄP int Color,Color1; char S[100],S1[100]; char Dri[100],Path_var[100],Name[100],TenFile[100],SubFile[100]; int chiso; public: TEXTBOX() {S[0]='\0';}//S1="Duong dan";} void InitTextBox(int x1,int y1,int x2,int y2,int color,int color1,char s[]); void Path(); void PressTextBox(); void OutTextBox(); int Left(){return l;} int Top(){return t;} int Right(){return r;} int Bottom(){return b;} void DelChar(int length);//,int xoa);//de xoa ky tu khi gap phim del tai texbox void InsertChar(char c); void GetS(char s[]){strcpy(s,S);}; void GetS_in(char s[]){strcpy(S,s);} int DuongDan(char s[]); void Get_path(char s[]){strcpy(s,Path_var);}; void Get_name(); }; #endif XV.MODULE TEXTBOX.CPP #include #include #include #include #include #include #include #include "textbox.hpp" #include "mouse.h" //--------------------------------------------------------- void TEXTBOX::InitTextBox(int x1,int y1,int x2,int y2,int color,int color1,char s[]) { char buffer[MAXPATH]; l=x1;t=y1;r=x2;b=y2; Color=color; Color1=color1; strcpy(S1,s); getcwd(buffer, MAXPATH); strcpy(S,buffer); strcat(S,"\\"); } //--------------------------------------------------------- void TEXTBOX::OutTextBox() { setfillstyle(SOLID_FILL,Color); bar(l,t,r,b); setcolor(WHITE); line(l,b,r,b); line(r,t,r,b); setcolor(BLACK); line(l,t,r,t); line(l,t,l,b);
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2