ecaits
Member level 4
- Joined
- Jan 16, 2014
- Messages
- 76
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Activity points
- 579
Dear All,
I am facing problem in below code. Please refer below.
In above code, I am getting output of ADC say 193 in f and same in variable a.
Now I want to devide a by 6.82 to reduce the range from 0-1023 t0 0.00 to 150.00 to display on LCD. But I am not getting the output as per my expectation. What may the problem or how can i divide the variable a by 6.82???
This is part of the whole program code. I am working on PIC16F877 using Hitech C Compiler.
I am facing problem in below code. Please refer below.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 void main() { int data[4]; unsigned int b,c,d,z=0,e,i,f,a,x,p=0,g,h,j,k,l,o,q; unsigned int v; float t=0; long long m,n; PORTD=0x00; PORTC=0x00; PORTB=0x00; TRISD = 0x00; TRISB = 0x00; TRISC = 0x00; ADC_Init(); f = ADC_Read(0); a = f; t=a/6.82;
In above code, I am getting output of ADC say 193 in f and same in variable a.
Now I want to devide a by 6.82 to reduce the range from 0-1023 t0 0.00 to 150.00 to display on LCD. But I am not getting the output as per my expectation. What may the problem or how can i divide the variable a by 6.82???
This is part of the whole program code. I am working on PIC16F877 using Hitech C Compiler.
Last edited by a moderator: