Weird compiler problem.

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

Weird compiler problem.

1,298 Views
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.



Labels (1)
0 Kudos
1 Reply

220 Views
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 Kudos