Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 10:29 15 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : New 4 inch LCD

     Page 10 of 12    
Author Message
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1805
Posted: 10:08pm 09 Apr 2024
Copy link to clipboard 
Print this post

Thanks I'll try that. Is the BL 3.3v only.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 911
Posted: 10:28pm 09 Apr 2024
Copy link to clipboard 
Print this post

Palcal the specs are very difficult to find but here is what I have found:

  Quote  GENERAL ELECTRICAL PROPERTIES
Minimum supply voltage [V DC] 2.8
Maximum supply voltage [V DC] 3.5
Minimum IO-pin input voltage [V] 2.8
Maximum IO-pin input voltage [V] 3.5
IO-pin output voltage [V] Equal to supply voltage


There is a provision for a 3 terminal regulator cct. next to the backlight cct. but on the ones I have the regulator circuit is bridged out with a zero ohm resistor and the pads for the regulator are not populated.

0A47
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 1810
Posted: 10:53pm 09 Apr 2024
Copy link to clipboard 
Print this post

  Quote   Is the BL 3.3v only.
The whole panel is 3.3V only. The 3.3V regulator (U1) has not been fitted and is bypassed by a link (R0).
The backlight anodes go to Vdd (Pin 1) via R1 (10Ω) and Q1 switches the cathodes to ground. The base goes to BL pin via R6 (1kΩ) and to ⏚ via R7 (10kΩ).

The old 2.8" ILI9341 don't have Q1, the LED anodes go direct to LED pin and cathodes direct to ground so they require an external resistor to limit the current.

I inadvertently plugged the 4" panel into a 5V board without any damage but SD cards are damaged by 5V, fortunately did not use one.

To use the 4" panel on a board that has 5V on Vdd remove R0 and install U1 (3.3V LDO regulator).

Edit. Followed my own advice, added a regulator as above.
Now running on 5V.
Edited 2024-04-10 11:52 by phil99
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1805
Posted: 03:35am 10 Apr 2024
Copy link to clipboard 
Print this post

Thanks for all that will follow up.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
morgs67
Regular Member

Joined: 10/07/2019
Location: Australia
Posts: 71
Posted: 03:50am 10 Apr 2024
Copy link to clipboard 
Print this post

@phil99
Thanks also, just ordered some suitable regulators.

Tony
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1805
Posted: 04:17am 10 Apr 2024
Copy link to clipboard 
Print this post

@phil99 what regulator did you use. I have identified the IN pad one should be GROUND and one OUT, I cant identify the ground pad.
Also I guess these displays can't be used with the MM BackPack because the PWM signal to the backlight is 5v.
Edited 2024-04-10 14:23 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 1810
Posted: 05:06am 10 Apr 2024
Copy link to clipboard 
Print this post

The regulator was salvaged from a dead 2.8" panel and doesn't have a recognisable type number. Too small for that.

Looking at the 4" panel with SD socket top left and connector pin 1 (Vdd) top right which goes to the middle (top) pin of the reg. Connector pin 2 ⏚ goes to bottom left of the reg. Bottom right of the reg. is 3.3V out and goes to C1 and R1.

The 1kΩ base resistor of Q1 is high enough to allow 5V PWM. Just 4.4mA max at 5V.
Edited 2024-04-10 15:14 by phil99
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1805
Posted: 06:33am 10 Apr 2024
Copy link to clipboard 
Print this post

I've searched Element14 and RS Components but can't find any with the correct footprint. I have some SMD regs I can probably wire in somehow but would like to do it properly.
@morgs67 what one did you order.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1805
Posted: 07:19am 10 Apr 2024
Copy link to clipboard 
Print this post

It's taken me over an hour but I finally found one at RS components
MCP 1754-3302CB its 150ma, should be ok.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1654
Posted: 03:19pm 10 Apr 2024
Copy link to clipboard 
Print this post

  phil99 said  
  Quote   Is the BL 3.3v only.
The whole panel is 3.3V only. The 3.3V regulator (U1) has not been fitted and is bypassed by a link (R0).
The backlight anodes go to Vdd (Pin 1) via R1 (10Ω) and Q1 switches the cathodes to ground. The base goes to BL pin via R6 (1kΩ) and to ⏚ via R7 (10kΩ).

The old 2.8" ILI9341 don't have Q1, the LED anodes go direct to LED pin and cathodes direct to ground so they require an external resistor to limit the current.

I inadvertently plugged the 4" panel into a 5V board without any damage but SD cards are damaged by 5V, fortunately did not use one.

To use the 4" panel on a board that has 5V on Vdd remove R0 and install U1 (3.3V LDO regulator).

Edit. Followed my own advice, added a regulator as above.
Now running on 5V.

I run all my ili panels from 5V and the led/bl
my ils ili9488 board

 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1805
Posted: 09:28pm 10 Apr 2024
Copy link to clipboard 
Print this post

Modified my Pico backpack to supply display with 3.3v.  The 4" display that stopped working on 5v. is now alive again and calibrates ok. Now to test on MM2 with 3.3v.
On the MM2 the 3.5" screen won't calibrate I get Touch Hardware Failure after two targets and it won't calibrate on the Pico so maybe a display fault.
So my 4" screens now work and calibrate on both Pico and MM2.
Edited 2024-04-11 07:49 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 1810
Posted: 02:05am 12 Apr 2024
Copy link to clipboard 
Print this post

Another oddity with the 4" IPS ILI9488.
The resistors near the SD socket on other panels are in series with the SD pins (to protect the SD card in the event of 5V SPI data I guess) but on this panel they are all 4.7kΩ pull-ups.

When the SD SPI is connected to the display SPI Blit, Save Image and Pixel(x,y) no longer work as the 10kΩ (or 6.8kΩ) from LCD_CS to MISO can no longer pull MISO low enough.
The cure is to remove R8 from SDO.

