PreviousNext
FSRx as a 16-bit variable
Help > Appendix > Code Optimization > FSRx as a 16-bit variable

FLASH-                        RAM-               Speed+

 

When FSRx content is preserved then it can be used as a general 16-bit variable to save RAM and avoid MOVLBs. Also because of ADDFSR instruction adding/subtracting small constant numbers is very efficient.

.

uns16 loop16 = 1000;

uns8 var8;

do

{

  var8 = getTemperature();

  // use loop16 and var8

  loop16 -= 5;

} while ( loop16 != 0 );

FSR0 = 1000;

uns8 var8 @ FSR1L;

do

{

  var8 = getTemperature();

  // use FSR0 and var8

  FSR0 -= 5;

} while ( FSR0 != 0 );