Cover image
Try Now
2020-10-18

MCP3208 8频道,12位,ADC芯片的Arduino库

3 years

Works with Finder

4

Github Watches

7

Github Forks

20

Github Stars

MCP3208

Arduino library for MCP3208 8 channel, 12 bit, ADC chip

Usage

The library provides a constructor which takes a chip select pin number. To use the library you must first create a new MCP3208 object with the pin number. On the chipKIT boards you also get the option of passing a DSPI object to use a different SPI bus than the default:

Arduino or chipKIT:

MCP3208 myADC(10);

chipKIT only:

DSPI1 mySPI;
MCP3208 myADC(&mySPI, 10);

You can also miss out all parameters and the default chip select pin of 10 will be used.

Reading the ADC values can be done in two ways. The chip supports both normal linear analog reading (as the on-board ADC on Arduino and chipKIT boards provides), and also differential reading; that is the difference between the voltages applied to two adjacent channels.

To do a normal straight reading use the analogRead() member function of the MCP3208 object. For instance, to read from channel 3:

int myValue = myADC.analogRead(3);

For differential reading channels are numbered 0 to 3 instead of 0 to 7 and form the single-ended pairs 0+1, 2+3, 4+5 and 6+7. The analogReadDif() member function is used to read a differential value, so to read the voltage difference between inputs 4 and 5, you would use:

int myValue = myADC.analogReadDif(2);

Differential reading is done in either one or two stages depending on the voltages applied. If the voltage difference is positive then the channels are read simultaneously and the value returned. However, if the difference is negative the first reading will return an invalid value, so the channel assignments are then swapped and a new reading taken. The negative of this new value is then returned, thus giving you the full positive and negative difference ranges.

For more detail on how the chip works you should consult the datasheet:

http://ww1.microchip.com/downloads/en/DeviceDoc/21298c.pdf

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Lists Tailwind CSS classes in monospaced font

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

    Reviews

    5 (1)
    Avatar
    user_baaHte3l
    2025-04-17

    The MCP3208 from MajenkoLibraries is an excellent choice for anyone needing a reliable and efficient ADC for their projects. It offers great precision and versatility, supporting up to 8 channels of analog input. The documentation on GitHub is thorough and easy to follow, making it simple to integrate into both beginner and advanced projects. Highly recommended for its performance and ease of use!