Datasheet
Programming PIC Microcontrollers in BASIC - mikroElektronika
BASIC provides a trigonometry library for applications which involve angle calculations. Trigonometric routines take an angle (in
degrees) as parameter of type word and return sine and cosine multiplied by 1000 and rounded up (as integer).
5.2.22.1 SinE3 – Returns sine of angle
Prototype sub function sinE3(dim Angle as word) as integer
Description Function takes a word-type number which represents angle in degrees and returns the sine of <Angle> as
integer, multiplied by 1000 (1E3) and rounded up to nearest integer: result = round_up(sin(Angle)
*1000). Thus, the range of the return values for these functions is from -1000 to 1000.
Note that parameter <Angle> cannot be negative. Function is implemented as lookup table, and the maximum
error obtained is ±1.
Example
dim angle as word
dim result as integer
angle = 45
result = sinE3(angle) ' result is 707
5.2.22.2 CosE3 – Returns cosine of angle
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/05.htm (110 sur 112)05/11/2004 02:20:55