Check the initialisation... here is an asm snippet that works... ;--------------Lcd handler for pic 16cxx / 5x------------- ;--------------By Steve Smith 1997 onwards---------------- ;--------------RS line reused for other items------------- ;************* LCD FUNCTIONS ****************************** ;LCD_DATA EQU PORTB ; PLACE TO SEND LCD INFO ;#DEFINE LCD_EN PORTA,4 ; LCD ENABLE ;#DEFINE LCD_RS PORTA,3 ; LCD REGISTER SEL ; R/W IS NOT USED (GND) ;------------------MEMORY REQUIREMENTS---------------------------------- STRNUM EQU GP1 +1 ; TEXT STRING NUMBER STORE CHPT EQU STRNUM +1 ; CHAR POINTER LCDCH EQU CHPT +1 ; LCD CHAR TABOFF EQU LCDCH+1 ; TABLE OFFSET ;------------------INCREMEMTS CHARTHER POINTER FOR TEXT STRING---------- POINT MACRO INCF TABOFF,1 MOVFW TABOFF ADDWF PCL,1 ENDM POINT1 MACRO INCF TABOFF,F incf PCLATH,f MOVFW TABOFF ADDWF PCL,F ENDM ;--------------LCD CONTROL FUNCTION EQUATES----------------- LINE1 EQU B'10000000' LINE2 EQU B'11000000' LINE1_8 EQU B'10001000' LINE1_14 EQU B'10001101' LINE2_8 EQU B'11001000' LINE2_6 EQU B'11000101' BLINK EQU B'00001110' NBLINK EQU B'00001100' S_P EQU 020h LCD_INIT MACRO ;--------------LCD INITALISATION CODE----------------------- MOVLW 38h ; LCD RESET CALL LCD_CMD ; DO INSTRUCTION MOVLW 06h ; DISPLAY DIR RIGHT CALL LCD_CMD ; DO INSTRUCTION MOVLW 0Ch ; DISPLAY ON AND CURSER SET CALL LCD_CMD ; DO INSTRUCTION ENDM ;--------------------------------LCD TEXT STRING HANDLER--------------------- STRING IF DEBUG == 1 ; REMOVE COMMENT DURING DEBUG RETLW 0 ELSE MOVWF STRNUM ; SAVE STRING NUMBER MOVLW 0FFH ; POINTER TO BEGINING OF STRING MOVWF TABOFF ; WELL IT IS NOW DOSTR PAGE1 ; SET PAGE MARKER CALL CALLSTR ; GET STRING CHAR POINTED TO IN TABOFF PAGE0 ; RESET PAGE MARKER MOVWF LCDCH ; SAVE CHAR ANDLW B'01111111' ; MASK END BIT (END OF STRING MARKER) CALL LCD_OUT ; SEND CHAR BTFSS LCDCH,7 ; CHECK LAST GOTO DOSTR ; NOT FINISHED DO SOME MORE RETLW 0 ; EXIT ENDIF LCD_CMD BCF LCD_RS ; CONTROL MODE goto LCD_OUT_1 LCD_OUT BSF LCD_RS ; data mode LCD_OUT_1 MOVWF LCD_DATA ; PUT LCD CONTROL DATA ON BUS ; 1us port settle time NOP BSF LCD_EN ; Lcd enable High SEND IT NOP ; 1us port settle time BCF LCD_EN ; Lcd enable low BSF LCD_RS ; RESET RS LINE ; btfss COM_F ; flag for line ; BCF LCD_RS MOVLW .20 ; short delay period GOTO SHORT ; short delay ;--------------LCD CLEAR DISPLAY----------------------------------- LCDCLR MOVLW 01h ; CLEAR DISPLAY CALL LCD_CMD ; SHORT TIME DELAY MOVLW .3 ; LONG DELAY PERIOD GOTO LONG ; DO TIME ;************* END LCD FUNCTIONS ************************ ;--------------TEXT STRINGS------------------------------ ; ORG 200 ;LAST EQU b'10000000' ;CALLSTR ; MOVFW STRNUM ; GET STRING ; ADDWF PCL,1 ; WHICH STRING ; RETLW '0'+LAST ; GOTO MSG7 ; ON ; GOTO MSG8 ; OFF ; GOTO MSG9 ; FAULT ;MSG7 POINT ; RETLW 'O' ; RETLW 'N' ; RETLW ' '+LAST ;MSG8 POINT ; RETLW 'O' ; RETLW 'F' ; RETLW 'F'+LAST ;MSG9 POINT ; RETLW 'F' ; RETLW 'A' ; RETLW 'U' ; RETLW 'L' ; RETLW 'T' ; RETLW ' '+LAST -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Steve Maroney Sent: 11 July 2009 05:16 To: Microcontroller discussion list - Public. Subject: RE: [EE] Trouble on 2nd line of LCD Also, I think I should add that If I turn the contrast all the up, to where I cant read the chars and see square blocks, I thought I would see the second row blocks, as I do the first row, but I only see the first row. Hopefully that makes some sense. Best Regards, Steve Maroney Business Computer Support, LLC Mobile Phone:504-914-4704 Office Phone: 504-904-0266 Fax: 866-871-7797 -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Steve Maroney Sent: Friday, July 10, 2009 10:31 PM To: Microcontroller discussion list - Public. Subject: RE: [EE] Trouble on 2nd line of LCD Dear gang, I have this LCD: http://www.futurlec.com/LED/LCD16x2.shtml I can write chars to the LCD and seems to work ok but when I move the cursor to the 2nd line, and write to the LCD, nothing is displayed. To move the cursor the 2nd line, I clear the RS bit, send 0xC0, then pulse the EN bit. The code works as expected on the OSHON PIC IDE/Simulator. Anyone have any ideas on what im doing wrong ? Before writing characters to the LCD, I have this small function to setup the LCD: First I bring the RS bit low and bring the EN bit high movlw 0x38 ; 8bit, 2 line, 5x7 resolution movwf PORTC then I pulse the EN bit movlw 0x0C ; display on, cursor off movwf PORTC pulse the EN bit again movlw 0x01 ; clear LCD display movwf PORTC pulse the EN bit again finally I bring the RS bit high before returning from the routine. Best Regards, Steve Maroney Business Computer Support, LLC Mobile Phone:504-914-4704 Office Phone: 504-904-0266 Fax: 866-871-7797 -- 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 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist