Why status register take the program into forever chk mode?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello Every body,

   

I am doing SPI communication between Pi and PSOC 5LP.

   

I placed a command

   

while(!(SPIS_ReadTxStatus() & SPIS_STS_SPI_DONE));

   

But by doing this, my program just takes too long to fulfill the condition and when I replace the above condition with just:

   

while(!(SPIS_STS_SPI_DONE));

   

It does not!

   

I wonder why it is behaving so wierd?

   

Looking forward to your answers!

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

while(!(SPIS_STS_SPI_DONE));

   

The above is testing a constant value for zero. SPIS_STS_SPI_DONE is a #defined value to check for a bit pattern. Checking with
while(!(SPIS_ReadTxStatus() & SPIS_STS_SPI_DONE));
will indeed consume MIPS. Think about to use a "callback macro". Look for that term in SPI datasheet and in Creator help.

   

 

   

Bob

View solution in original post

0 Likes
3 Replies