Categories
Latest Postings
- 17. January 2012: Atypical Curiosity
- 4. January 2012: PIC32MX7 PIM, RB5 pin conflict (solved)
- 30. December 2011: MikroE Mini-32 Board
- 29. December 2011: Donate to Wikipedia
- 28. December 2011: PIC32 Interrupt Nesting (update)
- 20. December 2011: Graphics Library 3.02
- 2. December 2011: Home Brewed IDE for PIC32 assembly development
- 30. November 2011: Yoda Conditions, Egyptian brackets and more...
- 9. November 2011: AVI Player Project (for the uMMB)
- 21. March 2011: More Multimedia Boards
Links
Archives
- January 2012
- December 2011
- November 2011
- March 2011
- February 2011
- January 2011
- March 2010
- January 2010
- December 2009
- November 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- January 2009
- December 2008
- November 2008
- October 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
Updating Chapter 4
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
Leave a Reply
You must be logged in to post a comment.