Out of curiousity is your LCD 4 bit for data? John --- Stewart Abel wrote: > Ok, I've totally rewritten my code. I have tried > different length delays > but still to no avail. I have also tried different > rated Pots on the > contrast circuit, but still nothing. Here is my new > code, commented better > this time!!! > > include p16f73.inc > list p=16f73 > ;include XLCD.inc > > CBLOCK 0x020 > Delay_i > DelayCount > data_to_send > LCD_temp > endc > > RS equ 4 ;RS bit > E equ 5 ;E bit > D4 equ 0 ;Data bits > D5 equ 1 > D6 equ 2 > D7 equ 3 > LCD_PORT equ PORTB ;Port LCD connected to > LCD_TRIS equ TRISB ;Tris LCD connected to > > org 0 > > goto init > > org 4 > > init bsf STATUS, RP0 > movlw 0x00 > movwf LCD_TRIS ;Set LCD_TRIS to > Outputs > bcf STATUS, RP0 > clrf LCD_PORT ;clear LCD_PORT > > init_lcd > movlw 0x014 ;Delay to wait for LCD to initalise > call Dlay > movlw 0x03 > call send_w ;Send Reset > movlw 0x05 > call Dlay ;Delay 5ms > movlw 0x05 > call send_w ;cycle Reset > call Dlay_500us > movlw 0x05 > call send_w ;cycle reset again > movlw 0x002 > call send_w ;Set to 4 bit mode > movlw b'00101000' > call send_w_data ;Set Interface Length > movlw b'00010000' > call send_w_data ;Disable shifting of display > movlw b'00000001' ;clear display > call send_w_data > movlw b'00000110' ;enable cursor increment > call send_w_data > movlw b'00001110' ;turn display & cursor on > call send_w_data > > mainline > bsf LCD_PORT, RS ;Put LCD into data mode > nop > nop > nop > nop > movlw 'H' > call send_w_data > movlw 'E' > call send_w_data > movlw 'L' > call send_w_data > movlw 'L' > call send_w_data > movlw 'O' > call send_w_data > goto $ > > Dlay movwf DelayCount ;Calls Dlay_1ms number of > times > stored in w_reg > Dlay_loop > call Dlay_1ms > decfsz DelayCount, f > goto Dlay_loop > return > > Dlay_1ms > movlw 0xff ;1ms Delay on 4Mhz Oscillator > movwf Delay_i > goto L1 > Dlay_500us > movlw d'156' ;aprox 500us Delay on 4Mhz > Oscillator > movwf Delay_i > L1 nop > decfsz Delay_i, f > goto L1 > return > > send_w_data > movwf data_to_send > swapf data_to_send, f > movlw 0x00F > andwf data_to_send, w > call send_w > swapf data_to_send, f > movlw 0x00F > andwf data_to_send, w > call send_w > return > > send_w bsf LCD_PORT, E > nop > nop > nop > nop > nop > nop > movwf LCD_PORT ;Sends data to LCD_PORT > nop > nop > nop > nop > nop > nop > bcf LCD_PORT, E > nop > nop > nop > nop > nop > return > > end > > stew > > > -----Original Message----- > > From: piclist-bounces@mit.edu > [mailto:piclist-bounces@mit.edu] On Behalf > > Of Alan B. Pearce > > Sent: 28 June 2006 14:34 > > To: Microcontroller discussion list - Public. > > Subject: Re: [PIC] LCD Interface HD44780 > > > > > Thanks for this Jinx, I will try it out. Is > there anything I need to > > > change as far as timings are concerned, I am > using a 4mhz oscillator > > > > One of the queries this problem often brings up is > the question "are you > > really using a 44780, or one of the clones"? Many > of the clones require > > longer delays, especially when initialising the > chip, and the general > > consensus seemed to be to start with delays that > are significantly longer, > > and then once you have the display working, > shorten them. > > > > > > -- > > http://www.piclist.com PIC/SX FAQ & list archive > > View/change your membership options at > > http://mailman.mit.edu/mailman/listinfo/piclist > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist