Devkit MPC5744P rev.e data problem

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

Devkit MPC5744P rev.e data problem

854 Views
haoxue1027
Contributor IV

Hello,

Now,I recevied the data which is changed from 0 to 2pi.

But I want  the value from -pi to pi.

So I set the program " if data > pi,  data = data-2*pi"

When the data <pi , the data is correct in the freemaster.

haoxue1027_1-1599533843752.png

But if the data >pi , the data is big negative numbers.

haoxue1027_0-1599533807942.png

Can you tell me why? how to change the data to [-pi pi]?

Any help will be appreciated.

best regards

hao

Labels (1)
0 Kudos
2 Replies

836 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @haoxue1027 ,

Have you tried to check the data type? Maybe the FreeMaster tries to display as integer and you stores in the MCU like float.

Hope this helps,

Marius

0 Kudos

825 Views
haoxue1027
Contributor IV

@mariuslucianand hello,

I have found the reason.

Beacuse in the sincon block , the input theta is set to [-pi,pi].

But in my simulink, the input is 0 to 2pi.

Therefore, when the data is greater than pi, an abnormal data  is displayed.

best regards

hao