89c52 assembly programming doubts

Discussion in 'Embedded Systems and Microcontrollers' started by Barasha Mali, Oct 27, 2011.

  1. Barasha Mali

    Thread Starter New Member

    Oct 13, 2010
    15
    0
    Hi,
    I am facing problems programming in assembly...Need some help
    I am using 8052 μc with 16*2 LCD display..wrote the initialising program but its not working .can any one help me...plz

    This is the progrm-


    org 0000h
    AJMP HERE

    ORG 30H

    HERE:
    mov A,#38h
    ACALL COMNWRT
    ACALL DELAY
    mov A,#0Eh
    ACALL COMNWRT
    ACALL DELAY
    mov A,#01h
    LI: JMP LI
     
  2. DumboFixer

    Active Member

    Feb 10, 2009
    219
    34
    Can you be more specific ?

    you say it's not working - if what way ?

    What is it doing ?

    What should it be doing ?

    Do you have a schematic ?
     
  3. RiJoRI

    Well-Known Member

    Aug 15, 2007
    536
    26
    First, please use the code tags around your code (the '#' button above).

    Second, according to your code, all you are doing is sending 3 commands to your display, but NOT sending any text! The display is displaying just what you tell it to -- nothing.

    --Rich
     
  4. Jon Wilder

    New Member

    Oct 25, 2011
    23
    1
    Not only that but we also need to see your COMNWRT subroutine. When using code tags, your code should look something like this -

    Code ( (Unknown Language)):
    1.  
    2.               org 0000h
    3.               AJMP HERE
    4.  
    5.               ORG 30H
    6.  
    7. HERE:         mov          A,#38h
    8.               ACALL        COMNWRT
    9.               ACALL        DELAY
    10.               mov          A,#0Eh
    11.               ACALL        COMNWRT
    12.               ACALL        DELAY
    13.               mov          A,#01h
    14. LI:           JMP          LI
     
  5. Barasha Mali

    Thread Starter New Member

    Oct 13, 2010
    15
    0
    Since i am at the initial stage, so i want to initialise the lcd first -i mean i want the cursor to display on my LCD.
    I used the sub routines
    After burning my program into the uP LCD shows only boxes which means that it isnt initialised
     
  6. Barasha Mali

    Thread Starter New Member

    Oct 13, 2010
    15
    0
    # code button
    plz xplain
     
  7. Barasha Mali

    Thread Starter New Member

    Oct 13, 2010
    15
    0
    This is the schematic i am using
     
  8. stahta01

    Member

    Jun 9, 2011
    133
    21
    How long is the delay; it needs to be very long (after power up) if I recall correctly.

    Tim S.
     
  9. Jon Wilder

    New Member

    Oct 25, 2011
    23
    1
    We still don't have enough information to go on -

    Which LCD display are you using (make and model)?

    Can you post the subroutine that is labeled COMNWRT?

    Are you using an actual 89C52 or is it an Atmel AT89S52?

    Are you using internal or external program EPROM?

    Also, most LCD displays need to be pulled into a reset condition upon power up of the microcontroller. So you need to add an instruction and a delay subroutine to your code -

    Code ( (Unknown Language)):
    1.  
    2.               org 0000h
    3.               AJMP HERE
    4.  
    5.               ORG 30H
    6.  
    7. HERE:         clr          P3.4          ;reset LCD (assuming reset active low)
    8.               ACALL        DELAY
    9.               setb         P3.4          ;release reset
    10.               mov          A,#38h
    11.               ACALL        COMNWRT
    12.               ACALL        DELAY
    13.               mov          A,#0Eh
    14.               ACALL        COMNWRT
    15.               ACALL        DELAY
    16.               mov          A,#01h
    17. LI:           JMP          LI
    18.  
     
    Last edited: Nov 1, 2011
  10. Barasha Mali

    Thread Starter New Member

    Oct 13, 2010
    15
    0
    This is my Cmndwrt subroutin and i am using a 16*2 LCD
    COMNWRT:mov p2,A
    CLR RS
    CLR P3.5
    SETB P3.6
    ACALL DELAY
    CLR P3.6
    RET
     
  11. Barasha Mali

    Thread Starter New Member

    Oct 13, 2010
    15
    0
    and i am using AT89C52 NOT S
     
  12. Jon Wilder

    New Member

    Oct 25, 2011
    23
    1
    OK..."16*2 LCD" is not a "brand and model". I need the "brand" (who makes the LCD) and model number.

    Second off...with the "CLR RS" instruction you're resetting the LCD unit every time you call your subroutine.
     
Loading...