This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TM4C123GH6PM:简单的 ADC 读数

Guru**** 1993015 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1115436/tm4c123gh6pm-simple-adc-reading

器件型号:TM4C123GH6PM

大家好、

我尝试使用 Tiva 芯片上的 PE2来读取模拟输入。  我找到了下面的示例、并尝试对其进行编辑以读取该端口、但我只得到大约287的值。

奇怪的是、无论输入电压是多少、读入的第一个值的值仍然为+/- 3。  但是、如果我复位程序、我会看到大约20个跳变 (例如、如果我将输入电压降低0.2V。)

我忘记设置或重置某个内容了吗?  我应该使用其他示例吗?

(我不想使用 uDMA 例程、该示例看起来过于复杂、每隔几秒只需简单读取一次。)

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//*****************************************************************************
//
// single_ended.c - Example demonstrating how to configure the ADC for
// single ended operation.
//
// Copyright (c) 2010-2020 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

感谢您提供任何指导。  我知道我缺少一些简单的东西。

Bob

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

     您读取的引脚错误。 您的程序已设置为读取 AIN2。 AIN2为 PE1、而不是 PE2。 如果读取 PE1、则应读取正确的值。  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    今天晚上我会尝试一下。   您能给我指一下您从中获取图表的文档吗?  (我还需要读取其他几个引脚。)

    非常感谢!

    Bob

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    这来自器件数据表。 https://www.ti.com/lit/pdf/spms376。 转到801页查看该表。  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    谢谢!