I need to print my name and surname on LCD in Proteus but I tried every solution I can find but it's not working. The LCD displays nothing at all. Please see the schematic and my code below. I tried another schemas too but they didn't worked too. I think problem is proteus but I'm not sure.
What can I do for the solution?
![[Proteus Schema]](https://i.stack.imgur.com/h7DlI.png)
LIST P='16F877A'
INCLUDE <P16F877A.INC>
DEGER EQU 0x21
SAYAC1 EQU 0x22
SAYAC2 EQU 0X23
ORG 0x00
GOTO START
ORG 0x04
VERIYAZ
MOVWF DEGER ;
SWAPF DEGER ,W ;
ANDLW 0x0F
MOVWF PORTB
BSF PORTB,4 ;
CALL GECIKME ;
MOVF DEGER,W ;
ANDLW 0x0F
MOVWF PORTB
BSF PORTB,4 ;
CALL GECIKME
RETURN
KOMUTYAZ
MOVWF DEGER ; 1101 1010
SWAPF DEGER,W;1010 1101
ANDLW 0x0F ; 0000 1111 =0000 1101
MOVWF PORTB
BCF PORTB,4 ;
CALL GECIKME ;
MOVF DEGER,W ;1101 1010
ANDLW 0x0F ;0000 1010
MOVWF PORTB
BCF PORTB,4 ;
CALL GECIKME
RETURN
START
CLRF PORTB
BANKSEL TRISB
CLRF TRISB
BANKSEL PORTB
MOVLW 0x03 ;
CALL KOMUTYAZ ;
MOVLW 0x02;
CALL KOMUTYAZ ;
MOVLW 0x28 ;
CALL KOMUTYAZ ;
MOVLW 0x01 ;
CALL KOMUTYAZ ;
MOVLW 0x06;
CALL KOMUTYAZ ;
MOVLW 0x0C ;
CALL KOMUTYAZ ;
MOVLW 0x80;
CALL KOMUTYAZ ;
MOVLW 'B'
CALL VERIYAZ
MOVLW 'A'
CALL VERIYAZ
MOVLW 'T'
CALL VERIYAZ
MOVLW 'U'
CALL VERIYAZ
MOVLW 'H'
CALL VERIYAZ
MOVLW 0xC0;
CALL KOMUTYAZ
MOVLW 0x06 ;
CALL KOMUTYAZ
MOVLW 'D'
CALL VERIYAZ
MOVLW 'I'
CALL VERIYAZ
MOVLW 'L'
CALL VERIYAZ
MOVLW 'L'
CALL VERIYAZ
MOVLW 'I'
CALL VERIYAZ
GECIKME
BSF PORTB,5;
CALL BEKLE
BCF PORTB,5;
RETURN
BEKLE
MOVLW 0x40
MOVWF SAYAC1;
D1
MOVLW 0x05
MOVWF SAYAC2
D2
DECFSZ SAYAC2
GOTO D2
DECFSZ SAYAC1
GOTO D1
RETURN
END
I tried what I can find and I'm expecting to solution.
PORTB 3 is configured as Low Voltage Programming (LVP) pin by default. When in this mode, this pin cannot be used as IO. You must alter the congfiguration bits to control LVP bit so that B3 pin can be used as IO. Add this line into your source code after the include line as following:
You can alternatively change the output port to another port other than PORTB. But be careful; an IO pin can be designed as multifunctional, that is, a single IO pin may have designed to be used either as analog input or digital IO or timer input or PWM output etc. You should always check the microcontroller's datasheet to be able to configure pins correctly as per your need.
Go ahead and add that config line to your code then try it again. Then let me know the result.
Edit-1
The provided solution above hasn't worked, so now what? Well we keep trying until you get it work. Now that we made sure the PORTB3 pin is free, we can focus on other bugs. Here is another one I've seen: The init procedure of the LCD. The init procedure is very important so that the LCD know how it should function. If it is not initialized correctly, unfortunately it will be uncontrollable. So let's get into it...
In this datasheet at page 13 you can see the init procedure for 16x2 LCD controller. Have a look...
0x30x3second time, then wait for more than 100us (we'll round it to 1ms)0x3for the last timeThese steps should be done this way so that the LCD controller complete its reset procedure for further setup. Then the interface setup steps follows after this. Now you must replace your following code:
With the following code:
Make this change in addition to the LVP config. Try and let me know the result.