Using Matlab to read from a PI-SPI-8AI+ board using SPI

3 次查看(过去 30 天)
Hi,
I have a PI-SPI-8AI+ board using a 12 bit A/D converter connected to a Raspberry Pi with some pressure sensors connected to it that I'm trying to read data from using Simulink and Matlab.
In Python I've been using the widgetlords library which makes this an easy task but in Matlab and Simulink I haven't been able to do it yet.
I've been looking at this example (the one under "Read voltage"): https://www.mathworks.com/help/supportp ... g-spi.html
This example does everything I want to do with the PI-SPI-8AI+ but I fail to understand what I need to update to make it work with this board, which I believe is using a MCP3208 chip instead of the MCP3008 in the example. So 12 bits instead of 10.
In the example they use [1, bin2dec('10000000'), 0] which I think I need to extend to 12 bits but I'm not sure how to modify correctly.
Does anyone know if there is an example that could help me or can someone please tell me how to update the code example?
Any help would be much appreciated.
Thanks in advance!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for Raspberry Pi Hardware 的更多信息

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by