LED matrix animation

Discussion in 'Embedded Systems and Microcontrollers' started by nsaspook, Mar 27, 2013.

  1. nsaspook

    Thread Starter AAC Fanatic!

    Aug 27, 2009
    2,908
    2,168
    This project is the prototype for a simple graphics (sprites) display for a process controller. The hardware is the standard X,Y crossbar selection scanning method and uses the textbook dot matrix transformations to move the objects around the screen. This has the main display code with echo back stubs instead of the real RS-232 light-link code functions. The CTMU module will provide the function and mode switching with small touch pads. (short wire coils are used here)

    Nothing complex or new but here it is with a (work in progress) demo.

    http://flic.kr/p/e51LFv
    http://flic.kr/p/e6xFR2

    Source code: https://github.com/nsaspook/matrix_led

    The object (slowed to be easily visual) operations seen in the video.

    Pixel X,Y,on/off,pixel_id,object_id defines for ROM object '0'.
    Code ( (Unknown Language)):
    1.  
    2. #define    ROT_SPEED    35    // The highest speed is 1
    3.  
    4.     -1, -3, 1, 0, 0,
    5.     0, -2, 0, 1, 0,
    6.     1, -1, 1, 2, 0,
    7.     2, 0, 1, 3, 0,
    8.     -1, 0, 1, 4, 0,
    9.     1, 1, 1, 5, 0,
    10.     0, 2, 1, 6, 0,
    11.     -1, 3, 1, 7, 0,
    12.     -2, 0, 1, 8, 0,
    13.  
    14.  
    15.  
    16.                     obj_init(0, TRUE); // clear ram display memory
    17.                     obj1 = obj_init(romid, FALSE); // return ID for rom object into ram id
    18.                     object_scale(obj1, scaling, scaling);    // big to small
    19.                     object_rotate(obj1, rotation);    // CW
    20.                     object_trans(obj1, 3, 3);    // move to near center
    The graphic objects are in a ROM section with each assigned a number for an ID handle. You can select the object to be copied into the display memory where the new memory object will be assigned a ID handle for any object movement operations.
     
    absf likes this.
  2. RRITESH KAKKAR

    Senior Member

    Jun 29, 2010
    2,831
    89
    Hi,

    what are these matrix dat used for???? and how?


    Code ( (Unknown Language)):
    1.    -1, -3, 1, 0, 0,     0, -2, 0, 1, 0,     1, -1, 1, 2, 0,     2, 0, 1, 3, 0,     -1, 0, 1, 4, 0,     1, 1, 1, 5, 0,     0, 2, 1, 6, 0,     -1, 3, 1, 7, 0,     -2, 0, 1, 8, 0,
     
  3. nsaspook

    Thread Starter AAC Fanatic!

    Aug 27, 2009
    2,908
    2,168
    They define the shape of the object centered at a 0,0. Each pixel is defined by it's position on the grid. For a small display of simple objects it's not too inefficient compared to bitmap methods.

    -1, -3, 1, 0, 0 pixel at x -1, y -3, pixel is on, pixel number 0, pixel in object 0

    Code ( (Unknown Language)):
    1. typedef struct pixel_t {
    2.         int8_t x, y, v; // display bit x,y and v for pixel value 0=off
    3.         int8_t m_link, n_link; // pixel links m_ id for each pixel, n_ pixel group id for object
    4. } volatile pixel_t; // -1 in the m_link and n_link means end of display data
    [​IMG]
    [​IMG]
     
    Last edited: Mar 30, 2013
  4. RRITESH KAKKAR

    Senior Member

    Jun 29, 2010
    2,831
    89
    Not clear to me!!
     
  5. nsaspook

    Thread Starter AAC Fanatic!

    Aug 27, 2009
    2,908
    2,168
    The array is a very simple database of pixel objects.
    Read about vector graphics to understand the concepts.
    http://en.wikipedia.org/wiki/Vector_graphics

    I only use the dot primitive not the line drawing or higher function primitives but the manipulation operations are the same at the pixel level.

    How rotation works: http://en.wikipedia.org/wiki/2D_computer_graphics#Rotation

    A good book to learn about computer graphics is this: http://www.amazon.com/Principles-Interactive-Computer-Graphics-McGraw-Hill/dp/0070463387

    This was my student textbook on the subject many years ago.

    Bob Sproull is a true pioneer on the subject.
    http://en.wikipedia.org/wiki/Bob_Sproull
     
    Last edited: Mar 31, 2013
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    Cool project spook. This is something I've always wanted to do "just because."
     
Loading...