A possible alternative to removing R8 may be to reduce the 10kΩ to 1kΩ - 1.5kΩ to override it. Untested, may be too low for some SD cards.

The pull-ups are another reason to take care not to apply 5V to this panel unless you fit a 3.3V regulator.

@Palcal, yes also found the blotch eventually reappears.

Edit.
To check that MISO is reading all colours from the screen this one liner counts all the blues, greens and reds. For an ILI9488 there should be 64 of each.
> for a=0 to 16 step 8:m=0:for n=0 to 255:q=n<<a:pixel 9,9,q:c=pixel(9,9):if c=q then:inc m :endif :next:?:?m:next

64

64

64
>

Edited 2024-04-12 16:04 by phil99

Footnote added 2024-04-17 09:00 by phil99
  Quote  A possible alternative to removing R8 may be to reduce the 10kΩ to 1kΩ - 1.5kΩ to override it. Untested, may be too low for some SD cards

Now tested. All the SD cards I have are happy with this so I suggest leaving R8 in place and using 1.5kΩ or 1.8kΩ for the LCD_CS to MISO resistor.
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 08:22am 12 Apr 2024
Copy link to clipboard 
Print this post

Phil,
I connected the 4'' IPS with 10k and shottky diode:

1. Your oneliner did not work for me so I changed it into a short loaded program:
for a=0 to 16 step 8
   m=0
   for n=0 to 255
     q=n<<a:pixel 9,9,q:c=pixel(9,9)
       if c=q then:inc m
     endif
   next
?
?m
 next


2. Without removing R8 (4.7k pullup) from the display board the resulting output was 0 0 0.

3. Removed R8 and the output is 7 7 7. Tested with 133MHz and 420MHz CPUspeed with the same result.

> option list
PicoMite MMBasic Version 5.09.00RC3
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION LCDPANEL ILI9488, LANDSCAPE,GP15,GP14,GP13,GP17,INVERT
OPTION TOUCH GP12,GP11
GUI CALIBRATE 0, 3902, 3845, -1284, -872
OPTION SDCARD GP22


SD works OK. Normal display output works OK.

Any thoughts why I am not getting the desired 64 64 64 output from your test program?

Pluto
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 1810
Posted: 08:41am 12 Apr 2024
Copy link to clipboard 
Print this post

  Quote  I connected the 4'' IPS with 10k and shottky diode

That combination has always worked for me in the past. Peter uses a 6.8kΩ.
On a breadboard I just grabbed what was closest to hand, a 5.6kΩ and a 1N4001 and it worked giving 64, 64, 64.
Also tried a 1N4148 which is faster and has a lower junction capacitance so should be a better choice. But instead it also gave 7, 7, 7. Makes no sense.

All I can suggest is try a lower resistance and different diode, or perhaps a few pF across the diode.

Maybe that is the key, the capacitance gives faster rise / fall times.

Footnote added 2024-04-13 10:20 by phil99
As the one-liner was too long for Pluto's window here is a minimized version.
If still too long the colours can be done separately.
> for a=0to 2:b=0:for c=0to 255:d=c<<a*8:pixel 9,9,d:if d=pixel(9,9)then:inc b:endif:next:?b:next
64
64
64
> b=0:for c=0to 255:d=c<<16:pixel 9,9,d:if d=pixel(9,9)then:inc b:endif:next:?b
64
> b=0:for c=0to 255:d=c<<8:pixel 9,9,d:if d=pixel(9,9)then:inc b:endif:next:?b
64
> b=0:for c=0to 255:d=c:pixel 9,9,d:if d=pixel(9,9)then:inc b:endif:next:?b
64
>
If still too long replace
Pixel 9,9,d
with
CLS d
But it is Extremely SLOW.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8601
Posted: 09:17am 12 Apr 2024
Copy link to clipboard 
Print this post

Probably makes no difference but I always use a BAT54 diode
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 09:29am 12 Apr 2024
Copy link to clipboard 
Print this post

Diode     BAT43   BAT43   1N4148   1N4002
Resistor  10k       6.8k       6.8k      6.8K
Works?    NO        NO         NO       YES

THANKS PHIL FOR THE HELP! Now it works. A standard rectifier diode 1N4002 and a 6.8k resistor gives 64 64 64 with your test program.

I didn't test your capacitor proposal. Stopped soldering when I got it to work!

Pluto
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 11:00am 12 Apr 2024
Copy link to clipboard 
Print this post

Here is an LCD test program I have developed/used for some  time.
You configure the LCD and SDCARD and run the program. It was useful for finding obscure faults when developing drivers for parallel displays.(e.g. display would fail if all 16 bits transitioned between 0 ad 1 but ok if onlt 15 bits changed). Still gives an SPI a good workout. You look at results on screen and the printout to verify the result.
Checks Backlight, RGB colour order, blit, save imaged, load image.
Where a pixel is not as expected the actual vs expected result is printed.






? "--------------------------------------------------"
? "Connected to: " MM.DEVICE$ MM.VER
? "--------------------------------------------------"
?
PAUSE 1000
'Program to verify LCDPanel read and write
'Writes a pixel to every point and reads it back to check
'Does a BLIT and check is still correct

OPTION EXPLICIT
OPTION DEFAULT NONE

DIM INTEGER s,t, x, y, r, red, green, blue, c, b,i=0
DIM INTEGER x1,y1,la
DIM INTEGER x2,y2,tp,hmax,vmax,shorttest
DIM INTEGER pwr=0,pb=0,tx=0,ty=0,tbx=0,tby=0,tbt=0,pir=0,pirw=0,top,bottom
DIM INTEGER pwre=0,pbe=0,txe=0,tye=0,tbxe=0,tbye=0,tbte=0,pire=0,pirwe=0
DIM INTEGER myWHITE,rgbWHITE,nearWHITE,rgbmask
DIM INTEGER getscanlineSupported=1,blitsupport=1,backlightsupported=1
DIM INTEGER MMVRES,MMHRES,retry
DIM ok$=""
'myWHITE=RGB(&HFF,&HFF,&HFF)
myWHITE=RGB(&HF8,&HFC,&HF8)
'myWHITE=RGB(&HF8,&HF8,&HF8)
'myWHITE=RGB(&HF0,&HF8,&HF0)
''nearWHITE=RGB(&HF8,&HF0,&HF8)
rgbWHITE=RGB(&HF8,&HFC,&HF8)
'rgbWHITE=RGB(&HFF,&HFF,&HFF)
rgbmask=&HF8FCF8

