// 學生管理.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "resource.h" #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; // current instance TCHAR szTitle[MAX_LOADSTRING]; // The title bar text TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text // Foward declarations of functions included in this code module: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM); struct person { char name[10]; int ID; int cj_yw; int cj_sx; struct person* next; struct person* pro; }per; int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // TODO: Place code here. MSG msg; HACCEL hAccelTable; // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_MY, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MY); // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; } // // FUNCTION: MyRegisterClass() // // PURPOSE: Registers the window class. // // COMMENTS: // // This function and its usage is only necessary if you want this code // to be compatible with Win32 systems prior to the 'RegisterClassEx' // function that was added to Windows 95. It is important to call this function // so that the application will get 'well formed' small icons associated // with it. // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_MY); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = (LPCSTR)IDC_MY; wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); return RegisterClassEx(&wcex); } // // FUNCTION: InitInstance(HANDLE, int) // // PURPOSE: Saves instance handle and creates main window // // COMMENTS: // // In this function, we save the instance handle in a global variable and // create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return True; } // // FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; TCHAR szHello[MAX_LOADSTRING]; LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... RECT rt; GetClientRect(hWnd, &rt); DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } // Mesage handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return True; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return True; } break; } return FALSE; }
上傳時間: 2016-12-29
上傳用戶:767483511
// 學生管理.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "resource.h" #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; // current instance TCHAR szTitle[MAX_LOADSTRING]; // The title bar text TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text // Foward declarations of functions included in this code module: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM); struct person { char name[10]; int ID; int cj_yw; int cj_sx; struct person* next; struct person* pro; }per; int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // TODO: Place code here. MSG msg; HACCEL hAccelTable; // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_MY, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MY); // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; } // // FUNCTION: MyRegisterClass() // // PURPOSE: Registers the window class. // // COMMENTS: // // This function and its usage is only necessary if you want this code // to be compatible with Win32 systems prior to the 'RegisterClassEx' // function that was added to Windows 95. It is important to call this function // so that the application will get 'well formed' small icons associated // with it. // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_MY); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = (LPCSTR)IDC_MY; wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); return RegisterClassEx(&wcex); } // // FUNCTION: InitInstance(HANDLE, int) // // PURPOSE: Saves instance handle and creates main window // // COMMENTS: // // In this function, we save the instance handle in a global variable and // create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return True; } // // FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; TCHAR szHello[MAX_LOADSTRING]; LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... RECT rt; GetClientRect(hWnd, &rt); DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } // Mesage handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return True; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return True; } break; } return FALSE; }
標簽: 學生 計算器
上傳時間: 2016-12-29
上傳用戶:767483511
三種SMA接口pcb封裝 捕獲1.PNG (16.1 KB, 下載次數(shù): 86) 捕獲2.PNG (17.35 KB, 下載次數(shù): 39) 捕獲3.PNG (19.16 KB, 下載次數(shù): 37)
上傳時間: 2017-03-06
上傳用戶:qjjjjwqvc
/****************temic*********t5557***********************************/ #include <at892051.h> #include <string.h> #include <intrins.h> #include <stdio.h> #define uchar unsigned char #define uint unsigned int #define ulong unsigned long //STC12C2051AD的SFR定義 sfr WDT_CONTR = 0xe1;//stc2051的看門狗?????? /**********全局常量************/ //寫卡的命令 #define write_command0 0//寫密碼 #define write_command1 1//寫配置字 #define write_command2 2//密碼寫數(shù)據(jù) #define write_command3 3//喚醒 #define write_command4 4//停止命令 #define True 1 #define FALSE 0 #define OK 0 #define ERROR 255 //讀卡的時間參數(shù)us #define ts_min 250//270*11.0592/12=249//取近似的整數(shù) #define ts_max 304//330*11.0592/12=304 #define t1_min 73//90*11.0592/12=83:-10調(diào)整 #define t1_max 156//180*11.0592/12=166 #define t2_min 184//210*11.0592/12=194 #define t2_max 267//300*11.0592/12=276 //***********不采用中斷處理:采用查詢的方法讀卡時關(guān)所有中斷****************/ sbit p_U2270B_Standby = P3^5;//p_U2270B_Standby PIN=13 sbit p_U2270B_CFE = P3^3;//p_U2270B_CFE PIN=6 sbit p_U2270B_OutPut = P3^7;//p_U2270B_OutPut PIN=2 sbit wtd_sck = P1^7;//SPI總線 sbit wtd_si = P1^3; sbit wtd_so = P1^2; sbit iic_data = P1^2;//lcd IIC sbit iic_clk = P1^7; sbit led_light = P1^6;//測試綠燈 sbit led_light1 = P1^5;//測試紅燈 sbit led_light_ok = P1^1;//讀卡成功標志 sbit fengmingqi = P1^5; /***********全局變量************************************/ uchar data Nkey_a[4] = {0xA0, 0xA1, 0xA2, 0xA3};//初始密碼 //uchar idata card_snr[4]; //配置字 uchar data bankdata[28] = {1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7}; //存儲卡上用戶數(shù)據(jù)(1-7)7*4=28 uchar data cominceptbuff[6] = {1,2,3,4,5,6};//串口接收數(shù)組ram uchar command; //第一個命令 uchar command1;// //uint temp; uchar j,i; uchar myaddr = 8; //uchar ywqz_count,time_count; //ywqz jishu: uchar bdata DATA; sbit BIT0 = DATA^0; sbit BIT1 = DATA^1; sbit BIT2 = DATA^2; sbit BIT3 = DATA^3; sbit BIT4 = DATA^4; sbit BIT5 = DATA^5; sbit BIT6 = DATA^6; sbit BIT7 = DATA^7; uchar bdata DATA1; sbit BIT10 = DATA1^0; sbit BIT11 = DATA1^1; sbit BIT12 = DATA1^2; sbit BIT13 = DATA1^3; sbit BIT14 = DATA1^4; sbit BIT15 = DATA1^5; sbit BIT16 = DATA1^6; sbit BIT17 = DATA1^7; bit i_CurrentLevel;//i_CurrentLevel BIT 00H(Saves current level of OutPut pin of U2270B) bit timer1_end; bit read_ok = 0; //緩存定時值,因用同一個定時器 union HLint { uint W; struct { uchar H;uchar L; } B; };//union HLint idata a union HLint data a; //緩存定時值,因用同一個定時器 union HLint0 { uint W; struct { uchar H; uchar L; } B; };//union HLint idata a union HLint0 data b; /**********************函數(shù)原型*****************/ //讀寫操作 void f_readcard(void);//全部讀出1~7 AOR喚醒 void f_writecard(uchar x);//根據(jù)命令寫不同的內(nèi)容和操作 void f_clearpassword(void);//清除密碼 void f_changepassword(void);//修改密碼 //功能子函數(shù) void write_password(uchar data *data p);//寫初始密碼或數(shù)據(jù) void write_block(uchar x,uchar data *data p);//不能用通用指針 void write_bit(bit x);//寫位 /*子函數(shù)區(qū)*****************************************************/ void delay_2(uint x) //延時,時間x*10us@12mhz,最小20us@12mhz { x--; x--; while(x) { _nop_(); _nop_(); x--; } _nop_();//WDT_CONTR=0X3C;不能頻繁的復位 _nop_(); } ///////////////////////////////////////////////////////////////////// void initial(void) { SCON = 0x50; //串口方式1,允許接收 //SCON =0x50; //01010000B:10位異步收發(fā),波特率可變,SM2=0不用接收到有效停止位才RI=1, //REN=1允許接收 TMOD = 0x21; //定時器1 定時方式2(8位),定時器0 定時方式1(16位) TCON = 0x40; //設(shè)定時器1 允許開始計時(IT1=1) TH1 = 0xfD; //FB 18.432MHz 9600 波特率 TL1 = 0xfD; //fd 11.0592 9600 IE = 0X90; //EA=ES=1 TR1 = 1; //啟動定時器 WDT_CONTR = 0x3c;//使能看門狗 p_U2270B_Standby = 0;//單電源 PCON = 0x00; IP = 0x10;//uart you xian XXXPS PT1 PX1 PT0 PX0 led_light1 = 1; led_light = 0; p_U2270B_OutPut = 1; } /************************************************/ void f_readcard()//讀卡 { EA = 0;//全關(guān),防止影響跳變的定時器計時 WDT_CONTR = 0X3C;//喂狗 p_U2270B_CFE = 1;// delay_2(232); //>2.5ms /* // aor 用喚醒功能來防碰撞 p_U2270B_CFE = 0; delay_2(18);//start gap>150us write_bit(1);//10=操作碼讀0頁 write_bit(0); write_password(&bankdata[24]);//密碼block7 p_U2270B_CFE =1 ;// delay_2(516);//編程及確認時間5.6ms */ WDT_CONTR = 0X3C;//喂狗 led_light = 0; b.W = 0; while(!(read_ok == 1)) { //while(p_U2270B_OutPut);//等一個穩(wěn)定的低電平?超時判斷? while(!p_U2270B_OutPut);//等待上升沿的到來同步信號檢測1 TR0 = 1; //deng xia jiang while(p_U2270B_OutPut);//等待下降沿 TR0 = 0; a.B.H = TH0; a.B.L = TL0; TH0 = TL0 = 0; TR0 = 1;//定時器晚啟動10個周期 //同步頭 if((324 < a.W) && (a.W < 353)) ;//檢測同步信號1 else { TR0 = 0; TH0 = TL0 = 0; goto read_error; } //等待上升沿 while(!p_U2270B_OutPut); TR0 = 0; a.B.H = TH0; a.B.L = TL0; TH0 = TL0 = 0; TR0 = 1;//b.N1<<=8; if(a.B.L < 195);//0.5p else { TR0 = 0; TH0 = TL0 = 0; goto read_error; } //讀0~7塊的數(shù)據(jù) for(j = 0;j < 28;j++) { //uchar i; for(i = 0;i < 16;i++)//8個位 { //等待下降沿的到來 while(p_U2270B_OutPut); TR0 = 0; a.B.H = TH0; a.B.L = TL0; TH0 = TL0 = 0; TR0 = 1; if(t2_max < a.W/*)&&(a.W < t2_max)*/)//1P { b.W >>= 2;//先左移再賦值 b.B.L += 0xc0; i++; } else if(t1_min < a.B.L/*)&&(a.B.L < t1_max)*/)//0.5p { b.W >>= 1; b.B.L += 0x80; } else { TR0 = 0; TH0 = TL0 = 0; goto read_error; } i++; while(!p_U2270B_OutPut);//上升 TR0 = 0; a.B.H = TH0; a.B.L = TL0; TH0 = TL0 = 0; TR0 = 1; if(t2_min < a.W/*)&&(a.W < t2_max)*/)//1P { b.W >>= 2; i++; } else if(t1_min < a.B.L/*a.W)&&(a.B.L < t1_max)*/)//0.5P //else if(!(a.W==0)) { b.W >>= 1; //temp+=0x00; //led_light1=0;led_light=1;delay_2(40000); } else { TR0 = 0; TH0 = TL0 = 0; goto read_error; } i++; } //取出奇位 DATA = b.B.L; BIT13 = BIT7; BIT12 = BIT5; BIT11 = BIT3; BIT10 = BIT1; DATA = b.B.H; BIT17 = BIT7; BIT16 = BIT5; BIT15 = BIT3; BIT14 = BIT1; bankdata[j] = DATA1; } read_ok = 1;//讀卡完成了 read_error: _nop_(); } } /***************************************************/ void f_writecard(uchar x)//寫卡 { p_U2270B_CFE = 1; delay_2(232); //>2.5ms //psw=0 standard write if (x == write_command0)//寫密碼:初始化密碼 { uchar i; uchar data *data p; p = cominceptbuff; p_U2270B_CFE = 0; delay_2(31);//start gap>330us write_bit(1);//寫操作碼1:10 write_bit(0);//寫操作碼0 write_bit(0);//寫鎖定位0 for(i = 0;i < 35;i++) { write_bit(1);//寫數(shù)據(jù)位1 } p_U2270B_CFE = 1; led_light1 = 0; led_light = 1; delay_2(40000);//測試使用 //write_block(cominceptbuff[4],p); p_U2270B_CFE = 1; bankdata[20] = cominceptbuff[0];//密碼存入 bankdata[21] = cominceptbuff[1]; bankdata[22] = cominceptbuff[2]; bankdata[23] = cominceptbuff[3]; } else if (x == write_command1)//配置卡參數(shù):初始化 { uchar data *data p; p = cominceptbuff; write_bit(1);//寫操作碼1:10 write_bit(0);//寫操作碼0 write_bit(0);//寫鎖定位0 write_block(cominceptbuff[4],p); p_U2270B_CFE= 1; } //psw=1 pssword mode else if(x == write_command2) //密碼寫數(shù)據(jù) { uchar data*data p; p = &bankdata[24]; write_bit(1);//寫操作碼1:10 write_bit(0);//寫操作碼0 write_password(p);//發(fā)口令 write_bit(0);//寫鎖定位0 p = cominceptbuff; write_block(cominceptbuff[4],p);//寫數(shù)據(jù) } else if(x == write_command3)//aor //喚醒 { //cominceptbuff[1]操作碼10 X xxxxxB uchar data *data p; p = cominceptbuff; write_bit(1);//10 write_bit(0); write_password(p);//密碼 p_U2270B_CFE = 1;//此時數(shù)據(jù)不停的循環(huán)傳出 } else //停止操作碼 { write_bit(1);//11 write_bit(1); p_U2270B_CFE = 1; } p_U2270B_CFE = 1; delay_2(560);//5.6ms } /************************************/ void f_clearpassword()//清除密碼 { uchar data *data p; uchar i,x; p = &bankdata[24];//原密碼 p_U2270B_CFE = 0; delay_2(18);//start gap>150us //操作碼10:10xxxxxxB write_bit(1); write_bit(0); for(x = 0;x < 4;x++)//發(fā)原密碼 { DATA = *(p++); for(i = 0;i < 8;i++) { write_bit(BIT0); DATA >>= 1; } } write_bit(0);//鎖定位0:0 p = &cominceptbuff[0]; write_block(0x00,p);//寫新配置參數(shù):pwd=0 //密碼無效:即清除密碼 DATA = 0x00;//停止操作碼00000000B for(i = 0;i < 2;i++) { write_bit(BIT7); DATA <<= 1; } p_U2270B_CFE = 1; delay_2(560);//5.6ms } /*********************************/ void f_changepassword()//修改密碼 { uchar data *data p; uchar i,x,addr; addr = 0x07;//block7 p = &Nkey_a[0];//原密碼 DATA = 0x80;//操作碼10:10xxxxxxB for(i = 0;i < 2;i++) { write_bit(BIT7); DATA <<= 1; } for(x = 0;x < 4;x++)//發(fā)原密碼 { DATA = *(p++); for(i = 0;i < 8;i++) { write_bit(BIT7); DATA >>= 1; } } write_bit(0);//鎖定位0:0 p = &cominceptbuff[0]; write_block(0x07,p);//寫新密碼 p_U2270B_CFE = 1; bankdata[24] = cominceptbuff[0];//密碼存入 bankdata[25] = cominceptbuff[1]; bankdata[26] = cominceptbuff[2]; bankdata[27] = cominceptbuff[3]; DATA = 0x00;//停止操作碼00000000B for(i = 0;i < 2;i++) { write_bit(BIT7); DATA <<= 1; } p_U2270B_CFE = 1; delay_2(560);//5.6ms } /***************************子函數(shù)***********************************/ void write_bit(bit x)//寫一位 { if(x) { p_U2270B_CFE = 1; delay_2(32);//448*11.0592/120=42延時448us p_U2270B_CFE = 0; delay_2(28);//280*11.0592/120=26寫1 } else { p_U2270B_CFE = 1; delay_2(92);//192*11.0592/120=18 p_U2270B_CFE = 0; delay_2(28);//280*11.0592/120=26寫0 } } /*******************寫一個block*******************/ void write_block(uchar addr,uchar data *data p) { uchar i,j; for(i = 0;i < 4;i++)//block0數(shù)據(jù) { DATA = *(p++); for(j = 0;j < 8;j++) { write_bit(BIT0); DATA >>= 1; } } DATA = addr <<= 5;//0地址 for(i = 0;i < 3;i++) { write_bit(BIT7); DATA <<= 1; } } /*************************************************/ void write_password(uchar data *data p) { uchar i,j; for(i = 0;i < 4;i++)// { DATA = *(p++); for(j = 0;j < 8;j++) { write_bit(BIT0); DATA >>= 1; } } } /*************************************************/ void main() { initial(); TI = RI = 0; ES = 1; EA = 1; delay_2(28); //f_readcard(); while(1) { f_readcard(); //讀卡 f_writecard(command1); //寫卡 f_clearpassword(); //清除密碼 f_changepassword(); //修改密碼 } }
標簽: 12345
上傳時間: 2017-10-20
上傳用戶:my_lcs
題目:古典問題:有一對兔子,從出生后第3個月起每個月都生一對兔子,小兔子長到第三個月后每個月又生一對兔子,假如兔子都不死,問每個月的兔子總數(shù)為多少? //這是一個菲波拉契數(shù)列問題 public class lianxi01 { public static void main(String[] args) { System.out.println("第1個月的兔子對數(shù): 1"); System.out.println("第2個月的兔子對數(shù): 1"); int f1 = 1, f2 = 1, f, M=24; for(int i=3; i<=M; i++) { f = f2; f2 = f1 + f2; f1 = f; System.out.println("第" + i +"個月的兔子對數(shù): "+f2); } } } 【程序2】 題目:判斷101-200之間有多少個素數(shù),并輸出所有素數(shù)。 程序分析:判斷素數(shù)的方法:用一個數(shù)分別去除2到sqrt(這個數(shù)),如果能被整除, 則表明此數(shù)不是素數(shù),反之是素數(shù)。 public class lianxi02 { public static void main(String[] args) { int count = 0; for(int i=101; i<200; i+=2) { boolean b = false; for(int j=2; j<=Math.sqrt(i); j++) { if(i % j == 0) { b = false; break; } else { b = True; } } if(b == True) {count ++;System.out.println(i );} } System.out.println( "素數(shù)個數(shù)是: " + count); } } 【程序3】 題目:打印出所有的 "水仙花數(shù) ",所謂 "水仙花數(shù) "是指一個三位數(shù),其各位數(shù)字立方和等于該數(shù)本身。例如:153是一個 "水仙花數(shù) ",因為153=1的三次方+5的三次方+3的三次方。 public class lianxi03 { public static void main(String[] args) { int b1, b2, b3;
上傳時間: 2017-12-24
上傳用戶:Ariza
遺傳算法已經(jīng)成為組合優(yōu)化問題的近似最優(yōu)解的一把鑰匙。它是一種模擬生物進化過程的計算模型,作為一種新的全局優(yōu)化搜索算法,它以其簡單、魯棒性強、適應(yīng)并行處理以及應(yīng)用范圍廣等特點,奠定了作為21世紀關(guān)鍵智能計算的地位。 背包問題是一個典型的組合優(yōu)化問題,在計算理論中屬于NP-完全問題, 其計算復雜度為,傳統(tǒng)上采用動態(tài)規(guī)劃來求解。設(shè)w是經(jīng)營活動 i 所需要的資源消耗,M是所能提供的資源總量,p是人們經(jīng)營活動i得到的利潤或收益,則背包問題就是在資源有限的條件下, 追求總的最大收益的資源有效分配問題。
上傳時間: 2018-04-26
上傳用戶:jiazhe110125
由STC89C51單片機來控制DHT11傳感器采集的溫濕度的轉(zhuǎn)換、1602液晶屏的顯示,以及蜂鳴器的報警。
上傳時間: 2018-04-27
上傳用戶:luson
Introduction jSMPP is a java implementation (SMPP API) of the SMPP protocol (currently supports SMPP v3.4). It provides interfaces to communicate with a Message Center or an ESME (External Short Message Entity) and is able to handle traffic of 3000-5000 messages per second. jSMPP is not a high-level library. People looking for a quick way to get started with SMPP may be better of using an abstraction layer such as the Apache Camel SMPP component: http://camel.apache.org/smpp.html Travis-CI status: History The project started on Google Code: http://code.google.com/p/jsmpp/ It was maintained by uudashr on Github until 2013. It is now a community project maintained at http://jsmpp.org Release procedure mvn deploy -DperformRelease=True -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -Dgpg.passphrase=<yourpassphrase> log in here: https://oss.sonatype.org click the 'Staging Repositories' link select the repository and click close select the repository and click release License Copyright (C) 2007-2013, Nuruddin Ashr uudashr@gmail.com Copyright (C) 2012-2013, Denis Kostousov denis.kostousov@gmail.com Copyright (C) 2014, Daniel Pocock http://danielpocock.com Copyright (C) 2016, Pim Moerenhout pim.moerenhout@gmail.com This project is licensed under the Apache Software License 2.0.
上傳時間: 2019-01-25
上傳用戶:dragon_longer
在包 hugeinteger 中創(chuàng)建功能類 HugeInteger,該類用來存放和操作一個不超過 40 位的大整數(shù)。 (1) 定義一個構(gòu)造函數(shù),用來對大整數(shù)進行初始化。參數(shù)為一個字符串。 (2) 定義 input 成員函數(shù),實現(xiàn)大整數(shù)的重新賦值。參數(shù)為一個字符串,無返回 值。 (3) 定義 output 成員函數(shù),將大整數(shù)輸出到屏幕上。無參數(shù)無返回值。 (4) 定義 add 成員函數(shù),實現(xiàn)兩個大整數(shù)的加法。參數(shù)為一個 HugeInteger 對 象,無返回值,例如: HugeInteger A = new HugeInteger("12345"); HugeInteger B = new HugeInteger("1234"); A.add(B); 此時,A 為 13579,B 為 1234。 (5) 定義 sub 成員函數(shù),實現(xiàn)兩個大整數(shù)的減法。參數(shù)和返回值同 add 函數(shù)。 (6) 定義若干大整數(shù)關(guān)系運算的成員函數(shù),包括 isEqualTo(等于,=)、 isNotEqualTo(不等于,≠)、isGreaterThan(大于,>)、isLessThan(小 于,<)、isGreaterThanOrEqualTo(大于等于,≥)和 isLessThanOrEqualTo (小于等于,≤)。這些函數(shù)的參數(shù)為一個 HugeInteger 對象,返回值為一個 布爾類型,表示關(guān)系運算的結(jié)果,例如: HugeInteger A = new HugeInteger("12345"); HugeInteger B = new HugeInteger("1234"); 那么此時 A.isGreaterThan(B)的結(jié)果應(yīng)當為 True,表示 12345>1234。
上傳時間: 2019-06-01
上傳用戶:idealist
High-Speed, Low-Power Dual Operational Amplifier The AD826 features high output current drive capability of 50 mA min per amp, and is able to drive unlimited capacitive loads. With a low power supply current of 15 mA max for both amplifiers, the AD826 is a True general purpose operational amplifier. The AD826 is ideal for power sensitive applications such as video cameras and portable instrumentation. The AD826 can operate from a single +5 V supply, while still achieving 25 MHz of band width. Furthermore the AD826 is fully specified from a single +5 V to ±15 V power supplies. The AD826 excels as an ADC/DAC buffer or active filter in data acquisition systems and achieves a settling time of 70 ns to 0.01%, with a low input offset voltage of 2 mV max. The AD826 is available in small 8-lead plastic mini-DIP and SO packages.
上傳時間: 2020-04-19
上傳用戶:su1254
蟲蟲下載站版權(quán)所有 京ICP備2021023401號-1