i have no idea about lcdinfo
all i know is that this lcd has a built in controller ks0108
i wrote a piece of code but it didn't work i don't know why i'm using 16f877
here's the code:
list p=16f877
#include <p16f877.inc>
LCD_DATA EQU PORTC ; LCD data lines interface
LCD_DATA_TRIS EQU TRISC
LCD_CTRL EQU PORTA ; LCD control lines interface
LCD_TEMP EQU 0x020 ; LCD subroutines internal use
R1 EQU 0x21
R2 EQU 0x22
DELAY EQU 0x023 ; Used in DELAYxxx routines
X_DELAY EQU 0x024 ; Used in X_DELAYxxx routines
; PORTA control bits
LCD_E EQU 2 ; LCD Enable control line
LCD_RW EQU 1 ; LCD Read/Write control line
LCD_RS EQU 0 ; LCD Register-Select control line
CS1 EQU 3
CS2 EQU 4
Rst EQU 5
ORG 0X00
main BCF STATUS,RP1 ;turns to Bank 1
BSF STATUS,RP0
MOVLW 0x06 ; Configure all pins
MOVWF ADCON1 ; as digital inputs BSF STATUS,RP0
MOVLW B'00000111'
OPTION
CLRF TRISA
MOVLW H'00'
MOVWF TRISC
BCF STATUS,RP0
CLRF PORTA
CLRF PORTC
BSF LCD_CTRL, LCD_RS ; Set LCD in command
BSF PORTA,5
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
BCF PORTA,5
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
BSF PORTA,5
`
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
MOVLW 40H ;Set Y Column Address >From 0
CALL WRITE_COMMAND1
CALL WRITE_COMMAND2
MOVLW H'B8' ;Set Page From 0
CALL WRITE_COMMAND1
CALL WRITE_COMMAND2
MOVLW H'C0' ;Set Display Start Line
CALL WRITE_COMMAND1
CALL WRITE_COMMAND2
MOVLW H'3F' ;Set Display ON
CALL WRITE_COMMAND1
CALL WRITE_COMMAND2
SHOWC: CLRF R1
CLRF R2
SCLOOP1:
MOVLW H'B8' ;Set Page Address FROM 00H
ADDWF R1,W ;Command B8H~BFH
CALL WRITE_COMMAND1
CALL WRITE_COMMAND2
MOVLW 0x40 ;Set Column Address FROM 40H
CALL WRITE_COMMAND1
CALL WRITE_COMMAND2
SCLOOP2 CALL table
CALL WRITE_DATA1
INCF R2,1
MOVLW D'15'
SUBWF R2,W
BTFSC STATUS,Z
GOTO main
GOTO SCLOOP2
table MOVF R2,W
ADDWF PCL,1
RETLW H'8C'
RETLW H'92'
RETLW H'92'
RETLW H'62'
RETLW H'80'
RETLW H'FE'
RETLW H'92'
RETLW H'92'
RETLW H'92'
RETLW H'80'
RETLW H'8C'
RETLW H'92'
RETLW H'92'
RETLW H'62'
RETLW H'00'
WRITE_COMMAND1 MOVWF LCD_TEMP ; Command to send is in W ;Write Command To CS1
BCF LCD_CTRL,CS1
BSF LCD_CTRL,CS2
BCF LCD_CTRL, LCD_RW ; Set LCD in read mode
BCF LCD_CTRL, LCD_RS ; Set LCD in command mode
MOVF LCD_TEMP, W
MOVWF LCD_DATA
BSF LCD_CTRL, LCD_E ; LCD E-line High
NOP
NOP
NOP
NOP
BCF LCD_CTRL, LCD_E ; LCD E-line Low
RETURN
;******************************************************************************
WRITE_DATA1 ;Write Data To CS1
MOVWF LCD_TEMP ; Command to send is in W ;Write Command To CS1
BCF LCD_CTRL,CS1
BSF LCD_CTRL,CS2
BCF LCD_CTRL, LCD_RW ; Set LCD in read mode
BSF LCD_CTRL, LCD_RS ; Set LCD in command mode
MOVF LCD_TEMP, W
MOVWF LCD_DATA
BSF LCD_CTRL, LCD_E ; LCD E-line High
NOP
BCF LCD_CTRL, LCD_E ; LCD E-line Low
RETURN
;******************************************************************************
WRITE_COMMAND2 ;Write Command To CS2
MOVWF LCD_TEMP ; Command to send is in W ;Write Command To CS1
BSF LCD_CTRL,CS1
BCF LCD_CTRL,CS2
BCF LCD_CTRL, LCD_RW ; Set LCD in read mode
BCF LCD_CTRL, LCD_RS ; Set LCD in command mode
MOVF LCD_TEMP, W
MOVWF LCD_DATA
BSF LCD_CTRL, LCD_E ; LCD E-line High
NOP
BCF LCD_CTRL, LCD_E ; LCD E-line Low
RETURN
;******************************************************************************
;LCDINIT
; Busy-flag is not yet valid
; CLRF LCD_CTRL ; ALL PORT output should output Low.
; power-up delay
; MOVLW 0x050
; CALL X_DELAY500
; MOVLW 0x030 ; 8-bit-interface, 2-lines
; CALL LCDPUTCMD
;MOVLW 0x009
; CALL X_DELAY500
; MOVLW 0x030 ; 8-bit-interface, 2-lines
; CALL LCDPUTCMD
;CALL X_DELAY500
; MOVLW 0x030 ; 8-bit-interface, 2-lines
; CALL LCDPUTCMD
;MOVLW 0x030 ; 8-bit-interface, 2-lines
; CALL LCDPUTCMD
;MOVLW 0x008 ; 8-bit-interface, 2-lines
; CALL LCDPUTCMD
;MOVLW 0x001 ; 8-bit-interface, 2-lines
; CALL LCDPUTCMD
;MOVLW 0x007 ; 8-bit-interface, 2-lines
; CALL LCDPUTCMD
END
|