Reading Datasheet of Chip Drivers

Dear Sparkfun members,

is there anyone who can direct me or teach me how to interpreter datasheets of Chip Drivers.

I want to understand the register thing.

I’ll give an example, with this please enlighten me.

For convenience, let’s focus on the ILI932X_DISP_CTRL1

I get was is written in register.h → the 0x07

but i don’t get how that makes → 0x0133 in the adafruit_GFX.cpp.

I can’t make heads or tails from the given information or from the datasheet.

How do they work together? What am i missing here?

kind regards

And thanks in advance for the time you’re giving.

Lorcan

taken from adafruit_GFX.cpp, register.h and the ILI9325 datasheet.

adafruit_GFX.cpp

static const uint16_t ILI932x_regValues PROGMEM = {

ILI932X_START_OSC , 0x0001, // Start oscillator

TFTLCD_DELAY , 50, // 50 millisecond delay

ILI932X_DRIV_OUT_CTRL , 0x0100,

ILI932X_DRIV_WAV_CTRL , 0x0700,

ILI932X_ENTRY_MOD , 0x1030,

ILI932X_RESIZE_CTRL , 0x0000,

ILI932X_DISP_CTRL2 , 0x0202,

ILI932X_DISP_CTRL3 , 0x0000,

ILI932X_DISP_CTRL4 , 0x0000,

ILI932X_RGB_DISP_IF_CTRL1, 0x0,

ILI932X_FRM_MARKER_POS , 0x0,

ILI932X_RGB_DISP_IF_CTRL2, 0x0,

ILI932X_POW_CTRL1 , 0x0000,

ILI932X_POW_CTRL2 , 0x0007,

ILI932X_POW_CTRL3 , 0x0000,

ILI932X_POW_CTRL4 , 0x0000,

TFTLCD_DELAY , 200,

ILI932X_POW_CTRL1 , 0x1690,

ILI932X_POW_CTRL2 , 0x0227,

TFTLCD_DELAY , 50,

ILI932X_POW_CTRL3 , 0x001A,

TFTLCD_DELAY , 50,

ILI932X_POW_CTRL4 , 0x1800,

ILI932X_POW_CTRL7 , 0x002A,

TFTLCD_DELAY , 50,

ILI932X_GAMMA_CTRL1 , 0x0000,

ILI932X_GAMMA_CTRL2 , 0x0000,

ILI932X_GAMMA_CTRL3 , 0x0000,

ILI932X_GAMMA_CTRL4 , 0x0206,

ILI932X_GAMMA_CTRL5 , 0x0808,

ILI932X_GAMMA_CTRL6 , 0x0007,

ILI932X_GAMMA_CTRL7 , 0x0201,

ILI932X_GAMMA_CTRL8 , 0x0000,

ILI932X_GAMMA_CTRL9 , 0x0000,

ILI932X_GAMMA_CTRL10 , 0x0000,

ILI932X_GRAM_HOR_AD , 0x0000,

ILI932X_GRAM_VER_AD , 0x0000,

ILI932X_HOR_START_AD , 0x0000,

ILI932X_HOR_END_AD , 0x00EF,

ILI932X_VER_START_AD , 0X0000,

ILI932X_VER_END_AD , 0x013F,

ILI932X_GATE_SCAN_CTRL1 , 0xA700, // Driver Output Control (R60h)

ILI932X_GATE_SCAN_CTRL2 , 0x0003, // Driver Output Control (R61h)

ILI932X_GATE_SCAN_CTRL3 , 0x0000, // Driver Output Control (R62h)

ILI932X_PANEL_IF_CTRL1 , 0X0010, // Panel Interface Control 1 (R90h)

ILI932X_PANEL_IF_CTRL2 , 0X0000,

ILI932X_PANEL_IF_CTRL3 , 0X0003,

ILI932X_PANEL_IF_CTRL4 , 0X1100,

ILI932X_PANEL_IF_CTRL5 , 0X0000,

ILI932X_PANEL_IF_CTRL6 , 0X0000,

ILI932X_DISP_CTRL1 , 0x0133, // Main screen turn on

};

