Toolbar   The Engineering Toolbar
The Ultimate Resource for Engineering and Technical Research. (Learn More)

Efficient Fixed-Point Trigonometry Using CORDIC Functions for PIC16F

From Microchip Technology, Inc.
 

 

AN1061 Efficient Fixed-Point Trigonometry Using CORDIC Functions For PIC16F TABLE 1: SIN(x) FUNCTION CALL Author: Jose Benavides SPECIFICATIONS WITH Microchip Technology Inc. PIC16F877A AT 20 MHZ CORDIC in asm Math.h in C INTRODUCTION Time 370 µs1.9 ms This application note presents an implementation of the Flash 190 words 1,117 words following fixed-point math routines for the PIC16F RAM 11 bytes 40 bytes microcontroller families: * SIN(X), COS(X) CORDIC THEORY ATAN(X) The CORDIC transform is based on the idea that all the CORDIC is an acronym for COordinate Rotation DIgital trigonometric functions can be calculated using vector Computer and was first developed by Jack Volder in rotations. Equation 1 shows how to do vector rotations. 1959. The CORDIC transforms are a collection of Its derivation is presented in Appendix B. iterative, shift-add algorithms used to compute a wide range of trigonometric and hyperbolic functions on a EQUATION 1: ROTATION OF VECTOR digital computer. (X, Y) BY ? With proper modification, these routines can also be -1 -1 xx= cos? - ysin?, cos , polar/rectangularused to implement the sin yy= cos? + xsin? coordinate conversion, hyperbolic, and even multiply/ divide functions. More detail on these modifications can Figure 1 shows an example of Equation 1 by rotating a be found in a paper titled, "A Survey of CORDIC vector (70, 19), by 30°. Algorithms for FPGA-Based Computers" by Ray Andraka. FIGURE 1: ROTATION OF VECTOR The structure of the CORDIC transform lends itself to (70,19) BY 30° hardware implementations. Typical applications of the CORDIC transform include FPGA-based applications. In fact, entire Arithmetic Logic Units have been imple- mented based on the CORDIC transform. However, the software-based CORDIC algorithm presented in this 51.4 application note will provide a sufficient performance improvement for most applications. 19 These fixed-point CORDIC math routines are consider- 45°ably faster than other more traditional methods based 15° on the Taylor expansion. This makes these routines 7051.1 ideal for real-time applications requiring very fast calcu- lations. The SINCOS function, which simultaneously x = (70)cos(30°) - (19)sin(30°) = 51.12 calculates the sine and cosine values of a given angle = (19)cos(30°) + (70)sin(30°) = 51.45y using the CORDIC transform, will typically take 370 µs to compute on a PIC16F microcontroller running at 20 MHz. This is in contrast to 1.9 ms using a sin(x) function The CORDIC transform gives an iterative method for


Products & Services
Microcontrollers (MCU) are complete computer systems on a chip. They combine an arithmetic logic unit (ALU), memory, timer/counters, serial port, input/output (I/O) ports and a clock oscillator. Search by Specification | Learn more about Microcontrollers (MCU)
Specialty microprocessors and microcontrollers are specialty or proprietary products and accessories related to microprocessors and microcontrollers. Learn more about Specialty Microprocessors and Microcontrollers

Product Announcements
PTC - MATHCAD - Mathcad® Datasheet
Mathcad® - Create and Document Critical Engineering Calculations... (read more)
Acromag, Inc. - New PMC modules feature a Virtex-5 FPGA
with an embedded PowerPC core for high-performance I/O signal processing. Acromag's new PMC I/O modules provide a Virtex-5 FPGA with hard core PowerPC for fast execution of the most complex and... (read more)
ValueTronics International, Inc. - Tektronix TDS3000C Series DPO's on Sale
The Tektronix TDS3000C is a Series of Factory New 100 - 500 MHz, Digital Phosphor Oscilloscopes consisting of six different models. Why ValueTronics.......talk to knowledgeable people with real... (read more)
OceanServer Technology, Inc. - USB or Serial Low Cost Digital Compass
The OS5000-US is a small form factor (1" square) 3-Axis, tilt compensated digital compass. The flexible design allows customers to use either a USB or RS232 Serial connection for system integration. (read more)
Acromag, Inc. - New Industry Pack digital I/O module is the first
to implement a user-configurable Altera® Cyclone™ II FPGA (the most powerful low-cost FPGA available) Acromag's new Industry Pack I/O modules provide a user-configurable FPGA for... (read more)
OceanServer Technology, Inc. - OS5000-USD Digital Compass with Depth
The OS5000-USD is a small form factor 3-axis, tilt compensated digital compass which has the unique ability to report the depth in water of a device. The compass string provides the "Dnnn.n" field... (read more)
Acromag, Inc. - User-configurable Virtex®-II FPGA PMC modules
with conduction cooling and differential digital I/O New PMC I/O modules combine the ruggedness of a conduction-cooled circuit board with customizable FPGA computing while maintaining a price point... (read more)
 

Topics of Interest
AN1061 Efficient Fixed-Point Trigonometry Using CORDIC Functions For PIC16F TABLE 1: SIN(x) FUNCTION CALL Author: Jose Benavides SPECIFICATIONS WITH Microchip Technology Inc. PIC16F877A AT 20 MHZ... (Read More)
B.1 Coordinates The position of a point particle in three-dimensional Euclidean space is given by the vector r( x, y, z) in Cartesian coordinates, where x, y, and z are measured in the x ~, y ~,... (Read More)
Useful Integrals Trigonometric Relations sin( x y) = sin x cos y cos x sin y cos( x y) = cos x cos y sin x sin y 2sin x sin y = cos( x - y) - cos( x + y) 2sin x cos y = cos( x + y) +... (Read More)
In this section, we present several useful trigonometric identities used in communication system design. e j ? = cos ( ?) j sin ( ?) cos( A) = sin( A + 90 ) sin( A) = cos( A ? 90 )... (Read More)
Appendix List Appendix A: Mathematical Symbols Appendix B: A Review of Some Elementary Trigonometry Appendix C: Integrals Appendix D: The Fourier Transform: The Different Conventions... (Read More)