Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 00:05 21 Apr 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 : MM2: All graphics updated - version 1.2

     Page 1 of 2    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 09:13am 18 Jan 2015
Copy link to clipboard 
Print this post

Please find attached a new version 1.2 of all the graphics routines.

Changes are:

All displays brought to common version with identical routine calling sequences other than the difference between monochrome and colour

Pbitmap subroutine implemented across all versions to allow any 8x6 bitmap to be displayed in any orientation, at any x,y coordinate, and at any scale factor

Font table reduced in size

Fill triangle routine converted to cFunction

cFunction code size reduced and some speed improvements.

There are 9 files in the zip, all include complete test and demonstration code. All programs are tested and work properly on my breadboard. If you are using older versions I recommend updating.

Monochrome:
128x64 GLCD KS0108 controller - 8-bit parallel interface (the "old" GLCD version)
128x64 GLCD ST7920 controller - SPI ("new" GLCD)
84x48 GLCD Nokia 5110 - SPI
128x64 OLED SSD1306 - SPI
128x64 OLED SSD1306 - I2C

Colour
240x320 TFT ST7781 controller - parallel I/F (many 2.4" Arduino shield displays)
240x320 TFT ILI9341 controller - parallel I/F (other 2.4" and many 2.8" Arduino shield displays)
240x320 TFT ILI9341 controller + XPT 2046 touch controller - SPI (2.4" displays)
120x160 TFT ST7735 controller - SPI (1.8" displays)

2015-01-18_190412_Graphics-v1.2.zip
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 10:21am 18 Jan 2015
Copy link to clipboard 
Print this post

A million thanks Peter from me. I guess lots of other members here will also want to pass on their gratitude too. Absolutely brilliant once again

So can I now have one cheeky request without sounding too ungrateful for all your excellent effort to date . . .

I have a personal project requiring a small colour display (no touch) and would love to use one of these 1.8" OLED SPI modules (based on a SSD1351 controller). They are a very clear & bright unit - far better contrast than any colour TFT I have come across.

So do you think these could work nicely with a MicroMite running some 'MatherP code'? If so, are you up for the challenge of adding this Display & code to your ever expanding list?

WW

Edited by WhiteWizzard 2015-01-19
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1326
Posted: 06:41pm 18 Jan 2015
Copy link to clipboard 
Print this post

Thanks again from me too Peter. This is a great resource for everyone using MMBasic and the Micromite. Also the speed you've now made available for graphics highlights the effort that Geoff and Peter C put in to develope the CFunction 'system'.

Greg
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 712
Posted: 07:38pm 18 Jan 2015
Copy link to clipboard 
Print this post

Wow!

What a great Job, wonderfull.

I prefer more comments in the C code, so my chance to understand it will rise ;-)
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5886
Posted: 03:40pm 21 Jan 2015
Copy link to clipboard 
Print this post

I have finally started playing with a 120x160 TFT ST7735 controller display

It seems to work OK except for line drawing.
lines and triangles (which call the line drawing sub) do nothing.

Filled triangles are OK

Another problem I had was the colours.
I had to invert the pixels with
i=T18draw(T18.wcom,ST7735_INVON)

This gets something resembling true colours but I still need to do some more experimenting.

Is there a recommended way to control the back-light?
I am using PWM at a frequency of 200 Hz

Jim


VK7JH
MMedit   MMBasic Help
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 10:32pm 21 Jan 2015
Copy link to clipboard 
Print this post

Hi Jim

Do the lines and triangles fail in my demo program or in your own code?

Do unfilled rectangles work?

I can think of one possible reason why line drawing may fail to do with an optimisation I made if the controller behaves slightly different from the one on my boards.

Try doing a fillscreen and then draw a diagonal line, if that works I know the reason.

I've got two different versions of the 1.8" display and both work with the attached code.

I just tie the backlight to 3.3V - can't see any reason not to. On my boards the complete system, including MM only pulls 70mA.

Please note this has a different pinout for CS, CD and reset and there are options for 44-pin or 28-pin MM

2015-01-22_085958_TFT-ST7735-SPI.zip



Edited by matherp 2015-01-23
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5886
Posted: 11:24pm 21 Jan 2015
Copy link to clipboard 
Print this post

I have done some more testing.
Replace the test sub in you program with this:

SUB T18_test
T18.fillscreen(red)
pause 2000
T18.dline(0, 0, 110, 110, white)
pause 2000
T18.drect(10, 10, T18_params(T18_wi)-20, T18_params(T18_ht)-20, green)

pause 2000
end sub


The diagonal line does not appear, even for a few seconds.

but with the order of drawing changed, this code:
SUB T18_test
T18.fillscreen(red)

pause 2000
T18.drect(10, 10, T18_params(T18_wi)-20, T18_params(T18_ht)-20, green)
pause 2000
T18.dline(0, 0, 110, 110, white)
pause 2000
end sub


Does work. Both the diagonal line and the rectangle are drawn.

I am also having problems with the colours but I will put that down to my hardware.
To get reasonable colours, as well as 'inverting', I am using:
DIM INTEGER BLACK = &H0000
DIM INTEGER BLUE = &H000E
DIM INTEGER RED = &H3000
DIM INTEGER GREEN = &H0100
DIM INTEGER CYAN = &H010E
DIM INTEGER MAGENTA=&H300E
DIM INTEGER YELLOW= &H3100
DIM INTEGER WHITE = &H310E


Jim

VK7JH
MMedit   MMBasic Help
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 11:41pm 21 Jan 2015
Copy link to clipboard 
Print this post

Jim

both your programs work properly for me so I think we can assume, particularly given the colour issue, that your board isn't using exactly the same controller. Unfortunately, these SPI boards don't have a SPI-OUT pin so you can't read from them.

Can you provide a link to the specific board you bought.

Also, you could try running the ILI9341 code (you wiill need to change the width and height parameters - this uses nearly the same drawing but has different setup. You could also try slowing down the SPI to say 6000000.

 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5886
Posted: 10:48am 22 Jan 2015
Copy link to clipboard 
Print this post

This is the one I have
1.8TFT

The one that arrived has a slightly different silk screen overlay so I expect that you are right - different chip.
Luckily, I didn't buy a big pile of them!

I will try the ILI9341 code later today.

Jim
VK7JH
MMedit   MMBasic Help
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 01:34pm 22 Jan 2015
Copy link to clipboard 
Print this post

Yikes... I bought 10 of these... Hope TassyJim can get them working... They just came in today... Will get a chance to play during the weekend...

Also, with the SD-card, could you hook up the MiniMM (64 pinner), use the SD-card, and have the code to interface to the display..? Maybe not...
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 04:22am 23 Jan 2015
Copy link to clipboard 
Print this post

  Quote  could you hook up the MiniMM (64 pinner), use the SD-card, and have the code to interface to the display..?


Not unless Geoff migrates Cfunctions

Zonker:
your displays may work anyway I've got two different versions and they both work fine. If not, worst case, you can ship me one and we will get it working somehow.

Jim:

You could try this initialisation for the SPFD5408.

The fact that the screen displays at all and the cursor moves correctly means that the controller must be in the ILI9341/ST7781/SPDF5408 group.

These all use registers 0x20 and 0x21 to set the cursor position - I haven't found any other yet the same so the problem must be soluble.

There are two variants of the SPFD5408 - try this code first and if not I'll look for the other version


T24.wreg(&H00e5,&H8000)
T24.wreg(&H0000,&H0001)
T24.wreg(&H0001,&H0100)
T24.wreg(&H0002,&H0700)
T24.wreg(&H0003,&H1030)
T24.wreg(&H0004,&H0000)
T24.wreg(&H0008,&H0202)
T24.wreg(&H0009,&H0000)
T24.wreg(&H000a,&H0000)
T24.wreg(&H000c,&H0000)
T24.wreg(&H000d,&H0000)
T24.wreg(&H000f,&H0000)
'*********************************************Power On
T24.wreg(&H0010,&H0000)
T24.wreg(&H0011,&H0000)
T24.wreg(&H0012,&H0000)
T24.wreg(&H0013,&H0000)
T24.wreg(&H0010,&H17b0)
T24.wreg(&H0011,&H0037)
T24.wreg(&H0012,&H0138)
T24.wreg(&H0013,&H1700)
T24.wreg(&H0029,&H000d)
T24.wreg(&H0020,&H0000)
T24.wreg(&H0021,&H0000)
'*********************************************Set gamma
T24.wreg(&H0030,&H0001)
T24.wreg(&H0031,&H0606)
T24.wreg(&H0032,&H0304)
T24.wreg(&H0033,&H0202)
T24.wreg(&H0034,&H0202)
T24.wreg(&H0035,&H0103)
T24.wreg(&H0036,&H011d)
T24.wreg(&H0037,&H0404)
T24.wreg(&H0038,&H0404)
T24.wreg(&H0039,&H0404)
T24.wreg(&H003c,&H0700)
T24.wreg(&H003d,&H0a1f)
'**********************************************Set Gram aera
T24.wreg(&H0050,&H0000)
T24.wreg(&H0051,&H00ef)
T24.wreg(&H0052,&H0000)
T24.wreg(&H0053,&H013f)
T24.wreg(&H0060,&H2700)
T24.wreg(&H0061,&H0001)
T24.wreg(&H006a,&H0000)
'*********************************************Partial display
T24.wreg(&H0090,&H0010)
T24.wreg(&H0092,&H0000)
T24.wreg(&H0093,&H0003)
T24.wreg(&H0095,&H0101)
T24.wreg(&H0097,&H0000)
T24.wreg(&H0098,&H0000)
'******************************************** Plan Control
T24.wreg(&H0007,&H0021)
T24.wreg(&H0007,&H0031)
T24.wreg(&H0007,&H0173)
Edited by matherp 2015-01-24
 
Oldbitcollector

Senior Member

Joined: 16/05/2014
Location: United States
Posts: 172
Posted: 06:15am 23 Jan 2015
Copy link to clipboard 
Print this post

Might the SD card slot be accessible using the MkII?


My Propeller/Micromite mini-computer project.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 07:41am 23 Jan 2015
Copy link to clipboard 
Print this post

  Quote  Might the SD card slot be accessible using the MkII?


I've raised this with Geoff and it is just too much code for the 32MX170 either embedded in the firmware or as a Cfunction - sorry....
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 08:53am 23 Jan 2015
Copy link to clipboard 
Print this post

Jim, Zonker et al

Just found this listing 1.8" TFT
- 3 options for controller and all slightly different but all use the same x,y,positioning commands so we now have 7 possibilities for the 1.8" controller.

ST7735B
ST7735R
ILI9341
SPFD5408A
SPFD5408B
HX8353
S6D02A1

The good news is that the same cFunctions should work for them all so it will only be the Basic code that needs changing.

The bad news is that the only way to tell which you have is to find initialisation code for each and keep trying until it works properly.

In all cases, using my SPI routines, intialisation consists of making a call to set the register you want to update and then writing a number of databytes as required by the register.

The best sources I've found of "working" initialisation codes are usually Adafruit or Itead or Sainsmart if they have ever used the particular controller.

I guess the moral of this story is only to buy off vendors who are absolutely specific which controller is used and who list appropriate sample code - doesn't matter if it is Arduino, it is just important that there is working code available.



Edited by matherp 2015-01-24
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 09:32am 23 Jan 2015
Copy link to clipboard 
Print this post

You might be able to use the SD card directly in SPI mode. In that case you need to read and write blocks of data. Most often that is 512 bytes.
Code can be found on the net.

If a filesystem is necessary the smallest I found is Petit FAT File System. (Also a full FS is available FatFs )
Code size is about 2-4k for the Petit FAT. If assembly language is used it can probably be even less.
I guess it is how much you need it to go into that effort.




Microblocks. Build with logic.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5886
Posted: 06:45pm 23 Jan 2015
Copy link to clipboard 
Print this post

Oh joy! Oh happiness!

My 1.8in modules use the S6D02A1

I have replaced the T18.init sub with
sub T18.init
'Global "Constants"
const T18_CS=6
const T18_CD=4
const T18_RESET=5
const ST7735_NOP =&H0
const ST7735_SWRESET =&H01
const ST7735_RDDID =&H04
const ST7735_RDDST =&H09
const ST7735_SLPIN =&H10
const ST7735_SLPOUT =&H11
const ST7735_PTLON =&H12
const ST7735_NORON =&H13
const ST7735_INVOFF =&H20
const ST7735_INVON =&H21
const ST7735_DISPOFF =&H28
const ST7735_DISPON =&H29
const ST7735_CASET =&H2A
const ST7735_RASET =&H2B
const ST7735_RAMWR =&H2C
const ST7735_RAMRD =&H2E
const ST7735_COLMOD =&H3A
DIM integer ST7735_MADCTL =&H36
const ST7735_FRMCTR1 =&HB1
const ST7735_FRMCTR2 =&HB2
const ST7735_FRMCTR3 =&HB3
const ST7735_INVCTR =&HB4
const ST7735_DISSET5 =&HB6
const ST7735_PWCTR1 =&HC0
const ST7735_PWCTR2 =&HC1
const ST7735_PWCTR3 =&HC2
const ST7735_PWCTR4 =&HC3
const ST7735_PWCTR5 =&HC4
const ST7735_VMCTR1 =&HC5
const ST7735_RDID1 =&HDA
const ST7735_RDID2 =&HDB
const ST7735_RDID3 =&HDC
const ST7735_RDID4 =&HDD
const ST7735_PWCTR6 =&HFC
const ST7735_GMCTRP1 =&HE0
const ST7735_GMCTRN1 =&HE1
'
dim integer BLACK = &H0000 ' Color definitions: 16 bit (BGR565) colour palette so these are just examples
dim integer BLUE = &HF800
dim integer RED = &H001F
dim integer GREEN = &H07E0
dim integer CYAN = &HFFE0
dim integer MAGENTA=&HF81F
dim integer YELLOW= &H07FF
dim integer WHITE = &HFFFF
dim integer T18.pix=0
dim integer T18.ffr=1
dim integer T18.filltri=2
dim integer T18.drawline=3
dim integer T18.wcom=4
dim integer T18.wdata=5
dim integer T18.fastfillscreen=6
dim integer T18.fpstring=7
dim integer T18.fcirch=8
dim integer T18.dcirch=9
dim integer T18_normal=0
dim integer T18_inverse=1
dim integer T18_rt_right=2
dim integer T18_rt_left=3
dim integer T18_AddrOfFont, T18_params(6) ' Global variables
DIM integer T18_wi=0,T18_ht=1,T18_rot=2, T18_nr=3,T18_X=4,T18_Y=5,T18_seed=6
local integer i
spi open 10000000,3,8
T18_Params(T18_wi)=128
T18_params(T18_ht)=160
T18_AddrOfFont=PEEK(CFunAddr FONT)
pin(T18_CS)=1
setpin T18_CS, DOUT
pin(T18_CD)=1
setpin T18_CD, DOUT
pin(T18_RESET)=1
setpin T18_RESET, DOUT' Reset the display
pin(T18_RESET)=0
pause 100
pin(T18_RESET)=1
pause 100
i=T18draw(T18.wcom,ST7735_SWRESET)'software reset
pause 150
i=T18draw(T18.wcom,ST7735_SLPOUT)'out of sleep mode
pause 500
'case S6D02A1:
i=T18draw(T18.wcom,&Hf0)
i=T18draw(T18.wdata,&H5a)
i=T18draw(T18.wdata,&H5a)

i=T18draw(T18.wcom,&Hfc)
i=T18draw(T18.wdata,&H5a)
i=T18draw(T18.wdata,&H5a)

i=T18draw(T18.wcom,&H26)
i=T18draw(T18.wdata,&H01)

i=T18draw(T18.wcom,&Hfa)
i=T18draw(T18.wdata,&H02)
i=T18draw(T18.wdata,&H1f)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H10)
i=T18draw(T18.wdata,&H22)
i=T18draw(T18.wdata,&H30)
i=T18draw(T18.wdata,&H38)
i=T18draw(T18.wdata,&H3A)
i=T18draw(T18.wdata,&H3A)
i=T18draw(T18.wdata,&H3A)
i=T18draw(T18.wdata,&H3A)
i=T18draw(T18.wdata,&H3A)
i=T18draw(T18.wdata,&H3d)
i=T18draw(T18.wdata,&H02)
i=T18draw(T18.wdata,&H01)

i=T18draw(T18.wcom,&Hfb)
i=T18draw(T18.wdata,&H21)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H02)
i=T18draw(T18.wdata,&H04)
i=T18draw(T18.wdata,&H07)
i=T18draw(T18.wdata,&H0a)
i=T18draw(T18.wdata,&H0b)
i=T18draw(T18.wdata,&H0c)
i=T18draw(T18.wdata,&H0c)
i=T18draw(T18.wdata,&H16)
i=T18draw(T18.wdata,&H1e)
i=T18draw(T18.wdata,&H30)
i=T18draw(T18.wdata,&H3f)
i=T18draw(T18.wdata,&H01)
i=T18draw(T18.wdata,&H02)

'//////////////power setting sequence//////////
i=T18draw(T18.wcom,&Hfd)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H17)
i=T18draw(T18.wdata,&H10)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H01)
i=T18draw(T18.wdata,&H01)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H1f)
i=T18draw(T18.wdata,&H1f)

