Download package
This driver supports an A/D converter from Microchip technology inc. It is an SPI device, which features 4 or 8 analog channels, which are autonomously sampling the signals at a pretty high rate:
This is far beyond what we are able to read via Linux over SPI.
You need to have the device description and driver library installed from the "MCP3008" project.
This driver can be used in a similar way as most other CODESYS devices. You add it to your project and map your input variables.
The chip has to be connected to a free SPI port. We assume, that you connect the chip with a chip select that coresponds to your SPI port. ATM we don't support to use general GPIOs for chip selects. Also no daisy chaining is supported, as the device doesn't support that.
This example shows the wiring of an MCP3008 with a Raspberry Pi on SPI port 0 and chip select 0. This corresponds to "spidev0.0".
The device is named MCP3008 and has to be inserted below an SPI Master of your CODESYS project.
The SPI port and chip select have to be set to the Pins, where you connected the MCP3008.
The first number specifies the SPI bus. The second number specifies the chip select.
You can easily map the analog input channels to some variables within your project.