1923 views|0 replies

1025

Posts

1

Resources
The OP
 

Little Bee SLSTK2010A Learning Sequence 5: AD Test [Copy link]

This post was last edited by wudianjun2001 on 2018-7-12 12:17
These articles are part of the content to be used in the following project. The sample I made has not been returned yet. First use the development board to test the functions that need to be used, and then directly transplant the parts that have no problems in the test and modify them.
This time we test the AD acquisition function. Let's first look at the corresponding pins on the schematic diagram. It is a button joystick, corresponding to the P1.4 pin of MCU.
There are several options for the reference voltage of MCU. The default is to select the internal 1.65V, which is also the reference voltage for this test. There is a reason why this reference voltage is selected. The range voltage of the signal input is 3.3V. When setting the registers later, you can see that the signal is amplified by 0.5 times, that is, it is reduced by half, which is exactly 3.3/2=1.65V, so choosing this reference voltage can reach the full range.
Initialization settings of AD, select channel 12 corresponding to channel P1.4, 12-bit resolution, 0.5x magnification, and use TC2 to trigger acquisition. It uses TC2 for timing. When the timing overflows, it will reset the timing and trigger an AD acquisition.
ADAcquisition completion interrupt function, calculate and print the collected voltage value to the serial port in the interrupt. Collect 10 times and upload the last data. What I usually do is to collect data 10 or 20 times, then remove one or two maximum and minimum values, average the remaining values, put the processed data into a queue, and then perform calculations on the data in the queue.
The effect of serial port printing data
Acquiring data is not complicated. The key is to process the collected data. There are many algorithms.
This content is originally created by EEWORLD forum user wudianjun2001. If you need to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source

This post is from DIY/Open Source Hardware
 

Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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