Read potentiometer value in simulink with MBDT blocks

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Read potentiometer value in simulink with MBDT blocks

Jump to solution
998 Views
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 Kudos
1 Solution
979 Views
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

 

View solution in original post

0 Kudos
1 Reply
980 Views
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 Kudos