필터 지우기
필터 지우기

how to monitor analog input from raspberry pi using simulink

조회 수: 2 (최근 30일)
Mihir Pingle
Mihir Pingle 2020년 6월 15일
댓글: Mihir Pingle 2020년 6월 26일
hello,
I am using the MCP3008 to connect analog inputs to raspberry pi. I can view the voltage over matlab using the code given in the link below.
I created a model containing SPI master transfer block and connected a constant input of [1, bin2dec('10000000'), 0] to it. Then created a Matlab function block to convert the Datain the form of vector to actual voltage same as matlab code. I am using a scope to monitor this voltage signal. When I try to build it in external mode the input over time is zero (I can see the varying input ver matlab). If anone has step by step solution please help.
Thanks in advance.
  댓글 수: 2
Nirmalkumar Doreraju
Nirmalkumar Doreraju 2020년 6월 26일
Hi Mihir,
Since by default the datatype of a constant block in Simulink is double, you might be seeing no data output. Double click on the Constant block, go to Signal Attributes tab, and select the Output data type to be uint8. After this, hopefully the block should output proper values.
Please give it a try and let us know how it went.
Thanks and Regards,
Nirmal
Mihir Pingle
Mihir Pingle 2020년 6월 26일
Thanks Nirmal for the help. My issue is already resolved. Instead of the Matlab function block I replicated the logic by using the simulink blocks and at the end converted the data type to double from unit8. Now its working properly

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Raspberry Pi Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by