Storing information for lcd data

This is a discussion on Storing information for lcd data within the C Programming forums, part of the General Programming Boards category; Hello! I want to display this image on my lcd. There is a format with which i can store this ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    30

    Storing information for lcd data

    Hello!

    I want to display this image on my lcd.

    There is a format with which i can store this image in my memory. It is .TNT

    This format descibes this image via this way(All the numbers are in HEX)

    WWHHDATA...

    The WW is in hex the width of the image.
    The HH is the height of the image.
    And then the data are being displayed form bottom-left to right and then one page(8 pixels) up from left to right and so on...

    My question is how can i store this long number in memory and be able to call it. I will need to call the data later, in teams of two bytes.

    The number could be for example (for this image)
    0F11300FF80B0

    0F = 15 pixels width
    11 = 16 pixels height
    bit 76543210
    00 = 00000000 first column bottom-left
    FF =11111111 2nd column
    80 = 10000000 3rd column
    B0 =10110000 4th column

    Try to check this in the picture

    So, How can i store this long number in my memory so as to as easier as possible to use it later?

    An idea. (Maybe silly.i am new yet) Could i do it with 2-dimension array and have a function with two parameters passing inside?(width, height=number of pages). Each variable in the array would be a 2digit Hex. (Ex. 4F) and with some loops to display the data)
    Attached Images Attached Images  

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Why not just store the image as an array of bytes?
    Code:
    #include <stdio.h>
    
    void send(const unsigned char *buffer, size_t size)
    {
        printf("width = %d, height = %d\n", buffer[0], buffer[1]); /* for PC demo */
        while(size-- > 0)
        {
            printf("%02X%c", *buffer++, size == 0 ? '\n' : ' ');   /* for PC demo */
        }
    }
    
    int main(void)
    {
        unsigned char data[] = { 0x0F, 0x10, 0x00, 0xFF, 0x80, 0xB0 };
        send(data, sizeof(data)/sizeof(*data));
        return 0;
    }
    
    /* my output
    width = 15, height = 16
    0F 10 00 FF 80 B0
    */
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. data structure design for data aggregation
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 05-20-2008, 06:43 AM
  2. Replies: 3
    Last Post: 04-18-2008, 10:06 AM
  3. Storing Data into a file
    By Sridar in forum C++ Programming
    Replies: 2
    Last Post: 05-29-2005, 07:03 PM
  4. can't insert data into my B-Tree class structure
    By daluu in forum C++ Programming
    Replies: 0
    Last Post: 12-05-2002, 05:03 PM
  5. Storing information in a file
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 11-18-2001, 08:05 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21