i=T18draw(T18.wcom,&Hf4)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H3f)
i=T18draw(T18.wdata,&H3f)
i=T18draw(T18.wdata,&H07)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H3C)
i=T18draw(T18.wdata,&H36)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H3C)
i=T18draw(T18.wdata,&H36)
i=T18draw(T18.wdata,&H00)
'//pause(80)

i=T18draw(T18.wcom,&Hf5)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H70)'//39
i=T18draw(T18.wdata,&H66)'//3a
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H6d)'//38
i=T18draw(T18.wdata,&H66)'//38
i=T18draw(T18.wdata,&H06)

i=T18draw(T18.wcom,&Hf6)
i=T18draw(T18.wdata,&H02)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H3f)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H02)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H06)
i=T18draw(T18.wdata,&H01)
i=T18draw(T18.wdata,&H00)

i=T18draw(T18.wcom,&Hf2)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H01)'//04
i=T18draw(T18.wdata,&H03)
i=T18draw(T18.wdata,&H08)
i=T18draw(T18.wdata,&H08)
i=T18draw(T18.wdata,&H04)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H01)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H04)
i=T18draw(T18.wdata,&H08)
i=T18draw(T18.wdata,&H08)

i=T18draw(T18.wcom,&Hf8)
i=T18draw(T18.wdata,&H11)'//66

