当前位置:网站首页>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.
五、源代码
边栏推荐
猜你喜欢
Unity 锁定相机第二弹

Easy gene: human tRNA gene loci showed age-related high DNA methylation | research articles

优酷VIP会员周卡只需7.5元,看《沉香如屑》用优酷视频

STM32F1 reads MLX90632 non-contact infrared temperature sensor

高手云集、丰富活动,斩获佳绩,超过2万名开发者参与的AI社团邀你加入!

24. 两两交换链表中的节点

久经沙场的程序员居然也被某鱼的假程序员骗了,程序员之间的信任应该是最高的,他一个人毁了这种信任感

Performance testing of API Gateway APISIX on Google Cloud T2A and T2D

还在用Swagger?我推荐这款零代码侵入的接口管理神器

Neural Network Study Notes 4 - Autoencoder (including sparse, stacked) (updated)
随机推荐
spin lock和mutex使用场景的差异
RY-D1/1电压继电器
【数据库基础】redis使用总结
decodeURIComponent()、eval()、encodeURIComponent()
Current relay JL-8GB/11/AC220V
2022全球数字经济大会人工智能专场:AI安全受高度关注
电压继电器HDY-A/1-220VAC-1
ORA-00600 [13013], [5001], [268] 问题分析及恢复
Performance testing of API Gateway APISIX on Google Cloud T2A and T2D
零代码开发入门:快速上手DIY函数公式的5个步骤
域名怎么注册备案解析?
MySQL database maintenance
高能产出!腾讯内部的MyCat中间件手册,理论实操齐下
360发布面向未来的EDR,全方位守护政企用户终端安全
salesforce使用方法(salesforce authenticator下载)
基于.NetCore开发博客项目 StarBlog - (16) 一些新功能 (监控/统计/配置/初始化)
UE5 GAS 学习笔记 后记0
API 网关 APISIX 在Google Cloud T2A 和 T2D 的性能测试
pg_rewind 修复主备环境的时间线
还在用Swagger?我推荐这款零代码侵入的接口管理神器




