priyanka pew
Newbie level 4
- Joined
- Sep 16, 2014
- Messages
- 5
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 40
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 48 49 50 51 52 53 //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 char display[16]; void Move_delay() { delay_ms(500); } void main() { unsigned int result; int volt,temp; trisb=0; portb=0; trisc.f3=0; portc.f3=0; trisa=0b11111111; adcon1=0b10000000; lcd_init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); while(1) { result=ADC_READ(1); volt=result*4.88; temp=volt/10; Lcd_out(1,1,"temp="); inttostr(temp,display); Lcd_out(1,6,display); Lcd_out_cp("c"); if(temp>=32) { portc.f3=0; } else if(temp<32) { portc.f3=1; } } }
Last edited by a moderator: