Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4924

xc16 Battling the optimiser

$
0
0
Hi. I'm using MPLAB X IDE v3.2 and I've just realised I can turn the xc16 optimisation level up to 1 free-of-charge. However now my code doesn't work. I have a simple while loop as an example
Code (Text):
  1.  
  2.     unsigned short i;    
  3.     i = 2000;
  4.     while(i>0)
  5.     {
  6.         __delay_ms(1);
  7.         Lcd_Process();
  8.         i--;
  9.     }
  10.  
Compiles to the below, which clearly doesn't loop after decriminenting W8
Code (Text):
  1.  
  2. 997:                   unsigned short i;    
  3. 998:                   i = 2000;...
xc16 Battling the optimiser

Viewing all articles
Browse latest Browse all 4924

Trending Articles