i=T18draw(T18.wcom,&Hf7)
i=T18draw(T18.wdata,&Hc8)
i=T18draw(T18.wdata,&H20)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)

i=T18draw(T18.wcom,&Hf3)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)

i=T18draw(T18.wcom,&H11)
pause(50)

i=T18draw(T18.wcom,&Hf3)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H01)
pause(50)
i=T18draw(T18.wcom,&Hf3)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H03)
pause(50)
i=T18draw(T18.wcom,&Hf3)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H07)
pause(50)
i=T18draw(T18.wcom,&Hf3)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H0f)
pause(50)

i=T18draw(T18.wcom,&Hf4)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H04)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H3f)
i=T18draw(T18.wdata,&H3f)
i=T18draw(T18.wdata,&H07)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H3C)
i=T18draw(T18.wdata,&H36)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H3C)
i=T18draw(T18.wdata,&H36)
i=T18draw(T18.wdata,&H00)
pause(50)

i=T18draw(T18.wcom,&Hf3)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H1f)
pause(50)
i=T18draw(T18.wcom,&Hf3)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H7f)
pause(50)

i=T18draw(T18.wcom,&Hf3)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&Hff)
pause(50)

i=T18draw(T18.wcom,&Hfd)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H17)
i=T18draw(T18.wdata,&H10)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H01)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H16)
i=T18draw(T18.wdata,&H16)