register.h

// Register names from Peter Barrett’s Microtouch code

#define ILI932X_START_OSC 0x00

#define ILI932X_DRIV_OUT_CTRL 0x01

#define ILI932X_DRIV_WAV_CTRL 0x02

#define ILI932X_ENTRY_MOD 0x03

#define ILI932X_RESIZE_CTRL 0x04

#define ILI932X_DISP_CTRL1 0x07

#define ILI932X_DISP_CTRL2 0x08

#define ILI932X_DISP_CTRL3 0x09

#define ILI932X_DISP_CTRL4 0x0A

#define ILI932X_RGB_DISP_IF_CTRL1 0x0C

#define ILI932X_FRM_MARKER_POS 0x0D

#define ILI932X_RGB_DISP_IF_CTRL2 0x0F

#define ILI932X_POW_CTRL1 0x10

#define ILI932X_POW_CTRL2 0x11

#define ILI932X_POW_CTRL3 0x12

#define ILI932X_POW_CTRL4 0x13

#define ILI932X_GRAM_HOR_AD 0x20

#define ILI932X_GRAM_VER_AD 0x21

#define ILI932X_RW_GRAM 0x22

#define ILI932X_POW_CTRL7 0x29

#define ILI932X_FRM_RATE_COL_CTRL 0x2B

#define ILI932X_GAMMA_CTRL1 0x30

#define ILI932X_GAMMA_CTRL2 0x31

#define ILI932X_GAMMA_CTRL3 0x32

#define ILI932X_GAMMA_CTRL4 0x35

#define ILI932X_GAMMA_CTRL5 0x36

#define ILI932X_GAMMA_CTRL6 0x37

#define ILI932X_GAMMA_CTRL7 0x38

#define ILI932X_GAMMA_CTRL8 0x39

#define ILI932X_GAMMA_CTRL9 0x3C

#define ILI932X_GAMMA_CTRL10 0x3D

#define ILI932X_HOR_START_AD 0x50

#define ILI932X_HOR_END_AD 0x51

#define ILI932X_VER_START_AD 0x52

#define ILI932X_VER_END_AD 0x53

#define ILI932X_GATE_SCAN_CTRL1 0x60

#define ILI932X_GATE_SCAN_CTRL2 0x61

#define ILI932X_GATE_SCAN_CTRL3 0x6A

#define ILI932X_PART_IMG1_DISP_POS 0x80

#define ILI932X_PART_IMG1_START_AD 0x81

#define ILI932X_PART_IMG1_END_AD 0x82

#define ILI932X_PART_IMG2_DISP_POS 0x83

#define ILI932X_PART_IMG2_START_AD 0x84

#define ILI932X_PART_IMG2_END_AD 0x85

#define ILI932X_PANEL_IF_CTRL1 0x90

#define ILI932X_PANEL_IF_CTRL2 0x92

#define ILI932X_PANEL_IF_CTRL3 0x93

#define ILI932X_PANEL_IF_CTRL4 0x95

#define ILI932X_PANEL_IF_CTRL5 0x97

#define ILI932X_PANEL_IF_CTRL6 0x98

The ILI9325 datasheet

page 50 registry description

No. Registers Name R/W RS D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0

07h Display Control 1 W 1 0 0 PTDE1 PTDE0 0 0 0 BASEE 0 0 GON DTE CL 0 D1 D0

page 57-58 Display Control 1

7.2.7. Display Control 1 (R07h)

R/W RS D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0

W 1 0 0 PTDE1 PTDE0 0 0 0 BASEE 0 0 GON DTE CL 0 D1 D0

D[1:0] Set D[1:0]=”11” to turn on the display panel, and D[1:0]=”00” to turn off the display panel.

A graphics display is turned on the panel when writing D1 = “1”, and is turned off when writing

D1 = “0”.

When writing D1 = “0”, the graphics display data is retained in the internal GRAM and the

ILI9325 displays the data when writing D1 = “1”. When D1 = “0”, i.e. while no display is shown on the

panel, all source outputs becomes the GND level to reduce charging/discharging current, which is

