i don't andestand the result at this :
on my windows calculator the result is
cos(31) = 0.8571
sin(31) = 0.5150
with SF
cos(31) = 0.9147
sin(31) = -0.4040
Code: Select all
Device = 18F452
Clock = 20
#option GLCD_SCREEN_WIDTH = 128 // Screen Width in Pixels
#option GLCD_SCREEN_HEIGHT = 64 // Screen Height in Pixels
#option GLCD_CS_COUNT = 2 // Count of CS Lines. Must be 2 or 3
// default module options - user options can override these values...
#option GLCD_DATA = PORTD // data port
#option GLCD_RS = PORTB.2 // RS pin
#option GLCD_EN = PORTB.4 // EN pin
#option GLCD_RW = PORTB.3 // RW pin
#option GLCD_CS1 = PORTB.1 // chip select
#option GLCD_CS2 = PORTB.0 // chip select
#option GLCD_ASPECT_RATIO = 75 // aspect ratio, smaller number will squeeze y for GLCD circles and box
#option GLCD_INIT_DELAY = 100 // initialisation delay (ms)
#option GLCD_INVERT_CS = true // invert CS lines...
#option GLCD_RST = PORTB.5
Include "GLCD.bas"
Include "FixedFont.bas"
Include "ADC.bas"
Include "convert.bas"
Include "math"
////////////////////////////
Dim ADVal, result As Word
Dim angle, X, Y, puissance As Float
Dim text, X_text, Y_text As String
////////////////////////////
puissance = 31
////////////////////////////
GLCD.Cls
X = cos(puissance)
Y = sin(puissance)
DelayMS(1000)
text = floattostr(puissance)
X_text = floattostr(X,5)
Y_text = floattostr(Y,5)
GLCD.SetFont(Fixed)
GLCD.WriteAt (80,15, text)
GLCD.WriteAt (80,25, X_text)
GLCD.WriteAt (80,35, Y_text)