shaltera
Newbie level 5
- Joined
- Mar 26, 2014
- Messages
- 8
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 52
Hi,
I'm having difficulties to integrate external ADC0808 with PIC18F45k22. ACD0808 outputs are connected to PIC18F45K22 respectively:
To IN0, LM35 is connected (VOUT)
I have tried C code below, but result is incorrect.As well temperature result on LCD does not update when voltage on LM35 is changes.
---------------------------------------------------------
---------------------------------------------------------------------------------------
I'm having difficulties to integrate external ADC0808 with PIC18F45k22. ACD0808 outputs are connected to PIC18F45K22 respectively:
ADC PIC
-------------------
OUT1 RB7
OUT2 RB6
OUT3 RB5
0UT4 RB4
OUT5 RB3
OUT6 RB2
OUT7 RB1
OUT8 RB0
To IN0, LM35 is connected (VOUT)
I have tried C code below, but result is incorrect.As well temperature result on LCD does not update when voltage on LM35 is changes.
---------------------------------------------------------
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 unsigned int temp_res,cal; char last[5]; void main() { TRISb = 0b11111111; // PORTB is input lcd_init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); do { temp_res = portb; // Get 8-bit results of AD conversion cal = (temp_res); inttostr(cal,last); Lcd_Out(1,1,”temp”); Lcd_Out(1,6,last); Lcd_Out(1,13,”C”); Lcd_Out(1,15,” “); } while(1); }
---------------------------------------------------------------------------------------
Last edited by a moderator: