Şimdi Ara

lcd sürme...acil!

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
1 Misafir - 1 Masaüstü
5 sn
12
Cevap
0
Favori
431
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Merhaba Arkadaşlar,
    lcd için yazdığım aşağıdaki kodları çalıştıramadım. yardımcı olabilirseniz sevinirim.




    void lcd_reset(void)
    {
    delay_ms(0x10);
    portb=0x38;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1

    delay_ms(0x05);
    portb=0x38;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1

    delay_100us(0x01);
    asm nop
    asm nop
    asm nop
    asm nop
    portb=0x38;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop

    asm bcf _portc,1

    asm nop
    asm nop
    portb=0x38;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1


    asm nop
    asm nop
    asm nop
    portb=0x08;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1


    asm nop
    asm nop
    asm nop
    portb=0x01;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1


    asm nop
    asm nop
    portb=0x06;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1
    }


    //B harfi yaz:

    msg=0x0B;
    //lcdwrite();
    portb=msg;
    //portc=0x01; //rs=1, rw=0,
    asm bsf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1







  • C derleyicisi kullanıyorsun anladığım kadarıyla, lcd.h veya benzeri bir dosyayı include veya examples klasörünün içinde bulacaksın eğer eklersen yardımcı olabiliriz...
  • lcd.c dosyası aşağıdaki gibi:


    #include <system.h>
    #pragma CLOCK_FREQ 4000000
    #pragma DATA _CONFIG, _CP_OFF & _WRT_ENABLE_ON & _XT_OSC & _WDT_OFF & _PWRTE_ON &_BODEN_OFF & _LVP_OFF & _CPD_OFF & _DEBUG_OFF
    //VARIABLES:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    char ref,speed,msg;
    char lcdtemp,tableindex,delay,count,xdelay;
    //FUNCTIONS LIST: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    void pic_init(void);
    void interrupt(void);
    void lcd_reset(void);
    //INTERRUPT VECTOR:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    void interrupt(void)
    {

    //Handle timer0 interrupt
    if( intcon & (1<<T0IF) )
    {
    //porte=porte^(0x01); //toggle ledA
    //tmr0=0x64; //set timer offset value to 100
    clear_bit( intcon, T0IF ); //clear timer 0 interrupt bit
    }

    //Handle timer1 interrupt
    if( pir1 & (1<<TMR1IF) )
    {
    clear_bit( pir1, TMR1IF ); //clear timer 1 interrupt bit
    }

    //Handle timer2 interrupt
    if( pir1 & (1<<TMR2IF) )
    {
    clear_bit( pir1, TMR2IF ); //clear timer 2 interrupt bit
    }

    }
    //PIC INITIALIZATION~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    void pic_init(void)
    {
    char i,j;

    asm
    {
    movlw 0x00 ; all port pins = low
    movwf _porta
    movwf _portb
    movwf _portc
    movwf _portd
    movwf _porte

    ;//movlw 0x07 ;p_up
    ;//movwf ADCON0 ; a/d on RA0 selected currently

    ;// INITIALISE PORTS
    movlw 0xFF ;//only A0 is used as temperature sensor input
    movwf _trisa ;bank 1

    ;//digital input shift registers are connected to portb
    movlw 0x00
    movwf _trisb

    ;//digital output shift registers are connected to portc
    movlw 0x00
    movwf _trisc

    ;//lcd data pins are connected to portd
    movlw 0x00
    movwf _trisd

    ;//warning leds are connected to porte
    //movlw 0x00
    //movwf _trise

    movlw 0x01 ;//00000101 ise calisiyor
    movwf _adcon0 ;bank 1
    movlw 0x01;
    movwf _adcon1 ;bank 1

    movlw 0x87 ;high to low, 1:256
    movwf _option_reg ;bank 1

    //movlw 0x04
    //movwf _t1con
    }
    intcon = intcon & 0xEF; // GLOBAL INTERRUPTS OFF
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    void lcd_reset(void)
    {
    delay_ms(0x10);
    portb=0x38;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1

    delay_ms(0x05);
    portb=0x38;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1

    delay_100us(0x01);
    asm nop
    asm nop
    asm nop
    asm nop
    portb=0x38;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop

    asm bcf _portc,1

    asm nop
    asm nop
    portb=0x38;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1


    asm nop
    asm nop
    asm nop
    portb=0x08;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1


    asm nop
    asm nop
    asm nop
    portb=0x01;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1


    asm nop
    asm nop
    portb=0x06;
    asm nop
    asm bcf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //MAIN FUNCTION:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    void main()
    {
    //char temp;
    pic_init();
    //option_reg = 3; // set prescaler to 1:16
    //tmr0=0x64; //timer offset value is 100
    //set_bit(intcon,GIE); // enable interrupts
    //set_bit(intcon,T0IE); // enable TMR0 overflow bit
    //portb=0xAA; //test icin
    lcd_reset();
    msg=0x0B;
    //lcdwrite();
    portb=msg;
    //portc=0x01; //rs=1, rw=0,
    asm bsf _portc,3
    asm nop
    asm bsf _portc,1
    asm nop
    asm bcf _portc,1

    while(1)
    {

    clear_wdt(); //clear watch dog timer
    }
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




  • lcd.h dosyası lazım...
  • HEX DOSYASIMI???
  • lcd.h
    derleyicinin kurulduğu klasörde örnekler adında alt klasör vardır orada bulabilirsin...
  • bi bakıyım...
  • Yapay Zeka’dan İlgili Konular
    Daha Fazla Göster
  • bu arada sourceboost kullanıyorum. lcd_drive.h dosyasını buldum. bunu include etsem olacak mı?
  • evet dosyayı c dosyasına ekleyeceksiniz. lcd sürme için gerekli fonksiyonlar lcd_drive.h dosyası içinde tanımlı.
    Hi-Tech PIC C nin de ücretsiz derleyicileri mevcut örnekleriyle birliktede kuruluyor isterseniz bahsi geçen derleyiciyi kurun bir kaç örnek ekleyeyim...
  • c2c ve sourceboost var. bir örnek koyarsanız çok sevinirim. çok acil ihtiyacim var.

    teşekkürler...
  • program paylaşımlarının forumda yasak olmasından dolayı, Hi-Tech PIC C derleyicisi download adresini PM olarak gönderdim ayrıca dosya içinde bir de lcd örneği bulunmakta.
    kolay gelsin...
  • ilginiz için çok teşekkür ederim. şimdi dosyaları indiriyorum. inceledikten sonra durumdan haberdar ederim.
  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.