Menu

ILI9341 read pixels problem

Help
2020-02-29
2020-03-07
1 2 3 > >> (Page 1 of 3)
  • stan cartwright

    stan cartwright - 2020-02-29

    I am writing a test program for ILI9341 readpixel.
    I draw a sprite and check 2 pixel below the sprite, one on the bottom left and one on the bottom right.
    I print their values in the main loop. They are 0 until the point is not black ie landscape.
    When ithe sprite hits the left landscape it says landed not dead.
    It shows both pixels are not black ie 0 so I pset a yellow pixel at both test points and the right one was black or 0.
    Please watch the video that shows the problem.
    https://www.youtube.com/edit?video_id=-zLdhIlnxec&ar=1582986019037&nv=1

    do
    
    sprite (sprite_x,sprite_y) ;draw sprite
    
    pixel_colour_left = ReadPixel_ILI9341(sprite_x-1,sprite_y + sprite_height+1) ;left pixel colour
    
    pixel_colour_right = ReadPixel_ILI9341(sprite_x + sprite_width+1,sprite_y + sprite_height+1) ;right pixel colour
    
        GLCDPrint 70,10,Str32 (pixel_colour_left)
        GLCDPrint 70,20,Str32 (pixel_colour_right)
    
    if (pixel_colour_left > 0) and  (pixel_colour_right > 0) then
        GLCDPrint 100,100,"LANDED",wh
        do
        GLCDPrint 100,10,Str32 (pixel_colour_left)
        GLCDPrint 100,20,Str32 (pixel_colour_right)
        pset sprite_x + sprite_width+1,sprite_y + sprite_height+1,ye
        pset sprite_x-1,sprite_y + sprite_height+1 ,ye
        loop
    end if
    
    
    if pixel_colour_left > 0 and pixel_colour_right = 0 then
      GLCDPrint 100,100,"Dead",wh
      do
      loop
    end if
    
    if pixel_colour_left = 0 and pixel_colour_right > 0 then
      GLCDPrint 100,100,"DEAD",wh
      do
      loop
    end if
    
     
  • Anobium

    Anobium - 2020-02-29

    Check that you do not have overflow or some maths error in the following:

    pixel_colour_left = ReadPixel_ILI9341(sprite_x-1,sprite_y + sprite_height+1) ;left pixel colour
    
    pixel_colour_right = ReadPixel_ILI9341(sprite_x + sprite_width+1,sprite_y + sprite_height+1) ;right pixel colour
    
     
    • stan cartwright

      stan cartwright - 2020-02-29

      Anobium. I see no faults as the points tested are then pset to yellow when the event occurs so I know I am not testing the sprite pixels.
      As the video shows it displays 0 0 until it hits something. Hitting left should say dead not landed.
      Hitting right works and both pixel lit on a flat line works.
      Very odd head scratcher.

      if (pixel_colour_left > 0) and  (pixel_colour_right > 0) then
          GLCDPrint 100,100,"LANDED",wh
          do
          GLCDPrint 100,10,Str32 (pixel_colour_left)
          GLCDPrint 100,20,Str32 (pixel_colour_right)
          pset sprite_x + sprite_width+1,sprite_y + sprite_height+1,ye
          pset sprite_x-1,sprite_y + sprite_height+1 ,ye
          loop
      

      is the only way to landed yet only one pixel is lit

       

      Last edit: stan cartwright 2020-02-29
  • stan cartwright

    stan cartwright - 2020-02-29

    Here is the problem

    GLCDRotate ( Portrait_Rev )     ' optionally you can rotate the screen.
    GLCDCLS bk
    ;
    dim temp as Byte
    dim pixel_colour_left,pixel_colour_right as long ;test pixel colour
    dim sprite_x,sprite_height,sprite_width as byte ;height and width of sprite in pixels
    dim sprite_y as Word ;y position of sprite
    dim ptr,spritedata_ptr,pixel as word
    dim gravity,gravity_count,x_drift,x_dir as Byte
    ;
    ;test
    pset 100,100,wh ;This is lit
    ;pset 120,100,wh ;This is not lit, it's background
    
    pixel_colour_left = ReadPixel_I9341(100,100)
    
    pixel_colour_right = ReadPixel_ILI9341(120,100)
    
        GLCDPrint 70,10,Str32 (pixel_colour_left)
        GLCDPrint 70,20,Str32 (pixel_colour_right)
    
    do
    loop
    

    pixel_colour_right is non zero although pixel_colour_right = ReadPixel_ILI9341(120,100) is reading a black background

    ;test
    ;pset 100,100,wh
    ;pset 120,100,bk
    
    pixel_colour_left = ReadPixel_ILI9341 (100,100)
    
    pixel_colour_right = ReadPixel_ILI9341 (120,100)
    
        GLCDPrint 70,10,Str32 (pixel_colour_left)
        GLCDPrint 70,20,Str32 (pixel_colour_right)
    
    do
    loop
    

    If nothing is pset then it reads 0 0
    but if either pixel is pset it's >0 for both
    EDIT!
    I found if I test a pixel and it's 0 then test another and it's >0 then it works
    but if I test a pixel and it's >0 and test another which is 0 then BOTH test show results >0.
    I will try to check your ili9341 read_pixel code.
    edit... your ili9341 inc uses word values for x and y.
    I was using byte for x...as screen is 240 wide x 320 high but changed it to a word var but made no difference.
    I will post all the code as is if ok.

    #chip 18f25k22,64
    #config MCLRE=on
    #option Explicit
    #include <glcd.h>
    
    #define GLCD_TYPE GLCD_TYPE_ILI9341
    
    'Pin mappings for ILI9341
    #define GLCD_DC portc.2
    #define GLCD_CS portc.0
    #define GLCD_RESET portc.1
    
    'As we are using Harware SPI this cannot be change on this chip. This is a non-PPS chip.
    #define GLCD_DI portc.4
    #define GLCD_DO portc.5
    #define GLCD_SCK portc.3
    #define ILI9341_hardwarespi
    
    ;rename colours to make less typeing
    #define bk ILI9341_BLACK
    #define re ILI9341_RED
    #define gr ILI9341_GREEN
    #define bl ILI9341_BLUE
    #define wh ILI9341_WHITE
    #define pu ILI9341_PURPLE
    #define ye ILI9341_YELLOW
    #define cy ILI9341_CYAN
    #define dg ILI9341_D_GRAY
    #define lg ILI9341_L_GRAY
    #define si ILI9341_SILVER
    #define ma ILI9341_MAROON
    #define ol ILI9341_OLIVE
    #define li ILI9341_LIME
    #define aq ILI9341_AQUA
    #define te ILI9341_TEAL
    #define na ILI9341_NAVY
    #define fu ILI9341_FUCHSIA
    ;
    #define left_thrust_button portb.5 ;all buttons held hi by 10k resistors....well 12k cos all I had
    #define vertical_thrust_button portb.4
    #define right_thrust_button portb.3
    dir left_thrust_button in
    dir vertical_thrust_button in
    dir right_thrust_button in
    ;
    GLCDRotate ( Portrait_Rev )  ;xy=0 top left, optionally you can rotate the screen.
    GLCDCLS bk
    ;
    dim temp as Byte
    dim pixel_colour_left,pixel_colour_right as long ;test pixel colour
    dim ,sprite_height,sprite_width as byte ;height and width of sprite in pixels
    dim sprite_x,sprite_y as Word ;xy position of sprite
    dim ptr,spritedata_ptr,pixel,x_dir as word
    dim gravity,gravity_count,x_drift as Byte
    ;
    ;test
    ;pset 100,100,wh
    ;pset 120,100,wh
    
    'pixel_colour_left = ReadPixel_ILI9341 (100,100)
    '
    'pixel_colour_right = ReadPixel_ILI9341 (120,100)
    '
    '    GLCDPrint 70,10,Str32 (pixel_colour_left)
    '    GLCDPrint 70,20,Str32 (pixel_colour_right)
    '
    'do
    'loop
    
    sprite_x=30:sprite_y=40 ; sprite x,y start
    sprite_height=24:sprite_width=24
    gravity_count=20
    x_drift = 20
    x_dir = 0
    ;
    ;draw lanscape
    line 0,8,16,120,wh
    line 16,120,48,280,wh
    line 48,280,100,319,wh
    
    line 100,319,140,319,wh
    
    line 140,319,196,280,wh
    line 196,280,224,120,wh
    line 224,120,239,8,wh
    
    sprite (sprite_x,sprite_y) ;draw sprite
    
    do ;main loop
    pixel_colour_right = ReadPixel_ILI9341((sprite_x - 1),(sprite_y + sprite_height + 1)) ;left pixel colour
    pixel_colour_left = ReadPixel_ILI9341((sprite_x + sprite_width + 1),(sprite_y + sprite_height + 1)) ;right pixel colour
    
    GLCDPrint 70,10,Str32 (pixel_colour_left)
    GLCDPrint 70,20,Str32 (pixel_colour_right)
    
    if (pixel_colour_left > 0) and  (pixel_colour_right > 0) then ;both pixels lit so flat
        GLCDPrint 100,100,"LANDED",wh
        do
        GLCDPrint 100,10,Str32 (pixel_colour_left)
        GLCDPrint 100,20,Str32 (pixel_colour_right)
    
        pset sprite_x + sprite_width+1,sprite_y + sprite_height+1,wh ;show test points
        pset sprite_x-1,sprite_y + sprite_height+1 ,wh
        loop
    end if
    
    if (pixel_colour_left > 0) and (pixel_colour_right = 0) then
      GLCDPrint 100,100,"Dead",wh ;hit left
      do
      loop
    end if
    
    if pixel_colour_left = 0 and pixel_colour_right > 0 then
      GLCDPrint 100,100,"DEAD",wh ;hit right
      do
      loop
    end if
    
    gravity_count = gravity_count + 1
    
    if left_thrust_button=0 then
      x_drift = x_drift + 1
    else if right_thrust_button = 0 then
      x_drift = x_drift - 1
    end if
    
    if x_drift = 15 then
      x_drift = 20
      x_dir = 65535
      sprite_x = sprite_x + x_dir
    else if x_drift = 25 then
      x_drift = 20
      x_dir = 1
      sprite_x = sprite_x + x_dir
    end if
    
    sprite (sprite_x,sprite_y) ;draw sprite
    
    if vertical_thrust_button=0 then
      gravity_count = gravity_count - 2
      line sprite_x+6,sprite_y+12,sprite_x+11,sprite_y+21,wh
      line sprite_x+16,sprite_y+12,sprite_x+13,sprite_y+21,wh
    end if
    
    if gravity_count=15 then
      gravity_count=20
      sprite_y = sprite_y - 1
    else if gravity_count = 25 then
      gravity_count=20
      sprite_y = sprite_y + 1
    end if
    
    loop
    ;
    sub sprite (sprite_x,sprite_y) ;fills box with sprite data
    ;  SetAddressWindow_ILI9341 ( sprite_x,sprite_y,sprite_x + sprite_width-1,sprite_y + sprite_height - 1 )
      SetAddressWindow_ILI9341 ( sprite_x,sprite_y,sprite_x + 23,sprite_y + 23)
      for ptr=1 to 576 ;(sprite_width * sprite_height)
        ReadTable lander,ptr,pixel
        SendWord_ILI9341 pixel
      next ptr
    end sub
    ;
    ;sprite data
    ;1 2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 21 23 24
    table lander
    bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk ;1
    bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,wh,wh,wh,wh,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk ;2
    bk,bk,bk,bk,bk,bk,bk,wh,wh,bk,bk,bk,bk,bk,bk,wh,wh,bk,bk,bk,bk,bk,bk,bk ;3
    bk,bk,bk,bk,bk,bk,wh,bk,bk,bk,wh,wh,wh,wh,bk,bk,bk,wh,bk,bk,bk,bk,bk,bk ;4
    bk,bk,bk,bk,wh,wh,bk,bk,wh,wh,bk,bk,bk,bk,wh,wh,bk,bk,wh,wh,bk,bk,bk,bk ;5
    bk,bk,bk,wh,bk,bk,bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk,bk,bk,wh,bk,bk,bk ;6
    bk,bk,wh,bk,bk,wh,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,wh,bk,bk,wh,bk,bk ;7
    bk,bk,wh,bk,bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk,bk,wh,bk,bk ;8
    bk,bk,bk,wh,bk,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,bk,wh,bk,bk,bk ;9
    bk,bk,bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk,bk,bk ;10
    bk,bk,bk,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,bk,bk,bk ;11
    bk,bk,bk,bk,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,wh,bk,bk,bk,bk ;12
    bk,bk,bk,bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk,bk,bk,bk ;13
    bk,bk,bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk,bk,bk ;14
    bk,bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk,bk ;15
    bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk ;16
    bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk ;17
    bk,bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk,bk ;18
    bk,bk,bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk,bk,bk ;19
    bk,bk,bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk,bk,bk ;20
    bk,bk,bk,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,bk,bk,bk ;21
    bk,bk,wh,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,wh,bk,bk ;22
    bk,wh,wh,wh,wh,wh,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,wh,wh,wh,wh,wh,bk ;23
    bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk ;24
    end table
    ;
    
     

    Last edit: stan cartwright 2020-02-29
  • stan cartwright

    stan cartwright - 2020-02-29

    if (pixel_colour_left > 0) and (pixel_colour_right > 0) then ;both pixels lit so flat
    GLCDPrint 100,100,"LANDED",wh
    do
    GLCDPrint 100,10,Str32 (pixel_colour_left)
    GLCDPrint 100,20,Str32 (pixel_colour_right)

    but they show different values for the same white colour?

     
  • Anobium

    Anobium - 2020-03-01

    'returns a 24bit pixel color value... as GCB uses a 16bit color value the user will need to complete conversion

    The function returns a 24 bit value. And, the colors are 16 bits. Is this the issue?

    I would draw a horizontal line, test and review the values.
    Then, I would then series of line to get a handle on the returned values.
    This process would isolate the issue.

     
  • stan cartwright

    stan cartwright - 2020-03-01

    dim pixel_colour_left,pixel_colour_right as long
    pset 100,100,wh
    pset 120,100,wh

    pixel_colour_left = ReadPixel_ILI9341 (100,100)
    ;
    pixel_colour_right = ReadPixel_ILI9341 (120,100)
    ;
    GLCDPrint 70,10,Str32 (pixel_colour_left) ;gives 16579836
    GLCDPrint 70,20,Str32 (pixel_colour_right) ;gives 2164063484
    ;
    do
    loop

    Why different results for same white pixels?

     
  • stan cartwright

    stan cartwright - 2020-03-01

    this gives same as last post just reading the same pixel.
    Does something need resetting in the read_pixel?
    pset 100,100,wh

    pixel_colour_left = ReadPixel_ILI9341 (100,100)
    ;
    pixel_colour_right = ReadPixel_ILI9341 (100,100)
    ;
    GLCDPrint 70,10,Str32 (pixel_colour_left)
    GLCDPrint 70,20,Str32 (pixel_colour_right)
    ;
    do
    loop

     
  • Anobium

    Anobium - 2020-03-01

    The two number are the same, in the context of the constraint of the function.

    The function returna long but only the bottom 24bits are valid, so,

    16579836 = 0x00FCFCFC
    2164063484 = 0x80FCFCFC

    So, and, with 24bits. Both numbers return the same.

    16579836 = 0x00FCFCFC AND 0XFFFFFF = 0x00FCFCFC
    2164063484 = 0x80FCFCFC AND 0XFFFFFF = 0x00FCFCFC

    So, what does 0x00FCFCFC equate to?

     
    • stan cartwright

      stan cartwright - 2020-03-01

      16,579,836‬
      this not the problem though.
      it is that the read_pixel is reading the pixels wrong after a non zero result.
      if it reads a non zero pixel then reads a zero/black pixel it reads it as a non zero value.
      Black is 0000000000000000000----
      There is a problem

       

      Last edit: stan cartwright 2020-03-01
  • Anobium

    Anobium - 2020-03-01
     
  • Anobium

    Anobium - 2020-03-01

    It that true? Read two black pixels. What is the result?

     
    • stan cartwright

      stan cartwright - 2020-03-01

      If I read 2 black pixels from glcdcls black or pset 2 black pixels it is 0 0
      It's if the first read is not 0 then the second one will be none 0 even though it is 0.
      Like some thing needs clearing in the include
      I used ILI9341_BLACK and ILI9341_WHITE incase the #defines were not working but same.
      I may be wrong but when a routine doesn't seem to work and one can't find a reason then there is an error somewhere. I would think it was me but...This routine is giving wrong results...prove me wrong cos this program and any others using the routine are on stop til sorted.
      Please show me the errors of my ways Anobium.
      It's frustrating when I can't sort things myself.

       

      Last edit: stan cartwright 2020-03-01
      • Anobium

        Anobium - 2020-03-01

        Slowly. Read what you wrote.

        If I read 2 black pixels from glcdcls black or pset 2 black pixels it is 0 0

        So, do you mean , if you read one pixel when the background is black or where you have set the pixel to black - the result is 0.

        So, what happens when you this with white?

        It's if the first read is not 0 then the second one will be none 0 even though it is 0.

        I have no idea of the context. What is the context?

        We need to understand the two sentences. Cus, I have an answer - yet.

         
  • stan cartwright

    stan cartwright - 2020-03-01

    GLCDCLS bk
    dim pixel_colour_left,pixel_colour_right as long
    pset 100,100,ILI9341_black
    pset 120,100,ILI9341_black
    pixel_colour_left = ReadPixel_ILI9341 (100,100)
    pixel_colour_right = ReadPixel_ILI9341 (120,100)
    GLCDPrint 70,10,Str32 (pixel_colour_left) ;gives 0
    GLCDPrint 70,20,Str32 (pixel_colour_right) ;gives 0
    do
    loop
    ;------------------------------------------------------------------------------
    pset 100,100,ILI9341_black
    pset 120,100,ILI9341_white
    pixel_colour_left = ReadPixel_ILI9341 (100,100)
    pixel_colour_right = ReadPixel_ILI9341 (120,100)
    GLCDPrint 70,10,Str32 (pixel_colour_left) ;gives 0
    GLCDPrint 70,20,Str32 (pixel_colour_right) ;gives 16579836
    ;---------------------------------------------------------------------------------
    pset 100,100,ILI9341_white
    pset 120,100,ILI9341_black
    pixel_colour_left = ReadPixel_ILI9341 (100,100)
    pixel_colour_right = ReadPixel_ILI9341 (120,100)
    GLCDPrint 70,10,Str32 (pixel_colour_left) ;gives 16579836
    GLCDPrint 70,20,Str32 (pixel_colour_right) ;gives 2147483648

    the last statement should print 0 as the pixel is black

    are any vars kept in the ililib after use like top byte of long...your code is not always easy to follow....sometimes is.

     

    Last edit: stan cartwright 2020-03-01
  • Anobium

    Anobium - 2020-03-01

    Can you attach the full code that the above test is based upon? Let us add some debug to analyse.

     
  • stan cartwright

    stan cartwright - 2020-03-01

    I have previous above and the test is commented out. The whole test game program and
    ;test
    ;pset 100,100,wh
    ;pset 120,100,wh

    'pixel_colour_left = ReadPixel_ILI9341 (100,100)
    '
    'pixel_colour_right = ReadPixel_ILI9341 (120,100)
    '
    ' GLCDPrint 70,10,Str32 (pixel_colour_left)
    ' GLCDPrint 70,20,Str32 (pixel_colour_right)
    '
    'do
    'loop

    commented out, this is the simple test...the rest is the complete program all setup to go.
    No reason to repost as is the same.
    I thought you might have an ili9341 setup around...as you do and could check my findings.
    Cheers.

     
  • stan cartwright

    stan cartwright - 2020-03-01

    this is a working test Anobium

    #chip 18f25k22,64
    #config MCLRE=on
    #option Explicit
    #include <glcd.h>
    
    #define GLCD_TYPE GLCD_TYPE_ILI9341
    
    'Pin mappings for ILI9341
    #define GLCD_DC portc.2
    #define GLCD_CS portc.0
    #define GLCD_RESET portc.1
    
    'As we are using Harware SPI this cannot be change on this chip. This is a non-PPS chip.
    #define GLCD_DI portc.4
    #define GLCD_DO portc.5
    #define GLCD_SCK portc.3
    #define ILI9341_hardwarespi
    
    ;rename colours to make less typeing
    #define bk ILI9341_BLACK
    #define re ILI9341_RED
    #define gr ILI9341_GREEN
    #define bl ILI9341_BLUE
    #define wh ILI9341_WHITE
    #define pu ILI9341_PURPLE
    #define ye ILI9341_YELLOW
    #define cy ILI9341_CYAN
    #define dg ILI9341_D_GRAY
    #define lg ILI9341_L_GRAY
    #define si ILI9341_SILVER
    #define ma ILI9341_MAROON
    #define ol ILI9341_OLIVE
    #define li ILI9341_LIME
    #define aq ILI9341_AQUA
    #define te ILI9341_TEAL
    #define na ILI9341_NAVY
    #define fu ILI9341_FUCHSIA
    ;
    GLCDRotate ( Portrait_Rev )  ;xy=0 top left, optionally you can rotate the screen.
    GLCDCLS bk
    ;
    dim pixel_colour_left,pixel_colour_right as long ;test pixel colour
    ;
    ;test
    pset 100,100,wh
    pset 120,100,bk   ;--should be 0
    
    pixel_colour_left = ReadPixel_ILI9341 (100,100)
    pixel_colour_right = ReadPixel_ILI9341 (120,100)
    GLCDPrint 70,10,Str32 (pixel_colour_left)
    GLCDPrint 70,20,Str32 (pixel_colour_right)   ;--should be 0
    do
    loop
    
     
  • Anobium

    Anobium - 2020-03-02

    Stan,

    I have found the issue. The DI port was not being set correctly. I found this by accident. I set up an UNO using your code and it worked... So, I looked through the ASM.... and spotted it.

    Try this please. https://sourceforge.net/p/gcbasic/code/HEAD/tree/GCBASIC/trunk/include/glcd_ILI9341.h?format=raw

     
    • stan cartwright

      stan cartwright - 2020-03-02

      I tried your link,I downloaded the glcd_ili9341 which is an uncompressed file, renamed the original glcd_ili9341 and the new one to gcbasic includes.
      It behaves the same, the same fault.
      I am using a pic at 3V.
      When you said "I found this by accident. I set up an UNO using your code and it worked... "
      did you mean it worked ok on an uno or displayed the same fault?

       
  • Anobium

    Anobium - 2020-03-02

    Re the new file. Compile your program and then attach your ASM. Let me review it.

    I do no think voltage would impact. But, mine is at 3v3 via a set of levelers.

    The UNO device worked. This puzzled me as I expected your code to fail. Then, I by I accident I stumbed across the error in the .h that may impact PICs (but, not AVRs).

    So, post ASM using the new .h

     
  • stan cartwright

    stan cartwright - 2020-03-02

    This is the complete test program using new ili9341.h
    This is when
    pset 100,100,wh
    pset 120,100,bk

    pixel_colour_left = ReadPixel_ILI9341 (100,100)
    pixel_colour_right = ReadPixel_ILI9341 (120,100)
    GLCDPrint 70,10,Str32 (pixel_colour_left)
    GLCDPrint 70,20,Str32 (pixel_colour_right)
    do
    loop

     

    Last edit: stan cartwright 2020-03-02
  • Anobium

    Anobium - 2020-03-02

    You sure this still exhibits the same error? The init looks correct now for the SPI DI port - it was not correct before.

    You do have the DI connected to Portc.4?

    And, disable Hardware SPI, by, commenting out #define ILI9341_hardwarespiThen, test.

     
  • stan cartwright

    stan cartwright - 2020-03-02

    I could tranfer the program to a uno but then if there is a pic problem it would need sorting.
    am I using the correct pin for miso on 18f25k22? Think I am cos it nearly works.
    Don't a bit of basic make loads of asm!

     
  • stan cartwright

    stan cartwright - 2020-03-02

    sdi mosi goes to port c.4
    sdo miso goes to port c.5
    commenting ;#define ILI9341_hardwarespi and the display clears to black but displays nothing.

     
1 2 3 > >> (Page 1 of 3)

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.