Read potentiometer value in simulink with MBDT blocks

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Read potentiometer value in simulink with MBDT blocks

跳至解决方案
1,516 次查看
pierpaolo_dini
Contributor III

Hello,
I was trying to get familiar with MBDT for Simulink.
The board I use is the s32k144.
The objective was to read the potentiometer value and graph it in PIL simulation.
I can actually read when it is at the minimum or the maximum value as if it were a boolean.
My Simulink diagram is as follows:

pierpaolo_dini_0-1656601014918.pngpierpaolo_dini_1-1656601062440.png

in fact, you can see how Simulink suggests that at the GPI Read block output, there is a boolean.

pierpaolo_dini_2-1656601148218.png

I can graph it via scope bl during the simulationock, but I can only see 0 or 1.

any suggestions for reading the entire set of values associated with the potentiometer?

Thanks in advance for the help.

0 项奖励
回复
1 解答
1,497 次查看
SorinIBancila
NXP Employee
NXP Employee

Hello @pierpaolo_dini ,

The GPIO blocks are digital so they can only read/write logic values (0 and 1). If you want to use the potentiometer, you have to use the ADC (Analog To Digital Converter) blocks. You can check adc examples to see how to use them. 

 

Best regards,

Bancila Sorin

 

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,498 次查看
SorinIBancila
NXP Employee
NXP Employee

Hello @pierpaolo_dini ,

The GPIO blocks are digital so they can only read/write logic values (0 and 1). If you want to use the potentiometer, you have to use the ADC (Analog To Digital Converter) blocks. You can check adc examples to see how to use them. 

 

Best regards,

Bancila Sorin

 

0 项奖励
回复