AnsweredAssumed Answered

while() problem

Question asked by uriy on Mar 28, 2014
Latest reply on Apr 4, 2014 by CraigG

I am using VisualDSP 5.1

I have problem in piece of code

nsamples declared as:

volatile uint32_tnsamples;

It increments in SPORT interrupt

But it doesn't exit from while(nsamples < 304) in other function even though nsamples is 304 and higher.

while (nsamples < 304

void Wait_To_Fill(void)
{ 
             while (nsamples < 304)
             {
                       IDLE;
                       HRCP_RXParser();
                       HRCP_StateMachine();
                       ProcessMessages();        
          }
  
          if (rx_buf == rx_buf1) 
          {
                    rx_buf = rx_buf2;
                    tx_buf = tx_buf2;
                    tmp_rx_buf = rx_buf1;
                    tmp_tx_buf = tx_buf1;
          }
          else 
          {
                    rx_buf = rx_buf1;
                    tx_buf = tx_buf1;
                    tmp_rx_buf = rx_buf2;
                    tmp_tx_buf = tx_buf2;
          }

   Resetnsamples();
}

 

In mixed code you can see that nsamples value must be in R0. but R0 is zero

Attachments

Outcomes