DIM INTEGER MAXTESTS=1    'Number of times to repeat test
DIM INTEGER MAXPRINT=20   'How many errors to output

DIM INTEGER TESTCOUNT=0,TESTFAILED=0
TESTSTART:
IF TESTCOUNT=MAXTESTS THEN
? vt100.colour$("GREEN");
? "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
? "!!!! "+STR$(MAXTESTS,2)+ " tests completed    !!!!"
IF TESTFAILED>0 THEN
  ? vt100.colour$("RED");
  ? "!!!! "+STR$(TESTFAILED,2)+ " tests Failed       !!!!"
ELSE
  ? vt100.colour$("GREEN");
  ? "!!!! "+STR$(TESTFAILED,2)+ " tests Failed       !!!!"
ENDIF
? "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
? vt100.colour$("RESET")
END
ENDIF
s=0:t=0:i=0
pwr=0:pb=0:tx=0:ty=0:tbx=0:tby=0:tbt=0:pir=0:pirw=0
pwre=0:pbe=0:txe=0:tye=0:tbxe=0:tbye=0:tbte=0:pire=0:pirwe=0
CLS
? vt100.colour$("HOME"):? vt100.colour$("CLS")

'if MM.INFO$(LCDPANEL)="ILI9341" then getscanlineSupported=0
'if MM.INFO$(LCDPANEL)="ILI9488" then getscanlineSupported=0
'if MM.INFO$(LCDPANEL)="ILI9481" then getscanlineSupported=0:blitsupport=0
'if MM.INFO$(LCDPANEL)="ILI9486" then getscanlineSupported=0
'if MM.INFO$(LCDPANEL)="ST7789" then getscanlineSupported=0:blitsupport=0

IF MM.INFO$(LCDPANEL)="SSD1963_4" THEN rgbmask=&HFFFFFF    'RGB888
IF MM.INFO$(LCDPANEL)="SSD1963_5ER" THEN rgbmask=&HFFFFFF  'RGB888
IF MM.INFO$(LCDPANEL)="SSD1963_5" THEN rgbmask=&HFFFFFF    'RGB888
IF MM.INFO$(LCDPANEL)="SSD1963_5A" THEN rgbmask=&HFFFFFF   'RGB888
IF LEFT$(MM.DEVICE$,4)="Pico" THEN
  IF MM.INFO$(LCDPANEL)="ILI9488" THEN rgbmask=&HFCFCFC     'RGB666
  IF MM.INFO$(LCDPANEL)="ILI9481IPS" THEN rgbmask=&HFCFCFC  'RGB666
END IF  

retry=1
shorttest=1
IF shorttest=0 THEN
 vmax=MM.VRES-1
 hmax=MM.HRES-1
ELSE
 vmax=99
 hmax=99
ENDIF  
tp=(vmax+1)*(hmax+1)
? vt100.colour$("RESET")
? "LCDPANEL Integrity Test "
? "----------------------- "

IF shorttest=0 THEN
? "Long Test - All pixels tested"
ELSE
? "Short Test - 100*100 pixels tested"
ENDIF
? MM.INFO$(LCDPANEL)
'? MM.INFO$(LCDPANELID)



'Check for BLIT SUPPORT'''''''''''''''''
ON ERROR SKIP 1
t = PIXEL(0,0)
IF MM.ERRNO<>0 THEN blitsupport=0
ON ERROR CLEAR
IF blitsupport=1 THEN
 ? "BLIT Supported"
ELSE
 ? "BLIT NOT Supported""
END IF

'Check for BACKLIGHT SUPPORT'''''''''''''''''
ON ERROR SKIP 1
BACKLIGHT 50
IF MM.ERRNO<>0 THEN backlightsupported=0
ON ERROR CLEAR
IF backlightsupported=1 THEN
 ? "BACKLIGHT Supported"
ELSE
 ? "BACKLIGHT NOT Supported"
END IF

