2022年2022年简单信号发生器源程序C语言代码 .pdf

上传人:C****o 文档编号:39722888 上传时间:2022-09-07 格式:PDF 页数:4 大小:42.24KB
返回 下载 相关 举报
2022年2022年简单信号发生器源程序C语言代码 .pdf_第1页
第1页 / 共4页
2022年2022年简单信号发生器源程序C语言代码 .pdf_第2页
第2页 / 共4页
点击查看更多>>
资源描述

《2022年2022年简单信号发生器源程序C语言代码 .pdf》由会员分享,可在线阅读,更多相关《2022年2022年简单信号发生器源程序C语言代码 .pdf(4页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、简单信号发生器源 程序 C 语言代码#include#include#include#define DA0832 XBYTE0Xa000#define uchar unsigned char#define S1 XBYTE0X0000#define S2 XBYTE0X2000#define S3 XBYTE0X4000 uchar code tab10=0 x3f,0 x06,0 x5b,0 x4f,0 x66,0 x6d,0 x7d,0 x07,0 x7f,0 x6f;uchar code tosin256=0 x80,0 x83,0 x86,0 x89,0 x8d,0 x90,0 x93

2、,0 x96,0 x99,0 x9c,0 x9f,0 xa2,0 xa5,0 xa8,0 xab,0 xae,0 xb1,0 xb4,0 xb7,0 xba,0 xbc,0 xbf,0 xc2,0 xc5,0 xc7,0 xca,0 xcc,0 xcf,0 xd1,0 xd4,0 xd6,0 xd8,0 xda,0 xdd,0 xdf,0 xe1,0 xe3,0 xe5,0 xe7,0 xe9,0 xea,0 xec,0 xee,0 xef,0 xf1,0 xf2,0 xf4,0 xf5,0 xf6,0 xf7,0 xf8,0 xf9,0 xfa,0 xfb,0 xfc,0 xfd,0 xfd

3、,0 xfe,0 xff,0 xff,0 xff,0 xff,0 xff,0 xff,0 xff,0 xff,0 xff,0 xff,0 xff,0 xff,0 xfe,0 xfd,0 xfd,0 xfc,0 xfb,0 xfa,0 xf9,0 xf8,0 xf7,0 xf6,0 xf5,0 xf4,0 xf2,0 xf1,0 xef,0 xee,0 xec,0 xea,0 xe9,0 xe7,0 xe5,0 xe3,0 xe1,0 xde,0 xdd,0 xda,0 xd8,0 xd6,0 xd4,0 xd1,0 xcf,0 xcc,0 xca,0 xc7,0 xc5,0 xc2,0 xbf

4、,0 xbc,0 xba,0 xb7,0 xb4,0 xb1,0 xae,0 xab,0 xa8,0 xa5,0 xa2,0 x9f,0 x9c,0 x99,0 x96,0 x93,0 x90,0 x8d,0 x89,0 x86,0 x83,0 x80,0 x80,0 x7c,0 x79,0 x76,0 x72,0 x6f,0 x6c,0 x69,0 x66,0 x63,0 x60,0 x5d,0 x5a,0 x57,0 x55,0 x51,0 x4e,0 x4c,0 x48,0 x45,0 x43,0 x40,0 x3d,0 x3a,0 x38,0 x35,0 x33,0 x30,0 x2e

5、,0 x2b,0 x29,0 x27,0 x25,0 x22,0 x20,0 x1e,0 x1c,0 x1a,0 x18,0 x16,0 x15,0 x13,0 x11,0 x10,0 x0e,0 x0d,0 x0b,0 x0a,0 x09,0 x08,0 x07,0 x06,0 x05,0 x04,0 x03,0 x02,0 x02,0 x01,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x00,0 x01,0 x02,0 x02,0 x03,0 x04,0 x05,0 x06,0 x07,0 x08

6、,0 x09,0 x0a,0 x0b,0 x0d,0 x0e,0 x10,0 x11,0 x13,0 x15,0 x16,0 x18,0 x1a,0 x1c,0 x1e,0 x20,0 x22,0 x25,0 x27,0 x29,0 x2b,0 x2e,0 x30,0 x33,0 x35,0 x38,0 x3a,0 x3d,0 x40,0 x43,0 x45,0 x48,0 x4c,0 x4e ,0 x51,0 x55,0 x57,0 x5a,0 x5d,0 x60,0 x63,0 x66,0 x69,0 x6c,0 x6f,0 x72,0 x76,0 x79,0 x7c,0 x80;ucha

7、r fun=0,b=0,c=0,d=0,tl,th;void key1(void);void key2(void);void key3(void);void key4(void);void judge(void);void main(void)名师资料总结-精品资料欢迎下载-名师精心整理-第 1 页,共 4 页 -TMOD=0X01;TR0=1;th=0 xff;tl=0 xd0;TH0=th;TL0=tl;ET0=1;EA=1;while(1)judge();void judge(void)uchar line,row,de1,de2,keym;P1=0 x0f;keym=P1;if(key

8、m=0 x0f)return;for(de1=0;de1200;de1+)for(de2=0;de2125;de2+);P1=0 x0f;keym=P1;if(keym=0 x0f)return;P1=0 x0f;line=P1;P1=0 xf0;row=P1;line=line+row;/*存放特征键值*/if(line=0 xde)key1();if(line=0 x7e)key2();if(line=0 xbd)key3();if(line=0 x7d)key4();void key1(void)/键选择发波类型,1 为正弦波,2 为三角波,3 为方波 fun+;if(fun=4)fun

9、=0 x00;名师资料总结-精品资料欢迎下载-名师精心整理-第 2 页,共 4 页 -void key2(void)/键加大频率 tl+;if(tl=0 x1f)th+;void key3(void)/键减小频率 tl-;if(tl=0 x00)th-;void key4(void)/键显示频率 double t;int f;TR0=0;/的区别t=(65535-th*256-tl)*0.4;f=(int)(1000/t);S3=tabf%10;f=f/10;S2=tabf%10;f=f/10;if(f=0)S1=0;else S1=tabf;TR0=1;void time0_int(void)interrupt 1/中断服务 程序 TR0=0;if(fun=1)DA0832=tosin;/正弦波b+;else if(fun=2)/三角波 if(c128)DA0832=c;else DA0832=255-c;c+;else if(fun=3)/方波 d+;名师资料总结-精品资料欢迎下载-名师精心整理-第 3 页,共 4 页 -if(d=128)DA0832=0 x00;else DA0832=0 xff;TH0=th;TL0=tl;TR0=1;名师资料总结-精品资料欢迎下载-名师精心整理-第 4 页,共 4 页 -

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

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

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