Инициализирую TIC151 так:
//Разрешение дисплея:
#define RES_X 133
#define RES_Y 64
//Количество строк и знакомест:
#define MAX_LIN 6
#define MAX_POS 21
//Максимальные значения адресов:
#define MAX_X RES_X
#define MAX_Y (RES_Y / 8)
//PCF8535 Address:
#define LCD_ADDR_W 0x78 //address, R/W = 0
#define LCD_ADDR_R 0x79 //address, R/W = 1
//Control Byte:
#define LCD_CTRL 0x00 //Co = 0, D/C = 0
#define LCD_CO_CTRL 0x80 //Co = 1, D/C = 0
#define LCD_DATA 0x40 //Co = 0, D/C = 1
//H[2:0] = XXX - RAM Read/Write Command Page:
#define LCD_NOP 0x00 //no operation
#define LCD_PAGE_FN 0x01 //H[2:0] = 111: select Function and RAM Command Page
//H[2:0] = 111 - Function and RAM Command Page:
#define LCD_PAGE_DS 0x0E //H[2:0] = 110: select Display Setting Command Page
#define LCD_PAGE_HV 0x0D //H[2:0] = 101: select HV-gen Command Page
#define LCD_PAGE_SP 0x0B //H[2:0] = 011: select Special Feature Command Page
#define LCD_POWERDN 0x14 //PD = 1, V = 0: power down
#define LCD_VERT_ADDR 0x12 //PD = 0, V = 1: vertical addressing
#define LCD_HOR_ADDR 0x10 //PD = 0, V = 0: horizontal addressing
#define LCD_XM_0 0x20 //XMo = 0, X addressing 0..127
#define LCD_XM_1 0x24 //XMo = 0, X addressing 128..132
#define LCD_ADDR_Y 0x40 //+ Y address 0..8
#define LCD_ADDR_X 0x80 //+ X address 0..127
//H[2:0] = 110 - Display Setting Command Page:
#define LCD_BLANK 0x04 //D = 0, E = 0: display blank
#define LCD_NORMAL 0x06 //D = 1, E = 0: normal mode
#define LCD_ALL_ON 0x05 //D = 0, E = 1: all display segments on
#define LCD_INV_VID 0x07 //D = 1, E = 1: inverse video
#define LCD_NO_MIRROR 0x08 //MX = 0, MY = 0: no mirror
#define LCD_X_MIRROR 0x0C //MX = 1, MY = 0: X mirror
#define LCD_Y_MIRROR 0x0A //MX = 0, MY = 1: Y mirror
#define LCD_XY_MIRROR 0x0E //MX = 1, MY = 1: Y mirror
#define LCD_BIAS_1_11 0x10 //[BS2:BS0] = 0: bias 1/11
#define LCD_BIAS_1_10 0x11 //[BS2:BS0] = 1: bias 1/10
#define LCD_BIAS_1_9 0x12 //[BS2:BS0] = 2: bias 1/9
#define LCD_BIAS_1_8 0x13 //[BS2:BS0] = 3: bias 1/8
#define LCD_BIAS_1_7 0x14 //[BS2:BS0] = 4: bias 1/7
#define LCD_BIAS_1_6 0x15 //[BS2:BS0] = 5: bias 1/6
#define LCD_BIAS_1_5 0x16 //[BS2:BS0] = 6: bias 1/5
#define LCD_BIAS_1_4 0x17 //[BS2:BS0] = 7: bias 1/4
#define LCD_BIAS_L 0x20 //IB = 0: low bias current mode
#define LCD_BIAS_H 0x24 //IB = 1: high bias current mode
#define LCD_MUX_1_17 0x80 //[M2:M0] = 0: multiplex rate 1/17
#define LCD_MUX_1_26 0x81 //[M2:M0] = 1: multiplex rate 1/26
#define LCD_MUX_1_34 0x82 //[M2:M0] = 2: multiplex rate 1/34
#define LCD_MUX_1_49 0x83 //[M2:M0] = 3: multiplex rate 1/49
#define LCD_MUX_1_65 0x84 //[M2:M0] = 4: multiplex rate 1/65
//H[2:0] = 101 - HV-gen Command Page:
#define LCD_HV_OFF 0x04 //PRS = 0, HVE = 0: HV-gen disabled
#define LCD_HV_LOW 0x05 //PRS = 0, HVE = 1: HV-gen on, Vlcd low range
#define LCD_HV_HIGH 0x07 //PRS = 1, HVE = 1: HV-gen on, Vlcd high range
#define LCD_VMUL_X2 0x08 //[S1:S0] = 0: multiplication factor 2
#define LCD_VMUL_X3 0x09 //[S1:S0] = 1: multiplication factor 3
#define LCD_VMUL_X4 0x0A //[S1:S0] = 2: multiplication factor 4
#define LCD_VMUL_X5 0x0B //[S1:S0] = 3: multiplication factor 5
#define LCD_TC_0_00 0x10 //[TC2:TC0] = 0: temp. coeff. 0.00E-3 1/°C
#define LCD_TC_0_44 0x11 //[TC2:TC0] = 1: temp. coeff. -0.44E-3 1/°C
#define LCD_TC_1_10 0x12 //[TC2:TC0] = 2: temp. coeff. -1.10E-3 1/°C
#define LCD_TC_1_45 0x13 //[TC2:TC0] = 3: temp. coeff. -1.45E-3 1/°C
#define LCD_TC_1_91 0x14 //[TC2:TC0] = 4: temp. coeff. -1.91E-3 1/°C
#define LCD_TC_2_15 0x15 //[TC2:TC0] = 5: temp. coeff. -2.15E-3 1/°C
#define LCD_TC_2_32 0x16 //[TC2:TC0] = 6: temp. coeff. -2.32E-3 1/°C
#define LCD_TC_2_74 0x17 //[TC2:TC0] = 7: temp. coeff. -2.74E-3 1/°C
#define LCD_START_TM 0x21 //TM = 1: start temperature measurement
#define LCD_V_LCD 0x80 //+ Vlcd 0..127
//H[2:0] = 011 - Special Feature Command Page:
#define LCD_DISP_OFF 0x06 //DOF = 1, DM = 0: display off
#define LCD_EXT_VLCD 0x04 //DOF = 0, DM = 0: external Vlcd (if HVE = 0)
#define LCD_INT_VLCD 0x04 //DOF = 0, DM = 0: internal Vlcd (if HVE = 1)
#define LCD_VDD_VLCD 0x05 //DOF = 0, DM = 1: using Vdd as Vlcd (if HVE = 0)
#define LCD_OSC_EN 0x08 //EC = 0: internal oscillator enabled
#define LCD_OSC_DIS 0x0A //EC = 1: internal oscillator disabled
#define LCD_NO_SWAP 0x40 //TRS = 0, BRS = 0: no row swap
#define LCD_TOP_SWAP 0x50 //TRS = 1, BRS = 0: top row swap
#define LCD_BOT_SWAP 0x48 //TRS = 0, BRS = 1: bottom row swap
#define LCD_ALL_SWAP 0x58 //TRS = 1, BRS = 1: all row swap
//-------------------------- Прототипы функций: ------------------------------
void I2C_Start(void); //генерация условия "СТАРТ" на I2C
void I2C_Write(char data); //запись байта по I2C
void I2C_Stop(void); //генерация условия "СТОП" на I2C
//-------------------------- Инициализация LCD: ------------------------------
void LCD_Init(void)
{
TWBR = 12; //скорость I2C 400 kbit
TWSR = 0;
Port_RES_1; //снимаем RESET
I2C_Start();
I2C_Write(LCD_ADDR_W); //address
I2C_Write(LCD_CTRL); //control byte
I2C_Write(LCD_PAGE_FN); //select Function and RAM Command Page
I2C_Write(LCD_HOR_ADDR); //PD = 0
I2C_Write(LCD_PAGE_DS); //select Display Setting Command Page
I2C_Write(LCD_Y_MIRROR); //set mirror mode
I2C_Write(LCD_BIAS_1_9); //set bias
I2C_Write(LCD_BIAS_H); //select bias current
I2C_Write(LCD_MUX_1_65); //set mux rate
I2C_Write(LCD_NORMAL); //D = 1, E = 0
I2C_Write(LCD_PAGE_FN); //select Function and RAM Command Page
I2C_Write(LCD_PAGE_SP); //select Special Feature Command Page
I2C_Write(LCD_ALL_SWAP); //TRS = 1, BRS = 1
I2C_Write(LCD_VDD_VLCD); //DM = 1
Delay_us(100);
I2C_Write(LCD_PAGE_FN); //select Function and RAM Command Page
I2C_Write(LCD_PAGE_HV); //select HV-gen Command Page
I2C_Write(LCD_TC_1_10); //temp. coeff. -1.10E-3 1/°C
I2C_Write(LCD_V_LCD + NOM_CONTR); //set Vlcd
I2C_Write(LCD_HV_LOW); //PRS = 0, HVE = 1
Delay_us(100);
I2C_Write(LCD_VMUL_X3); //set mul factor
Delay_us(100);
I2C_Write(LCD_PAGE_FN); //select Function and RAM Command Page
I2C_Write(LCD_PAGE_SP); //select Special Feature Command Page
I2C_Write(LCD_INT_VLCD); //DM = 0
I2C_Stop();
}
//----------------------- Установка контраста LCD: ---------------------------
void LCD_SetContr(char c)
{
I2C_Start();
I2C_Write(LCD_ADDR_W); //address
I2C_Write(LCD_CTRL); //control byte
I2C_Write(LCD_PAGE_FN); //select Function and RAM Command Page
I2C_Write(LCD_PAGE_HV); //select HV-gen Command Page
I2C_Write(LCD_V_LCD + c); //set Vlcd
I2C_Stop();
}
//-------------------- Генерация условия "СТАРТ" на I2C: ---------------------
void I2C_Start(void)
{
TWCR = (1 << TWINT) | (1 << TWSTA) | (1 << TWEN);
while(!(TWCR & (1 << TWINT)));
}
//------------------------- Запись байта по I2C: -----------------------------
void I2C_Write(char data)
{
TWDR = data;
TWCR = (1 << TWINT) | (1 << TWEN);
while(!(TWCR & (1 << TWINT)));
}
//-------------------- Генерация условия "СТОП" на I2C: ---------------------
void I2C_Stop(void)
{
TWCR = (1 << TWINT) | (1 << TWSTO) | (1 << TWEN);
}
//----------------------------------------------------------------------------