Devkit MPC5744P rev.e data problem

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

Devkit MPC5744P rev.e data problem

1,194 次查看
haoxue1027
Contributor V

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

标签 (1)
0 项奖励
回复
2 回复数

1,176 次查看
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 项奖励
回复

1,165 次查看
haoxue1027
Contributor V

@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