element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Webinars, Training and Events
  • Learn
  • More
Webinars, Training and Events
Forum Midas MC42005A6W-FPTLW3-V2 does not initialize
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Webinars, Training and Events to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 0 replies
  • Subscribers 983 subscribers
  • Views 313 views
  • Users 0 members are here
Related

Midas MC42005A6W-FPTLW3-V2 does not initialize

msabwat
msabwat over 7 years ago

I have been struggling for two weeks to get a SPL780D based LCD to work. I checked the wiring and the code with the timers many times, based on the datasheet and a lot of examples. Alone, and with other people.

 

I use this function to send instructions to the LCD

 

    void send(int rs, int rw, unsigned char db)

    {

        RS = rs;

        RW = rw;

        wait(1000);//26ms

        E = 1;

        wait_k(1000);

        DB0 = (db & (1 << 0)) ? 1:0;

        DB1 = (db & (1 << 1)) ? 1:0;

        DB2 = (db & (1 << 2)) ? 1:0;

        DB3 = (db & (1 << 3)) ? 1:0;

           DB4 = (db & (1 << 4)) ? 1:0;

        DB5 = (db & (1 << 5)) ? 1:0;

        DB6 = (db & (1 << 6)) ? 1:0;

        DB7 = (db & (1 << 7)) ? 1:0;

        wait_k(1000);

        E = 0;

    }

I tried many other delays, and I follow the sequence below :

[![enter image description here][1]][1]

 

Can someone please help me ? Launching the sequence makes the screen blink once, and then I only have two lines of black boxes.

 

I am starting to think it is broken.

 

lcd reference  MC42005A6W-FPTLW3-V2MC42005A6W-FPTLW3-V2

Size : 20*4

  [1]: https://i.stack.imgur.com/1NdEo.png

 

Adding the complete code below:

 

    #define DB0 LATDbits.LATD4

    #define DB1 LATDbits.LATD5

    #define DB2 LATDbits.LATD6

    #define DB3 LATDbits.LATD7 

    #define DB4 LATDbits.LATD8

    #define DB5 LATDbits.LATD9

    #define DB6 LATDbits.LATD10

    #define DB7 LATDbits.LATD11

 

    #define E   LATDbits.LATD3

    #define RS  LATDbits.LATD0

    #define RW  LATDbits.LATD1

 

    void wait_k(int k)

    {

        while (k)

        { k -= 1; }

    }

 

    void    init(void)

    {

        LATDbits.LATD0 = 0;

        LATDbits.LATD1 = 0;

        LATDbits.LATD3 = 0;

        LATDbits.LATD4 = 0;

        LATDbits.LATD5 = 0;

        LATDbits.LATD6 = 0;

        LATDbits.LATD7 = 0;

        LATDbits.LATD8 = 0;

        LATDbits.LATD9 = 0;

        LATDbits.LATD10 = 0;

        LATDbits.LATD11 = 0;

 

        TRISDbits.TRISD0 = 0;

        TRISDbits.TRISD1 = 0;

        TRISDbits.TRISD3 = 0;

        TRISDbits.TRISD4 = 0;

        TRISDbits.TRISD5 = 0;

        TRISDbits.TRISD6 = 0;

        TRISDbits.TRISD7 = 0;

        TRISDbits.TRISD8 = 0;

        TRISDbits.TRISD9 = 0;

        TRISDbits.TRISD10 = 0;

        TRISDbits.TRISD11 = 0;

 

    }

 

    int main ()

    {

        init();

        wait_k(1000);

        send(0, 0, 0b00110000);

 

        wait_k(1000);

        send(0, 0, 0b00110000);

 

 

        wait_k(100);

        send(0, 0, 0b00110000);

 

 

        wait_k(1000);

        send(0, 0, 0b00110000);

 

 

        wait_k(1000);

        send(0, 0, 0b00001000);

 

        wait_k(1000);

        send(0, 0, 0b00000001);

 

        wait_k(1000);

        send(0, 0, 0b00000111);

 

        //----End Of INIT

 

        wait_k(1000);

        send(0, 0, 0b00111000);//Function Set

 

        wait_k(1000);

        send(0, 0, 0b00001110);// Display on

 

        wait_k(1000);

        send(0, 0, 0b00000110);//Entry mode set

 

        wait_k(1000);

        send(1, 0, 0b01010111);//Write 'W'

   

        while(42);

            return 0;

    }

  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube