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.

lcd display to answer of sin(36.4)....?

Status
Not open for further replies.

elmayadunna

Banned
Joined
Oct 14, 2013
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
0
how can we get lcd display answer of sin(36.4)?plz help me.....

i want to display sin(36.4),cos(42.6) using mikroc.plz help me code to this.
 

If you want to disply numbers like 34.6 then you need to convert it to string using


Code C - [expand]
1
2
3
4
5
6
float floatval = 0.0;
unsigned char myString[23];
 
floatval = 36.456546;
FloatToStr(floatval, myString);
LCD_Out(1,1,myString);



function. If you want to plot the graph of the values then you need GLCD.
 

If you want to disply numbers like 34.6 then you need to convert it to string using


Code C - [expand]
1
2
3
4
5
6
float floatval = 0.0;
unsigned char myString[23];
 
floatval = 36.456546;
FloatToStr(floatval, myString);
LCD_Out(1,1,myString);



function. If you want to plot the graph of the values then you need GLCD.

i want to disply value of sin(34.6).how can i do this?plz help me.
 

See LCD example code in Compiler folder. Modify it and add


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
float fSin = 0.0;
unsigned char sSin[23];
 
void main(){
 
 
 
    while(1){
 
        fSin = sin(34.6);
        FloatToStr(fSin, sSin);
        LCD_Out(1,1,sSin);
 
    } 
}

 

See LCD example code in Compiler folder. Modify it and add


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
float fSin = 0.0;
unsigned char sSin[23];
 
void main(){
 
 
 
    while(1){
 
        fSin = sin(34.6);
        FloatToStr(fSin, sSin);
        LCD_Out(1,1,sSin);
 
    } 
}




thank you for ur kind attention.now i want to find the answer for d.

d=sin(u)*sin(v)/((sin(v)*cos(u))+(sin(u)*cos(v)));

in here u & v value maybe point value.like u & v =34.6,76.8,32.7.......

i want to code above equation using mikroc.plz help me.
 

What you have written itself is the code.

plz tell me how can write it?i haven't no any idea how to write above equation?


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
unsigned int motor1 = 300;
unsigned int motor2 = 300;
// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
 
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
float fSin = 0.0;
float fcos =0.0;
float fd =0.0;
float fu=0.0;
float fv=0.0;
unsigned char sSin[23];
unsigned char scos[23];
unsigned char sd[23];
 
 
void main() {
 
  TRISB = 0;
  Lcd_Init();
  Lcd_Cmd(_LCD_CLEAR);
  Lcd_Cmd(_LCD_CURSOR_OFF);
 
 
 
 while(1){
         fu = motor1 * 0.1;
         fv = motor2 * 0.1;
        fd =sin(u)*sin(v)/((sin(v)*cos(u))+(sin(u)*cos(v)));
        FloatToStr(fd, sd);
        LCD_Out(1,1,sd);
 
    }
}

 
Last edited by a moderator:

as per jayanth mentioned try your long equation to sort form calculate sin , cos in form of u ,v and put that value in your real equation and get desired value . and also make sure that venkadesh mentioned in your function u,v is not declared
so first make your program and if any error in output then post your code..
 


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
 
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
 
#define MOTOR 30;
 
float fSinU = 0.0;
float fCosU = 0.0;
float fSinV = 0.0;
float fCosV = 0.0;
float fd = 0.0;
float fu = MOTOR;
float fv = MOTOR;
 
unsigned char sLCD[23];
 
void main() {
 
  TRISB = 0x00;
  
  Lcd_Init();
  Lcd_Cmd(_LCD_CLEAR);
  Lcd_Cmd(_LCD_CURSOR_OFF);
 
  fSinU = sin(fu);
  fCosU = cos(fu);
  fSinV = sin(fv);
  fCosV = cos(fv);
  fd = (fSinU * fSinV) / ((fSinV * fCosV) + (fSinU * fCosV));
  FloatToStr(fd, sLCD);
  LCD_Out(1,1, sLCD);
        
  while(1);
  
}

 
Last edited:

this mikroc code helpful we also.but there is a error.

float fu = motor;
float fv=motor;
 

motor = put your value like 36.4 so motor is constant in this code.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top