Giáo trình phân tích quy trình ứng dụng điều chế thiết bị bán dẫn chứa các mạch logic điện tử p6

11 211 0
Giáo trình phân tích quy trình ứng dụng điều chế thiết bị bán dẫn chứa các mạch logic điện tử p6

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

LUAÂÄN VAÊN TOÁT NGHIEÄP 56 ;KeyKRB : Chuong trinh quet ban phim Ma cua phim an duoc cat ;trong ; ghi A ;DELAY : Chuong trinh tri hoan theo thoi hang 0.1 ms He so tri ;hoan duoc ; nap vao ghi A ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++ ;##################################################################### ;Khai bao cac nhan duoc su dung ;##################################################################### RegCNT equ 03h PortA equ 00h PortB equ 01h PortC equ 02h CntI79 equ 0A001h DataI79 equ 0A000h KEYBRD equ 0216h DELAY equ 0310h KeyGO equ 17h ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ End LUAÂÄN VAÊN TOÁT NGHIEÄP B.Module Demo.cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "screen.h" "mouse.h" "button.hpp" "textbox.hpp" "list.hpp" "disklist.hpp" "send.hpp" #define NumBox #define NumBut LPEVENT lpEvent; //bien chua cac bien co chuot char szMessage[128]; BUTTON But[NumBut],NutKiem; TEXTBOX Box[NumBox],Port; char DiskName[27],DName; char ftype[15]="*.prn"; char inter_Path[100]=""; char RequF[100]; unsigned int St_address,End_address=0; char Sta_hex[5],End_hex[5]; // int TestPressedButton(int x,LPEVENT lpEvent); int TestPressTexbox(int x,LPEVENT lpEvent,char layra[],unsigned *attribp); void MainProgram(); int TestPressList(LIST L,LPEVENT lpEvent,char s[],unsigned *attrib,char *typ);//nhap bang liet ke int SendFile(); // void main(void) { InitGraphics(); InitValues("Download Program."); InitScreen(); if (!InitMouse(&MainWindow.rViewPort)) { OutMessage("Mouse driver not found Init mouse and return"); getch(); closegraph(); exit(1); } ShowMouse(); MainProgram(); closegraph(); } 57 LUAÂÄN VAÊN TOÁT NGHIEÄP // void MainProgram() { char Name[20],buffer[MAXPATH]; unsigned attrib,Attribp; SEND Send; LIST L; But[0].InitButton(200,380,250,400,LIGHTGRAY,"Send"); But[1].InitButton(400,380,450,400,LIGHTGRAY,"Exit"); Box[0].InitTextBox(50,70,477,90,GREEN,LIGHTGREEN,"Open File"); Port.InitTextBox(50,270,250,290,GREEN,LIGHTGREEN,"Out port"); Port.GetS_in("LPT1"); L.InitList(480,70,500,90,LIGHTGRAY); But[0].OutButton();//xuat nut lenh But[1].OutButton();//xuat nut lenh Box[0].OutTextBox();//xuat hop nhap text Port.OutTextBox(); L.Show(); setcolor(BLACK); line(50,150,250,150); line(50,150,50,215); setcolor(WHITE); line(50,215,250,215); line(250,150,250,215); outtextxy(50,130,"Free memory request"); outtextxy(55,158,"Start ad :"); outtextxy(55,178,"End ad :"); outtextxy(55,198,"Total :"); OutMessage("Click mouse to chose action"); int kkkk; char RequestFile[15]=""; do//kiem tra nhap chuot chon cong viec { ShowMouse(); lpEvent = GetEvent();//lay bien co chuot if(TestPressedButton(2,lpEvent)==0)//kiem tra xem da click vao nut nao //0:nhan OK { char InName[100],OutName[100]; Box[0].GetS(InName); if(InName[strlen(InName)-1]=='\\') InName[strlen(InName)-1]='\0'; _dos_getfileattr(InName,&attrib); if(attrib==16) { OutMessage(""); OutError("Please enter a file name"); OutMessage("Click mouse to chose action"); } else//la file { if(End_address!=0) { if(OutError("Are you sure ?")) { OutMessage("Sending Press Esc to stop if time is over."); Send.CatFile(Sta_hex,End_hex,inter_Path); 58 LUAÂÄN VAÊN TOÁT NGHIEÄP 59 Send.Out(); HideMouse(); if(Send.Out()!=-1) { HideMouse(); OutMessage(""); OutError("Task is complete."); OutMessage("Click mouse to choose action"); } else { HideMouse(); OutMessage("Click mouse to choose action"); } } } } }//if(TestPressedButton if(TestPressList(L,lpEvent,Name,&attrib,ftype)==1) //chon OK { switch (attrib) { case 16:chdir(Name); getcwd(buffer, MAXPATH);//lay duong dan hien thoi vao buffer strcpy(inter_Path,buffer); Box[0].GetS_in(inter_Path); Box[0].OutTextBox(); break; default: getcwd(buffer, MAXPATH);//lay duong dan hien thoi vao buffer strcpy(inter_Path,buffer); if(inter_Path[strlen(inter_Path)-1]!='\\') strcat(inter_Path,"\\"); strcat(inter_Path,Name); Box[0].GetS_in(inter_Path); Box[0].DuongDan(inter_Path); Box[0].OutTextBox(); break; }//end switch }//if(TestPressList( //chon Cancel TestPressTexbox(NumBox,lpEvent,inter_Path,&Attribp);//Path lay duong dan cho file nhap vao //ShowMouse(); if(kbhit()) { kkkk=getch(); if(kkkk==0)kkkk=getch(); } Box[0].GetS(RequF); { int n=strlen(RequF); if(n>5)//?.??? if(RequF[n-1]!='\\') { while(n>0&&RequF[n-1]!='\\') { n ; } char *strtemp=RequF; LUAÂÄN VAÊN TOÁT NGHIEÄP 60 for(int m=0;m')//gat bo dau \> sau thu muc nhung van giu lai doi voi o dia if(layra[strlen(layra)-2]=='\\') if(layra[strlen(layra)-3]==':')//dang a:\> layra[strlen(layra)-1]='\0';//ra a:\ else //dang a:\fname\> layra[strlen(layra)-2]='\0';//ra dang a:\fname else layra[strlen(layra)-1]='\0';//bo dau > if(layra[strlen(layra)-1]=='\\')//gat bo dau \ sau thu muc nhung van giu lai doi voi o dia if(layra[strlen(layra)-2]!=':')//dang a:\fname\ layra[strlen(layra)-1]='\0'; if(layra[strlen(layra)-1]==':') if(strlen(layra)==2)//dang a: strcat(layra,"\\");//ra a:\ int NotExist=_dos_getfileattr(layra, attribp); int m=strlen(layra)-1; while(layra[m]!='\\')//dem so ky tu thuoc ve phan Path m ; for(int n=0;n='a'&&layra[n]Msg==1) if(L.Left()Posx&&L.Top()Posy&&L.Right()>=lpEvent->Posx&&L.Bottom()>=lpEvent->Posy) { OutMessage("Open File Name"); delay(100);//neu khong thi khong the putimage, khong thoat khoi bang list duoc k=L.Press(s,&Box[0],attrib,DiskName,&DName,typ); } return k; } // II.CLASS BUTTON.HPP #if !defined BUTTON #define BUTTON class BUTTON { private: int l,t,r,b;//toa box int Color; char S[100]; public: void InitButton(int x1,int y1,int x2,int y2,int color,char s[]); void OutButton(); void PressButton(); int Left() {return l;} int Right() {return r;} int Top() {return t;} int Bottom() {return b;} }; #endif LUAÂÄN VAÊN TOÁT NGHIEÄP 65 III.MODULE BUTTON.CPP #include #include #include "button.hpp" // void BUTTON::InitButton(int x1,int y1,int x2,int y2,int color,char s[]) { l=x1; t=y1; r=x2; b=y2; Color=color; strcpy(S,s); } // void BUTTON::OutButton() { setfillstyle(SOLID_FILL,Color); bar(l,t,r,b); setcolor(WHITE); line(l,t,r,t); line(l,t,l,b); setcolor(BLACK); line(r,t,r,b); line(l,b,r,b); setcolor(BLUE); int x=l+(r-l-textwidth(S))/2,y=t+(b-t-textheight(S))/2; outtextxy(x,y,S); } // void BUTTON::PressButton() { setcolor(BLACK); line(l,t,r,t); line(l,t,l,b); setcolor(WHITE); line(r,t,r,b); line(l,b,r,b); } // IV CLASS DISKLIST.HPP #include "textbox.hpp" #include "mouse.h" #if !defined DISKLIST #define DISLIST extern char Disk(char *s); extern int ChosenDisk(char *s,/*TEXTBOX *Box,*/char PreDisk,char CurDisk); extern LPEVENT CheckChooseDisk(char *DiskName,char *DName,LPEVENT lpEvent,int x,int y); extern char *FileType(TEXTBOX *b); #endif V.MODULE #include #include #include #include #include #include DISKLIST.CPP LUAÂÄN VAÊN TOÁT NGHIEÄP 66 #include #include // #include "disklist.hpp" char Disk(char *s)//kiem tra co bao nhieu o dia may, luu ten cac o dia vao chuoi s, tra ve ten o dia hien hanh { int save,disk, disks; int equip_check; char c[4]; s[0]='\0'; save = getdisk(); equip_check = biosequip(); equip_check >>= 6; equip_check = (equip_check & 3) + 1;//dem so o dia mem for (disk = 0;disk < 26;++disk) { setdisk(disk); if (disk == getdisk()) { sprintf(c,"%c",disk +'A'); strcat(s,c); } } setdisk(save); if(equip_check==1&&s[1]=='B')//neu chi co ot o dia mem for(int i=1;i

Ngày đăng: 07/12/2015, 00:53

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan