LED matrix animation

Thread Starter

nsaspook

Joined Aug 27, 2009
13,079
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'.
Rich (BB code):
#define    ROT_SPEED    35    // The highest speed is 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,



                    obj_init(0, TRUE); // clear ram display memory
                    obj1 = obj_init(romid, FALSE); // return ID for rom object into ram id
                    object_scale(obj1, scaling, scaling);    // big to small
                    object_rotate(obj1, rotation);    // CW
                    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.
 

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Hi,

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


Rich (BB code):
   -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,
 

Thread Starter

nsaspook

Joined Aug 27, 2009
13,079
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

Rich (BB code):
typedef struct pixel_t {
        int8_t x, y, v; // display bit x,y and v for pixel value 0=off
        int8_t m_link, n_link; // pixel links m_ id for each pixel, n_ pixel group id for object
} volatile pixel_t; // -1 in the m_link and n_link means end of display data

 
Last edited:

Thread Starter

nsaspook

Joined Aug 27, 2009
13,079
Not clear to me!!
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:
Top