EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / JHD162A-LCD_4BitDriver-v1

JHD162A-LCD_4BitDriver-v1

|

Microcontroller › 8051 › JHD162A-LCD_4BitDriver-v1

  • This topic has 0 replies, 1 voice, and was last updated 14 years ago by VEDANG_JADHAV.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • November 24, 2011 at 9:49 pm #1415
    VEDANG_JADHAV
    Participant

    EN EQU P0.3
    RW EQU P0.2
    RS EQU P0.1

    ORG    0000H
    CLR    RW
    SETB RW
    CLR    RW
    CLR    RS
    SETB RS
    CLR    RS
    CLR    EN
    SETB EN
    CLR    EN
    MOV DPTR,#INITIALIZE_CONFIG_4bit
    LCALL WRITE_COMMAND
    MAIN_PROGRAM:
    MOV DPTR,#DISPLAYDATA
    LCALL WRITE_DATA
    MOV    DPTR,#CURSOR_POSITION
    LCALL WRITE_COMMAND
    LJMP MAIN_PROGRAM

    WRITE_DATA:
    SETB RS
    LCALL ACCESS_DATA
    MOV DPTR,#CLEAR_CODE
    LCALL WRITE_COMMAND
    RET
     
    WRITE_COMMAND:
    CLR RS
    LCALL ACCESS_DATA
    RET

    ACCESS_DATA:
    CLR    A
    MOVC A,@A+DPTR
    CJNE A,#0FFH,SKIPRESET
    LCALL DELAY2
    RET
    SKIPRESET:
    LCALL WRITE_TEXT
    INC    DPTR
    LJMP ACCESS_DATA

    WRITE_TEXT:        ;4BIT NIBBLE LATCHING [twice]
    MOV    R7,A
    LCALL HIGH4BITS
    LCALL LATCH_DATA
    LCALL DELAY1
    MOV    A,R7
    LCALL LOW4BITS
    LCALL LATCH_DATA
    LCALL DELAY1
    CLR    A
    RET

    LATCH_DATA:
    SETB EN
    CLR EN
    RET    
        
    LOW4BITS:         ;BIT BANG LSB
    MOV C,ACC.3
    MOV P0.7,C
    MOV C,ACC.2
    MOV P0.6,C
    MOV C,ACC.1
    MOV P0.5,C
    MOV C,ACC.0
    MOV P0.4,C
    RET

    HIGH4BITS:        ;BIT BANG MSB
    MOV C,ACC.7
    MOV P0.7,C
    MOV C,ACC.6
    MOV P0.6,C
    MOV C,ACC.5
    MOV P0.5,C
    MOV C,ACC.4
    MOV P0.4,C
    RET

    DELAY1:
    MOV R3,#01H
    Divisioned_loop1:
    Mov R4 , #15H
    Mini_wait1:
    djnz r4,Mini_wait1
    djnz r3,Divisioned_loop1
    RET

    DELAY2:
    MOV R3,#010H
    Divisioned_loop2:
    Mov R4 , #0FFH
    Mini_wait2:
    djnz r4,Mini_wait2
    djnz r3,Divisioned_loop2
    RET

    LCD_POWERLOAD_DELAY:
    MOV R3,#0FFH
    Divisioned_loop3:
    Mov R4 , #0FFH
    Mini_wait3:
    djnz r4,Mini_wait3
    djnz r3,Divisioned_loop3
    RET

    INITIALIZE_CONFIG_4bit:
    DB 028H,0CH,06H
    DB 0FFH

    INITIALIZE_CONFIG_8bit:
    DB 038H,0CH,06H
    DB 0FFH

    CLEAR_CODE:
    DB 01H
    DB 0FFH

    shift_disp_right_code:
    DB 04H
    DB 0FFH

    shift_disp_left_code:
    DB 07H
    DB 0FFH

    CURSOR_POSITION:
    DB 080H
    DB 0FFH

    DISPLAYDATA:
    DB ‘BLUETOOTH SCAN #’
    DB 0FFH

    END

  • Author
    Posts
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • What is involved to convert a small town to fiber optic? December 12, 2025
  • Droplet1 December 12, 2025
  • Help to Identify capacitor fault December 12, 2025
  • Dog fence help December 12, 2025
  • EEPROM not being written or read on dsPIC30F2010 December 12, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise