I confirmed you observations when I reran the routines @ 16MHz and PBPL.
I did notice if you use PBP's "DIG" command, the number of instruction cycles used are not consistent for various 4 digit numbers.
Here is the data I collected.
Code:
Algorithm 1:
Pressure = 1234
'Start Stopwatch in MPLAB Simulator
tmpDig0 = Pressure dig 0
tmpDig1 = Pressure dig 1
tmpDig2 = Pressure dig 2
tmpDig3 = Pressure dig 3
'Stop Stopwatch in MPLAB Simulator
Algorithm 2:
Pressure = 1234
'Start Stopwatch in MPLAB Simulator
tmpDig0 = Pressure // 10
tmpDig1 = Pressure / 10
tmpDig2 = Pressure / 100
tmpDig3 = Pressure / 1000
tmpDig1 = tmpDig1 // 10
tmpDig2 = tmpDig2 // 10
tmpDig3 = tmpDig3 // 10
'Stop Stopwatch in MPLAB Simulator
Algorithm 3:
Pressure = 1234
tmpDig0 = Pressure // 10
pressure = Pressure / 10
tmpDig1 = Pressure // 10
pressure = Pressure / 10
tmpDig2 = Pressure // 10
tmpDig3 = Pressure / 10
'Stop Stopwatch in MPLAB Simulator
PBPW @ 16MHz
Algorithm Inst Cycles Time
1 2958 739.50 us
2 2086 521.50 us
3 1783 445.75 us
PBPL @ 16MHz
Algorithm Inst Cycles Time
1 9626 2.406500 ms
2 6830 1.707500 ms
3 5839 1.459750 ms
Obviously PBPL slows down the routines considerably.
Good luck.
Bookmarks