基于51单片机的波形发生器(四种波形)(毕业设计资料)

四种波形的产生,包括锯齿波、三角波、方波、正弦波。通过LCD液晶显示当前波形以及波形的频率。可以通过按键切换波形,并可以通过按键进行设置当前波形的频率大小,也可以设置频率设置不步进值。资料从主页链接中进行下载。

链接:https://pan.baidu.com/s/1bMnNEv0cCAdTZ4xYCa3rtQ 
提取码:hj9e 
复制这段内容后打开百度网盘手机App,操作更方便哦

006【毕业设计】基于51单片机的波形发生器(四种波形)

#include <reg52.h>              /* 包含头文件 */
#include <intrins.h>
#define uchar	unsigned char   /* 宏定义 */
#define uint	unsigned int

sbit	s1	= P3 ^ 5;       /* 定义按键的接口 */
sbit	s2	= P3 ^ 6;
sbit	s3	= P3 ^ 7;
sbit	s4	= P3 ^ 4;

sbit	led0	= P3 ^ 0;
sbit	led1	= P3 ^ 1;
sbit	led2	= P3 ^ 2;
sbit	led3	= P3 ^ 3;

sbit	lcdrs	= P2 ^ 7;                               /* 液晶控制位 */
sbit	lcden	= P2 ^ 6;

char			num, boxing, u;                 /* 定义全局变量 */
int			pinlv		= 10, bujin = 1, bujin1 = 1;
uchar code		table[]		= "0123456789"; /* 定义显示的数组 */
uchar code		table1[]	= "Fout=     Wave form:";
unsigned long int	m;
int			a, b, h, num1;

/* 自定义字符 */
uchar code	zifu[] = {
	0x0e, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x0e, 0x00, /* 正弦波	   0  1 */

	0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x1c, 0x00,
	0x00, 0x1c, 0x04, 0x04, 0x04, 0x04, 0x07, 0x00, /* 矩形波	   2  3 */

	0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00,
	0x00, 0x10, 0x08, 0x04, 0x02, 0x01, 0x00, 0x00, /*三角波	   4  5 */

	0x00, 0x01, 0x03, 0x05, 0x09, 0x11, 0x00, 0x00, /* 锯齿波	   6 */
};
uchar code	sin[64] = {
	135, 145, 158, 167, 176, 188, 199, 209, 218, 226, 234, 240, 245, 249, 252, 254, 254, 253, 251, 247, 243, 237, 230, 222, 213, 204, 193, 182, 170, 158,
	146, 133, 121, 108, 96,	 84,  72,  61,	50,  41,  32,  24,  17,	 11,  7,   3,	1,   0,	  0,   2,   5,	 9,   14,  20,	28,  36,  45,  55,  66,	 78, 90,102, 114, 128
};                                                      /* 正弦波取码 */
uchar code	juxing[64] = {
	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
	255, 255, 255, 255, 255, 255, 0,   0,	0,   0,	  0,   0,   0,	 0,   0,   0,	0,   0,	  0,   0,   0,	 0,   0,   0,	0,   0,	 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};                                                      /* 矩形波取码 */

uchar code	sanjiao[64] = {
	0,   8,	  16,  24,  32,	 40,  48,  56,	64,  72,  80,  88,  96,	 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248,
	248, 240, 232, 224, 216, 208, 200, 192, 184, 176, 168, 160, 152, 144, 136, 128, 120, 112, 104, 96,  88,	 80,  72,  64,	56,  48,  40,  32,  24,	 16,  8,   0
};                                                      /*三角波取码 */
uchar code	juchi[64] = {
	0,   4,	  8,   12,  16,	 20,  24,  28,	32,  36,  40,  45,  49,	 53,  57,  61,	65,  69,  73,  77,  81,	 85,  89,  93,	97,  101, 105, 109, 113, 117, 121, 125, 130, 134, 138, 142,
	146, 150, 154, 158, 162, 166, 170, 174, 178, 182, 186, 190, 194, 198, 202, 206, 210, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255
};                                                      /* 锯齿波取码 */

posted @ 2020-12-04 22:36  roadroad  阅读(662)  评论(0编辑  收藏  举报
电设屋
上千套电子毕设课设方案