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.

16x2 LCD Interrupt MikroC PIC16F877A

Status
Not open for further replies.

asking

Full Member level 5
Joined
Sep 21, 2010
Messages
279
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Activity points
3,377
Hello again,

I have temperature sensor LM35 attached and i m measuring the temperature on the Display, Now if the Temp reaches pre-defined set point. Now if i want to clear the current temperature reading from LCD and i want to show some different message like Temperate Exceeded how to do it ? How to call interrupt in LCD ?

how to show some other format message for lcd_out ?





Code:
a = t%10;
    lcd[2] = a + '0';

    t = t/10;
    a = t%10;
    lcd[1] = a + '0';

    t = t/10;
    a = t%10;
    lcd[0] = a + '0';

    Lcd_out(1,12,lcd);
    customchar(1,15);
    Lcd_out(1,16,"C");
 

You need to clear the LCD with Lcd_Cmd(_LCD_CLEAR),
after clear LCD contents you may print out new value or text...
regards
 
Last edited:

actually if i use any command like Lcd_Cmd(_LCD_CLEAR), my whole display starts blinking @ Delay_ms(250) i think is is due to using if condition inside Do While loop ? please be advised..
 

You have to call clear lcd only once and after you display adc value then don't call lcd clear. Use below code.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
unsigned char doOnce = 0;
 
void main() {
 
 
    while(1) {
 
        //when you want to display adc value first time
 
        if(doOnce == 0) {
 
            Lcd_Cmd(_LCD_CLEAR);
            doOnce = 1;
        }
 
        //If you want to clear LCD again at any time then just make doOnce = 0 in that              //function.
    }
 
 
}

 


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
54
55
56
57
58
59
60
61
62
63
64
ADCON1 = 0x00;
       v = ADC_Read(2);
       i = ADC_Read(3);
       i = (i*4.89)/0.5;
       v = ((v*4.89)/20)*121;
       t = ADC_Read(1);
       
        if (t > 250 ) {               // (48 Degree C = 100 so 97-98 = 200 )
      led = 1;
       }
     else {
      led = 0;}
 
       if(v!=vp || i!=ip )
       Lcd_Cmd(_LCD_FIRST_ROW);
       vp = v;
       ip = i;
       volt1=v/100;
       current1=i/10;
       kp=volt1*current1;
       volt[0] = look(v/10000);
       volt[1] = look((v/1000)%10);
       volt[3] = look((v/100)%10);
       Lcd_Out(1,1,"V = ");
       Lcd_Out(1,5,volt);
       Lcd_Out(1,9,"V");
       t = t * 0.4887;
 
    a = t%10;
    lcd[2] = a + '0';
 
    t = t/10;
    a = t%10;
    lcd[1] = a + '0';
 
    t = t/10;
    a = t%10;
    lcd[0] = a + '0';
 
    Lcd_out(1,12,lcd);
    customchar(1,15);
    Lcd_out(1,16,"C");
    
 
    
       current[0] = look(i/1000);
       current[2] = look((i/100)%10);
       current[3] = look((i/10)%10);
       Lcd_Out(2,1,"A = ");
       Lcd_Out(2,5,current);
       Lcd_Out(2,9,"A");
 
       PWR[0]=look((kp/10000));
       PWR[1]=look((kp/1000)%10);
 
       PWR[3]=look((kp/100)%10);
       PWR[4]=look((kp/10)%10);
 
       Lcd_Out(2,11,PWR);
       Lcd_Out(2,16,"W");
       Delay_ms(250);
 
  } while(1);
}




The Code given above is my Digital Voltmeter code. Now i wish to put some condition when LED = 1, means LED is on...display should clear all the current values from the screen and it should show.. "Over Temperature" on the LCD 16x2.

so please show me the code where to place...it...i tried your code but did not helped me...i checked in proteus its blinking lcd @ some delay...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top