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.

write to lcd module please help

Status
Not open for further replies.

amerotke

New Member
Hi to all. I wrote again and again an assembler program for 16F877A to write S and A letters to lcd module with hd 44780. ...Ladies and gentylmen, I cant make it work...Where is my mistake...please help ..( I spend 2 months help please)
 

Attachments

  • GELISME.txt
    1.4 KB · Views: 249
Hi,

Sure others will enjoy trying to finding your coding problems - but think Nigels tutorial would be a good place to get your system working.




Richard
 
Hi to all. I wrote again and again an assembler program for 16F877A to write S and A letters to lcd module with hd 44780. ...Ladies and gentylmen, I cant make it work...Where is my mistake...please help ..( I spend 2 months help please)

please post your code as xxx.asm file
if needed try to zip it
It take lot of time to format it.
 
Here is his source, I haven't looked at it yet, perhaps later.
Code:
LIST    P=16F877A
INCLUDE    "P16F877A.INC"
    BSF    STATUS,5
    MOVLW    h'00'
    MOVWF    TRISB
    MOVWF    TRISD
    BCF    STATUS,5
POLIT    EQU    h'0D'
ZOLITE    EQU    h'0E'
    CLRF    PORTB
    CLRF    PORTD
    CALL    UZUNG
    CALL    UZUNG
    CALL    UZUNG
    CALL    UZUNG
    CALL    UZUNG
    CALL    UZUNG
    MOVLW    h'01'
    MOVWF    PORTB        ;EKRANI SILDIM
    CALL    UZUNG
    CALL    MESGUL
    MOVLW    h'02'        ;RETURN TO HOME
    MOVWF    PORTB
    CALL    UZUNG
    CALL    MESGUL
    MOVLW    h'3C'
    MOVWF    PORTB        ;8 BIT INTERFACE,5X7DOT
    CALL    UZUNG
    CALL    MESGUL
    MOVLW    h'07'
    MOVWF    PORTB        ;SAGA HAREKET ET
    CALL    UZUNG
    CALL    MESGUL
    MOVLW    h'0F'
    MOVWF    PORTB        ;CURSOR ALT CIZGI VAR YANIP SONME VAR
    CALL    UZUNG
    CALL    MESGUL
    MOVLW    h'80'
    MOVWF    PORTB        ;ILK YAZILACAK HARFIN ADRESI 
    CALL    UZUNG
    CALL    MESGUL
HARF
    BSF    PORTD,4
    MOVLW    h'4F'
    MOVWF    PORTB        ;ILK HARFIM O
    CALL    UZUNG
    CALL    MESGUL
    BCF    PORTD,5
    CALL    UZUNG
    BCF    PORTD,4
    BSF    PORTD,6
    CALL    UZUNG
    BCF    PORTD,6
    CALL    UZUNG
    BSF    PORTD,6
    CALL    UZUNG
    BCF    PORTD,6
    CALL    UZUNG
    CALL    UZUNG
    GOTO    HARF        
UZUNG
    MOVLW    h'FF'
    MOVWF    POLIT
DONGU1
    MOVLW    h'FF'
    MOVWF    ZOLITE
DONGU2
    DECFSZ    ZOLITE
    GOTO    DONGU2
    DECFSZ    POLIT
    GOTO    DONGU1
    RETURN
MESGUL
    BSF    STATUS,5
    MOVLW    h'0FF'
    MOVWF    TRISB
    BCF    STATUS,5
    BCF    PORTD,4
    BSF    PORTD,5
    BSF    PORTD,6
    MOVF    PORTB,0
    BCF    PORTD,6
    ANDLW    h'80'
    BTFSS    STATUS,2
    GOTO    MESGUL
DEVAM    
    BCF    PORTD,5
    BSF    STATUS,5
    MOVLW    h'00'
    MOVWF    TRISB
    BCF    STATUS,5
    RETURN
    END
 
Out of curiosity, Turkish language, isn't it?
 
I can erase notes...remain will be pure assembler
otherwise I can translate notes from turkish to english..
 
I can erase notes...remain will be pure assembler
otherwise I can translate notes from turkish to english..
please find the mplab files compiled as zip file

if you study the .err file, you will find some error 305 across may lines

the data (none is going to port b or port d
check what you intend to do, you may use mplab to compile the .asm file found in the zip
and it would create all other files
but load the .asm on some directory like E:\ and not on desktop or my documents

I have added config info and error level of bank switching
__config H'37fa' you may mod it if needed for your program but it is needed to have proper config


"errorlevel -302"
 
Last edited:
Dear Sarma..I am not in my home ( unfortunately in a night shift) and I cant use mplab program as this computer has not it ..
 
Hi...Thank you very much for simulator. I made smulation and it worked in simulator....But this stupid circuit dosnt work.. I see this display which I sent with atachment ...Help help..I will be crazy lcd.gif
 
I changed pic..I programmed 3 different pics and tried. no...then I molded a trimpot to third pin of lcd and contacted trim to +5 V....no......this is a little detail of my project but it made 2 month delay..I will be crazy
 
The trimpot has to be between +5 & gnd with the wiper on pin3
LCDs are very easy to damage. When adjusting contrast you should be able to see black squares.
 
I changed pic..I programmed 3 different pics and tried. no...then I molded a trimpot to third pin of lcd and contacted trim to +5 V....no......this is a little detail of my project but it made 2 month delay..I will be crazy

The examples in my tutorials are guaranteed to work - they are tried and tested, and have been used by many people all round the world.

Build the hardware exactly as shown, don't leave bits out or alter them, and it WILL work. Once you've got that part working you can then move on to adding the bits you want.
 
I put my program to simulator which I got from above. Program works without problem ..but it doesnt work in real circuit. I changed all components of circuit with new equals. can my mistake be in configuration bits..?
 
I put my program to simulator which I got from above. Program works without problem ..but it doesnt work in real circuit. I changed all components of circuit with new equals. can my mistake be in configuration bits..?

Can you confirm that your PIC is operating correctly with a simple LED flashing program?
 
Is your init code sequence and command correct ?

I use this (for four bit MODE) which works, you should have all of these commands in your initialisation. Your's seems a little short ?

INITLCD ;LCD INITIALISATION
CALL MSECS5 ;>15 mS REQUIRED FOR RESET
CALL MSECS5 ;
CALL MSECS5 ;
CALL MSECS5 ;
MOVLW .3 ;REQUIRED TO INITIALISE LCD
CALL COMMAND ;
CALL MSECS5 ;
CALL CLK_EN ;REQUIRED TO INITIALISE LCD
CALL USECS120 ;120uS DELAY
CALL CLK_EN ;REQUIRED TO INITIALISE LCD
CALL USECS120 ;120uS DELAY
MOVLW .2 ;SELECT 4 BIT DATA MODE
CALL COMMAND ;SEND COMMAND
CALL USECS120 ;120uS DELAY
MOVLW .40 ;SELECT TWO LINE DISPLAY
CALL COMMAND ;SEND COMMAND
MOVLW .8 ;TURN DISPLAY OFF
CALL COMMAND ;
MOVLW .1 ;CLEAR DISPLAY BUFFER
CALL COMMAND ;
CALL MSECS5 ;5mS DELAY
MOVLW .6 ;SELECT CURSOR DIRECTION
CALL COMMAND ;
MOVLW .12 ;TURN DISPLAY ON
CALL COMMAND ;
 
Status
Not open for further replies.

Latest threads

Back
Top