This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS320F28377D: The initial of various is incorrect

Part Number: TMS320F28377D


Tool/software: TI C/C++ Compiler

Hi!

 I want initial some various in my program this program is before the for();

Axis1Rg_Cla.Freq=0;
Axis1Rg_Cla.StepAngleMax=AXIS1BASE_FREQ*T;
Axis1Rg_Cla.Angle=0;
Axis1Rg_Cla.Gain=1;
Axis1Rg_Cla.Out=0;
Axis1Rg_Cla.Offset=1;

Axis1Rc_Cla.TargetValue=0;
Axis1Rc_Cla.RampDelayMax=5;
Axis1Rc_Cla.RampLowLimit=-1;
Axis1Rc_Cla.RampHighLimit=1;
Axis1Rc_Cla.RampDelayCount=0;
Axis1Rc_Cla.EqualFlag=0;
Axis1Rc_Cla.SetpointValue=0;
Axis1Rc_Cla.Tmp=0;

Axis1ParkOpen_Cla.Alpha=0;
Axis1ParkOpen_Cla.Angle=0;
Axis1ParkOpen_Cla.Beta=0;
Axis1ParkOpen_Cla.Cosine=0;
Axis1ParkOpen_Cla.Ds=0;
Axis1ParkOpen_Cla.Qs=0;
Axis1ParkOpen_Cla.Sine=0;

Axis2Rg_Cla.Freq=0;
Axis2Rg_Cla.StepAngleMax=AXIS2BASE_FREQ*T;

In my program Initial the various Axis1Rg_Cla.StepAngleMax=AXIS1BASE_FREQ*T and Axis2Rg_Cla.StepAngleMax=AXIS2BASE_FREQ*T; but after i run my program i find that the value  Axis1Rg_Cla.StepAngleMax is incorrect. the correct value is 166.7,but the value is 0. But the various Axis2Rg_Cla.StepAngleMax is correct.

I allocate these two  various in RAM LS1 as the cla variours. 

why one various is wrong the other is right?

regards

shook

  • the various of Axis1Rg_Cla.StepAngleMax's initialization is incorrect is because its value was changed by another various.
    the Axis1Rg_Cla.StepAngleMax in the ram LS1 , it's adree is 0x8A00, the other various i defined is in the ram 0x8A40, I write this various in 0X8A40 to 0, but i read from ccs it's value is 7FFFFFF, then the various of Axis1Rg_Cla.StepAngleMax in 0x8A00 changed to 0.
    why?
  • This is likely because you are working with floating point variables. Is this correct? floats are floating point numbers and ints are for integers.

    In order to know what the bit pattern is of certain floating point values you can use an online IEEE floating point conversion calculator.

    sal