'Check for GETSCANLINE SUPPORT'''''''''''''''''
ON ERROR SKIP 1
t = GETSCANLINE()
IF MM.ERRNO<>0 THEN getscanlineSupported=0
ON ERROR CLEAR
IF getscanlineSupported=1 THEN
 ? "getscanline{} Supported"
ELSE
 ? "getscanline() NOT Supported"
END IF
''''''''''''''''''''''''''''''''''''''''''''

? "TEST RGB colour order"
CLS RGB(RED)
TEXT MM.HRES/2,MM.VRES/2,"RED","CM",1,6,RGB(BLACK),RGB(RED)
PAUSE 1000
CLS RGB(GREEN)
TEXT MM.HRES/2,MM.VRES/2,"GREEN","CM",1,6,RGB(BLACK),RGB(GREEN)
PAUSE 1000
CLS RGB(BLUE)
TEXT MM.HRES/2,MM.VRES/2,"BLUE","CM",1,6,RGB(BLACK),RGB(BLUE)
PAUSE 1000
CLS RGB(BLACK)
TEXT MM.HRES/2,MM.VRES/4,"WHITE","CM",1,3,RGB(WHITE)
TEXT MM.HRES/2,MM.VRES/2,"on","CM",1,3,RGB(WHITE)
TEXT MM.HRES/2,3*MM.VRES/4,"BLACK","CM",1,3,RGB(WHITE)
PAUSE 1000
IF backlightsupported=1 THEN
 ? "**************************************************"
 ? "  BACKLIGHT TEST 10-100%                          "
 ? "**************************************************"
 '
 CLS RGB(BLUE)
 FOR x=10 TO 100 STEP 10
   BACKLIGHT x
   'pause 500
  '' TEXT MM.HRES/2,2.2*x,"BACKLIGHT "+str$(x),"CM",1,2,RGB(RED)
  '' TEXT MM.HRES/2,2.2*x,"BACKLIGHT "+str$(x),"CM",1,2,RGB(BLUE)
   TEXT MM.HRES/2,2.2*x,"BACKLIGHT "+STR$(x),"CM",1,2,RGB(WHITE)
   PAUSE 500
 NEXT x
 BACKLIGHT 100
ENDIF

? "************************************"
? " Doing write to Pixels colour gradiant"
? " and then read of pixels."
? "************************************"
? "writing ",tp," pixels..."
 s=0:t=0:i=0
CLS
TIMER=0
FOR x1=0 TO hmax
 FOR y1=0 TO vmax
   'c=RGB((x1<<3 AND &HF8 )OR 5 ,((x1+y1)<<2  and &HFC) or 1 ,(y1<<3 and &HF8) or 2)
   c=RGB((x1<<3 AND &HF8 ) ,((x1+y1)<<2  AND &HFC)  ,(y1<<3 AND &HF8) )
   'c=&H48
   PIXEL x1,y1,c
 NEXT
NEXT
? TIMER," mSec"
IF blitsupport=1 THEN
? "reading ",tp," pixels..."
TIMER=0
FOR x1=0 TO hmax
 FOR y1=0 TO vmax
   i=i+1
   c=RGB(x1<<3 AND &HF8 ,(x1+y1)<<2 AND &HFC,y1<<3 AND &HF8)
   'c=&H48
   r=PIXEL (x1,y1)
  ' r=r and &HF8FFF8
   c=c AND rgbmask
   IF r=c THEN
     s=s+1
   ELSE
     IF t=0 THEN ? "Pixels not read as written"
     IF t<maxprint THEN printerror
     t=t+1
   ENDIF
   IF i>10000 THEN
     ? ".";
     i=0
   ENDIF  
 NEXT
NEXT
?
? TIMER," mSec"
? "correct pixels ",s
? "incorrect pixels",t
? "total pixels",s+t
 IF t=0 THEN pwr=1
 pwre=t

?
? "************************************"
? "Doing BLIT - blit 0,0,0,0,100,100"
? " and re read of pixels."
? "************************************"


BLIT 0,0,100,100,100,100
'blit 100,100,200,200,100,100
'blit 200,200,300,300,100,100
BLIT 0,0,0,0,100,100
'blit 300,300,0,0,100,100
'blit read #1 ,0,0,100,100
'BLIT WRITE #1,0,0
'BLIT CLOSE #1
 'for x1=0 to hmax
 'for y1=0 to vmax
 '   PIXEL x1,y1,PIXEL (x1,y1)
 'NEXT
 'NEXT
 
'CLS RGB(RED)
'CLS rgb(green)
'CLS rgb(BLUE)
s=0:t=0:i=0
? "reading ",tp," pixels after blit ..."
TIMER=0
FOR x1=0 TO hmax
 FOR y1=0 TO vmax
   i=i+1
   c=RGB(x1<<3 AND &HF8,(x1+y1)<<2 AND &HFC,y1<<3 AND &HF8)
   'c=&H48
   r=PIXEL (x1,y1)
   c=c AND rgbmask
   IF r=c THEN
     s=s+1
   ELSE
     IF t=0 THEN ? "Pixels not read as written"
     IF t<maxprint THEN printerror
     t=t+1
   ENDIF
   IF i>10000 THEN
     ? ".";
     i=0
   ENDIF  
 NEXT
NEXT
?
? TIMER," mSec"
? "correct pixels ",s
? "incorrect pixels ",t
? "total pixels",s+t
IF t=0 THEN pb=1
pbe=t
ENDIF
'''end
IF MM.INFO$(SDCARD)="Ready" THEN

 ?
 ? "************************************"
 ? "Doing  SAVE IMAGE TEST.BMP ,0,0,100,100"
 ? "then  RESTORE IMAGE TEST.BMP 0,0"
 ? " and re read of pixels."
 ? "************************************"

 IF blitsupport=1 THEN
    SAVE IMAGE "TEST.BMP", 0,0,100,100
    ? "Image saved as TEST.BMP"
 ENDIF
 CLS
 PAUSE 2000
 ? "Loading Image TEST.BMP"
 LOAD IMAGE "TEST.BMP" , 0,0
 TEXT 20,150, "Image Loaded above"
 PAUSE 5000
 s=0:t=0:i=0
 IF blitsupport=1  THEN
   ? "reading ",tp," pixels after LOAD IMAGE ..."
   TIMER=0
   FOR x1=0 TO hmax
   FOR y1=0 TO vmax
     i=i+1
     c=RGB(x1<<3 AND &HF8,(x1+y1)<<2 AND &HFC,y1<<3 AND &HF8)
     r=PIXEL (x1,y1)
     c=c AND rgbmask
     IF r=c THEN
       s=s+1
     ELSE
       IF t=0 THEN ? "Pixels not read as written"
       IF t<maxprint THEN printerror
       t=t+1
     ENDIF
     IF i>10000 THEN
       ? ".";
       i=0
     ENDIF  
   NEXT
   NEXT
   ?
   ? TIMER," mSec"
   ? "correct pixels ",s
   ? "incorrect pixels ",t
   ? "total pixels",s+t
   IF t=0 THEN
     pirw=1
     ON ERROR SKIP
     NAME "TEST.BMP" AS "REFERENCE.BMP"
   END IF
    pirwe=t
ENDIF
ENDIF
IF MM.INFO$(SDCARD)="Ready" AND blitsupport=0 THEN

 ?
 ? "************************************"
 ? "Doing  RESTORE IMAGE REFRENCE.BMP 0,0"
 ? "and read of pixels.                  "
 ? "************************************"

 CLS
 PAUSE 2000
 ? "Loading Image REFERENCE.BMP"
 LOAD IMAGE "REFERENCE.BMP" , 0,0
 TEXT 20,150, "Image Loaded above"
 PAUSE 5000
 s=0:t=0:i=0
 IF blitsupport=1  THEN
   ? "reading ",tp," pixels after LOAD IMAGE ..."
   TIMER=0
   FOR x1=0 TO hmax
   FOR y1=0 TO vmax
     i=i+1
     c=RGB(x1<<3 AND &HF8,(x1+y1)<<2 AND &HFC,y1<<3 AND &HF8)
     r=PIXEL (x1,y1)
     c=c AND rgbmask
     IF r=c THEN
       s=s+1
     ELSE
       IF t=0 THEN ? "Pixels not read as written"
       IF t<maxprint THEN printerror
       t=t+1
     ENDIF
     IF i>10000 THEN
       ? ".";
       i=0
     ENDIF  
   NEXT
   NEXT
   ?
   ? TIMER," mSec"
   ? "correct pixels ",s
   ? "incorrect pixels ",t
   ? "total pixels",s+t
   IF t=0 THEN pir=1
   pire=t
ENDIF
ENDIF
'******************************************************************************************
? "----------------------"
? " All Bit transistion test"
? "change by X coordinate "
? "---------------------"

? "writing ",tp," pixels..."
s=0:t=0:i=0
CLS
TIMER=0
FOR x1=0 TO hmax
 FOR y1=0 TO vmax
   'c=RGB((x1<<3 AND &HF8 )OR 5 ,((x1+y1)<<2  and &HFC) or 1 ,(y1<<3 and &HF8) or 2)
   IF x1 MOD 2  THEN c=RGB(BLACK) ELSE c=myWHITE
   'if x1 mod 2  then c=RGB(RED) else c=RGB(GREEN)
   'if x1 mod 2  then c=RGB(0,0,&h40) else c=RGB(255,255,&HBF)
   PIXEL x1,y1,c
 NEXT
NEXT
? TIMER," mSec"
IF blitsupport=1 THEN
? "reading ",tp," pixels..."
TIMER=0
FOR x1=0 TO hmax
 FOR y1=0 TO vmax
   i=i+1
   'c=RGB(x1<<3 AND &HF8 ,(x1+y1)<<2 and &HFC,y1<<3 and &HF8)
   IF x1 MOD 2  THEN c=RGB(BLACK) ELSE c=myWHITE
   'if x1 mod 2  then c=RGB(RED) else c=RGB(GREEN)
   'if x1 mod 2  then c=RGB(0,0,&h40) else c=RGB(255,255,&HBF)
   r=PIXEL (x1,y1)
  ' r=r and &HF8FFF8
   c=c AND rgbmask
   'if r<>c then r=PIXEL (x1,y1) 'reread
   IF r=c THEN
     s=s+1
   ELSE
     IF t=0 THEN ? "Pixels not read as written"
     IF t<maxprint THEN printerror
     INC t
   ENDIF
   IF i>10000 THEN
     ? ".";
     i=0
   ENDIF  
 NEXT
NEXT
?
? TIMER," mSec"
? "correct pixels ",s
? "incorrect pixels",t
? "total pixels",s+t
?
IF t=0 THEN tx=1
txe=t

? "************************************"
? "Doing BLIT - blit 0,0,0,0,100,100"
? " and re read of Transition X pixels."
? "************************************"
BLIT 0,0,100,100,100,100
BLIT 0,0,0,0,100,100
s=0:t=0:i=0
? "reading ",tp," pixels after blit ..."
TIMER=0
FOR x1=0 TO hmax
 FOR y1=0 TO vmax
   i=i+1
   'c=RGB(x1<<3 AND &HF8,(x1+y1)<<2 and &HFC,y1<<3 and &HF8)
   IF x1 MOD 2  THEN c=RGB(BLACK) ELSE c=myWHITE
   'if x1 mod 2  then c=RGB(RED) else c=RGB(GREEN)
  ' if x1 mod 2  then c=RGB(0,0,&h40) else c=RGB(255,255,&HBF)
   r=PIXEL (x1,y1)
   c=c AND rgbmask
   'if r<>c then r=PIXEL (x1,y1) 'reread
   IF r=c THEN
     s=s+1
   ELSE
     IF t=0 THEN ? "Pixels not read as written"
     IF t<maxprint THEN printerror
     t=t+1
   ENDIF
   IF i>10000 THEN
     ? ".";
     i=0
   ENDIF  
 NEXT
NEXT
?
? TIMER," mSec"
? "correct pixels ",s
? "incorrect pixels ",t
? "total pixels",s+t
IF t=0 THEN tbx=1
tbxe=t
ENDIF

'*********************************************************************************************************************
? "************************************"
? "Bit transistion by Y test"
? " and re read of pixels."
? "************************************"
? "writing ",tp," pixels..."
CLS
s=0:t=0:i=0
TIMER=0
FOR x1=0 TO hmax
 FOR y1=0 TO vmax
   'c=RGB((x1<<3 AND &HF8 )OR 5 ,((x1+y1)<<2  and &HFC) or 1 ,(y1<<3 and &HF8) or 2)
   IF y1 MOD 2 THEN c=RGB(BLACK) ELSE c=myWHITE
   PIXEL x1,y1,c
 NEXT
NEXT
? TIMER," mSec"
IF blitsupport=1 THEN
? "reading ",tp," pixels..."
TIMER=0
FOR x1=0 TO hmax
 FOR y1=0 TO vmax
   i=i+1
   'c=RGB(x1<<3 AND &HF8 ,(x1+y1)<<2 and &HFC,y1<<3 and &HF8)
   IF y1 MOD 2 THEN c=RGB(BLACK) ELSE c=myWHITE
   r=PIXEL (x1,y1)
  ' r=r and &HF8FFF8
   'if r<>c then r=PIXEL (x1,y1) 'reread
   c=c AND rgbmask
   IF r=c THEN
     s=s+1
   ELSE
     IF t=0 THEN ? "Pixels not read as written"
     IF t<maxprint THEN printerror
     t=t+1
   ENDIF
   IF i>10000 THEN
     ? ".";
     i=0
   ENDIF  
 NEXT
NEXT
?
? TIMER," mSec"
? "correct pixels ",s
? "incorrect pixels",t
? "total pixels",s+t
IF t=0 THEN ty=1
tye=t
?
? "************************************"
? "Doing BLIT - blit 0,0,0,0,100,100"
? " and re read of transition Y pixels."
? "************************************"

BLIT 0,0,0,0,100,100
s=0:t=0:i=0
? "reading ",tp," pixels after blit ..."
TIMER=0
FOR x1=0 TO hmax
 FOR y1=0 TO vmax
   i=i+1
   'c=RGB(x1<<3 AND &HF8,(x1+y1)<<2 and &HFC,y1<<3 and &HF8)
   IF y1 MOD 2 THEN c=RGB(BLACK) ELSE c=myWHITE
   r=PIXEL (x1,y1)
   'if r<>c then r=PIXEL (x1,y1) 'reread
   c=c AND rgbmask
   IF r=c THEN
     s=s+1
   ELSE
     IF t=0 THEN ? "Pixels not read as written"
     IF t<maxprint THEN printerror
     t=t+1
   ENDIF
   IF i>10000 THEN
     ? ".";
     i=0
   ENDIF  
 NEXT
NEXT
 ?
 ? TIMER," mSec"
 ? "correct pixels ",s
 ? "incorrect pixels ",t
 ? "total pixels",s+t
 IF t=0 THEN tby=1
 tbye=t
ENDIF

'*********************************************************************************************************************
? "************************************"
? "BLIT TEST OF BLACK ON WHITE TEXT"
? "************************************"
? "writing ",tp," pixels..."
CLS
s=0:t=0:i=0
TIMER=0
TEXT 1,20,"IMHO",,2,2,myWHITE,RGB(BLACK):TEXT 1,60,"IMHO",,2,2,RGB(BLACK),myWHITE
PAUSE 1000
IF blitsupport=1 THEN
 BLIT 0,0,100,0,100,100
 
 '? timer," mSec"
 ? "verifying TEXT",tp," pixels..."
TIMER=0
FOR x1=0 TO hmax
 FOR y1=0 TO vmax
   i=i+1
   c=PIXEL(x1+100,y1)
   r=PIXEL (x1,y1)
 
   IF r=c THEN
     s=s+1
   ELSE
     IF t=0 THEN ? "TEXT Pixels not matched in BLIT area"
     IF t<maxprint THEN printerror
     t=t+1
   ENDIF
   IF i>10000 THEN
     ? ".";
     i=0
   ENDIF  
 NEXT
NEXT
 
 ?
 ? TIMER," mSec"
 ? "correct pixels ",s
 ? "incorrect pixels ",t
 ? "total pixels",s+t
 IF t=0 THEN tbt=1
 tbte=t
ENDIF


'***************************************************************************************************************
IF getscanlineSupported=1 THEN
 ? "************************************"
 ? "   Testing GETSCANLINE() Range      "
 ? "************************************"


 
 CLS
 TEXT MM.HRES/2,(MM.VRES/2)-50,"testing ...","CM",1,3,RGB(WHITE)
 TEXT MM.HRES/2,MM.VRES/2,"testing ...","CM",1,3,RGB(RED)
 TEXT MM.HRES/2,(MM.VRES/2)+50,"testing ...","CM",1,3,RGB(WHITE)
 
 
 
 'pause 3000

 
 
 'getscanline() testing
 top=0
 t=1000
 bottom=1000
  FOR s=1 TO MM.HRES*100
  t=getscanline()
  top=MAX(t,top)
  bottom=MIN(t,bottom)
 
NEXT s
ENDIF

CLS

? "**************************************************"
? "  TRANSPARENT TEXT TEST                          "
? "**************************************************"

 MMVRES=MM.VRES
 MMHRES=MM.HRES
 POKE DISPLAY HRES 308
 POKE DISPLAY VRES 108
 CLS RGB(BLUE)
 POKE DISPLAY HRES MMHRES
 POKE DISPLAY VRES MMVRES
 BOX 0,0,300,100,,RGB(green),RGB(green)
 
 IF blitsupport=1 THEN
   TEXT 150,30,"TRANSPARENT",CM,2,2,RGB(RED),-1
   TEXT 150,70,"TEXT",CM,2,2,RGB(RED),-1
 ELSE
   TEXT 150,30,"TRANSPARENT",CM,2,2,RGB(RED),-1
   TEXT 150,70,"NO SUPPORT",CM,2,2,RGB(RED),-1
 ENDIF
 


