Max7219 question


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Posts
    8

    Default Max7219 question

    HI list, I have a small problem with a max7219 I was hoping to get some help with.
    I have 8 led's connected to dig0 as the common and segments a-g and the decimal point connected to individual leds not a 7 segment display.

    All I'm trying to do is count from 0 to 255 in binary on the leds so I can learn the chip. It counts properly but doesn't shut off leds while it counts. for example at 0 all led's are off. at 1 d0 is on but when it gets to 2 it turns on d1 and keeps d0 on also. displaying the number 3.... as it goes from 2,4,8,16,32 ect I can see the next power led turn on but it's not turning the others off while counting. kind of latching the values.
    I would expect that when sending the number 8 to it that d3 would be on and d2,d1,d0 would be off ect. but they stay on. showing 15

    Could someone pls look at my code and point me in the right direction?

    everything else works ok on it.
    I'm just posting the problem section, all variable setups and port assignments are ok

    Thank you



    dig0 var word
    cr var byte



    Mainloop:
    Dig0 = $0100 'select digit 0

    GoSub DecodeMode
    GoSub ShutDownMode
    GoSub ScanLimit
    GoSub Intensity

    Dispig0 = $0100 'select digit 0

    For CR=0 To 255
    Dig0 = Dig0 | CR
    Low Load
    DelayMS 1
    shiftout Dout,Clk,msbfirst,[Dig0\16] 'no decode
    DelayMS 1
    High Load
    DelayMS 200
    Next
    GoTo Disp




    DecodeMode:
    Low Load
    shiftout Dout,Clk,msbfirst,[$0900\16] 'no decode
    High Load
    Return

    ShutDownMode:
    Low Load
    shiftout Dout,Clk,msbfirst,[$0C01\16] '$0C is shut down mode register and $01 = on $00 = off
    High Load
    Return


    ScanLimit:
    Low Load
    Shiftout Dout,Clk,msbfirst,[$0B00\16] '$0B scan limit register(#of led lines) we have only one so Dig 0
    High Load
    Return


    Intensity:
    Low Load
    Shiftout Dout,Clk,msbfirst,[$0A09\16] '$0A intensity register $00 is min and $0F is max
    High Load
    Return

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


    Did you find this post helpful? Yes | No

    Default

    I have not used this chip but this may held.
    http://www.ezl.com/~rsch/MAX7219-21%...y%20Driver.pdf
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jamied View Post
    ...All I'm trying to do is count from 0 to 255 in binary on the leds so I can learn the chip. It counts properly but doesn't shut off leds while it counts.
    By ORing Dig0 with CR, it keeps any bits that were already in the variable.
    Code:
    For CR=0 To 255
        Dig0 = Dig0 | CR
        Low Load
        DelayMS 1
        shiftout Dout,Clk,msbfirst,[Dig0\16]  'no decode
        DelayMS 1
        High Load
        DelayMS 200
    Next
    Might work better with Dig0 as the FOR variable, and skip the OR.

    And it looks like you are using PROTON basic.
    They have a PROTON forum here ...
    http://www.picbasic.org/forum
    <br>
    DT

  4. #4
    Join Date
    Dec 2008
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Thanks!

    Getting rid of the OR solved it!! Thank you.
    I had to do some digging to find out that the pipe was an OR

    Thanks again!


    Jamie

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jamied View Post
    Getting rid of the OR solved it!! Thank you.
    I had to do some digging to find out that the pipe was an OR

    Thanks again!


    Jamie
    Not sure where you did you digging, but the Math Operators section in the Pic Basic manual has all kinds of things to dig in
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Max7219 cascading problem ?
    By iugmoh in forum General
    Replies: 2
    Last Post: - 13th December 2020, 10:53
  2. MAX7219 Helping Hand Please
    By isaac in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 14th February 2014, 15:07
  3. 7 Segment Displays and MAX7219
    By Bill Legge in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 31st October 2010, 18:30
  4. Shorter Subroutines for MAX7219
    By exelanoz in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th March 2007, 11:35
  5. Please answer my first question
    By John_001 in forum Off Topic
    Replies: 1
    Last Post: - 15th September 2006, 06:49

Members who have read this thread : 0

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