AmmarAkhlaq
Junior Member level 1
- Joined
- Dec 12, 2013
- Messages
- 17
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 162
can any one teach me how to use tangent inverse function in Mikro C. And displaying it result on leds.
THis is what iam doing but no result.
THis is what iam doing but no result.
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 double X,Y,Zi,thetaa1; int thetaa; void SysInit(); double atan2(double y, double x); void main(){ X=2; Y=5; SysInit(); while(1) { thetaa1= atan2(Y,X); thetaa = (int)(thetaa1*57.295); PORTB=thetaa; } } void SysInit() { ADCON1=0x06; // disable ADC and make all the pins of Port A as digital input TRISA=0xFF; PORTA=0x00; TRISB=0x00; PORTB=0x00; TRISD=0x00; PORTD=0x00; TRISE=0x00; PORTE=0x00; TRISC.B6=0; TRISC.B7=0; TRISC.B4=1; // SDI input TRISC.B3=1; // SCK input from master TRISC.B5=0; // SDO output SSPSTAT.SMP=0; // input data sampled at middle SSPSTAT.CKE=0; // transition from idle to active //SPI1_Init_Advanced(_SPI_SLAVE_SS_ENABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH); }
Last edited: