PIC18f87J90 with graphical lcd

Discussion in 'Embedded Systems and Microcontrollers' started by RG23, Nov 18, 2011.

  1. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    LCDSIG_0:////////////////////////subroutine to display blank data for 105 columns
    movlw d'105'
    movwf count341
    movlw 0x00 ; column address
    movwf byte_pos

    movlw 0x00
    movwf PORTD
    call SND_CMD
    movlw 0xB8 ; page address
    movwf PORTD; (40h to 80h)
    CALL SND_CMD
    movlw 0xC0 ; line address
    movwf PORTD; (40h to 80h)
    CALL SND_CMD
    goto LCDSIG_101
    LCDSIG_101:
    decf count341,1
    movf count340,0

    call Table_SIG0//////////subroutine of all 0s

    incf byte_pos,1
    movf byte_pos,0
    sublw h'3C'
    btfss CARRY
    goto LCDSIG_102
    movf count341,0
    btfss ZERO
    goto LCDSIG_101
    return
    LCDSIG_102:
    movlw 0xEE ;;Read-Modify-Write OFF
    movwf PORTD
    call SND_CMD1
    movlw 0xB8 ; page address
    movwf PORTD; (40h to 80h)
    CALL SND_CMD1
    movlw 0x00 ; column address
    movwf PORTD; (40h to 80h)
    CALL SND_CMD1
    movlw 0xC0 ; line address
    movwf PORTD; (40h to 80h)
    CALL SND_CMD1
    goto LCDSIG_103
    LCDSIG_104:

    decf count341,1

    call Table_SIG0_1//////////subroutine of all 0s

    LCDSIG_103:

    movf count341,0
    btfss ZERO
    goto LCDSIG_104
    return

    LCDSIG_F::////////////////////////subroutine to display data 7E ie 6 pixels high each for 105 columns
    movlw d'105'
    movwf count341
    movlw 0x00 ; column address
    movwf byte_pos

    movlw 0x00
    movwf PORTD
    call SND_CMD
    movlw 0xB8 ; page address
    movwf PORTD; (40h to 80h)
    CALL SND_CMD
    movlw 0xC0 ; line address
    movwf PORTD; (40h to 80h)
    CALL SND_CMD
    goto LCDSIG_1151
    LCDSIG_1151:
    decf count341,1
    movf count340,0

    ;addlw 0x01
    call Table_SIG15
    ;movwf PORTD
    ;call SND_DTA
    ;TBLRD*+
    incf byte_pos,1
    movf byte_pos,0
    sublw h'3C'
    btfss CARRY
    goto LCDSIG_1152
    movf count341,0
    btfss ZERO
    goto LCDSIG_1151
    return
    LCDSIG_1152:
    movlw 0xEE ;;Read-Modify-Write OFF
    movwf PORTD
    call SND_CMD1
    movlw 0xB8 ; page address
    movwf PORTD; (40h to 80h)
    CALL SND_CMD1
    movlw 0x00 ; column address
    movwf PORTD; (40h to 80h)
    CALL SND_CMD1
    movlw 0xC0 ; line address
    movwf PORTD; (40h to 80h)
    CALL SND_CMD1
    goto LCDSIG_1153
    LCDSIG_1154:

    decf count341,1

    call Table_SIG15_1

    LCDSIG_1153:

    movf count341,0
    btfss ZERO
    goto LCDSIG_1154
    return
     
  2. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    When I call these subroutines in the main part of the program they work as required.

    But I want to implement the following:

    When I press the down button I want to display 105 columns high(0x7E)
    When I press the up button I want to display 105 columns low(0x00)

    Now the issue is

    When I hit the down button only the columns in the right half of display are high and there is no data in the left half at all

    I tried a lot of possibilities but could not figure out the problem

    I would really appreciate if anyone has an idea on this and go through my subroutines patiently

    I have included only the relevant subroutines
    The subroutines not shown work perfectly fine like SND_CMD,SND_DTA etc.

    Thanks
     
  3. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    The main issue is when I try to use the LCDSIG_F subroutine with the switch of a button

    the left half of the display does not work at all
     
Loading...