基于51单片机的正弦波发生器设计

news2024/11/22 11:38:37

程序运行图:

仿真原理图:

 部分程序:

#include <reg52.h>

//接口定义

sbit DA = P1^1;

sbit CK = P1^2;

sbit CS = P1^4;

//10bit取样,1024点正弦查表数据

unsigned int code sine_dot[1024]=

{

0x200,0x203,0x206,0x209,0x20c,0x20f,0x212,0x215,0x219,0x21c,0x21f,0x222,0x225,0x228,0x22b,0x22f,0x232,

0x235,0x238,0x23b,0x23e,0x241,0x244,0x247,0x24b,0x24e,0x251,0x254,0x257,0x25a,0x25d,0x260,0x263,0x266,0x269,0x26d,0x270,

0x273,0x276,0x279,0x27c,0x27f,0x282,0x285,0x288,0x28b,0x28e,0x291,0x294,0x297,0x29a,0x29d,0x2a0,0x2a3,0x2a6,0x2a9,0x2ac,

0x2af,0x2b2,0x2b5,0x2b8,0x2bb,0x2be,0x2c0,0x2c3,0x2c6,0x2c9,0x2cc,0x2cf,0x2d2,0x2d5,0x2d7,0x2da,0x2dd,0x2e0,0x2e3,0x2e6,

0x2e8,0x2eb,0x2ee,0x2f1,0x2f4,0x2f6,0x2f9,0x2fc,0x2fe,0x301,0x304,0x307,0x309,0x30c,0x30f,0x311,0x314,0x317,0x319,0x31c,

0x31e,0x321,0x324,0x326,0x329,0x32b,0x32e,0x330,0x333,0x335,0x338,0x33a,0x33d,0x33f,0x342,0x344,0x347,0x349,0x34b,0x34e,

0x350,0x353,0x355,0x357,0x35a,0x35c,0x35e,0x360,0x363,0x365,0x367,0x369,0x36c,0x36e,0x370,0x372,0x374,0x376,0x379,0x37b,

0x37d,0x37f,0x381,0x383,0x385,0x387,0x389,0x38b,0x38d,0x38f,0x391,0x393,0x395,0x397,0x399,0x39b,0x39c,0x39e,0x3a0,0x3a2,

0x3a4,0x3a6,0x3a7,0x3a9,0x3ab,0x3ad,0x3ae,0x3b0,0x3b2,0x3b3,0x3b5,0x3b7,0x3b8,0x3ba,0x3bb,0x3bd,0x3be,0x3c0,0x3c1,0x3c3,

0x3c4,0x3c6,0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,0x3ad,0x3ab,0x3aa,0x3a8,0x3a6,

0x3a4,0x3a2,0x3a1,0x39f,0x39d,0x39b,0x399,0x397,0x395,0x393,0x392,0x390,0x38e,0x38c,0x38a,0x388,0x386,0x384,0x382,0x37f,

0x37d,0x37b,0x379,0x377,0x375,0x373,0x371,0x36e,0x36c,0x36a,0x368,0x366,0x363,0x361,0x35f,0x35c,0x35a,0x358,0x355,0x353,

0x351,0x34e,0x34c,0x34a,0x347,0x345,0x342,0x340,0x33d,0x33b,0x339,0x336,0x334,0x331,0x32e,0x32c,0x329,0x327,0x324,0x322,

0x31f,0x31d,0x31a,0x317,0x315,0x312,0x30f,0x30d,0x30a,0x307,0x305,0x302,0x2ff,0x2fc,0x2fa,0x2f7,0x2f4,0x2f1,0x2ef,0x2ec,

0x2e9,0x2e6,0x2e4,0x2e1,0x2de,0x2db,0x2d8,0x2d5,0x2d2,0x2d0,0x2cd,0x2ca,0x2c7,0x2c4,0x2c1,0x2be,0x2bb,0x2b8,0x2b6,0x2b3,

0x2b0,0x2ad,0x2aa,0x2a7,0x2a4,0x2a1,0x29e,0x29b,0x298,0x295,0x292,0x28f,0x28c,0x289,0x286,0x283,0x280,0x27d,0x27a,0x277,

0x273,0x270,0x26d,0x26a,0x267,0x264,0x261,0x25e,0x25b,0x258,0x255,0x252,0x24e,0x24b,0x248,0x245,0x242,0x23f,0x23c,0x239,

0x236,0x232,0x22f,0x22c,0x229,0x226,0x223,0x220,0x21d,0x219,0x216,0x213,0x210,0x20d,0x20a,0x207,0x203,0x200,0x1fd,0x1fa,

0x1f7,0x1f4,0x1f1,0x1ed,0x1ea,0x1e7,0x1e4,0x1e1,0x1de,0x1db,0x1d8,0x1d4,0x1d1,0x1ce,0x1cb,0x1c8,0x1c5,0x1c2,0x1bf,0x1bb,

0x1b8,0x1b5,0x1b2,0x1af,0x1ac,0x1a9,0x1a6,0x1a3,0x1a0,0x19c,0x199,0x196,0x193,0x190,0x18d,0x18a,0x187,0x184,0x181,0x17e,

0x17b,0x178,0x175,0x172,0x16f,0x16c,0x169,0x166,0x163,0x160,0x15d,0x15a,0x157,0x154,0x151,0x14e,0x14b,0x148,0x145,0x142,

0x13f,0x13c,0x13a,0x137,0x134,0x131,0x12e,0x12b,0x128,0x125,0x123,0x120,0x11d,0x11a,0x117,0x115,0x112,0x10f,0x10c,0x109,

0x107,0x104,0x101,0xff,0xfc,0xf9,0xf6,0xf4,0xf1,0xee,0xec,0xe9,0xe6,0xe4,0xe1,0xdf,0xdc,0xd9,0xd7,0xd4,0xd2,0xcf,0xcd,

0xca,0xc8,0xc5,0xc3,0xc0,0xbe,0xbb,0xb9,0xb7,0xb4,0xb2,0xaf,0xad,0xab,0xa8,0xa6,0xa4,0xa1,0x9f,0x9d,0x9b,0x98,0x96,0x94,

0x92,0x90,0x8d,0x8b,0x89,0x87,0x85,0x83,0x81,0x7f,0x7c,0x7a,0x78,0x76,0x74,0x72,0x70,0x6e,0x6d,0x6b,0x69,0x67,0x65,0x63,

0x61,0x5f,0x5e,0x5c,0x5a,0x58,0x56,0x55,0x53,0x51,0x50,0x4e,0x4c,0x4b,0x49,0x47,0x46,0x44,0x43,0x41,0x3f,0x3e,0x3c,0x3b,

0x3a,0x38,0x37,0x35,0x34,0x32,0x31,0x30,0x2e,0x2d,0x2c,0x2b,0x29,0x28,0x27,0x26,0x25,0x23,0x22,0x21,0x20,0x1f,0x1e,0x1d,

0x1c,0x1b,0x1a,0x19,0x18,0x17,0x16,0x15,0x14,0x13,0x12,0x12,0x11,0x10,0xf,0xe,0xe,0xd,0xc,0xc,0xb,0xa,0xa,0x9,0x8,0x8,0x7,

0x7,0x6,0x6,0x5,0x5,0x4,0x4,0x3,0x3,0x3,0x2,0x2,0x2,0x1,0x1,0x1,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,

0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x2,0x2,0x2,0x2,0x3,0x3,0x4,0x4,0x4,0x5,0x5,0x6,0x6,0x7,0x7,0x8,0x8,0x9,

0xa,0xa,0xb,0xc,0xc,0xd,0xe,0xf,0xf,0x10,0x11,0x12,0x13,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,

0x20,0x21,0x22,0x24,0x25,0x26,0x27,0x28,0x2a,0x2b,0x2c,0x2d,0x2f,0x30,0x31,0x33,0x34,0x36,0x37,0x38,0x3a,0x3b,0x3d,0x3e,

//数据写入

void da5615(unsigned int da)

{

  unsigned char i;

  da <<= 6;//10有效数据左对齐

  CS = 0;

  CK = 0;

  for (i=0;i<12;i++)

  {

    DA = (bit)(da & 0x8000);

    CK = 1;

   

  }

  CS = 1;

  CK = 0;

}

main()

{

         unsigned int j;

         while(1)

         {

                da5615(sine_dot[j]);

                  if(++j > 1023) j=0;          

         }

}

资料包括:

需要完整的资料可在我的资源里下载,也可以加入我的纷传圈子,里面有资源压缩包的百度网盘下载地址及提取码。

纷传点击用微信打开即可,过程有点繁琐请见谅。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/87414.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

可视化编排的数据集成和分发开源框架Nifi轻松入门-上

文章目录概述定义dataflow面临挑战特性核心概念架构高级概述安装部署常见处理器入门示例概述 定义 Nifi 官网地址 https://nifi.apache.org/ Nifi 官网文档 https://nifi.apache.org/docs.html Nifi GitHub源码地址 https://github.com/apache/nifi Apache NiFi是一个易于使用…

NetInside助力IT提高业务性能管理能力(二)

​​需求简介 某外高桥公司的OA系统是其重要的业务系统&#xff0c;OA系统负责人表示&#xff0c;部分用户反馈&#xff0c;访问OA系统时比较慢。需要通过分析系统看一下实际情况。 本次分析重点针对OA系统性能进行分析&#xff0c;以供安全取证、性能分析、网络质量监测以及…

关于推特隐私设置的一些小窍门

大家在使用推特进行引流的时候&#xff0c;在使用的时候难免会遇到一些功能模糊不清&#xff0c;这里twitter群推王给大家总结了一些偏门功能应该如何去设置&#xff0c;让你使用起来更加得心应手。 一、推特怎么设置自动放声音 1、首先打开推特APP并登陆。 2、其次在推特主…

CPDA认证|数据分析能给企业带来哪些好处?

数据分析的核心并不在于数据本身&#xff0c;而在于设计有意义、有价值的数据分析主题与指标体系&#xff0c;通过科学有效的手段去分析&#xff0c;进而发现问题优化迭代。 无论分析给出的结果是积极的还是负面的&#xff0c;都是价值承载体&#xff0c;必须以客观的态度面对。…

Enum枚举

枚举一般是针对常量需求,优化代码,.使代码看起来简洁 看下下面这个工具类 说有问题,那就是是看起来代码不够简洁 我看着倒还行,也许也是枚举不怎么实用的原因 下面就用枚举来优化这个代码,首先看下枚举介绍 java中对常量数据的配置可以使用枚举类型实现,,枚举类型是面向对象…

3小时!开发ChatGPT微信小程序

导读 | 上周OpenAI发布了对话语言模型 ChatGPT&#xff0c;相关讨论引爆全网。你是否也迫不及待体验一番&#xff1f;本文特邀作者腾讯云开发者社区作者戴传友从开发环境准备、开发过程、服务器接口、腾讯API网关接入到部署&#xff0c;详细教你如何动手开发一个chatGPT微信小程…

2022年华中杯数学建模挑战赛A题分拣系统优化问题

2022年华中杯数学建模 A 题 分拣系统优化问题 真的有想占便宜的 醉了 几十元让我写论文这是什么选手 想占便宜想疯了么 还要求查重率在10% 一开始说想看看你的A题论文 想学习一下 然后谈完价(几十块钱)之后 需要改成现做一篇独一无二的论文 然后想套路我占便宜 套路是真的深啊…

【R语言绘图】R在气象、水文中数据处理及结果分析、绘图技术

【查看原文】R语言在气象、水文中数据处理及结果分析、绘图实践技术应用 【内容简述】&#xff1a; 一、R简介与 R 在气象水文中的应用 R语言与 R软件简介 R 在各行业的应用 R 与其他语言的比较及其在数据分析与作图上的优势 R 在地学中的应用以及R 在气象水文中的应用 二、…

【react】虚拟DOM的两种创建方式

1、使用js创建虚拟DOM <body><div id"test"></div><!-- 引入react核心库 --><script src"../js/react.development.js"></script><!-- 引入react-dom&#xff0c;用于支持react操作dom --><script src"…

大数据期末课设~基于spark的气象数据处理与分析

目录 一 、项目背景 .......................................... 3 二 、实验环境 .......................................... 3 三 、实验数据来源 ................................... 4 四 、数据获取 .......................................... 5 五 、数据分析 ....…

港科夜闻|2022年香港科大气候适应及复原力大会圆满闭幕,政经领袖研讨香港气候政策与绿色金融发展...

关注并星标每周阅读港科夜闻建立新视野 开启新思维1、2022年香港科大气候适应及复原力大会圆满闭幕&#xff0c;政经领袖研讨香港气候政策与绿色金融发展。该会议由香港科大主办&#xff0c;于12月10日开幕。会议以跨领域的知识及观点交流为方针&#xff0c;凝聚公营及私营部门…

vulnhub serial讲解

环境搭建 下载 https://download.vulnhub.com/serial/serial.zip ​ 你会得到一个这样的文件&#xff0c;这里使用VMware新建一个虚拟机&#xff0c;这里记录比较重要的几部分。 ​ ​ ​ ​ 这里就是使用我们刚才下过来的。 ​ 漏洞过程详解 1.信息收集 netdiscover -i …

[附源码]Node.js计算机毕业设计调查问卷及调查数据统计系统Express

项目运行 环境配置&#xff1a; Node.js最新版 Vscode Mysql5.7 HBuilderXNavicat11Vue。 项目技术&#xff1a; Express框架 Node.js Vue 等等组成&#xff0c;B/S模式 Vscode管理前后端分离等等。 环境需要 1.运行环境&#xff1a;最好是Nodejs最新版&#xff0c;我…

【论文】Auto-Encoding Variational Bayes

1.预备概念 1.1 后验分布 最大后验&#xff08;Maximum a Posteriori&#xff0c;MAP&#xff09;概率估计详解 【参考文章】https://blog.csdn.net/fq_wallow/article/details/104383057 1.2 重参数 Reparameterization 目的是&#xff1a; 转为公式表达从而实现微分 知乎…

编辑部已成羊村,这几天幸亏有ChatGPT(doge)

梦晨 羿阁 发自 凹非寺量子位 | 公众号 QbitAI坏事了&#xff0c;AI真的来抢饭碗了。还是我的饭碗&#xff01;这两天你们看的推送&#xff0c;有些标题是AI帮忙取的&#xff0c;有些文章甚至由AI完成了主要工作。我呢&#xff1f;我不过是打打下手&#xff0c;加些过渡句&…

RS485总线详解

RS485总线详解前言一、常见接口划分二、RS485概述&#xff08;一&#xff09;简介&#xff08;二&#xff09;接口/引脚图三、RS485总线详解&#xff08;一&#xff09;RS485总线概述&#xff08;二&#xff09;差分传输&#xff1a;&#xff08;三&#xff09;原理图&#xff…

基于51单片机的超声波测距系统设计

功能&#xff1a; 超声波测距仪&#xff0c;测量距离&#xff0c;用LCD12864显示信息。 lcd_writestr(0,0," 超声波测距仪 "); lcd_writestr(1,0,"&#xff0a;&#xff0a;&#xff0a;&#xff0a;&#xff0a;&#xff0a;&#xff0a;&#xff0a;");…

商场中央空调工程-商场商铺中央空调安装常见问题解答

商场中央空调工程-商场商铺中央空调安装常见问题解答 为了提高装修档次&#xff0c;提高舒适度&#xff0c;为顾客营造一个相对舒适的购物环境&#xff0c;很多门店都会选择安装中央空调。刚接触门店中央空调安装的客户会有很多疑问。例如&#xff0c;商店安装的中央空调和家用…

Android消息机制与源码剖析(Looper,Message,MessageQueue以及Handler)

Android消息机制 文章目录Android消息机制消息传递与处理的流程&#xff08;配图示&#xff09;1.【入口】 在 ActivityThread.class 的 main() 方法&#xff0c;为主线程创建 Looper&#xff0c;并开启 loop() 循环2.【创建Looper】通过 Looper.prepareMainLooper() 创建主线程…

MySQL如何快速恢复单表(物理方式)

GreatSQL社区原创内容未经授权不得随意使用&#xff0c;转载请联系小编并注明来源。GreatSQL是MySQL的国产分支版本&#xff0c;使用上与MySQL一致。作者&#xff1a;xryz文章来源&#xff1a;社区投稿 使用方法 1、首先创建一个测试表test1&#xff0c;并插入几条数据&#x…