You are currently browsing the archives for the Chapter 4 category.
- AV16 (4)
- builtin (1)
- Chapter 1 (2)
- Chapter 12 (3)
- Chapter 14 (1)
- chapter 2 (1)
- Chapter 3 (1)
- Chapter 4 (1)
- Chapter 5 (4)
- Configuration (1)
- Events (2)
- Flying (4)
- I2C (5)
- Linux (1)
- MPLAB 8.00 (5)
- mplab c30 v3.02 (11)
- PIC24 (2)
- PIC32 (9)
- Tips and Tricks (14)
- Tools (10)
- Warnings (2)
- 19. November 2008: Bending the laws of physics
- 13. November 2008: Electronica 2008
- 6. November 2008: Deep Blue PIC32
- 4. November 2008: MIPS DSP Libraries
- 1. November 2008: Inexplicably Working Errata
- 26. October 2008: PIC32, Harvard or Von Neumann
- 22. October 2008: Back online, Excuses and the Blues Brothers
- 28. July 2008: Not a dsPIC!
- 23. July 2008: Scilab, FLEX and the Evidence
- 22. July 2008: New compiler and new libraries for the PIC32
Blogroll
PIC24
PIC32
Archive for the Chapter 4 Category
Updating Chapter 4
19. January 2008 by pilot.
There are no changes required to the code in chapter 4 after the upgrade to MPLAB C30 v.3.02. But there are some changes in MPLAB 8.00 behavior that will have you puzzled when looking for the subroutines (library modules) used by the compiler for the long long (64-bit) integer multiplications.
In fact, the listing in the Disassembly window will not show anymore the long long multiplication routine muldi3.c as MPLAB 7.40 and older versions did. In a way the Disassembly listing has been cleaned up a bit, but don’t despair. If you follow the next few steps you’ll be able to find the missing routine anyway:
- Take note of the subroutine address, the number after the rcall mnemonic:
(00280 in my case)
- Open the Program Memory Window and make sure to select the Symbolic view
(use the tabs at the bottom left corner of the window) - Press CTRL+F to open the search dialog box and type the address (00280) or simply scroll down the window until you reach the address.
- There you will recognize the label __muldi3 marking the entry point of the 64-bit multiplication routine used by the compiler. (That’s pretty dry reading, isn’t it?)
Looking at the exercises proposed in Chapter 4:
- Using Timer2 to self time the number of cycles used by each arithmetic operation is just a good idea. Exercise 4-1
Most/all operations will fall withing the 16-bit resolution of the timer (within 65,536 cycles) so that it is easy to obtain all the cycle counts in a single watch window shot:
Notice how some of the values changed a little bit since version 1.30 of the MPLAB C30 compiler? - Checking all the divisions at once is just as simple now: Excercise 4-2
Here are the results:
Do you notice anything interesting? Who said float math has to be always slower than integer? - Trigonometric operations (sin()) is performed using polynomial approximations and therefore multiple additions and multiplications. This has to be “hard”… Excercise 4-3
Looking at these numbers you can almost guess the order of the polynomials… - Complex math as well is composed of multiple operations of the fundamental type (integer/float): Excercise 4-4
Posted in MPLAB 8.00, Chapter 4, mplab c30 v3.02 | No Comments »