Hi everyone,
I'm working on f877 and want to display cos or sin value of an angle.
i could not find any examples about cos function but as i read it says that i have to input angle value between 0-255 .
That means i have to input 63 for 90 degrees.
If i calculate for 63, LCD displays Cos = 3 and Sin = 127 .
Or if i do it for 90, it displays Cos = 65460 and Sin = 102 .
I'd appreciate if anyone could help me with these commands with simple explaination.
Thansk for your helps.
MyCodes:
PORTD = 0
TRISD = 0
DEGREE VAR WORD
COSVALUE VAR WORD
SINVALUE VAR WORD
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEGREE = 63
COSVALUE = COS DEGREE
lcdout $fe,1
lcdout #COSVALUE
pause 2000
SINVALUE = SIN DEGREE
lcdout $fe,$c0
lcdout #SINVALUE
end
Bookmarks