基于單片機(jī)的CK6163數(shù)控車床控制系統(tǒng)設(shè)計(jì)【含CAD圖紙和文檔資料】【GC系列】
購買設(shè)計(jì)請(qǐng)充值后下載,資源目錄下的文件所見即所得,都可以點(diǎn)開預(yù)覽,資料完整,充值下載可得到資源目錄里的所有文件?!咀ⅰ浚篸wg后綴為CAD圖紙,doc,docx為WORD文檔,原稿無水印,可編輯。帶三維備注的都有三維源文件,由于部分三維子文件較多,店主做了壓縮打包,都可以保證打開的,三維預(yù)覽圖都是店主用電腦打開后截圖的,具體請(qǐng)見文件預(yù)覽,有不明白之處,可咨詢QQ:1304139763 =題目最后備注XX系列,只是店主整理分類,與內(nèi)容無關(guān),請(qǐng)忽視
#include#include#define uint unsigned int#define uchar unsigned char#define com8255 XBYTE0x007f/8255端口地址#define PA8255 XBYTE0x007c#define PB8255 XBYTE0x007d#define PC8255 XBYTE0x007euchar code F_rotation1=0x80,0xc0,0x40,0x60,0x20,0xa0;/步進(jìn)電機(jī)正反轉(zhuǎn)控制狀態(tài)表uchar code B_rotation1=0xa0,0x20,0x60,0x40,0xc0,0x80;uchar code F_rotation2=0x08,0x0c,0x04,0x06,0x02,0x0a;uchar code B_rotation2=0x0a,0x02,0x06,0x04,0x0c,0x08;uchar code F_rotation3=0x88,0xcc,0x44,0x66,0x22,0xaa;uchar code B_rotation3=0xaa,0x22,0x66,0x44,0xcc,0x88;uchar code F_rotation4=0x8a,0xc2,0x46,0x64,0x2c,0xa8;uchar code B_rotation4=0xa8,0x2c,0x64,0x46,0xc2,0xa8;uchar code table16 = 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f;/數(shù)碼管數(shù)字顯示表uchar code table_d16 = 0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef;void xianshi();/數(shù)碼管顯示函數(shù)void jianpan();/鍵盤功能實(shí)現(xiàn)函數(shù)uchar keyscan();/鍵盤掃描函數(shù)int A,W,H;int X3=0, Z3=0, X4=-50,Z4=-50;/加工參數(shù)設(shè)置 int X5, Z5, F1,j0; uchar i0=0,k0=0;int X0=0,Z0=-50,X1=0,Z1=0,X2=-50,Z2=-50; int F=0,X,Z; uchar n,m=0,k=0; uchar key,g,count;void delay(t)/延時(shí)函數(shù) uint i,j; for(i=0;it;i+) for(j=0;j0) if(F10) PA8255=B_rotation2i0; F1=F1+Z5; i0+;A+;H+; if(i0=6) i0=0; else PA8255=B_rotation1k0; F1=F1-X5; k0+;W+;H+; if(k0=6) k0=0; j0-; void RS_move()/第三象限圓弧順時(shí)針加工函數(shù) if(nZ1-X2) if(F0) PA8255=B_rotation2m; F=F-2*X+1; X=X-1; m+;A+;H+; if(m=6) m=0; else PA8255=B_rotation1k; F=F-2*Z+1; Z=Z-1; k+;W+;H+; if(k=6) k=0; n+; void RN1_move()/第三象限圓弧逆時(shí)針加工函數(shù) if(nZ1+X2) if(F0) PA8255=B_rotation2m; F=F+2*X+1; X=X+1; m+;A-;H+; if(m=6) m=0; else PA8255=B_rotation1k; F=F-2*Z+1; Z=Z-1; k+;W+;H+; if(k=6) k=0; n+; void RN2_move()/第三象限圓弧逆時(shí)針加工函數(shù) if(n=0) PA8255=B_rotation2m; F=F-2*X+1; X=X-1; m+;A+;H+; if(m=6) m=0; else PA8255=B_rotation1k; F=F-2*Z+1; Z=Z-1; k+;W+;H+; if(k=6) k=0; n+; void iti() interrupt 1/中斷函數(shù) TH0=(65536-8000)/256; TL0=(65536-8000)%256; count+; if(count=15) count=0; jianpan(); void main() TMOD=0x01; TH0=(65536-8000)/256; TL0=(65536-8000)%256; TR0=1; ET0=1; EA=0; A=0;W=0; com8255=0x80; PA8255=0x00; X1=X1-X0;Z1=Z1-Z0; X2=X2-X0;Z2=Z2-Z0; Z=Z1;X=X1;H=0; X5=X3-X4;Z5=Z3-Z4; j0=X5+Z5; while(1) xianshi(); key=keyscan(); if(key=1) A=0;W=0; else if(key=2) EA=0; else if(key=5) EA=1; uchar keyscan() uchar Y=0xfe,0xfd,0xfb,0xf7, X=0xd0,0xb0,0x70,ii=0,jj=0,temp; P1=Yii; temp=P1; temp=temp&0xf0; if(temp!=0xf0) delay(2); if(temp!=0xf0) for(;jj3;jj+) if(temp=Xjj) return 3*ii+jj; ii+; P1=Yii; temp=P1; temp=temp&0xf0; if(temp!=0xf0) delay(2); if(temp!=0xf0) for(;jj3;jj+) if(temp=Xjj) return 3*ii+jj; ii+; P1=Yii; temp=P1; temp=temp&0xf0; if(temp!=0xf0) delay(2); if(temp!=0xf0) for(;jj3;jj+) if(temp=Xjj) return 3*ii+jj; ii+; P1=Yii; temp=P1; temp=temp&0xf0; if(temp!=0xf0) delay(2); if(temp!=0xf0) for(;jj3;jj+) if(temp=Xjj) return 3*ii+jj; void jianpan() if(key=8) com8255=0x80; PA8255=B_rotation2g+; A+; if(g=6)g=0; else if(key=11) com8255=0x80; PA8255=F_rotation2g+; A-; if(g=6)g=0; else if(key=7) com8255=0x80; PA8255=B_rotation1g+; W+; if(g=6)g=0; else if(key=10) com8255=0x80; PA8255=F_rotation1g+; W-; if(g=6)g=0; else if(key=6) com8255=0x80; PA8255=B_rotation3g+; W+; A+; if(g=6)g=0; else if(key=9) com8255=0x80; PA8255=F_rotation3g+; W-; A-; if(g=6)g=0; else if(key=3) com8255=0x80; PA8255=F_rotation4g+; W-; A+; if(g=6)g=0; else if(key=4) com8255=0x80; PA8255=F_rotation4g+; W+; A-; if(g=6)g=0; else if(H0) PB8255=0x00; PB8255=0x40; PC8255=6; delay(1); PB8255=0x00; PB8255=tableW%1000000/100000; PC8255=5; delay(1); PB8255=0x00; PB8255=tableW%1000000%100000/10000; PC8255=4; delay(1); PB8255=0x00; PB8255=tableW%1000000%100000%10000/1000; PC8255=3; delay(1); PB8255=0x00; PB8255=table_dW%1000000%100000%10000%1000/100; PC8255=2; delay(1); PB8255=0x00; PB8255=tableW%1000000%100000%10000%1000%100/10; PC8255=1; delay(1); PB8255=0x00; PB8255=tableW%1000000%100000%10000%1000%100%10; PC8255=0; delay(1); PB8255=0x00; else PB8255=0x00; PB8255=0x3f; PC8255=6; delay(1); PB8255=0x00; PB8255=table-W/100000; PC8255=5; delay(1); PB8255=0x00; PB8255=table-W%100000/10000; PC8255=4; delay(1); PB8255=0x00; PB8255=table-W%100000%10000/1000; PC8255=3; delay(1); PB8255=0x00; PB8255=table_d-W%100000%10000%1000/100; PC8255=2; delay(1); PB8255=0x00; PB8255=table-W%100000%10000%1000%100/10; PC8255=1; delay(1); PB8255=0x00; PB8255=table-W%100000%10000%1000%100%10; PC8255=0; delay(1); PB8255=0x00; PB8255=0x76; PC8255=0x0f; delay(1); PB8255=0x00; PB8255=0x40; PC8255=0x0e; delay(1); PB8255=0x00; PB8255=tableA/100000; PC8255=0x0d; delay(1); PB8255=0x00; PB8255=tableA%100000/10000; PC8255=0x0c; delay(1); PB8255=0x00; PB8255=tableA%100000%10000/1000; PC8255=0x0b; delay(1); PB8255=0x00; PB8255=table_dA%100000%10000%1000/100; PC8255=0x0a; delay(1); PB8255=0x00; PB8255=tableA%100000%10000%1000%100/10; PC8255=0x09; delay(1); PB8255=0x00; PB8255=tableA%100000%10000%1000%100%10; PC8255=0x08; delay(1);
收藏