Our Sites: GlobalSpec.com | GlobalSpec Electronics | CR4

Efficient Fixed-Point Trigonometry Using CORDIC Functions for PIC16F


Print

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
Math calculation software is used to perform mathematical calculations. These programs provide general core calculations as well as graphical analysis that can be used in science, engineering and technology. Learn more about Math Calculation Software | Math Calculation Software Insights
Graphics software is used to produce video graphics and to edit and convert graphic files of different formats. These types of software include raster graphics, vector graphics, raster to vector conversion (R2V), and others. Learn more about Graphics Software
Vector network analyzers (VNA) measure the complex transmission and reflection characteristics of two-port devices in the frequency domain. Search by Specification | Learn more about Vector Network Analyzers
Programmable logic devices (PLD) are designed with configurable logic and flip-flops linked together with programmable interconnect. PLDs provide specific functions, including device-to-device interfacing, data communication, signal processing, data display, timing and control operations, and almost every other function a system must perform. Search by Specification | Learn more about Programmable Logic Devices (PLD)
Electrical power generators, also known as alternators, transform mechanical energy into electrical energy.  They can be used for backup or emergency power or as an alternator on board a vehicle. Generators can produce either AC or DC power and are typically powered by a fuel engine. Search by Specification | Learn more about Electrical Power Generators | Electrical Power Generators Insights

Product Announcements
MICROMO - LM 2070 Linear DC Motor
FAULHABER expands its family of linear DC servomotors with the addition of a larger more powerful drive. The new LM 2070 measures 20 x 28 x 70 mm and weighs just 236 g. It provides a peak force of up... (read more)
Everight Position Technologies Corporation - Netzer Rotary Encoders
Netzer Rotary Encoders Our rotary Electric Encoders are tolerant to temperature extremes, EMI, RFI, magnetic fields, contamination, moisture, shock and vibrations. Their hollow, floating, rotor... (read more)
Microchip Technology, Inc. - Peripheral-rich, low pinc ount PIC12F & PIC16F
Peripheral-Rich Devices Are Highest-Memory PIC® MCUs in 8- and 18-pin Packages; Include eXtreme Low Power Technology and mTouch™ Capacitive Touch Sensing... (read more)
IC Flow Controls, Inc. - Innovative Helical Screw Flow Meter
In addition to the well-known VSE model series VSI and VHM as well as ECOFLOW, the company VSE Volumentechnik GmbH now launches a new generation of helical screw flow meters of the series RS. (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)
 

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...
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 ~,...
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) +...
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 )...
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...
Product Announcements