All, I have been trying to get a Toshiba TLX-1013-30 LCD display to work so that it may be used in a test equipment application later. But I can't even get it to display text at this point. I have attached my code. If someone would be kind enough to look it over and provide suggestions as to why you think it doesn't work, I'd be extremely grateful. It's not real pretty at this point, but hopefully you'll be able to read and understand what I'm trying to do. Thanks to all of you. I appreciate it. Thanks and Regards, Jim ;********************************************************** ;* GRPHLCD.ASM ;********************************************************** ;* Jim Paul ;* 20 May 2005 ;********************************************************** ;* This program configures the LCD module to display both ;* text and graphics. ;********************************************************** list p=18f452 include "p18f452.inc" ; The following is a assignment of address values for all of the configuration ; registers for the purpose of table reads _CONFIG1L EQU H'300000' _CONFIG1H EQU H'300001' _CONFIG2L EQU H'300002' _CONFIG2H EQU H'300003' _CONFIG3L EQU H'300004' _CONFIG3H EQU H'300005' _CONFIG4L EQU H'300006' _CONFIG4H EQU H'300007' _CONFIG5L EQU H'300008' _CONFIG5H EQU H'300009' _CONFIG6L EQU H'30000A' _CONFIG6H EQU H'30000B' _CONFIG7L EQU H'30000C' _CONFIG7H EQU H'30000D' _DEVID1 EQU H'3FFFFE' _DEVID2 EQU H'3FFFFF' _IDLOC0 EQU H'200000' _IDLOC1 EQU H'200001' _IDLOC2 EQU H'200002' _IDLOC3 EQU H'200003' _IDLOC4 EQU H'200004' _IDLOC5 EQU H'200005' _IDLOC6 EQU H'200006' _IDLOC7 EQU H'200007' ;Program Configuration Register 1H __CONFIG _CONFIG1H, _EC_OSC_1H ; External Clock w/OSC2 output divide by 4 ;Program Configuration Register 2L __CONFIG _CONFIG2L, _BOR_ON_2L & _BORV_20_2L & _PWRT_ON_2L ;Program Configuration Register 2H __CONFIG _CONFIG2H, _WDT_OFF_2H ;Program Configuration Register 3H ; __CONFIG _CONFIG3H, _CCP2MX_ON_3H ;Program Configuration Register 4L __CONFIG _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L ;Program Configuration Register 5L __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L ;Program Configuration Register 5H ; __CONFIG _CONFIG5H, _CPB_ON_5H & _CPD_OFF_5H ;Program Configuration Register 6L ; __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L ;Program Configuration Register 6H ; __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H ;Program Configuration Register 7L ; __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L ;Program Configuration Register 7H ; __CONFIG _CONFIG7H, _EBTRB_OFF_7H ; Start at the reset vector ;Reset_Vector code 0x000 goto Start ; Start application beyond vector area ; code 0x002A Start dly1 equ 0x20 dly2 equ 0x21 dly3 equ 0x22 ; PORTD 0 .. 7 go to D0 .. D7 on LCD Module. ; Portc 0 .. 5 go to /wr /rd /ce c/d /reset fs on LCD Module ; clrf PORTD ;Clear PORTD clrf TRISD ;PORTD all outputs. Data Port movlw 0xFF ;Clear PORTC movwf PORTC movwf LATC movwf PORTB movwf LATB movwf PORTD movwf LATD clrf TRISC ;PORTC all outputs. Control Port movlw 0x82 movwf TRISB ;PORTB all outputs. setitup ;Get the LCD ready to accept data and be able to display it. bcf PORTB,RB0 ;Put LCD into reset bsf PORTB,RB3 call delay65ms bcf PORTB, RB3 bsf PORTB, RB0 ;Take LCD out of Reset ;########################################################################### ### ;########################################################################### ### ;########################################################################### ### start ;*************************************************************** ;graphic home address set ;*************************************************************** movlw 0x00 movwf 0x40 call writedata movlw 0x00 movwf 0x40 call writedata movlw 0x42 movwf 0x40 call writecommand ;*************************************************************** ;graphic area set ;*************************************************************** movlw 0x14 movwf 0x40 call writedata movlw 0x00 movwf 0x40 call writedata movlw 0x43 movwf 0x40 call writecommand ;*************************************************************** ;text home address set ;*************************************************************** movlw 0x00 movwf 0x40 call writedata movlw 0x0A movwf 0x40 call writedata movlw 0x40 movwf 0x40 call writecommand ;*************************************************************** ;text area set ;*************************************************************** movlw 0x14 movwf 0x40 call writedata movlw 0x00 movwf 0x40 call writedata movlw 0x41 movwf 0x40 call writecommand ;*************************************************************** ;modeset ;*************************************************************** movlw 0x80 ;send command code movwf 0x40 call writecommand ;*************************************************************** ;display mode set ;*************************************************************** movlw 0x9F movwf 0x40 call writecommand ;address pointer set movlw 0x00 movwf 0x40 call writedata movlw 0x0A movwf 0x40 call writedata movlw 0x24 movwf 0x40 call writecommand ; call test ;write text data movlw 0x21 movwf 0x40 call writedata movlw 0xC0 movwf 0x40 call writecommand here goto here ;*************************************************************** ;Routines ;*************************************************************** ;===================== statuscheck ;===================== bsf PORTE,RE2 ;Turn on LED so I know when it enters this routine clrf PORTD ; Clear PORTD latch movlw 0xFF ; and make PORTD all inputs so movwf TRISD ; I can read the LCD status word bsf LATC,RC3 ;take CD high to accept commands nop bcf LATC,RC1 ;take /RD low to perform read operation nop bcf LATC,RC2 ;take /CE low to capture status info nop movf LATD, W ;Get status register value movwf 0x30 bsf LATC,RC2 ;take /CE back high movwf 0x30 bsf LATC,RC1 ;take /RD back high nop bcf LATC,RC3 ;take c/d back low nop movf 0x30,W ; temp holding place andlw 0x03 ; mask all but the two LSB's nop sublw 0x03 ; subtract the status value for true btfss STATUS,Z ; if zero, status okay goto statuscheck ; otherwise, check it again clrf TRISD ; make portd all outputs again bcf LATE,2 ; turn off LED so I know when it leaves this routine return ;===================== writedata ;===================== call statuscheck movf 0x40, W movwf LATD bcf LATC,RC3 ;accept data by taking CD low nop bcf LATC,RC0 ;take /WR low nop bcf LATC,RC2 ;take /CE low nop bsf LATC,RC2 ;take /CE back high nop bsf LATC,RC0 ;take /WR back high nop bcf LATC,RC3 ;leave c/d low return ;===================== writecommand ;===================== call statuscheck movf 0x40, W movwf LATD bsf LATC,RC3 ;accept command nop bcf LATC,RC0 ;take /WR low nop bcf LATC,RC2 ;take /CE low nop bsf LATC,RC2 ;take /CE back high nop bsf LATC,RC0 ;take /WR back high nop bcf LATC,RC3 ;leave c/d low return ;===================== delay5ms ;===================== movlw 0x1B movwf 0x20 one movlw 0x1A movwf 0x21 decit decf 0x21 two btfss STATUS,Z goto decit decf 0x20 btfss STATUS,Z goto decit return ;===================== delay65ms ;===================== movlw 0xFF movwf 0x20 thr movlw 0xFF movwf 0x21 decit2 decf 0x21 fou btfss STATUS,Z goto decit2 decf 0x20 btfss STATUS,Z goto decit2 return end -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist