GLCD Bitmap Images

Anobium
2014-06-19
2014-06-28
  • Anobium
    Anobium
    2014-06-19

    I have ported the GLCD eeManager to provides an easy way to load font and image data into eeprom and into GCB and CCGB.

    To load in image it is as simple as glcdImage 0, 0, 9 when the three paramaters are x and y position and the 'object' to displayed. The smaller the image, the faster. You can image load and then do 'other' stuff. :-)

    For Fonts I will have to give this some more thought to ensure we have backwards compatibility, but, currently I am thinking you have a few 'defines' and then the GLCD driver will do the rest. If the variable default font is equal zero the you get the existing GLCD fontset. You can define and extend the font set listed below with ease.

    # DEFINE fntLCD               = 1
    # DEFINE fntSans_Regular      = 2
    # DEFINE fntSans_Regular_Bold = 3
    # DEFINE fntLucida 5*5        = 4
    # DEFINE fntTimes LCD 15*16   = 5
    defaultfnt = fntSans_Regular
    

    The images are simply to create and very easy to install. You will need an EEPROM for storage via I2C. The loading process was the hardest part to complete.

    If anyone is interested in testing - please let me know. You will need a GLCD, an EEPROM and some pictures.

     
    Last edit: Anobium 2014-06-19
  • Do you have more detail somewhere?
    This looks very interesting but I don't understand how the .bmp gets converted into a binary file and then loaded into the EEPROM.
    And how is the file indexed so the beginning address of the .bmp binary file gets associated with the numerical number in the #define?

     
    • Anobium
      Anobium
      2014-06-19

      Here are the set of commands. Not a lot to learn. The code hides the complexity.

      ' These load and test the eeprom dataset. Comment out after initial load.
      
      'Three command
          loadEEPROM
          validateEEPROM
          formatEEPROM
      
      'Paint at image at x,y from EEPROM location 6   
      GLCDImage 0, 0, imgPCB
          GLCDDrawString 70, 2, "KS0108"
          GLCDDrawString 70, 14, "Graphic"
          GLCDDrawString 70, 30, "GLCD"
          Box 62, 26, 127, 43
          for xx = 102 to 127 step 5
             Line 102, 26, xx, 43
          next xx
          for xx = 78 to 110 step 8
             Circle xx, 54, 8, 1, 0
          next xx
          wait 5 s
          GLCDCLS
      
      'Paint at image at x,y from EEPROM location 7
      GLCDImage 8, 8, imgDino
          wait 5 s
          GLCDCLS
      
      'Paint at image at x,y from EEPROM location 8
          GLCDImage 0, 0, imgGCB
          GLCDDrawString 80, 34, "Great"
          GLCDDrawString 80, 44," Cow"
          GLCDDrawString 80, 54,"Basic"
      
       
      Last edit: Anobium 2014-06-23
  • Anobium
    Anobium
    2014-06-21

    Progress - I have all the font handling sorted. Now completing the testing - this will take a few days as this is a lot to test.

    A few asks from the community.

    1. I would like a code reviewer / tester. I want to ensure this works.

    2. Anyone got Visual Basic 6? I have been given the source software used to load the images and fonts. A tweak would make it a lot better.

    Let me know if you can help.

     
  • Anobium
    Anobium
    2014-06-22

    Progress - I have posted a video showing usage and the code running.

    See http://www.youtube.com/watch?v=o8UtGoRI308

     
  • Anobium
    Anobium
    2014-06-23

    Progress - The Image load, image verify and EEPROM code is complete. I have tested with multiple objects in the EEPROM, small images (of less than 77 pixels) up to large images of 12864 pixels.

    You can easily add this code to your projects and load images from external EEPROM. It is also possible to load from internal EEPROM where the size of the image is within the practical limits.

    I have a package for testing.

    Anobium

     
  • Anobium
    Anobium
    2014-06-28

    Progress - all done. Images and Fonts working.

    New commands.
       1. To show an image object. GLCDImage 0, 0, imgAnobium
       2. Change the font.        GLCDfntDefault = fntLucida_5x5, then use the standard GLCD command GLCDDrawString 0, 0,  "Lucida"
    

    Notes:

    To load the EEPROM YOU NEED the Hardware Serial to be operational as these functions use the Serial Interrupt Handlers to load the EEPROM. You only need this during the loading of the EEPROM.
    On Interrupt UsartRX1Ready Call readUSART

    There is an interrupt handler is required for glcd_ImagesandFonts_addin.h when calling GLCDImageandFonts_ManageEEPROM. If you are not using the EEPROM update routines this interrupt hanlder is not required. You can disable the interrupt after this point if you are not using the HSERial port
    On Interrupt UsartRX1Ready Ignore

    Images

    You must setup as your database in your EEPROM as defined by eeManager - you MUST change this in your code.
    'My Objects are:
    #define fntLCD 1
    #define imgAnobium 2
    #define imgGCB 3
    #define imgBatery_Mon 4
    #define img128aucasaurus 5
    #define imgManLooking 6
    #define imgpcb 7
    #define fntLCD_6x8 8
    #define fntLucida_5x5 9
    #define fntSans_Regular 10
    #define fntSans_Bold 11
    #define fntTimes_LCD_15x16 12

    Fonts

    To change your default font, choose a font from the objects!

      GLCDfntDefault = fntGCB
    
      ' show and image object
      GLCDImage 0, 0, imgAnobium
    
      ' set a new font
      GLCDfntDefault = fntLucida_5x5
    
      ' set the character spacing, if this is greater than zero the characters get closer.
      GLCDfntWidthAdjustment = 0
    
      ' another example, a large font and 3 pixels tighter.
      GLCDfntDefault = fntTimes_LCD_15x16
      GLCDfntWidthAdjustment = 3
      GLCDDrawString 0, 0,  "Times LCD"
      GLCDDrawString 0, 16,  "15*16"
      GLCDDrawString 0, 30,  "Type 3"
      wait 2 s
      GLCDCLS
    

    Anobium

     
    Last edit: Anobium 2014-06-28