? "******************************************"
? "              TEST RESULTS                  "
? "********************************************"
? "DEVICE     ",MM.DEVICE$
? "LCDPANEL   ",MM.INFO$(LCDPANEL)
'? "LCDPANELID ",MM.INFO$(LCDPANELID)
? "Size ",MM.HRES,"x",MM.VRES
'if getscanlineSupported=1 then
'  ? "LCD ID1    ",hex$(getscanline(1),2)
'  ? "LCD ID2    ",hex$(getscanline(2),2)
'  ? "LCD ID3    ",Hex$(getscanline(3),2)
'end if
IF blitsupport=1 THEN
 IF pwr THEN ? vt100.colour$("GREEN")+"Pixel write/read by gradiant OK" ELSE ? vt100.colour$("RED")+"Pixel write/read by gradiant FAILED!!!!!!!!!! " +STR$(pwre) +" pixels"
 IF pb THEN ? vt100.colour$("GREEN")+"Pixel blit by gradiant OK" ELSE  ? vt100.colour$("RED")+"Pixel blit  by gradiant FAILED!!!!!!!!!!!! " +STR$(pbe) +" pixels"
 IF tx THEN ? vt100.colour$("GREEN")+"Pixel write/read for all bit X transition OK" ELSE  ? vt100.colour$("RED")+"Pixel write/read for all bit X transition FAILED!!!!!!!!!! " +STR$(txe) +" pixels"
 IF tbx THEN ? vt100.colour$("GREEN")+"Pixel blit for all bit X transition OK" ELSE  ? vt100.colour$("RED")+"Pixel blit for all bit X transition FAILED!!!!!!! " +STR$(tbxe) +" pixels"
 IF ty THEN ? vt100.colour$("GREEN")+"Pixel write/read for all bit Y transition OK" ELSE  ? vt100.colour$("RED")+"Pixel write/read for all bit Y transition FAILED!!!!!!!!! " +STR$(tye) +" pixels"
 IF tby THEN ? vt100.colour$("GREEN")+"Pixel blit for all bit Y transition OK" ELSE  ? vt100.colour$("RED")+"Pixel blit for all bit Y transition FAILED!!!!!!!!!! " +STR$(tbye) +" pixels"
 IF tbt THEN ? vt100.colour$("GREEN")+"TEXT blit for Black on White OK" ELSE  ? vt100.colour$("RED")+"TEXT blit for Black on White FAILED!!!!!!!!!! " +STR$(tbte) +" pixels"
ENDIF
? vt100.colour$("RESET")
IF pir THEN
 IF blitsupport=1 THEN
    ? vt100.colour$("GREEN")+"LOAD IMAGE and test of pixels as loaded OK"
  ENDIF  
ELSE
 IF MM.INFO$(SDCARD)="Ready" THEN
   IF blitsupport=1 THEN
     IF pire>0 THEN
      ? vt100.colour$("RED")+"LOAD IMAGE  and test pixels FAILED!!!!!!!!!!! " +STR$(pire) +" pixels"
     END IF
   ELSE
    ? vt100.colour$("MAGENTA")+"LOAD IMAGE  Done - visually check it appear on screen"
   ENDIF
 ELSE
   ? vt100.colour$("YELLOW")+"LOAD IMAGE not TESTED - NO SDCARD"
 ENDIF
ENDIF
IF pirw THEN
  IF blitsupport=1 THEN
   ? vt100.colour$("GREEN")+"SAVE IMAGE then LOAD IMAGE and test of pixels as loaded OK"
  ENDIF  
ELSE
 IF MM.INFO$(SDCARD)="Ready" THEN
   IF blitsupport=1 THEN
    ? vt100.colour$("RED")+"SAVE IMAGE then LOAD IMAGE  and test pixels FAILED!!!!!!!!!!! " +STR$(pirwe) +" pixels"
   ELSE
    ? vt100.colour$("MAGENTA")+"LOAD IMAGE  OK - visually check it appears on screen"
   ENDIF
 ELSE
   ? vt100.colour$("YELLOW")+"SAVE IMAGE/LOAD IMAGE not TESTED - NO SDCARD"
 ENDIF
ENDIF
IF blitsupport=1 THEN
? vt100.colour$("MAGENTA")+"TRANSPARENT TEXT tested - Check on display if OK"
? vt100.colour$("YELLOW")
ELSE
? "BLIT, TRANSPARENT TEXT and Read PIXEL() not supported on this LCDPANEL"
ENDIF
IF getscanlineSupported=1 THEN
? "GETSCANLINE() Range ",bottom,"-",top
ELSE
? "GETSCANLINE() Not Supported on this display"
ENDIF
IF backlightSupported=1 THEN
? "Backlight Supported on this display "
ELSE
? "Backlight Not Setup/Supported on this display"
ENDIF
'? "COM1 Baudrate ",BAUDRATE(1,1)
'? "COM2 Baudrate ",BAUDRATE(2,1)
'? "COM3 Baudrate ",BAUDRATE(3,1)
'? "COM4 Baudrate ",BAUDRATE(4,1)
'? "Battery Voltage ",PIN(BAT)
'? "Battery Voltage ",PIN(BAT)
'? "Battery Voltage ",PIN(BAT)
'OPTION VCC 3.3
'OPTION VCC 3.3 * PIN(SREF) / PIN(IREF)
'? "**** AFTER VCC is adjusted ********"
'? "Battery Volatge ",PIN(BAT)
'? "Battery Volatge ",PIN(BAT)
'? "Battery Volatge ",PIN(BAT)

'CLS
TEXT MM.HRES/2,(MM.VRES/2)-20,"Complete","CM",1,4,RGB(WHITE)
TEXT MM.HRES/2,(MM.VRES/2)+30,"Complete","CM",1,4,RGB(RED)
TEXT MM.HRES/2,(MM.VRES/2)+80,"Complete","CM",1,4,RGB(WHITE)
? vt100.colour$("RESET")  
PAUSE 1000
POKE DISPLAY &H28
PAUSE 2000
POKE DISPLAY &H29
IF (pwre+pbe+txe+tye+tbxe+tbye+tbte+pire+pirwe=0) THEN
 INC TESTCOUNT
 GOTO TESTSTART
ELSE  
 ? vt100.colour$("RED")
 ? " !!!! test " + STR$(TESTCOUNT)+" Failed !!!"
 ? vt100.colour$("RESET")
 INC TESTFAILED
 INC TESTCOUNT
 GOTO TESTSTART
END IF  

