1658 views|0 replies

1663

Posts

0

Resources
The OP
 

How to determine the frequency of sine wave collected by microcontroller AD? [Copy link]

Now, the AC is input to the AD port of the PIC16F877A microcontroller through the op amp. The program code is in assembly, so I don't quite understand it. It seems that the program is written like this to judge whether the waveform is 50HZ or 60HZ by judging the number of acquisitions, and in order to judge the amplitude of the AC, it is compared with a fixed value after accumulation. AD is a 10-bit AD, so the absolute value of the difference between the collected value and 0x7f in the program is accumulated and compared with a value. What is the reason for this? Because AD is 10 bits and the op amp raises the AC waveform to about the midpoint of 5V during sampling, that is, the 0V and 2.5V of the AC coincide, so the collected value 0X7F is subtracted. I can understand, but I don't understand the following: The op amp circuit diagram and the voltage waveform output by the op amp to the AD port are shown in the figure. But the questions are as follows:
1. The AD program is processed once every 400US in the program, and the number of AD acquisitions is compared with 24 to judge whether the waveform is 50HZ or 60HZ. What is the reason for this?
2. Why is the value collected each time accumulated and compared with a fixed value to determine whether the input voltage amplitude is 220V or 380V?

There is a comment in the program as follows
; (half-cycle sampling amplitude accumulated value < #0x0350)
How is 0x0350 obtained?

Our product is a PIC assembly which looks too long. How does the microcontroller determine the frequency and amplitude of the alternating current?

This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list