Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

advace for the 16F877

Status
Not open for further replies.

MARWEN007

Junior Member level 2
Joined
Apr 16, 2011
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,481
advIce for the 16F877

Good evening I want to know is what the pic 16F877 we allow applications to multiplication and division as geometric functions, for example (fct sines and cosines )????
 

excuse me well I'm still newbie to praogrammations peak in our case of the 16F877. good question I ask myself the 16F877 I can do simple multiplication and division for example if I have a constant in my program and I will multiply or divs each variable with that i can c? otherwise I will determine a phase shift FI and I calculated the cosine FI? The 16F877 may atteidre these calculations?
 

if all you require is simple mathematical functions the C library in <math.h> should work with the PIC16 Hi-Tech compiler
cmath (math.h) - C++ Reference
**broken link removed**

it has sine and cosine
sin - C++ Reference
cos - C++ Reference

I thought from your original post you were looking for systems to support the Fourier Cosine Transform (FCT) for which I would use dsPICs or better
 
You can use CCSC has built in Funtions


PHP:
SIN( )
COS( )
TAN( )
ASIN( )
ACOS()
ATAN()
SINH()
COSH()
TANH()
ATAN2()

--------------------------------------------------------------------------------

 

Syntax:
 val = sin (rad)

val = cos (rad)

val = tan (rad)

rad = asin (val)

rad1 = acos (val)

rad = atan (val)

rad2=atan2(val, val)

result=sinh(value)

result=cosh(value)

result=tanh(value)

 
 
Parameters:
 rad is a float representing an angle in Radians -2pi to 2pi.  val is a float with the range -1.0 to 1.0.  Value is a float.

 
 
Returns:
 rad is a float representing an angle in Radians -pi/2 to pi/2

 

val is a float with the range -1.0 to 1.0. 

 

rad1 is a float representing an angle in Radians 0 to pi 

 

rad2 is a float representing an angle in Radians -pi to pi

Result is a float

 
 
Function:
 These functions perform basic Trigonometric functions.

sin
 returns the sine value of the parameter (measured in radians)
 
cos
 returns the cosine value of the parameter (measured in radians)
 
tan
 returns the tangent value of the parameter (measured in radians)
 
asin
 returns the arc sine value in the range [-pi/2,+pi/2] radians
 
acos
 returns the arc cosine value in the range[0,pi] radians
 
atan
 returns the arc tangent value in the range [-pi/2,+pi/2] radians
 
atan2
 returns the arc tangent of y/x in the range [-pi,+pi] radians
 
sinh
 returns the hyperbolic sine of x
 
cosh
 returns the hyperbolic cosine of x
 
tanh
 returns the hyperbolic tangent of x
 

 

Note on error handling:

If "errno.h" is included then the domain and range errors are stored in the errno variable. The user can check the errno to see if an error has occurred and print the error using the perror function.

 

Domain error occurs in the following cases:

asin: when the argument not in the range[-1,+1]

acos: when the argument not in the range[-1,+1]

atan2: when both arguments are zero

 

Range error occur in the following cases:

cosh: when the argument is too large

sinh: when the argument is too large

 
 
Availability:
 All devices

 
 
Requires:
 math.h must be included.

 
 
Examples:
 float phase;

// Output one sine wave

for(phase=0; phase<2*3.141596; phase+=0.01)

   set_analog_voltage( sin(phase)+1 );

 
 
Example Files:
 ex_tank.c

 
 
Also See: 
 log(), log10(), exp(), pow(), sqrt()
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top