Positron Compiler Documentation

ISin

Positron8 · Revision 4.0.6.5 · PDF page 104

Assignment Variable = ISin(pVariable)

Deduce the integer Sine of an integer value

pVariable can be a constant, variable or expression that requires the Sine extracted. The value expected and returned by ISin is in decimal radians (0 to 255). Assignment Variable can be any valid variable type.

Device = 18F26K40             ' Select the device to compile for
Declare Xtal = 16  ' Tell the compiler the device will be operating at 16MHz
Declare Hserial_Baud = 9600   ' Set the Baud rate for HRsoutLn

Dim ByteIn as Byte        ' Holds the value to ISin
Dim ByteOut as Byte      ' Holds the result of the ISin

ByteIn = 123             ' Load the variable
ByteOut = ISin(ByteIn)   ' Extract the integer Sin of the value
HRsoutLn Dec ByteOut      ' Display the result
Stop

When implementing trigonometry, or other built in, functions within an expression, always wrap them in parenthesis, otherwise the parser may consider the extra operands as part of the trigonometry parameter and produce an incorrect result. For example:

MyAssignment = (ISin(MyVar1)) + MyVar2
View original PDF page 104Open page in PDFOriginal PDF page 104