generated within the LCD while driving liquid crystal with AC voltage.

When the display is turned off by setting D[1:0] = “01”, the ILI9325 continues internal display

operation. When the display is turned off by setting D[1:0] = “00”, the ILI9325 internal display

operation is halted completely. In combination with the GON, DTE setting, the D[1:0] setting controls

display ON/OFF.

D1 D0 BASEE Source, VCOM Output ILI9325 internal operation

0 0 0 GND Halt

0 1 1 GND Operate

1 0 0 Non-lit display Operate

1 1 0 Non-lit display Operate

1 1 1 Base image display Operate

Note: 1. data write operation from the microcontroller is performed irrespective of the setting of D[1:0] bits.

  1. The D[1:0] setting is valid on both 1st and 2nd displays.

  2. The non-lit display level from the source output pins is determined by instruction (PTS).

CL When CL = “1”, the 8-color display mode is selected.

CL Colors

0 262,144

1 8

GON and DTE Set the output level of gate driver G1 ~ G320 as follows

GON DTE G1 ~G320 Gate Output

0 0 VGH

0 1 VGH

1 0 VGL

1 1 Normal Display

BASEE

Base image display enable bit. When BASEE = “0”, no base image is displayed. The ILI9325 drives

liquid crystal at non-lit display level or displays only partial images. When BASEE = “1”, the base

image is displayed. The D[1:0] setting has higher priority over the BASEE setting.

PTDE[1:0]

Partial image 2 and Partial image 1 enable bits

PTDE1/0 = 0: turns off partial image. Only base image is displayed.

PTDE1/0 = 1: turns on partial image. Set the base image display enable bit to 0 (BASEE = 0).

Sorry, double post.

Lorcan,

I am by no means an expert at this. But I know what it is like to try to muddle your way through some of these things. So I will do my best to answer your question. But please understand if we get too deep in this (and that can happen really quickly) we will be over my head as well and I won’t be able to help you much.

That being said, here is what I understand:

The register.h file is something that makes referencing the various registers in the device easier. Specifically, the line you have highlighted

#define ILI932X_DISP_CTRL1 0x07

Is a directive to the C compiler to replace every instance of the text. “ILI932X_DISP_CTRL1” with the value 0x07 (which is read 7 hexadecimal). Note that this is not real code in that it isn’t something that runs on your microcontroller when you run the program. It happens when you compile the code.

It looks like the file, “adafruit_GFX.cpp” is building an array in such a way that elements are assumed to be arranged register address, value to be written to that address, next address, next value, etc.

So the line, “ILI932X_DISP_CTRL1 , 0x0133, // Main screen turn on” would cause a 0x0133 to be written to register 0x07.

Now based on what you copied from the datasheet, the register address of the register named, “Display Control 1” is 0x07. In addition, it says to turn on the display, set D[1:0] = 11. Which if you were to write 0x0133 to that register, you would indeed be writing D[1:0] to 11. So this agrees with the commented portion of the line in the cpp file, “// Main screen turn on”. So far this seems to make sense.

Now writing the value 0x0133 to register 0x07 also writes 1’s to other bits as well. Specifically bits GON, DTE and BASEE get written to 1’s. I didn’t read far enough to know what implications that has. I will leave that to you.

It may also be important to understand what bits get written to 0 as well. In this case bits CL, PTDE1 and PTDE0 all get written to 0. Again, I will leave this up to you to figure out.

So, just to make sure you understand, I have ZERO experience with the chip you are referring to. But I do know a little bit about programming. My suggestion would be to look at a few of the other register names in the cpp file, compare them to the #define values in register.h and make sure that the values being defined make sense to the datasheet. Also, see if you can make sense of the values being written to those registers with what the datasheet says should be happening.

I know how confusing this can be. While I am not an expert (I am more of a hardware guy who dabbles in coding stuff), I have been doing stuff like this for some time. It can be daunting and I still have trouble wrapping my head around some of this. So, keep trying, you will start to get it. Remember, there is nothing scarier than when things start to work exactly like the way you thought they should. :smiley:

I hope this was helpful,

Joe