i=T18draw(T18.wcom,&Hf4)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H09)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H3f)
i=T18draw(T18.wdata,&H3f)
i=T18draw(T18.wdata,&H07)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H3C)
i=T18draw(T18.wdata,&H36)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wdata,&H3C)
i=T18draw(T18.wdata,&H36)
i=T18draw(T18.wdata,&H00)

'/////////////initializing sequence/////////////

i=T18draw(T18.wcom,&H36)
i=T18draw(T18.wdata,&H08)

i=T18draw(T18.wcom,&H35)
i=T18draw(T18.wdata,&H00)
i=T18draw(T18.wcom,&H3a)
i=T18draw(T18.wdata,&H05)


'/////////////////gamma setting sequence/////////

pause(150)
i=T18draw(T18.wcom,&H29)
i=T18draw(T18.wcom,&H2c)


pause 10
T18.setrot(0)
T18.fillscreen(black)
end sub


I found a nice set of routines for arduino (and others). I forget where I found it but here is a 10Meg ZIP. 18in_display.zip

It goes by the title "QDtech_TFT180A_S6D02A1 LCD Module" but the ZIP has code for a number of display types so it could be handy.

I now have to tidy up my code and remove any superfluous bits that remain from Peter's original.

I had to swap RED and BLUE colours. Instead of RGB, you need BGR. There might be a setting to change it so the order is the same as other displays but I don't think it's too much of a problem. At least it works.

