11.14.3 __TARGET_DIVIDE_CYCLES

Description:

__TARGET_DIVIDE_CYCLES resolves to the value 5 or 17 based on the processor Instruction Set Architecture. Using this symbol in assembly code instead of hard-coding a number helps in porting of code from one device to another.

Include:

libpic30.h

Prototype:

repeat #__TARGET_DIVIDE_CYCLES;

Remarks:

The 16-Bit MCU and DSC Programmer’s Reference Manual (DS-70000157), DIV.S instruction behavior section, explains how many cycles the div instruction takes, including the repeat, in its instruction description. Under Cycles:

  • 18 (plus 1 for REPEAT execution) for dsPIC30F, dsPIC33F,dsPIC33E
  • 6 (plus 1 for REPEAT execution) for dsPIC33C

Default Behavior:

The literal value of 5 or 7 is assigned based on device instruction set architecture.