Download package



This driver supports most SPI thermal modules (like MAX31855). Those modules are returning the absolute, prescaled temperature. The main difference between most of them is the bitwidth, scaling and range.

This driver is configurable, so that you can use most of them.


You need to have the device description and driver library installed from the "SPI-Temperature" project.


This driver can be used in a similar way as most other CODESYS devices. Except, that the outputs are not mapped through the I/O mapping, but they are provided as an output of the FB from the device tree.


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 a MAX31855 with a Raspberry Pi Zero W, on SPI port 0 and chip select 0. This corresponds to "spidev0.0".

Add the device

The device is named SPI Temperature and has to be inserted below an SPI Master of your CODESYS project.

  • Right click on SPI master
  • Add Device
  • Select the SPI Temperature

Configure the SPI port

The SPI port and chip select have to be set to the Pins, where you connected the chip.

  • Double Click on the SPI Master
  • Set the configuration parameters

The first number specifies the SPI bus. The second number specifies the chip select.

Configure the device

As this driver is a very generic one, you have to add some configuration parameters from the datasheet. In fact these are only two values:

  • Bitwidth
  • Resolution

Both can be usually found in the datasheet of the chio. A few common ones can be found here: [Configuration List]

Use the input values

After the configuration is done, the input of the sensor can be used directly from the output of the function block.

rTemp := SPITemperature.rValue;


Home: Configuration List

Start a new Talk topic