Menu

GLCD/BMP issue

Anobium
2022-11-13
2022-11-13
  • Anobium

    Anobium - 2022-11-13

    Reporting via YouTube

    I can not put my images on the GLCD ,images there are on the demos are great and working fine , but the converter process from .bmp file to a table does not work , the converter tool in GCB seems working only in linux ?!!!!! every time comes an error ... table not found.... this image converter 565 must be a trial or something (a couple of buttons are missing at the top ) gcb gives an error always everything is according the instructions ... if you could make an extra video explaining this converter process it would be wonderfull. thank you Mr. Venn .

     #chip 18f2455,8
     #config MCLRE= ON
     #option explicit
    
     #include <glcd.h>
    
    
      ; ----- Define GLCD Hardware settings
      #define GLCD_TYPE GLCD_TYPE_SSD1306
      #define GLCD_I2C_Address 0x78
      #define GLCD_PROTECTOVERRUN
    
    
       #include <..\converters\image1.bmp>
    
    
      #define HI2C_BAUD_RATE 400
      #define HI2C_DATA PORTb.0
      #define HI2C_CLOCK PORTb.1
        'I2C pins need to be input for SSP module when used on Microchip PIC device
      Dir HI2C_DATA in
      Dir HI2C_CLOCK in
    
    
      GLCDCLS
    
      CCount = 0
      dim longNumber as long
      longNumber = 123456 ' max value = 4294967290
      dim wordNumber as Word
      dim outstring as string
      wordNumber = 0
      byteNumber = 0
    
      dim lengthofpicture, ram_index as word
      Dim BYTENUMBER, WIDTHOFPICTURE, HEIGHTOFPICTURE, ORGCHARLOCX, CURRCHARVAL, FIRSTPASS, CHARLOCY, CURRCHARROW, CHARLOCX, CCOUNT as Byte
    
    
      ' Display a BMP file
      GLCDCLS
    
    
      ReadTable image1, 0, lengthofpicture
      ReadTable image1, 1, widthofpicture
      ReadTable image1, 2, heightofpicture
    
    
    
      lengthofpicture =  heightofpicture / 8
      lengthofpicture = [word]lengthofpicture * widthofpicture
    
      ' For BMP that fit the display simple write the data to the screen
    
      CharLocX = 0                       ' specify X pos for BMP
      CharLocY = 0                       ' specify Y pos for BMP.  For buffer any valid Y, for non-buffered 0,8,16, 24 etc...
      OrgCharLocX = CharLocX              ' specify X orginisal X pos
      firstpass = true                    ' specify this is the first pass
    
      for  ram_index =  3 to lengthofpicture + 3         ; start at third byte and finish at the end
    
    
               ReadTable image1,  ( ram_index ), CurrCharVal  ' read data
    '           
    
                if ( ( ram_index - 3 ) % widthofpicture ) = 0  and firstpass = false then     ' change position for new line of data
                   CharLocY = CharLocY + 8
                   CharLocX = OrgCharLocX
                end if
    
                        For CurrCharRow = 0 to 7
                            if ( CharLocY + CurrCharRow < GLCD_HEIGHT ) and ( CharLocX < GLCD_WIDTH ) then
                                If CurrCharVal.0 = 0 Then
                                   PSet CharLocX , CharLocY + CurrCharRow, GLCDBackground
                                Else
                                   PSet CharLocX , CharLocY + CurrCharRow, GLCDForeground
                                End If
                            end if
                            Rotate CurrCharVal Right
                        Next
    
                firstpass = false                                          ' now this is NOT the first pass
                CharLocX++                                                 ' increment the X pos
      next
    
    
    
      wait 2 s
      SetContrast_SSD1306 ( 10 )
      wait 2 s
      startscrollright_SSD1306(0x00, 0x0F)
      wait 3 s
      startscrollleft_SSD1306(0x00, 0x0F)
      wait 3 s
      startscrolldiagright_SSD1306(0x00, 0x0F)
      wait 3 s
      startscrolldiagleft_SSD1306(0x00, 0x0F)
      wait 3 s
      stopscroll_SSD1306
      GLCDCLS
    
    
    end
    
     
  • Anobium

    Anobium - 2022-11-13

    Mr Silva - I need the file image1.bmp

     
  • charles silva

    charles silva - 2022-11-13

    simple image for testing

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.