电子工艺实习报告

上传人:1666****666 文档编号:37907547 上传时间:2021-11-05 格式:DOC 页数:14 大小:1.09MB
返回 下载 相关 举报
电子工艺实习报告_第1页
第1页 / 共14页
电子工艺实习报告_第2页
第2页 / 共14页
电子工艺实习报告_第3页
第3页 / 共14页
点击查看更多>>
资源描述
电子工艺实习报告电工电子实验中心附录:#include#include#include#include#define uchar unsigned charvoid scan_key(void);void treat_with_key(void);void fun0(void);void fun1(void);void fun2(void);void delay(int t);void unit(void);void give_led_data(void);char data seg3=0x7F,0xBF,0xDF;char data dis10=0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90;unsigned char code sine_data128=0x80,0x86,0x8D,0x93,0x99,0x9F,0xA5,0xAB, 0xB1,0xB7,0xBC,0xC2,0xC7,0xCC,0xD1,0xD6, 0xDA,0xDF,0xE3,0xE7,0xEA,0xEE,0xF1,0xF4, 0xF6,0xF8,0xFA,0xFC,0xFD,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFE,0xFD,0xFB,0xF9,0xF7, 0xF5,0xF2,0xEF,0xEC,0xE9,0xE5,0xE1,0xDD, 0xD8,0xD4,0xCF,0xCA,0xC5,0xBF,0xBA,0xB4, 0xAE,0xA8,0xA2,0x9C,0x96,0x90,0x89,0x83, 0x80,0x79,0x72,0x6C,0x66,0x60,0x5A,0x55, 0x4E,0x48,0x43,0x3D,0x38,0x33,0x2E,0x29, 0x25,0x20,0x1C,0x18,0x15,0x11,0x0E,0x0B, 0x09,0x07,0x05,0x03,0x02,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0x02,0x04,0x06,0x08, 0x0A,0x0D,0x10,0x13,0x16,0x1A,0x1E,0x22, 0x27,0x2B,0x30,0x35,0x3A,0x40,0x45,0x4C, 0x51,0x57,0x5D,0x63,0x69,0x6F,0x76,0x7C;uchar key=0,wave_way=0,add_dec=1,j=0,n=0,m=0,k=0,l=0,led_data0,led_data1,led_data2;int i=0;main() unit(); give_led_data(); while(1) scan_key(); if(key!=0) treat_with_key(); /*/ void unit(void) IP=0xc2; ET0=0; TR0=0; ET1=0; TR1=0; TH0=0x7d; TL0=0x7d; TH1=0xdc; TL1=0xd8; TMOD=0x12; TR0=1; ET0=1; TR1=1; ET1=1; EA=1; /*/ void give_led_data(void) if(wave_way=0) switch(add_dec) case 1: led_data0=dis0; led_data1=dis0; led_data2=dis8; break; case 2: led_data0=dis0; led_data1=dis0; led_data2=dis4; break; case 3: led_data0=dis0; led_data1=dis0; led_data2=dis2; break; case 4: led_data0=dis0; led_data1=dis0; led_data2=dis2; break; default:break; if(wave_way=1) switch(add_dec) case 1: led_data0=dis0; led_data1=dis6; led_data2=dis1; break; case 2: led_data0=dis3; led_data1=dis8; led_data2=0x00; break; case 3: led_data0=dis7; led_data1=dis5; led_data2=0x00; break; case 4: led_data0=dis2; led_data1=dis4; led_data2=0x00; break; default:break; if(wave_way=2) switch(add_dec) case 1: led_data0=dis1; led_data1=dis7; led_data2=0x00; break; case 2: led_data0=dis7; led_data1=dis3; led_data2=0x00; break; case 3: led_data0=dis5; led_data1=dis2; led_data2=0x00; break; case 4: led_data0=dis8; led_data1=dis1; led_data2=0x00; break; default:break; /*/ void scan_key(void) key=(P1)&0x07; if(key!=0) delay(150); key=0; if(P1)&0x07)!=0) key=(P1)&0x07; /*/ /*ms延时函数*/void delay(int t) int i,j; for(i=0;it;i+) for(j=0;j120;j+) ; /*/ void treat_with_key(void) switch(key) case 1:fun0();give_led_data();break; case 2:fun1();give_led_data();l=add_dec;break; case 3:fun2();give_led_data();l=add_dec;break; default:break; /*/ void fun0(void) wave_way+; if(wave_way=3) wave_way=0; /*/ void fun1(void) add_dec+; if(add_dec=5) add_dec=1; /*/ void fun2(void) add_dec-; if(add_dec=0) add_dec=5; /*/ void timer1(void)interrupt 1 if(wave_way=0) ET0=0; TR0=0; TH0=0x00; TL0=0x00; TMOD=0x12; TR0=1; m+; if(m=2*add_dec) P0=0x00; if(m=4*add_dec) m=0; P0=0xff; ET0=1; EA=1; if(wave_way=1) ET0=0; TR0=0; TH0=0x13; TMOD=0x12; TR0=1; k+; if(k10*add_dec) j=j-4; P0=j; if(k=20*add_dec)P0=0x00;j=0;k=0; ET0=1; EA=1; if(wave_way=2) ET0=0; TR0=0; TH0=0xc8; TL0=0xc8; TMOD=0x12; TR0=1; l-; if(l=0) P0=sine_datai; i+; l=add_dec; if(i=128)i=0; ET0=1; EA=1; /*/ void timer3(void)interrupt 3 ET1=0; TR1=0; TH1=0xdc; TL1=0xd8; TMOD=0x12; TR1=1; n+; switch(n) case 1: P3=seg0; P2=led_data0; break; case 2: P3=seg1; P2=led_data1; break; case 3: P3=seg2; P2=led_data2; n=0; break; default:break; ET1=1; EA=1;
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 其他分类


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!