CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

SIN() example

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
acid
Guest







SIN() example
PostPosted: Mon Jun 09, 2003 9:09 am     Reply with quote

Hello
Can Somebody tell me what is the "set_analog_voltage"?

This is an CCS's examples for SIN() :
Examples:
float phase;

// Output one sine wave

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

set_analog_voltage( sin(phase)+1 );

Thank in advance
Albert
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515113
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: SIN() example
PostPosted: Mon Jun 09, 2003 12:48 pm     Reply with quote

:=Hello
:=Can Somebody tell me what is the "set_analog_voltage"?
:=
:=This is an CCS's examples for SIN() :
---------------------------------------------

What version of the compiler do you have ?
I looked in EX_SINE.C, and it doesn't have that code in it.
In fact, I can't find that code in any of the CCS example files.
I checked PCM versions 3.148 and 3.160.

___________________________
This message was ported from CCS's old forum
Original Post ID: 144515121
acid
Guest







Re: SIN() example
PostPosted: Tue Jun 10, 2003 12:46 am     Reply with quote

:=:=Hello
:=:=Can Somebody tell me what is the "set_analog_voltage"?
:=:=
:=:=This is an CCS's examples for SIN() :
:=---------------------------------------------
:=
:=What version of the compiler do you have ?
:=I looked in EX_SINE.C, and it doesn't have that code in it.
:=In fact, I can't find that code in any of the CCS example files.
:=I checked PCM versions 3.148 and 3.160.
:=

Hello,
I posted the help's page for sin(). My compiler is the 3.148 version and 3.126 IDE
Thanks

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()



___________________________
This message was ported from CCS's old forum
Original Post ID: 144515133
R.J.Hamlett
Guest







Re: SIN() example
PostPosted: Tue Jun 10, 2003 2:00 am     Reply with quote

:=:=:=Hello
:=:=:=Can Somebody tell me what is the "set_analog_voltage"?
:=:=:=
:=:=:=This is an CCS's examples for SIN() :
:=:=---------------------------------------------
:=:=
:=:=What version of the compiler do you have ?
:=:=I looked in EX_SINE.C, and it doesn't have that code in it.
:=:=In fact, I can't find that code in any of the CCS example files.
:=:=I checked PCM versions 3.148 and 3.160.
:=:=
:=
:=Hello,
:=I posted the help's page for sin(). My compiler is the 3.148 version and 3.126 IDE
:=Thanks
:=
:=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()
OK. This is a classic 'example'. It is just showing you a typical 'use' of the code. As such the other function (set_analog_voltage), doesn't exist in the compiler, but is (by it's name), meant to give you an idea of how to use the trig function.
What is being shown, is that if you wanted to output a sine wave, on a D-A converter, you would call the sin function, and send it's result to the D-A converter's 'output' function. Hence 'set_analog_voltage', is just meant to be a routine to set a D-A output value to the number given as an argument. This is a fairly common 'illustration' trick, where (for instance), if you wanted to show how to double an input voltage, you could give code like:

set_output_voltage(read_input_voltage() * 2);

It is 'meaningless' code in it's own right, but the idea is that readers should be able to understand the logic, for the function names.
So there is no 'set_analog_voltage' function, it is being used as an illustration.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515135
acid
Guest







Re: SIN() example..Thank
PostPosted: Tue Jun 10, 2003 2:56 am     Reply with quote

:=:=:=:=Hello
:=:=:=:=Can Somebody tell me what is the "set_analog_voltage"?
:=:=:=:=
:=:=:=:=This is an CCS's examples for SIN() :
:=:=:=---------------------------------------------
:=:=:=
:=:=:=What version of the compiler do you have ?
:=:=:=I looked in EX_SINE.C, and it doesn't have that code in it.
:=:=:=In fact, I can't find that code in any of the CCS example files.
:=:=:=I checked PCM versions 3.148 and 3.160.
:=:=:=
:=:=
:=:=Hello,
:=:=I posted the help's page for sin(). My compiler is the 3.148 version and 3.126 IDE
:=:=Thanks
:=:=
:=:=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()
:=OK. This is a classic 'example'. It is just showing you a typical 'use' of the code. As such the other function (set_analog_voltage), doesn't exist in the compiler, but is (by it's name), meant to give you an idea of how to use the trig function.
:=What is being shown, is that if you wanted to output a sine wave, on a D-A converter, you would call the sin function, and send it's result to the D-A converter's 'output' function. Hence 'set_analog_voltage', is just meant to be a routine to set a D-A output value to the number given as an argument. This is a fairly common 'illustration' trick, where (for instance), if you wanted to show how to double an input voltage, you could give code like:
:=
:=set_output_voltage(read_input_voltage() * 2);
:=
:=It is 'meaningless' code in it's own right, but the idea is that readers should be able to understand the logic, for the function names.
:=So there is no 'set_analog_voltage' function, it is being used as an illustration.
:=
:=Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515138
acid
Guest







Re: SIN() example..Thank
PostPosted: Tue Jun 10, 2003 2:57 am     Reply with quote

:=:=:=:=Hello
:=:=:=:=Can Somebody tell me what is the "set_analog_voltage"?
:=:=:=:=
:=:=:=:=This is an CCS's examples for SIN() :
:=:=:=---------------------------------------------
:=:=:=
:=:=:=What version of the compiler do you have ?
:=:=:=I looked in EX_SINE.C, and it doesn't have that code in it.
:=:=:=In fact, I can't find that code in any of the CCS example files.
:=:=:=I checked PCM versions 3.148 and 3.160.
:=:=:=
:=:=
:=:=Hello,
:=:=I posted the help's page for sin(). My compiler is the 3.148 version and 3.126 IDE
:=:=Thanks
.............
:=OK. This is a classic 'example'. It is just showing you a typical 'use' of the code. As such the other function (set_analog_voltage), doesn't exist in the compiler, but is (by it's name), meant to give you an idea of how to use the trig function.
:=What is being shown, is that if you wanted to output a sine wave, on a D-A converter, you would call the sin function, and send it's result to the D-A converter's 'output' function. Hence 'set_analog_voltage', is just meant to be a routine to set a D-A output value to the number given as an argument. This is a fairly common 'illustration' trick, where (for instance), if you wanted to show how to double an input voltage, you could give code like:
:=
:=set_output_voltage(read_input_voltage() * 2);
:=
:=It is 'meaningless' code in it's own right, but the idea is that readers should be able to understand the logic, for the function names.
:=So there is no 'set_analog_voltage' function, it is being used as an illustration.
:=
:=Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515139
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group