MM5451 35way LED driver example


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2006
    Location
    Glasgow, Scotland
    Posts
    26

    Default MM5451 35way LED driver example

    Hi There, I hope this example proves to be helpful to someone. I know that this forum has helped me a lot, and I offer this example in way of a thank you.

    I use this to drive a 5 by seven segment digital display via a two wire link. It can be modified to provide digital outputs to drive 35 relays for example.

    Should anyone need any help using this please don't hesitate to get in touch.

    The routines should be easily adapted to any type of pic using picbasic pro.

    'MM5451YN Setup
    ' output portA.2 'CS/Load pin low to enable clock high to load data to dac output
    output portA.0
    output portA.1
    symbol DCK=portA.1
    symbol DDA=portA.0
    symbol PSU=portb.7

    COUNT2 var word
    digout var byte
    DAout var word
    y var byte

    start:
    high psu
    pause 1500
    low psu
    goto main

    Main:
    for daout = 0 to 9999
    gosub tablex
    next
    goto Main
    ' ----------------------------------------------------------------------------
    ' Get Value and output to MM5451 display driver
    ' ----------------------------------------------------------------------------
    Display:
    shiftout DDA,DCK,0,[Digout\7]
    return

    tablex:
    gosub pulse
    for y = 4 to 0 step-1 'gfedcba display segments
    if DAout dig y = 0 then digout = %0111111
    if DAout dig y = 1 then digout = %0000110
    if DAout dig y = 2 then digout = %1011011
    if DAout dig y = 3 then digout = %1001111
    if DAout dig y = 4 then digout = %1100110
    if DAout dig y = 5 then digout = %1101101
    if DAout dig y = 6 then digout = %1111101
    if DAout dig y = 7 then digout = %0000111
    if DAout dig y = 8 then digout = %1111111
    if DAout dig y = 9 then digout = %1101111
    gosub display
    next
    return

    pulse:
    high DDA
    high DCK
    pause 100
    low DCK
    low DDA
    return
    end

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    It is a nice behavior that people are sharing their work here just because they had some help.

    J_norrie,

    Here is a code for your TableX subroutine that will reduce your code size to half of it.

    Code:
    <font color="#000000">TableX:
        <font color="#000080"><b>GOSUB </b></font>pulse
        
        <font color="#000080"><b>FOR </b></font>y = <font color="#FF0000"><b>4 </b></font><font color="#000080"><b>TO </b></font><font color="#FF0000"><b>0 </b></font><font color="#000080"><b>STEP</b></font>-<font color="#FF0000"><b>1 </b></font><font color="#000080"><i>'gfedcba display segments
            </i><b>LOOKUP </b></font>DAOut <font color="#000080"><b>DIG </b></font>y,[<font color="#FF0000"><b>%0111111</b></font>,<font color="#FF0000"><b>%0000110</b></font>,<font color="#FF0000"><b>%1011011</b></font>,<font color="#FF0000"><b>%1001111</b></font>,<font color="#FF0000"><b>%1100110</b></font>,<font color="#FF0000"><b>%1101101</b></font>,<font color="#FF0000"><b>%1111101</b></font>,<font color="#FF0000"><b>%0000111</b></font>,<font color="#FF0000"><b>%1111111</b></font>,<font color="#FF0000"><b>%1101111</b></font>],DigOut 
            <font color="#000080"><b>GOSUB </b></font>display
        <font color="#000080"><b>NEXT
        
        RETURN
    
    
    END
    </b></font>
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Thank you J_norrie.

    Someone helps you, help someone else.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Jun 2006
    Location
    Glasgow, Scotland
    Posts
    26


    Did you find this post helpful? Yes | No

    Smile mm5451 improvement

    Thanks Sayzer once again for your assistance.

    cheers john

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 06:14
  2. Free Project - 245 LED Display
    By T.Jackson in forum Code Examples
    Replies: 221
    Last Post: - 16th August 2009, 04:59
  3. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 20:19
  4. Alegro 6276 LED driver?
    By [email protected] in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd August 2007, 00:25
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts