filling an array


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2010
    Posts
    10

    Default filling an array

    I'm trying to place images on a 128*64 display.

    the output of my picture converter looks like (yes these are empty):

    00, 00, 00, 00, 00, 00, 00, 00
    00, 00, 00, 00, 00, 00, 00, 00
    00, 00, 00, 00, 00, 00, 00, 00

    is there a way i can place those directly into an array (p) like this?

    Code:
    p1=[00, 00, 00, 00, 00, 00, 00, 00]
    p2=[00, 00, 00, 00, 00, 00, 00, 00]
    Thanks in advance. I'm using Microcode Studio as editor.

  2. #2
    Join Date
    Aug 2010
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    I also found a CDATA command, but unfortunately i cannot use this in PicbasicPro?

    Is it possible to use the lookup command to fill arrays?

    Thanks in advance.

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


    Did you find this post helpful? Yes | No

    Default

    Welcome to the forum.

    Yes a lookup table can be used. The best I can do at the moment is point you to an example that has a string and comma seperated values being put into an arrary.
    http://www.picbasic.co.uk/forum/cont...ns-for-Dummies!

    But how do you plan on building the table with data?
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Aug 2010
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    I'm currently using a FOR loop to build the data.
    Just checking the byte position, and then switching lines and left/right.

    Code:
    logopart1:
    for logo = 0 to 255
    lookup logo, [255,255,255,10,10, etc] ,L
    next
    gosub placeandcontroldata
    return
    This works, but I cannot easily import pictures into the code this way...

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


    Did you find this post helpful? Yes | No

    Default

    This works, but I cannot easily import pictures into the code this way...
    I guess I do not understand exactly what you are trying to do.
    Is the picture being sent to the MCU via serial? Or are you hard coding it. or something else?
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Aug 2010
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    I'm making the pictures with a program like Bitmap2LCD, which comes into an .h file.
    I try to import these pictures into my code (copy-paste), and then putting them on the screen of an 128*64 LCD through a databyte. But I cannot get the whole 1024 bytes on the screen with 1 command.

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Beginner View Post
    I'm making the pictures with a program like Bitmap2LCD, which comes into an .h file.
    I try to import these pictures into my code (copy-paste), and then putting them on the screen of an 128*64 LCD through a databyte. But I cannot get the whole 1024 bytes on the screen with 1 command.
    Ok,

    let's make it simple ...

    Open Mikroelektronika ( MKBasicPro - Free edition i.e) Tool " GLCD Bitmap convertor " ...

    you get THAT in your Clipboard :
    Code:
     
    // ------------------------------------------------------ 
    // GLCD Picture name: truck.bmp 
    // GLCD Model: KS0108 128x64 
    // ------------------------------------------------------ 
    unsigned char const truck_bmp[1024] = {
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,128,128, 
    128, 64, 64, 64, 64, 64, 64, 32, 32, 32, 32, 32, 32, 32, 32, 32, 
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 
    32, 32,160,160,160, 96,224,224, 96, 96, 96, 32, 0, 32, 32, 32, 
    32, 32, 32, 32, 32, 32, 0, 0, 64, 64, 64, 0,128, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0,254, 0, 1, 1, 1, 1, 1,253,253,253,253, 
    1, 1, 1, 1, 1, 1,253,253,253,253, 1, 1, 1, 1,253,253, 
    253,253,249,241,225,193,129,193,225,249,253,253,253,253,253, 1, 
    1, 1, 1,253,253,253,253,221,221,221, 29, 17, 1,255, 1, 1, 
    1, 1, 0,254, 1,168, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 
    8, 8, 8, 8, 16,224, 24, 36,132, 0, 2,130, 5, 81, 68,112, 
    160,192, 96, 96, 32, 0,128,128,192,192,192, 64, 0, 0, 0, 0, 
    0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 63, 96, 96, 96,224, 96, 96,127,127,127,127, 
    124,124,124,124, 96, 96,127,127,127,127, 96, 96, 96, 96,127,127, 
    127,127, 97,103,111,127,127,111,103, 99, 97,127,127,127,127, 96, 
    96, 96, 96,127,127,127,127,125,125,125,124,116, 96,127, 64, 64, 
    64,160, 96,252,246, 1, 14, 6, 6, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 66,114, 60, 32, 16, 16, 0, 4, 2, 3, 2, 
    0, 0, 0, 4, 4, 4, 4, 20, 16, 16, 16, 16, 16, 9, 9, 41, 
    112, 32, 67, 5,240,126,174,128, 56, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 
    1, 1,127,127,127,127,255,255,247,251,123,191, 95, 93,125,189, 
    189, 63, 93, 89,177,115,243,229,207, 27, 63,119,255,207,191,255, 
    255,255,255,255,255,255,255,127,127,127,127,127,127,127,127,255, 
    255,255,127,127,125,120,120,120,120,120,248,120,120,120,120,120, 
    120,248,248,224,135, 0, 0, 0, 0, 0, 0, 0, 0,128,240,248, 
    120,188,220, 92,252, 28, 28, 60, 92, 92, 60,120,248,248, 96,192, 
    143,168,216,136, 49, 68, 72, 2,160, 96, 0, 0, 0, 0, 0, 0, 
    0, 0, 0,128,192,248,248,248,248,252,254,254,254,254,254,254, 
    254,254,254,254,254,255,255,255,255,255,246,239,208,246,174,173, 
    169,128,209,208,224,247,249,255,255,252,220,240,127,255,223,255, 
    255,255,255,255,255,254,254,255,255,255,255,255,255,255,254,255, 
    255,255,255,255,255,255,254,254,254,254,254,254,254,254,254,254, 
    254,254,254,254,255,255,255,255,255,255,254,255,190,255,255,253, 
    240,239,221,223,254,168,136,170,196,208,228,230,248,127,126,156, 
    216,224,240,240,242,242,240,177, 32, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 1, 1, 1, 1, 3, 3, 3, 7, 7, 7, 7, 7, 15, 
    15, 15, 7, 15, 15, 15, 7, 7, 15, 14, 15, 13, 15, 47, 43, 43, 
    43, 43, 43, 47,111,239,255,253,253,255,254,255,255,255,255,255, 
    191,191,239,239,239,191,255,191,255,255,255,255,255,255,255,255, 
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 
    255,255,255,255,127,127,127,127,255,255,191,191,191,191,255,254, 
    255,253,255,255,255,251,255,255,255,127,125, 63, 31, 31, 31, 31, 
    31, 31, 63, 15, 15, 7, 7, 3, 3, 3, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 
    1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 
    1, 1, 1, 1, 3, 3, 3, 11, 11, 11, 11, 7, 3, 14, 6, 6, 
    6, 2, 18, 19, 19, 3, 23, 21, 21, 17, 1, 19, 19, 3, 6, 6, 
    14, 15, 15, 7, 15, 15, 15, 11, 2, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
    };
    then, Modify it as is ...

    Code:
    ; ------------------------------------------------------ 
    ; GLCD Picture name: truck.bmp 
    ; GLCD Model: KS0108 128x64 
    ; ------------------------------------------------------ 
    POKECODE @ Startadress,_
     
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,_
     
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,_
     
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,128,128, 
    128, 64, 64, 64, 64, 64, 64, 32, 32, 32, 32, 32, 32, 32, 32, 32, 
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,_
     
    32, 32,160,160,160, 96,224,224, 96, 96, 96, 32, 0, 32, 32, 32, 
    32, 32, 32, 32, 32, 32, 0, 0, 64, 64, 64, 0,128, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,_
     
    0, 0, 0, 0, 0,254, 0, 1, 1, 1, 1, 1,253,253,253,253, 
    1, 1, 1, 1, 1, 1,253,253,253,253, 1, 1, 1, 1,253,253, 
    253,253,249,241,225,193,129,193,225,249,253,253,253,253,253, 1, 
    1, 1, 1,253,253,253,253,221,221,221, 29, 17, 1,255, 1, 1,_ 
     
    1, 1, 0,254, 1,168, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    8, 8, 8, 8, 16,224, 24, 36,132, 0, 2,130, 5, 81, 68,112, 
    160,192, 96, 96, 32, 0,128,128,192,192,192, 64, 0, 0, 0, 0, 
    0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,_
     
    0, 0, 0, 0, 0, 63, 96, 96, 96,224, 96, 96,127,127,127,127, 
    124,124,124,124, 96, 96,127,127,127,127, 96, 96, 96, 96,127,127, 
    127,127, 97,103,111,127,127,111,103, 99, 97,127,127,127,127, 96, 
    96, 96, 96,127,127,127,127,125,125,125,124,116, 96,127, 64, 64,_
     
    64,160, 96,252,246, 1, 14, 6, 6, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 66,114, 60, 32, 16, 16, 0, 4, 2, 3, 2, 
    0, 0, 0, 4, 4, 4, 4, 20, 16, 16, 16, 16, 16, 9, 9, 41, 
    112, 32, 67, 5,240,126,174,128, 56, 0, 0, 0, 0, 0, 0, 0,_
     
    0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 
    1, 1,127,127,127,127,255,255,247,251,123,191, 95, 93,125,189, 
    189, 63, 93, 89,177,115,243,229,207, 27, 63,119,255,207,191,255,
    255,255,255,255,255,255,255,127,127,127,127,127,127,127,127,255,_
     
    255,255,127,127,125,120,120,120,120,120,248,120,120,120,120,120, 
    120,248,248,224,135, 0, 0, 0, 0, 0, 0, 0, 0,128,240,248, 
    120,188,220, 92,252, 28, 28, 60, 92, 92, 60,120,248,248, 96,192, 
    143,168,216,136, 49, 68, 72, 2,160, 96, 0, 0, 0, 0, 0, 0,_
     
    0, 0, 0,128,192,248,248,248,248,252,254,254,254,254,254,254, 
    254,254,254,254,254,255,255,255,255,255,246,239,208,246,174,173,
    169,128,209,208,224,247,249,255,255,252,220,240,127,255,223,255, 
    255,255,255,255,255,254,254,255,255,255,255,255,255,255,254,255,_
     
    255,255,255,255,255,255,254,254,254,254,254,254,254,254,254,254, 
    254,254,254,254,255,255,255,255,255,255,254,255,190,255,255,253, 
    240,239,221,223,254,168,136,170,196,208,228,230,248,127,126,156, 
    216,224,240,240,242,242,240,177, 32, 0, 0, 0, 0, 0, 0, 0,_
     
    0, 0, 0, 1, 1, 1, 1, 3, 3, 3, 7, 7, 7, 7, 7, 15, 
    15, 15, 7, 15, 15, 15, 7, 7, 15, 14, 15, 13, 15, 47, 43, 43, 
    43, 43, 43, 47,111,239,255,253,253,255,254,255,255,255,255,255, 
    191,191,239,239,239,191,255,191,255,255,255,255,255,255,255,255,_
     
    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
    255,255,255,255,127,127,127,127,255,255,191,191,191,191,255,254, 
    255,253,255,255,255,251,255,255,255,127,125, 63, 31, 31, 31, 31, 
    31, 31, 63, 15, 15, 7, 7, 3, 3, 3, 0, 0, 0, 0, 0, 0,_
     
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 
    1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,_
     
    1, 1, 1, 1, 3, 3, 3, 11, 11, 11, 11, 7, 3, 14, 6, 6, 
    6, 2, 18, 19, 19, 3, 23, 21, 21, 17, 1, 19, 19, 3, 6, 6, 
    14, 15, 15, 7, 15, 15, 15, 11, 2, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 
    ;
    note the code extender "_" that must appear every 256 characters or less.

    so, once every 64 values ( 4 lines ) make it easy to do ...

    You retrieve your values with a

    Code:
     
    FOR pointer = 0 to 1024
     PEEKCODE ( Startadress + pointer ), value
     GoSub GLCDPrint_sub ; 
    Next Pointer
    .
    .
    .
    Isn't it simple ???

    BUT ... remember it is YOU to write the " GLCDPrint_sub " as PBP do not have a GLCD library ...

    Alain
    Last edited by Acetronics2; - 11th August 2010 at 14:31.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Members who have read this thread : 1

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