variable = TADIn(Channel)
variable | Variable to store results. (No String or Single) |
channel | AD channel number (0 to 15. This is the channel number, not the port number) |
This command is similar to ADIn, but returns the average of 10 values read
with the ADIncommand. When working under noisy environments, using
TADIn
could help in obtaining more precise results.
TADIn
is a pre-made function:
Function TADIn(num As Byte) As Integer Dim ii As Integer, ta As Long ta = 0 For ii = 0 To 9 ta = ta + ADIn(num) Next TADIn = ta / 10 End Function
The TADIn
function cannot be used for the CB405RT's high resolution AD channels (See HADIn and HADIn2), but the following implementation can be used as a substitute.
Function HTADIn(num As Byte) As Integer Dim ii As Integer, ta As Long ta = 0 For ii = 0 To 9 ta = ta + HADIn(num) Next HTADIn = ta / 10 End Function