I had a second module that refused to do anything with the original code. It now works too.

Happy days.

Jim

VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5886
Posted: 04:47pm 24 Jan 2015
Copy link to clipboard 
Print this post

This S6D02A1 1.8 inch display is a modification of Peter's ST7735 code.
I used the version with
' 28-pin
const T18_CS=24 'b13
const T18_CD=26 'b15
const T18_RESET=9 'a02

Apart from the initialization routine I had to change a couple of subs.
T18.setrot changed to alter rotation and keep RGB order.
T18.dcirc and T18.dline changed to draw with the correct colour.
It needs a call to T18.ffr to set the colour or you are likely to get a line drawn with the background colour.

I don't have all the details of the initialization routine but it works....

The initialization sub is getting rather long so I will experiment with using DATA statements in an attempt to get it back to a reasonable size.

2015-01-25_024541_TFT-S6D02A1-SPIb.zip

Jim

VK7JH
MMedit   MMBasic Help
 
Oldbitcollector

Senior Member

Joined: 16/05/2014
Location: United States
Posts: 172
Posted: 01:18pm 30 Jan 2015
Copy link to clipboard 
Print this post

Reporting another success... (thanks to TassyJim for helping me decode it a bit)

I took a chance on the 2.2 SPI TFT LCD-240x320-ILI9341

