+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Member level 1
    Points: 1,087, Level: 7

    Join Date
    Jan 2013
    Posts
    35
    Helped
    1 / 1
    Points
    1,087
    Level
    7

    HD44780-based Character-LCD display PIC code

    Hi everyone
    i'm trying to use HD44780-based Character-LCD(4line20character) . I found some material from some forums but couldn't make it.

    If you check my software steps i appreciate it:

    1st: I designate port configurations

    Code:
    	#define		RS			PORTA,0
    	#define		RW			PORTA,1
    	#define		E			PORTA,2
    	#define		LCD_DATA	PORTB
    	#define		LCD_CTRL	PORTA
    Code:
    movlw	b'00000111'
    	banksel	ADCON1
    	movwf	ADCON1
    	banksel	TRISA
    	clrf	TRISA		;RA0->RS
    						;RA1->R/W
    						;RA2->E
    	banksel	TRISB
    	clrf	TRISB
    
    	banksel	LCD_CTRL
    	clrf	LCD_CTRL	;
    2nd:I make function set(8 bit interface and 2line(although my LCD is 4 line)
    Code:
    movlw		0X38
    	banksel		LCD_DATA
    	movwf		LCD_DATA
    	banksel		LCD_CTRL
    	bcf			RW
    	bsf			RS
    	bsf			E
    	bcf			E
    	call		delay_100u ; delay for 100us
    3rd:I make -display off,clear display, entry mode set, display on- in sequence
    Code:
    movlw		b'00001011'			;disp off
    	call		send_cmd
    	movlw		b'00000001'			;clear disp
    	call		send_cmd
    	movlw		b'00000111'			;entry inc
    	call		send_cmd
    	movlw		b'00001111'			;disp on
    Code:
    send_cmd:
    	banksel		temp
    	movwf		temp
    	call		busy_check
    	banksel		temp
    	movf		temp,w
    	banksel		LCD_DATA
    	movwf		LCD_DATA		
    	banksel		LCD_CTRL
    	bcf			RW
    	bcf			RS
    	bsf			E
    	bcf			E
    	call		delay_100u	
    return
    Code:
    busy_check:
    	banksel		TRISB
    	movlw		b'11111111'
    	movwf		TRISB
    	banksel		LCD_CTRL
    	bcf			RS
    	bsf			RW
    	bsf			E
    	bcf			E
    	banksel		LCD_DATA
    	movf		LCD_DATA,w
    	banksel		temp_busy
    	movwf		temp_busy
    	btfsc		temp_busy,7
    	goto		busy_check
    	banksel		LCD_CTRL
    	bcf			RW
    	banksel		TRISB
    	clrf		TRISB
    return
    4th:send character-L- to LCD

    Code:
    	movlw		b'01001100'
    	call		        send_lcd
    Code:
    send_lcd:
    	banksel		temp
    	movwf		temp
    	call		busy_check
    	banksel		temp
    	movf		temp,w
    	banksel		LCD_DATA
    	movwf		LCD_DATA
    	banksel		LCD_CTRL
    	bcf			RW
    	bsf			RS
    	bsf			E
    	bcf			E
    	call		delay_100u	
    return
    But it didn't work.

    •   AltAdvertisement

        
       

  2. #2
    Member level 2
    Points: 1,420, Level: 8
    MarkoSiroki's Avatar
    Join Date
    Feb 2013
    Location
    Ljubljana
    Posts
    47
    Helped
    4 / 4
    Points
    1,420
    Level
    8

    Re: HD44780-based Character-LCD display PIC code

    Read attached pdf carefuly! I had same problems but then I read these two documents and it worked for me!
    ... there is no home like 127.0.0.1 ...


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  3. #3
    Member level 4
    Points: 1,797, Level: 9
    Achievements:
    7 years registered
    peeyushsigma's Avatar
    Join Date
    Apr 2012
    Location
    Bengaluru, Karnataka, India
    Posts
    76
    Helped
    19 / 19
    Points
    1,797
    Level
    9

    Re: HD44780-based Character-LCD display PIC code



    1 members found this post helpful.

--[[ ]]--