An algorithm for discussing AD conversion resolution (ZT) (1) In the total length of 5 meters in the range, the average distribution of 6 trees (or 6 elements), calculate the interval of each branch tree (or each element)? Solution: Each tree (or each element) should be distributed like this: 0 meters at the beginning of the 1th tree (recorded as number No. 0 tree) Plant a 2nd tree at 1 m (recorded as number 1th tree); Plant a 3rd tree at 2 m (recorded as number 2nd tree); 6th tree at 5th metre (i.e. end point) (recorded as No. 5th tree) Therefore, the algorithm for the interval (or resolution) of each tree is: total length/(length of total element-1) namely: 5 m/(6-1) tree = 1 m/tree Every 1 meters There are 1 trees, this truth everyone is very clear, should no one said resolution = total length/length of the total element =5/6=0.83 m, That is, there are 1 trees every 0.83 meters??? XXX, see Example Again (2) (2) in the total length of 5 meters in the range, the average distribution of 256 trees, to calculate the interval between each tree? Solution: Total length = 5, total element =256 in length So: According to the above algorithm, the interval (or resolution) of each tree =5/(256-1) =0.019607843 That is: the location of tree No. 0, the location of the 1th tree =0*0.019607843=0 (m) Location of tree No. 1th, 2nd tree location =1*0.019607843=0.019607843 (m) Location of Tree No. 100th, 101th tree location =100*0.019607843=1.9607843 (m) Location of tree No. No. 255, No. 256 tree location =255*0.019607843=4.99999997=5 (m) (3) in the range of 5V total voltage, the average distribution of 256 elements (0-FF), the interval of each element is calculated? Solution: Total voltage =5v; length total element =256 (0-FF) So: the interval (or resolution) of each element =5/(256-1) =0.019607843 That is: The position of element No. 0, the ad<00> voltage =0*0.019607843=0 (V) Position of element 100th, i.e. ad<64> voltage =100*0.019607843=1.9607843 (V) Position of element No. 255, i.e. ad<ff> voltage =255*0.019607843=4.99999997=5 (V) (4) Resolution of the ad conversion = reference voltage/(total element-1) When the ad is 8-bit, the total element =256 (FF) takes the reference voltage =vdd=5v Resolution =5/(256-1) = 0.019607843 When ad=255, the ad converts the value =255*0.019607843=4.99999997=5 (V) Consider this: conversion value =255* (5/256) =4.98046875=4.98 (V) The result is wrong, let's take a look at this algorithm calculation example (1) to see: Interval (or resolution) of each tree = total element length/length =5/6=0.8333333333 That is: the location of tree No. 0, the location of the 1th tree =0*0.8333333333=0 (m) Location of tree No. 1th, 2nd tree location =1*0.8333333333=0.8333333333 (m) Location of Tree No. 5th, 6th tree location =5*0.8333333333=4.166666666 (m) Visible, the final element is not at the end of 5 meters, it is obvious that the algorithm is not gross position element minus 1 is wrong, ignoring the position of an element in the 0 ah. |