Welcome Guest, you are in: Login

Fruit Of The Shed

Navigation (MMBasic)






Search the wiki

»


Page History: Multiple LCD panel displays

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: 2017/08/07 17:05


The Micromite can natively drive a number of common LCD panel displays - these can really bring a spark of panache to a project and are cheaply available on a number of electronics components outlets/tat-bazaars at around the £5 mark.

I have a requirement for such a display but it needs to be long rather than big due to restrictions on the space available. I decided to try stacking two 2.8" colour TFTs side by side, but would it be possible to drive them from a single Micromite?

In the breadboard knock-up, I handle the CS pins of each display individually. This requires two extra outputs and the code switches to the relevant display immediately before doing anything on it.

Here is a small video of the below code in action on a breadboard with a Micromite MkII 44pin.

Currently the displays are quite simplistic as this is only a proof of concept. I took the familiar test program from the Micromite manual and tweaked it to hold the relevant switching but it is essentially the same. Really, there is no practical limit to the number of LCDs you could drive in this way.

The Micromite needs to have the LCD options set at the command prompt but the program re-initialises the LCD panels with the GUI RESET command so that they play nicely. I also tied the LCD reset pins to VCC to prevent the GUI RESET commands fighting. You would probably be better off tying them to the master reset or to another output pin and controlling them manually too. This does sterilise the reset pin in the OPTION LCDPANEL command (19) from use.

If you are careful with the CS activity, there is no reason to lose any functionality - even when reading from the panels - MISO is tri-stated by the slave until the CS goes low - make sure you don't have both CSs low simultaneously. To minimise the control pins, you can use a simple selector and a single hi/lo selector for the displays as shown below. This could be expanded very easily to 16 displays with something like a 74HC154(!)

Image


' OPTION LCDPANEL ILI9341, orientation, D/C pin, reset pin [,CS pin]
' OPTION LCDPANEL ILI9341,RL,15,19,21

  SetPin 23,dout: Pin(23)=1 ' set both CS HI
  SetPin 24,dout: Pin(24)=1


  Pin(23)=0:GUI reset lcdpanel:Pin(23)=1)' reset each display in turn  CS LO -> RESET -> CS HI
  Pin(24)=0:GUI reset lcdpanel:Pin(24)=1)

  'Const DBlue = RGB(0, 0, 128) ' A dark blue colour
  Colour RGB(white), RGB(BLACK) ' Set the default colours

  Font 1,2 ' Set the default font

  Do
    For n=23 To 24 ' easy way to get the CS pins for each display
      Pin(n)=0 ' CS LO

      'draw some stuff
      Box 0, 0, MM.HRes-1, MM.VRes/2, 3, RGB(RED), RGB(Rnd*128,Rnd*128,Rnd*128)
      Text MM.HRes/2, MM.VRes/4, Time$, "CM" , 1, 4, RGB(CYAN), DBlue
      'Text MM.HRes/2, MM.VRes*3/4, "Disp"+Str$(n-22)+" "+Date$, "CM"
      Text Rnd*320, Rnd*240, "Disp"+Str$(n-22)+" "+Date$
      Circle Rnd*320,Rnd*240,Rnd*100
      Box Rnd*320,Rnd*240,Rnd*320,Rnd*240,3, RGB(Rnd*128,Rnd*128,Rnd*128)

      Pin(n)=1'  CS HI
    Next
  Loop