当前位置:网站首页>ADC0808/9 signal acquisition developed by single chip microcomputer
ADC0808/9 signal acquisition developed by single chip microcomputer
2022-07-30 11:26:00 【HUAWEI CLOUD】
一、题目
ADC0808信号采集
二、要求
1、画出实验的流程图
2、编写源程序并进行注释
3、记录实验过程
4、记录程序运行结果截图
三、过程及结果分析
利用LCD1602和AD0808Realize simple AC signal zero-crossing detection and frequency analysis.When signal amplitude changes are required(满量程的5%—95%),Does not affect detection results.The result of the frequency detection is passedLCD1602The first line of is displayed,When the signal crosses zero,能够通过P2.6Output a pulse width of 5μs的脉冲信号.
1. According to the above experiment content,在Proteus 环境下建立图1所示原理图,并将其保存为ADC0808_self.DSN 文件.
图1:实验电路图
2. 编写源程序,将其保存为ADC0808_self.c,运行Keil开发环境,建立工程ADC0808_self.uV2,CPU 为AT89C51,包含启动文件STARTUP.A51.
3. 将C 语言源程序ADC0808_self.c 加入工程ADC0808_self.uV2,并设置工程ADC0808_self.uV2 属性,将其晶振频率设置为12MHz,选择输出可执行文件,仿真方式为选择硬仿真,并选择其中的“PROTEUS VSM MONITOR 51 DRIVER”仿真器.
4.构造(Build)工程ADC0808_self.uV2.如果输入有误进行修改,直至构造正确,生成可执行程序ADC0808_self.hex 为止.为AT89C51 设置可执行程序ADC0808_self.hex.
5. 运行程序,观察计算结果,并验证其是否正确.改变RV1 the tap position,Thereby changing the amplitude of the input signal,Observe whether the calculation result is correct.Change the frequency of the signal transmitter,Verify again that it functions correctly.(注意:Because it is a soft simulation,So the speed of signal acquisition is limited,Therefore, the frequency of the input AC signal cannot be too high,可以在200Hz以内尝试).
实验结果如下:
1)Set the potentiometer to full scale90%,At this time, the amplitude of the signal is the maximum value90%
图2:The potentiometer is adjusted to full scale90%
2)Set the potentiometer to full scale50%,The amplitude of the signal at this time is half of the maximum value
图3:The potentiometer is adjusted to full scale50%
3)The potentiometer is adjusted to full scale10%,At this time, the amplitude of the signal is the maximum value10%
图4:The potentiometer is adjusted to full scale10%
四、流程图
图5:实验流程图
LCD1602control method by pressing 3.7method shown in sectionADC0808control method by pressing 3.8.1performed as indicated.Here is mainly how to realize the detection method of zero-crossing point.It cannot be used to judge whether the collected data is 0 的方法来实现,Because your acquisition time may not be strictly aligned with the zero-crossing time.但是,我们注意到在 0 The polarity of the signal on both sides of the point changes,We can take advantage of this feature to achieve zero-crossing detection.A sine wave has two zero crossings per cycle,因此,1s Divide by the number of internal zero crossings 2 is the frequency of the signal.
因此,This can be done in the program.Every time a new data is collected, it is necessary to check whether the data is positive or negative.当这个数大于 128 时是正数,当它小于 128 is negative.Determine whether the positive and negative polarities of the current data are consistent with the positive and negative polarities of the previous data,如果不一致,It means that a zero-crossing has passed,Record it in the times counter.
ADC0808 的 CLK Still using the timer T1 来实现,可以将其设置为 50kHz(It can be higher when implemented in hardware,No matter how high the software simulation is, it will be difficult to achieve).利用定时器 T0 实现 50ms 定时,And cooperate with the software to realize 1s clock time.采用 12M 晶振时,T0 采用方式 1,Then the disposal should be(TH0=0x3C,TL0=0xB0).
但是,Because the interrupt handler needs a certain response time,Therefore, this parameter is only a theoretical calculation result,To be adjusted slightly according to the actual situation. 同样 T1 There may also be a certain gap between the theoretical calculated value and the actual output value,Adjustments are also made.
五、源代码
边栏推荐
- AB test summary
- 2022全球数字经济大会人工智能专场:AI安全受高度关注
- 电压继电器HDY-A/1-220VAC-1
- Microsoft SQL服务器被黑客入侵 带宽被窃取
- Beyond Stream Processing!The 4th real-time computing Flink challenge is launched, and 490,000 prizes are waiting for you!
- 【HMS core】【FAQ】HMS Toolkit Typical Questions Collection 1
- 【数据库基础】redis使用总结
- 208. 实现 Trie (前缀树)
- paging
- ESP32CAM 1838接收红外遥控器信号
猜你喜欢

I built another wheel: GrpcGateway

Voltage relay h2d SRMUVS - 100 vac - 2

MySQL——数据库基础

The package of idea is not hollow

零代码开发入门:快速上手DIY函数公式的5个步骤

Beyond Stream Processing!The 4th real-time computing Flink challenge is launched, and 490,000 prizes are waiting for you!

PL5920 SOT-23-6 21V、2A、600KHz同步降压DC/DC转换器

async.js入门

HJY-F931A/YJ three-phase voltage relay

24. 两两交换链表中的节点
随机推荐
xshell使用技巧(赚分享平台怎么样)
高能产出!腾讯内部的MyCat中间件手册,理论实操齐下
PanGu-Coder: 函数级的代码生成模型
oracle export dmp file type as "crash dump file"
Telerik2022 R2,有效的自动化测试
【数据库基础】redis使用总结
基于.NetCore开发博客项目 StarBlog - (16) 一些新功能 (监控/统计/配置/初始化)
Current relay JL-8GB/11/AC220V
数据库事务,JDBC操作和数据类型
编译Hudi
正则表达式快速入门笔记
Drools 规则引擎一文读懂
C language - bitwise operations
decodeURIComponent()、eval()、encodeURIComponent()
Vim plugin GrepIt
IP池设计思考(面试点)[通俗易懂]
汇编实现冒泡排序
加密和安全
面试官:Redis中的布隆过滤器与布谷鸟过滤器,你了解多少?
salesforce使用方法(salesforce authenticator下载)