After seeing it work perfectly here, I took a few minutes to create a simple diagram to help others. See attached






My Propeller/Micromite mini-computer project.
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 07:56pm 31 Jan 2015
Copy link to clipboard 
Print this post

Thanks TassyJim..!!

Looks like the 10 1.8" displays I got were the S6D02A1 type controllers, got the 1st one up and working... Big thanks to you and Matherp for doing the hard work..!



 
MipsyKing
Newbie

Joined: 12/02/2015
Location: Italy
Posts: 17
Posted: 04:41pm 20 Aug 2019
Copy link to clipboard 
Print this post

Hello, I need a little help because I don't understan how to make it works.
I have the last version of Micromite Basic on a 28 pin PIC32, terminal is working correctly. Also I have the smallest I2C version of both OLED display: 128x64 and 128x32. I connect my display to hardware I2C pins on micromite, both lines with 10k resistor to +3V. At this point, I'm unable to get any result because I don't know how to use the library in you zip file.
If I simply load it with the "autosave" command, it gives "error, duplicate dim of OLED_OFF"  (I see there are two similar DIM in the listing).
I tried to copy only the Cfunctions from the listing and the gave LIBRARY SAVE, loading the rest of the listing only after: same problem.
At the end, I must admit I have no idea how to use the library, there is no instructions in the file. To add confusion, I found another version and it was "bitbanged", this one - instead -seems to use only the real I2C, but is just a my impression and is not stated anywhere in the file.
Also, is nice to have a complete demo of the libray. But again, since there is no documentation, this make even harder to understand what is the "library part" and what is the "demo part". For example, I see some "triangle routines" (and much more) and I don't know if needed to make the display works.
Please, explain the steps I need to do in order to use the libray.
 
     Page 1 of 2    
Print this page
© JAQ Software 2024