Haberler:

Forum kuralları güncellendi LÜTFEN  okuyunuz:  https://bit.ly/2IjR3ME

Ana Menü

KESME kullanarak LCD'de sayıcı

Başlatan ferhat.bayraktar, 16 Aralık 2011, 17:13:18

ferhat.bayraktar

Merhabalar.
LCD de bir sayıcı yapmak istiyorum.
ancak LCD de gösterilecek olan degeri  kesme ile değiştirmek istiyorum.
yani ekranda 1 string deger yazacak. eger RB4-RB7 arasında bir değişiklik oldu ise
bu deger alt programda değiştirilecek.
ana programa geri donup ekrana yazdırılacak.

bunu MİCROC ile KESME olmadan yaptım.
ancak bu ana programın sadece bir kısmı oldugundan kesmelerle gerçekleştirmem şart.

yaptıgım devre  ektedir.

http://www.upload.gen.tr/d.php/www/uqzknlbz/22.DSN.html


Alıntı Yap// LCD module connections
sbit LCD_RS at RD4_bit;
sbit LCD_EN at RD5_bit;
sbit LCD_D4 at RD0_bit;
sbit LCD_D5 at RD1_bit;
sbit LCD_D6 at RD2_bit;
sbit LCD_D7 at RD3_bit;
sbit LCD_RS_Direction at TRISD4_bit;
sbit LCD_EN_Direction at TRISD5_bit;
sbit LCD_D4_Direction at TRISD0_bit;
sbit LCD_D5_Direction at TRISD1_bit;
sbit LCD_D6_Direction at TRISD2_bit;
sbit LCD_D7_Direction at TRISD3_bit;

int i=0;
char txt[10];

void main() {
portb=0xFF;


    Lcd_Init();                      // LCD display initialization
    Lcd_Cmd(_LCD_CURSOR_OFF);        // LCD command (cursor off)
    Lcd_Cmd(_LCD_CLEAR);             // LCD command (clear LCD)


    while (1)
    {            Lcd_Out(2,1,txt);
                 if(portb.f4==0)
                 {
                 i++;
                 delay_ms(200);
                 inttostr(i,txt);
                 LCD_Out(2, 10, "") ;
                 }
                 if(portb.f5==0)
                 {i--;
                 delay_ms(200);
                 inttostr(i,txt);
                 LCD_Out(2, 10, "") ;
                 }
    }
}