Adc Single shot example.

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

Adc Single shot example.

472 Views
avinashstarkenn
Contributor III

Hello,

I am using MBDT for s32k344.

I am trying out following example.

avinashstarkenn_0-1695203039291.png

As per the adc configuration it is one-shot. Ideally in one shot the conversion should take place once and value should be saved in 'Channel X' variable in the model. After that even if voltage on the respective pin is changed value should not get updated like that happens in scan mode(Continuously updating the variable, as continuous conversion is happening.

But in this case on Freemaster I can see that value is continuously getting updated i.e. it is behaving like a continuous mode.

Please can you help me with this. And please explain me how to make it one-shot adc model in MATLAB.

Regards 

 

 

0 Kudos
Reply
1 Reply

392 Views
georgevictor
NXP Employee
NXP Employee

 

Hi, @avinashstarkenn,

The example used has the Adc_StartGroupConversion block in the main canvas. This means that the function is called at each model step and restarts the group conversion. The group that has the Group Conversion Mode set to ONESHOT will return only one value as expected but at the next step the conversion is restarted. 

Hence, the Adc_StartGroupConversion should be placed in a one-time call subsystem. Here are some examples that might help:

  •   Use the initialization subsystem. It is called only once at model initialization. Bare in mind that we usually have here the configuration blocks for multiple peripherals like Adc_SetupResultBuffer. The  Adc_StartGroupConversion function should be called after the Adc configuration functions. The block priority property can fit this purpose, like in the following picture:

georgevictor_0-1696260027892.png

 

  • A subsystem that is executed after a specific event, like an interrupt generated by a time elapse or a button press.

 

 

Cheers,

Victor

0 Kudos
Reply