Moving a led from 8x8 led matrix

Discussion in 'Programmer's Corner' started by gabi68, Mar 8, 2011.

  1. gabi68

    Thread Starter New Member

    May 4, 2009
    8
    0
    Hi,

    I need a piece of code - in Mikrobasic - to move a led (from a 8x8 led matrix). I will use a pic16F887 and I will try to simulate that in Proteus. Can somebody help me with that.
    My setup is:
    1- LED-Matrix Row pins to PORTA
    2- LED-Matrix Column pins to PORTB 330Ohm resistors.
    What I wrote until now is like that
    How I can wrote a procedure to automate this procedure?

    Thank you
    Gabi
     
  2. gabi68

    Thread Starter New Member

    May 4, 2009
    8
    0
    Anyone ....
     
  3. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    Move a LED?

    A procedure to automate the procedure?

    Maybe you could get a friend to help you with the language. The main question is what do you actually want to do?
     
  4. gabi68

    Thread Starter New Member

    May 4, 2009
    8
    0
    By moving I mean lit up a led or more by a pattern. I want to see a snippet of code in Mikrobasic which can scroll a series of led's in order to understand how it working. What I wrote in my fisrt message it is a simple pattern which lit up a diagonal of a 8x8 matrix starting from upper left corner.
    What I want it is to scroll a pattern to a 8x8 matrix.
    I hope now it is aliitle bit clear.

    Many thanks
    Gabi
     
    Last edited: Mar 9, 2011
  5. gabi68

    Thread Starter New Member

    May 4, 2009
    8
    0
    Anyoooone....
     
  6. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    What about a schematic, so we know what you are dealing with...
     
  7. gabi68

    Thread Starter New Member

    May 4, 2009
    8
    0
    Here you go:
     
  8. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    I think I would have done something like this. See att. And clocked the CD4017 at a fast pace. The LED is blinking, but real fast, so the eye and brain think it is permanent on.
     
  9. gabi68

    Thread Starter New Member

    May 4, 2009
    8
    0
    Thank you for that, but what I need it is a snippet of code which can do that in mikrobasic if itis possible.

    Thank you
    Gabi
     
  10. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    I don't know Mikrobasic.

    Your LEDs won't be very bright if you use 330 ohm resistors. Remember that each one will be on only 1/8 of the time. Maybe 120 ohms would be about right. Even then, the lights will be rather dim.

    It seems as if Port A is the current source, and connects to LED anodes, and Port B is the current sink, and connects to the cathodes via a resistor per 8 LEDs.

    What you need to do in this case is have 8 bytes which will be put onto Port B in turn, with a brief delay that keeps you from seeing any flicker; maybe 1KHz, so you get a full scan in 1/125 sec. For each byte on Port B, you set one output pin of Port A high. A given LED will be "on" if the corresponding bit that's sent to Port B is low.

    To scroll in one dimension, you would shift the 8-byte array so that each byte goes up or down one position, and a new byte gets added to the end of the array.

    To scroll in the other dimension, you would need to rotate each byte in the array left or right, and for each byte, add a new highest or lowest bit to replace the bit which will be lost at the far end of the byte.
     
  11. gabi68

    Thread Starter New Member

    May 4, 2009
    8
    0
    Hi,

    Can I have a snippet with this tehnique in your preffered programming language?

    Thanks
    Gabi
     
  12. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    I don't know Mikrobasic.

    Your LEDs won't be very bright if you use 330 ohm resistors. Remember that each one will be on only 1/8 of the time. Maybe 120 ohms would be about right. Even then, the lights will be rather dim.

    It seems as if Port A is the current source, and connects to LED anodes, and Port B is the current sink, and connects to the cathodes via a resistor per 8 LEDs.

    What you need to do in this case is have 8 bytes which will be put onto Port B in turn, with a brief delay that keeps you from seeing any flicker; maybe 1KHz, so you get a full scan in 1/125 sec. For each byte on Port B, you set one output pin of Port A high. A given LED will be "on" if the corresponding bit that's sent to Port B is low.

    To scroll in one dimension, you would shift the 8-byte array so that each byte goes up or down one position, and a new byte gets added to the end of the array.

    To scroll in the other dimension, you would need to rotate each byte in the array left or right, and for each byte, add a new highest or lowest bit to replace the bit which will be lost at the far end of the byte.

    This might be useful to you:
    http://www.instructables.com/id/8x8-LED-matrix/
     
Loading...