Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LCD interfacing with PIC16f877

Status
Not open for further replies.

sneha.kathuria

New Member
hi all, i m trying to display some text on LCD using pic16f877 but unable to get that.......... only backlight turns on in LCD.
text is displayed on LCD when i m chcking pic on demo board but its not working on my board. circuit diagram i have made ia as follows:
pin 1 of pic to rset button
8 MHz crystal with 22pf cap on 13 n 14 pin
12 n 31 pin ground
11 n 32 pin to +5 V
pin 27 t0 30 connected to pin 11 to 14 pf LCD respectively
pin 21 to pin 4 of LCD
pin 22 to pin 6 of LCD
lcd pins 1,5,7,8,9 n 10 are grounded
pin 2 of LCD connected to +5 V
n pin 3 to variable rheostat of 4k7
m unable to get the prob.
plzzz help
 
Last edited:
hi,
You say that pin #1, /MCLR is connected to the RESET PB, what else do you have connected to pin #1,
is it open circuit if the PB is not operated? [it should go to +5V via a 10K0, with say a 10nF to 0V]

Is it possible to post a listing of your program? Including the _CONFIG statement.

Is your demo board also using a 8MHz xtal, as you are not using the R/W line on the LCD, the program delays may not be long enough.

Its just possible that the crystal osc is not working, can you add a couple of lines to your program,
say set a port pin/high [with a delay interval] to drive a simple R/LED as an indicator that the prog is running?
 
thanx u bith 4 ur concern
well i hav conncted reset button through pull up resistance of 9.7k n it is at +5v when reset button is not pressed.
n my demo kit is also using 8MHz crystal
my code is in mikro is as follows for starting purpose:


char *text = "mikroElektronika";

void main() {
LCD_Init(&PORTD); // Initialize LCD connected to PORTB

LCD_Cmd(LCD_CLEAR); // Clear display
LCD_Cmd(LCD_CURSOR_OFF); // Turn cursor off
LCD_Out(1,1, text); // Print text to LCD, 2nd row, 1st column
Delay_ms(1000);
LCD_Out(2,6,"mikroE");
}
can give u hex code if needed
ya u r rite i think dere is some prob in crystsl as i m getting a sine wave from crystal instead of a square wave.
 
hi,

>>> ya u r rite i think dere is some prob in crystsl as i m getting a sine wave from crystal instead of a square wave
If you are measuring the crystal oscillation on one of the crystal wires, using a scope, you will see a sinewave not a square wave.

If you can post your hex code, I will run it thru my PIC test rig, I dont use your version of the Basic compiler.
 
Last edited:
Do you need to insert an Lcd_Config command? I can't tell from your pin descriptions. Can you post a diagram or a list such as,

LCD - PIC
En - D0
RS - D1
etc.

I don't do pin numbers. :eek:

Mike.
 
my connction are as follows:
LCD - PIC
VSS GND
vdd +5v
vee 4k7 reostat
rs RD2
rw gnd
e RD3
d0 gnd
d1 gnd
d2 gnd
d3 gnd
d4 rd4
d5 RD5
d6 RD6
d7 RD7
 
i have asm file of my prog. to display on LCD that i m coping here n i tried to glow the led but its also not working
; ADDRESS OPCODE ASM
; ----------------------------------------------
$0000 $2907 GOTO _main
$0004 $ _Delay_1us:
$0004 $0000 NOP
$0005 $0000 NOP
$0006 $0008 RETURN
$0007 $ _Delay_5500us:
$0007 $300F MOVLW 15
$0008 $1303 BCF STATUS, RP1
$0009 $1283 BCF STATUS, RP0
$000A $00FB MOVWF STACK_11
$000B $30FF MOVLW 255
$000C $00FA MOVWF STACK_10
$000D $0BFB DECFSZ STACK_11, F
$000E $2810 GOTO $+2
$000F $2813 GOTO $+4
$0010 $0BFA DECFSZ STACK_10, F
$0011 $2810 GOTO $-1
$0012 $280D GOTO $-5
$0013 $303E MOVLW 62
$0014 $00FA MOVWF STACK_10
$0015 $0BFA DECFSZ STACK_10, F
$0016 $2815 GOTO $-1
$0017 $0000 NOP
$0018 $0008 RETURN
$0019 $ _Delay_50us:
$0019 $3021 MOVLW 33
$001A $1303 BCF STATUS, RP1
$001B $1283 BCF STATUS, RP0
$001C $00FA MOVWF STACK_10
$001D $0BFA DECFSZ STACK_10, F
$001E $281D GOTO $-1
$001F $0008 RETURN
$0020 $ _Lcd_Cmd:
$0020 $1303 BCF STATUS, RP1
$0021 $1283 BCF STATUS, RP0
$0022 $0820 MOVF LCD_port_address, 0
$0023 $0084 MOVWF FSR
$0024 $0840 MOVF FARG_Lcd_Cmd+0, 0
$0025 $1903 BTFSC STATUS, Z
$0026 $2827 GOTO L_Lcd_Cmd_0
$0027 $ L_Lcd_Cmd_0:
$0027 $0180 CLRF INDF
$0028 $1BC0 BTFSC FARG_Lcd_Cmd+0, 7
$0029 $1780 BSF INDF, ___DB7
$002A $1B40 BTFSC FARG_Lcd_Cmd+0, 6
$002B $1700 BSF INDF, ___DB6
$002C $1AC0 BTFSC FARG_Lcd_Cmd+0, 5
$002D $1680 BSF INDF, ___DB5
$002E $1A40 BTFSC FARG_Lcd_Cmd+0, 4
$002F $1600 BSF INDF, ___DB4
$0030 $0821 MOVF LCD_cmd_status, 0
$0031 $1903 BTFSC STATUS, Z
$0032 $2835 GOTO L_Lcd_Cmd_1
$0033 $1100 BCF INDF, ___RS
$0034 $2836 GOTO L_Lcd_Cmd_2
$0035 $ L_Lcd_Cmd_1:
$0035 $1500 BSF INDF, ___RS
$0036 $ L_Lcd_Cmd_2:
$0036 $1580 BSF INDF, ___ENABLE
$0037 $2004 CALL _Delay_1us
$0038 $0840 MOVF FARG_Lcd_Cmd+0, 0
$0039 $1903 BTFSC STATUS, Z
$003A $283B GOTO L_Lcd_Cmd_3
$003B $ L_Lcd_Cmd_3:
$003B $1180 BCF INDF, ___ENABLE
$003C $0180 CLRF INDF
$003D $19C0 BTFSC FARG_Lcd_Cmd+0, 3
$003E $1780 BSF INDF, ___DB7
$003F $1940 BTFSC FARG_Lcd_Cmd+0, 2
$0040 $1700 BSF INDF, ___DB6
$0041 $18C0 BTFSC FARG_Lcd_Cmd+0, 1
$0042 $1680 BSF INDF, ___DB5
$0043 $1840 BTFSC FARG_Lcd_Cmd+0, 0
$0044 $1600 BSF INDF, ___DB4
$0045 $0821 MOVF LCD_cmd_status, 0
$0046 $1903 BTFSC STATUS, Z
$0047 $284A GOTO L_Lcd_Cmd_4
$0048 $1100 BCF INDF, ___RS
$0049 $284B GOTO L_Lcd_Cmd_5
$004A $ L_Lcd_Cmd_4:
$004A $1500 BSF INDF, ___RS
$004B $ L_Lcd_Cmd_5:
$004B $1580 BSF INDF, ___ENABLE
$004C $2004 CALL _Delay_1us
$004D $1180 BCF INDF, ___ENABLE
$004E $0821 MOVF LCD_cmd_status, 0
$004F $1903 BTFSC STATUS, Z
$0050 $2853 GOTO L_Lcd_Cmd_6
$0051 $2007 CALL _Delay_5500us
$0052 $2854 GOTO L_Lcd_Cmd_7
$0053 $ L_Lcd_Cmd_6:
$0053 $2019 CALL _Delay_50us
$0054 $ L_Lcd_Cmd_7:
$0054 $0008 RETURN
$0055 $ _Lcd_Chr_CP:
$0055 $1303 BCF STATUS, RP1
$0056 $1283 BCF STATUS, RP0
$0057 $01A1 CLRF LCD_cmd_status, 1
$0058 $083F MOVF FARG_Lcd_Chr_CP+0, 0
$0059 $00C0 MOVWF FARG_Lcd_Cmd+0
$005A $2020 CALL _Lcd_Cmd
$005B $3001 MOVLW 1
$005C $00A1 MOVWF LCD_cmd_status
$005D $0008 RETURN
$005E $ _Lcd_Init:
$005E $2007 CALL _Delay_5500us
$005F $2007 CALL _Delay_5500us
$0060 $2007 CALL _Delay_5500us
$0061 $083B MOVF FARG_Lcd_Init+0, 0
$0062 $00A0 MOVWF LCD_port_address
$0063 $083B MOVF FARG_Lcd_Init+0, 0
$0064 $0084 MOVWF FSR
$0065 $0180 CLRF INDF, 1
$0066 $1784 BSF FSR, 7
$0067 $0180 CLRF INDF
$0068 $1384 BCF FSR, 7
$0069 $1680 BSF INDF, ___DB5
$006A $1600 BSF INDF, ___DB4
$006B $1580 BSF INDF, ___ENABLE
$006C $1180 BCF INDF, ___ENABLE
$006D $2007 CALL _Delay_5500us
$006E $1580 BSF INDF, ___ENABLE
$006F $1180 BCF INDF, ___ENABLE
$0070 $2007 CALL _Delay_5500us
$0071 $1580 BSF INDF, ___ENABLE
$0072 $1180 BCF INDF, ___ENABLE
$0073 $2007 CALL _Delay_5500us
$0074 $1680 BSF INDF, ___DB5
$0075 $1200 BCF INDF, ___DB4
$0076 $1580 BSF INDF, ___ENABLE
$0077 $1180 BCF INDF, ___ENABLE
$0078 $2007 CALL _Delay_5500us
$0079 $0180 CLRF INDF
$007A $1680 BSF INDF, ___DB5
$007B $1580 BSF INDF, ___ENABLE
$007C $1180 BCF INDF, ___ENABLE
$007D $0180 CLRF INDF
$007E $1780 BSF INDF, ___DB7
$007F $1580 BSF INDF, ___ENABLE
$0080 $1180 BCF INDF, ___ENABLE
$0081 $2007 CALL _Delay_5500us
$0082 $0180 CLRF INDF
$0083 $1600 BSF INDF, ___DB4
$0084 $1580 BSF INDF, ___ENABLE
$0085 $1180 BCF INDF, ___ENABLE
$0086 $0180 CLRF INDF
$0087 $1580 BSF INDF, ___ENABLE
$0088 $1180 BCF INDF, ___ENABLE
$0089 $2007 CALL _Delay_5500us
$008A $0180 CLRF INDF
$008B $1580 BSF INDF, ___ENABLE
$008C $1180 BCF INDF, ___ENABLE
$008D $1600 BSF INDF, ___DB4
$008E $1580 BSF INDF, ___ENABLE
$008F $1180 BCF INDF, ___ENABLE
$0090 $2007 CALL _Delay_5500us
$0091 $0180 CLRF INDF
$0092 $1580 BSF INDF, ___ENABLE
$0093 $1180 BCF INDF, ___ENABLE
$0094 $1600 BSF INDF, ___DB4
$0095 $1680 BSF INDF, ___DB5
$0096 $1700 BSF INDF, ___DB6
$0097 $1780 BSF INDF, ___DB7
$0098 $1580 BSF INDF, ___ENABLE
$0099 $1180 BCF INDF, ___ENABLE
$009A $2007 CALL _Delay_5500us
$009B $3001 MOVLW 1
$009C $00A1 MOVWF LCD_cmd_status
$009D $0008 RETURN
$009E $ _LCD_Out:
$009E $28B0 GOTO L_LCD_Out_17
$009F $ L_LCD_Out_19:
$009F $3080 MOVLW 128
$00A0 $1303 BCF STATUS, RP1
$00A1 $1283 BCF STATUS, RP0
$00A2 $00BB MOVWF FARG_LCD_Out+0
$00A3 $28C3 GOTO L_LCD_Out_18
$00A4 $ L_LCD_Out_20:
$00A4 $30C0 MOVLW 192
$00A5 $00BB MOVWF FARG_LCD_Out+0
$00A6 $28C3 GOTO L_LCD_Out_18
$00A7 $ L_LCD_Out_21:
$00A7 $3094 MOVLW 148
$00A8 $00BB MOVWF FARG_LCD_Out+0
$00A9 $28C3 GOTO L_LCD_Out_18
$00AA $ L_LCD_Out_22:
$00AA $30D4 MOVLW 212
$00AB $00BB MOVWF FARG_LCD_Out+0
$00AC $28C3 GOTO L_LCD_Out_18
$00AD $ L_LCD_Out_23:
$00AD $3080 MOVLW 128
$00AE $00BB MOVWF FARG_LCD_Out+0
$00AF $28C3 GOTO L_LCD_Out_18
$00B0 $ L_LCD_Out_17:
$00B0 $1303 BCF STATUS, RP1
$00B1 $1283 BCF STATUS, RP0
$00B2 $083B MOVF FARG_LCD_Out+0, 0
$00B3 $3A01 XORLW 1
$00B4 $1903 BTFSC STATUS, Z
$00B5 $289F GOTO L_LCD_Out_19
$00B6 $083B MOVF FARG_LCD_Out+0, 0
$00B7 $3A02 XORLW 2
$00B8 $1903 BTFSC STATUS, Z
$00B9 $28A4 GOTO L_LCD_Out_20
$00BA $083B MOVF FARG_LCD_Out+0, 0
$00BB $3A03 XORLW 3
$00BC $1903 BTFSC STATUS, Z
$00BD $28A7 GOTO L_LCD_Out_21
$00BE $083B MOVF FARG_LCD_Out+0, 0
$00BF $3A04 XORLW 4
$00C0 $1903 BTFSC STATUS, Z
$00C1 $28AA GOTO L_LCD_Out_22
$00C2 $28AD GOTO L_LCD_Out_23
$00C3 $ L_LCD_Out_18:
$00C3 $033C DECF FARG_LCD_Out+1, 0
$00C4 $00F0 MOVWF STACK_0
$00C5 $083B MOVF FARG_LCD_Out+0, 0
$00C6 $07F0 ADDWF STACK_0, 1
$00C7 $0870 MOVF STACK_0, 0
$00C8 $00BB MOVWF FARG_LCD_Out+0
$00C9 $0870 MOVF STACK_0, 0
$00CA $00C0 MOVWF FARG_Lcd_Cmd+0
$00CB $2020 CALL _Lcd_Cmd
$00CC $01A1 CLRF LCD_cmd_status, 1
$00CD $01BE CLRF LCD_Out_i_L0, 1
$00CE $ L_LCD_Out_24:
$00CE $083E MOVF LCD_Out_i_L0, 0
$00CF $073D ADDWF FARG_LCD_Out+2, 0
$00D0 $0084 MOVWF FSR
$00D1 $0800 MOVF INDF, 0
$00D2 $00F0 MOVWF STACK_0
$00D3 $0870 MOVF STACK_0, 0
$00D4 $1903 BTFSC STATUS, Z
$00D5 $28DE GOTO L_LCD_Out_25
$00D6 $083E MOVF LCD_Out_i_L0, 0
$00D7 $073D ADDWF FARG_LCD_Out+2, 0
$00D8 $0084 MOVWF FSR
$00D9 $0800 MOVF INDF, 0
$00DA $00BF MOVWF FARG_Lcd_Chr_CP+0
$00DB $2055 CALL _Lcd_Chr_CP
$00DC $0ABE INCF LCD_Out_i_L0, 1
$00DD $28CE GOTO L_LCD_Out_24
$00DE $ L_LCD_Out_25:
$00DE $3001 MOVLW 1
$00DF $00A1 MOVWF LCD_cmd_status
$00E0 $0008 RETURN
$00E1 $ GlobalInilcd11:
$00E1 $306D MOVLW 109
$00E2 $1303 BCF STATUS, RP1
$00E3 $1283 BCF STATUS, RP0
$00E4 $00A2 MOVWF lstr1_lcd11+0
$00E5 $3069 MOVLW 105
$00E6 $00A3 MOVWF lstr1_lcd11+1
$00E7 $306B MOVLW 107
$00E8 $00A4 MOVWF lstr1_lcd11+2
$00E9 $3072 MOVLW 114
$00EA $00A5 MOVWF lstr1_lcd11+3
$00EB $306F MOVLW 111
$00EC $00A6 MOVWF lstr1_lcd11+4
$00ED $3045 MOVLW 69
$00EE $00A7 MOVWF lstr1_lcd11+5
$00EF $306C MOVLW 108
$00F0 $00A8 MOVWF lstr1_lcd11+6
$00F1 $3065 MOVLW 101
$00F2 $00A9 MOVWF lstr1_lcd11+7
$00F3 $306B MOVLW 107
$00F4 $00AA MOVWF lstr1_lcd11+8
$00F5 $3074 MOVLW 116
$00F6 $00AB MOVWF lstr1_lcd11+9
$00F7 $3072 MOVLW 114
$00F8 $00AC MOVWF lstr1_lcd11+10
$00F9 $306F MOVLW 111
$00FA $00AD MOVWF lstr1_lcd11+11
$00FB $306E MOVLW 110
$00FC $00AE MOVWF lstr1_lcd11+12
$00FD $3069 MOVLW 105
$00FE $00AF MOVWF lstr1_lcd11+13
$00FF $306B MOVLW 107
$0100 $00B0 MOVWF lstr1_lcd11+14
$0101 $3061 MOVLW 97
$0102 $00B1 MOVWF lstr1_lcd11+15
$0103 $01B2 CLRF lstr1_lcd11+16
$0104 $3022 MOVLW lstr1_lcd11
$0105 $00B3 MOVWF _text+0
$0106 $0008 RETURN
$0107 $ _main:
$0107 $20E1 CALL GlobalInilcd11
$0108 $306D MOVLW 109
$0109 $00B4 MOVWF lstr2_lcd11+0
$010A $3069 MOVLW 105
$010B $00B5 MOVWF lstr2_lcd11+1
$010C $306B MOVLW 107
$010D $00B6 MOVWF lstr2_lcd11+2
$010E $3072 MOVLW 114
$010F $00B7 MOVWF lstr2_lcd11+3
$0110 $306F MOVLW 111
$0111 $00B8 MOVWF lstr2_lcd11+4
$0112 $3045 MOVLW 69
$0113 $00B9 MOVWF lstr2_lcd11+5
$0114 $01BA CLRF lstr2_lcd11+6
;lcd11.c,3 :: void main() {
;lcd11.c,4 :: LCD_Init(&PORTD); // Initialize LCD connected to PORTB
$0115 $3008 MOVLW PORTD
$0116 $00BB MOVWF FARG_Lcd_Init+0
$0117 $205E CALL _Lcd_Init
;lcd11.c,6 :: LCD_Cmd(LCD_CLEAR); // Clear display
$0118 $3001 MOVLW 1
$0119 $00C0 MOVWF FARG_Lcd_Cmd+0
$011A $2020 CALL _Lcd_Cmd
;lcd11.c,7 :: LCD_Cmd(LCD_CURSOR_OFF); // Turn cursor off
$011B $300C MOVLW 12
$011C $00C0 MOVWF FARG_Lcd_Cmd+0
$011D $2020 CALL _Lcd_Cmd
;lcd11.c,8 :: LCD_Out(1,1, text); // Print text to LCD, 2nd row, 1st column
$011E $3001 MOVLW 1
$011F $00BB MOVWF FARG_LCD_Out+0
$0120 $3001 MOVLW 1
$0121 $00BC MOVWF FARG_LCD_Out+1
$0122 $0833 MOVF _text, 0
$0123 $00BD MOVWF FARG_LCD_Out+2
$0124 $209E CALL _LCD_Out
;lcd11.c,9 :: Delay_ms(1000);
$0125 $300B MOVLW 11
$0126 $00FC MOVWF STACK_12
$0127 $30FF MOVLW 255
$0128 $00FB MOVWF STACK_11
$0129 $30FF MOVLW 255
$012A $00FA MOVWF STACK_10
$012B $0BFC DECFSZ STACK_12, F
$012C $292E GOTO $+2
$012D $2935 GOTO $+8
$012E $0BFB DECFSZ STACK_11, F
$012F $2931 GOTO $+2
$0130 $2934 GOTO $+4
$0131 $0BFA DECFSZ STACK_10, F
$0132 $2931 GOTO $-1
$0133 $292E GOTO $-5
$0134 $292B GOTO $-9
$0135 $3033 MOVLW 51
$0136 $00FB MOVWF STACK_11
$0137 $30FF MOVLW 255
$0138 $00FA MOVWF STACK_10
$0139 $0BFB DECFSZ STACK_11, F
$013A $293C GOTO $+2
$013B $293F GOTO $+4
$013C $0BFA DECFSZ STACK_10, F
$013D $293C GOTO $-1
$013E $2939 GOTO $-5
$013F $3088 MOVLW 136
$0140 $00FA MOVWF STACK_10
$0141 $0BFA DECFSZ STACK_10, F
$0142 $2941 GOTO $-1
$0143 $0000 NOP
$0144 $0000 NOP
;lcd11.c,10 :: LCD_Out(2,6,"mikroE");
$0145 $3002 MOVLW 2
$0146 $00BB MOVWF FARG_LCD_Out+0
$0147 $3006 MOVLW 6
$0148 $00BC MOVWF FARG_LCD_Out+1
$0149 $3034 MOVLW lstr2_lcd11
$014A $00BD MOVWF FARG_LCD_Out+2
$014B $209E CALL _LCD_Out
;lcd11.c,11 :: }
$014C $294C GOTO $
 
hi,
The listing you have posted is the 'LST' output from the compiler. In order to
compile and run it I would have to 'strip' out all the hex components.
Also it dosnt show any CONFIG or EQU information.

Do you have just the full assembler listing?
 
i think this is the hex cord u r talking abt:
:100000000729FF3FFF3FFF3F0000000008000F30BF
:1000100003138312FB00FF30FA00FB0B1028132898
:10002000FA0B10280D283E30FA00FA0B15280000B4
:100030000800213003138312FA00FA0B1D28080070
:100040000313831220088400400803192728800125
:10005000C01B8017401B0017C01A8016401A0016DC
:1000600021080319352800113628001580150420B1
:10007000400803193B2880118001C01980174019DE
:100080000017C018801640180016210803194A28C6
:1000900000114B2800158015042080112108031938
:1000A0005328072054281920080003138312A101A4
:1000B0003F08C00020200130A100080007200720D1
:1000C00007203B08A0003B088400800184178001C2
:1000D000841380160016801580110720801580116A
:1000E00007208015801107208016001280158011CE
:1000F00007208001801680158011800180178015EF
:100100008011072080010016801580118001801564
:100110008011072080018015801100168015801144
:1001200007208001801580110016801600178017A7
:100130008015801107200130A1000800B028803010
:1001400003138312BB00C328C030BB00C328943004
:10015000BB00C328D430BB00C3288030BB00C328F9
:10016000031383123B08013A03199F283B08023A04
:100170000319A4283B08033A0319A7283B08043AAB
:100180000319AA28AD283C03F0003B08F0077008CB
:10019000BB007008C0002020A101BE013E083D0741
:1001A00084000008F00070080319DE283E083D07AF
:1001B00084000008BF005520BE0ACE280130A100EF
:1001C00008006D3003138312A2006930A3006B3066
:1001D000A4007230A5006F30A6004530A7006C3037
:1001E000A8006530A9006B30AA007430AB007230F3
:1001F000AC006F30AD006E30AE006930AF006B30D8
:10020000B0006130B100B2012230B3000800E1203B
:100210006D30B4006930B5006B30B6007230B70095
:100220006F30B8004530B900BA010830BB005E201D
:100230000130C00020200C30C00020200130BB0065
:100240000130BC003308BD009E200B30FC00FF30A5
:10025000FB00FF30FA00FC0B2E293529FB0B31295E
:100260003429FA0B31292E292B293330FB00FF309A
:10027000FA00FB0B3C293F29FA0B3C29392988302D
:10028000FA00FA0B4129000000000230BB000630E2
:10029000BC003430BD009E204C29FF3FFF3FFF3F94
:02400E007A3FF7
:00000001FF
 
I guess your program works as intended, can you link the mikroBasic source code?
 

Attachments

  • lcd_out.JPG
    lcd_out.JPG
    38.2 KB · Views: 1,128
Did you fill in the clock frequency before compiling the code?
It seems like the LCD doesn't initialize properly. You can try to add a small delay, like this:
Code:
void main() {

   Delay_ms(20);   // <<<<<
   
   LCD_Init(&PORTD); // Initialize LCD connected to PORTD

   LCD_Cmd(LCD_CLEAR); // Clear display
   LCD_Cmd(LCD_CURSOR_OFF); // Turn cursor off

   LCD_Out(1,1,"Hello");
}
 
Last edited:
hi,
Have run your hex code thru my PIC sim, it does flash the LED's, once, then it goes into a loop.

Was this assembler coding produced by "mikroElektronika basic.?

Why is it writing each LCD character to a specified LCD location, rather than initialising for auto right shift. ?

Do you have MPLAB V7 on your PC and can you use it?.

If so, I would recommend that you download working examples of LCD coding.

If the LCD R/W line isnt being controlled, connect it to 0v, that is WRITE mode, if its left 'open' it can cause problems.
 
hi,

>>gramo, I guess that was targeted at me

No way!, I just thought the OP may mis-understand.
I follow your responses with genuine interest.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top