Weird compiler problem.

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

Weird compiler problem.

1,712 次查看
NZ_Design
Contributor I
I have this code in my program for reading SPI port.
uchar SPI_Proc (SPI_PORT Port, uchar cValue)
{
  volatile uchar cData;
  while (!(*Port.pSPISR & SPI_TEF));                // Wait for SPTEF set
  *Port.pSPIDR = cValue; 
  while (!(*Port.pSPISR & SPI_IF));                 // Wait for SPIF set
  cData = *Port.pSPIDR;                        
  cSPI_Data = cData;                                       // load value into global location.
  return cData;
}


I have two lines calling this routine one after the other.

  cData = SPI_Proc(AD7730_Port,bComm);   // this line returns 0x30 which is correct.
  cData = SPI_Proc(AD7730_Port,bComm);   // this line also returns 0x30 but should be 0x80.

if I read cSPI_Data (global value) after the secound line it is equal to 0x80.

Therefore the secound SPI_Proc is not returning the data. Why???? Its reading the correct data but not returning it.



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

634 次查看
CrasyCat
Specialist III
Hello
 
In order to investigate that we probably need some project reproducing the trouble. 
Trouble might come from the source code or from the options you are using.
 
I would recommend you to submit a service request for that.

Click here to submit a service request.

Make sure to attach a reproducible project and installed product information to the service request.
To generate the required information:
- Start CodeWarrior
- Open the project
- Select "Help" -> "Pack and Go" and follow instructions on the screen.

Attach the generated .zip file to the SR.
CrasyCat
0 项奖励
回复