Mikroelektronika MIKROE-738 Datenbogen
656
mikoC PRO for PIC32
MikroElektronika
Trigonometry Library
The mikroC PRO for PIC32 implements fundamental trigonometry functions. These functions are implemented as look-
up tables. Trigonometry functions are implemented in integer format in order to save memory.
Library Routines
- sinE3
- cosE3
sinE3
Prototype
int sinE3(unsigned angle_deg);
Description The function calculates sine multiplied by 1000 and rounded to the nearest integer:
result = round(sin
(angle_deg)*1000)
Parameters -
angle_deg
: input angle in degrees
Returns
The function returns the sine of input parameter multiplied by 1000.
Requires
Nothing.
Example
int res;
...
res = sinE3(45); // result is 707
Notes
Return value range:
-1000..1000.
cosE3
Prototype
int cosE3(unsigned angle_deg);
Description The function calculates cosine multiplied by 1000 and rounded to the nearest integer:
result = round(cos
(angle_deg)*1000)
Parameters -
angle_deg
: input angle in degrees
Returns
The function returns the cosine of input parameter multiplied by 1000.
Requires
Nothing.
Example
int res;
...
res = cosE3(196); // result is -193
Notes
Return value range:
-1000..1000.