SUB printerror
       ?
       ? LEFT$(BIN$(c,24),8)+" "+MID$(BIN$(c,24),9,8)+" "+RIGHT$(BIN$(c,24),8)+" @ "+STR$(x1)+","+STR$(y1)
       ? LEFT$(BIN$(r,24),8)+" "+MID$(BIN$(r,24),9,8)+" "+RIGHT$(BIN$(r,24),8)      
       IF retry THEN
         r=PIXEL (x1,y1)
         IF r=c THEN
           ok$=" OK"
         ELSE
           ok$=""
         ENDIF
         '? left$(BIN$(c,24),8)+" "+mid$(BIN$(c,24),9,8)+" "+right$(BIN$(c,24),8)+" ReDo "+str$(x1)+","+str$(y1)
         ? LEFT$(BIN$(r,24),8)+" "+MID$(BIN$(r,24),9,8)+" "+RIGHT$(BIN$(r,24),8)+" Retry "+ ok$
       ENDIF  
END SUB

'#Include "../vt100.inc"
FUNCTION vt100$(s$)
 vt100$ = CHR$(27) + "[" + s$
END FUNCTION

FUNCTION vt100.colour$(c$)
 SELECT CASE LCASE$(c$)
   CASE "black"   : vt100.colour$ = vt100$("30m")
   CASE "red"     : vt100.colour$ = vt100$("31m")
   CASE "green"   : vt100.colour$ = vt100$("32m")
   CASE "yellow"  : vt100.colour$ = vt100$("33m")
   CASE "blue"    : vt100.colour$ = vt100$("34m")
   CASE "magenta", "purple" : vt100.colour$ = vt100$("35m")
   CASE "cyan"    : vt100.colour$ = vt100$("36m")
   CASE "white"   : vt100.colour$ = vt100$("37m")
   CASE "reset"   : vt100.colour$ = vt100$("0m")
   CASE "cls"   : vt100.colour$ = vt100$("2J")     'Clear Display
   CASE "home"   : vt100.colour$ = vt100$("H")     'Home Cursor
   CASE ELSE      : ERROR "Unknown VT100 colour: " + c$
 END SELECT
END FUNCTION



--------------------------------------------------
Connected to: PicoMite 5.09
--------------------------------------------------





LCDPANEL Integrity Test
-----------------------
Short Test - 100*100 pixels tested
ILI9488
BLIT Supported
BACKLIGHT NOT Supported
getscanline() NOT Supported
TEST RGB colour order
************************************
Doing write to Pixels colour gradiant
and then read of pixels.
************************************
writing          10000   pixels...
2099.456        mSec
reading          10000   pixels...

5350.002        mSec
correct pixels   10000
incorrect pixels         0
total pixels     10000

************************************
Doing BLIT - blit 0,0,0,0,100,100
and re read of pixels.
************************************
reading          10000   pixels after blit ...

5557.038        mSec
correct pixels   10000
incorrect pixels         0
total pixels     10000

************************************
Doing  SAVE IMAGE TEST.BMP ,0,0,100,100
then  RESTORE IMAGE TEST.BMP 0,0
and re read of pixels.
************************************
Image saved as TEST.BMP
Loading Image TEST.BMP
reading          10000   pixels after LOAD IMAGE ...

5361.411        mSec
correct pixels   10000
incorrect pixels         0
total pixels     10000
----------------------
All Bit transistion test
change by X coordinate
---------------------
writing          10000   pixels...
1559.72         mSec
reading          10000   pixels...

5088.771        mSec
correct pixels   10000
incorrect pixels         0
total pixels     10000

************************************
Doing BLIT - blit 0,0,0,0,100,100
and re read of Transition X pixels.
************************************
reading          10000   pixels after blit ...

5097.605        mSec
correct pixels   10000
incorrect pixels         0
total pixels     10000
************************************
Bit transistion by Y test
and re read of pixels.
************************************
writing          10000   pixels...
1602.467        mSec
reading          10000   pixels...

5334.488        mSec
correct pixels   10000
incorrect pixels         0
total pixels     10000

************************************
Doing BLIT - blit 0,0,0,0,100,100
and re read of transition Y pixels.
************************************
reading          10000   pixels after blit ...

5079.353        mSec
correct pixels   10000
incorrect pixels         0
total pixels     10000
************************************
BLIT TEST OF BLACK ON WHITE TEXT
************************************
writing          10000   pixels...
verifying TEXT   10000   pixels...

6242.066        mSec
correct pixels   10000
incorrect pixels         0
total pixels     10000
**************************************************
 TRANSPARENT TEXT TEST
**************************************************
******************************************
             TEST RESULTS
********************************************
DEVICE          PicoMite
LCDPANEL        ILI9488
Size     480    x        320
Pixel write/read by gradiant OK
Pixel blit by gradiant OK
Pixel write/read for all bit X transition OK
Pixel blit for all bit X transition OK
Pixel write/read for all bit Y transition OK
Pixel blit for all bit Y transition OK
TEXT blit for Black on White OK

SAVE IMAGE then LOAD IMAGE and test of pixels as loaded OK
TRANSPARENT TEXT tested - Check on display if OK

GETSCANLINE() Not Supported on this display
Backlight Not Setup/Supported on this display

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!  1 tests completed    !!!!
!!!!  0 tests Failed       !!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

>
>
Latest F4 Latest H7
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8601
Posted: 11:26am 12 Apr 2024
Copy link to clipboard 
Print this post

Nice test

For the ILI9488 set whites to &HFCFCFC and the same with the mask AND turn console mode off
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1654
Posted: 03:31pm 12 Apr 2024
Copy link to clipboard 
Print this post

I use the same board for ili9488 and ips ili9488 with 10K resistor and in5818 diode no other mods and both displays work fine. maybe I was lucky.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3573
Posted: 06:18pm 12 Apr 2024
Copy link to clipboard 
Print this post

The 1N5819 has 100 pf capacitance. That may actually work better. But you also may have been lucky.

Volhout
Edited 2024-04-13 04:20 by Volhout
PicomiteVGA PETSCII ROBOTS
 
     Page 10 of 12    
Print this page
© JAQ Software 2024