EMBEDDED APPLICATIONS FCT
LZT 123 8016 R1A
14
LCDcontrol(0x01);
LCDtext(“*Incoming
Call*”,
15);
}
}
else
{
CALLING
=
0;
}
} /* while (1) */
aterr = atdst(); /*destroy AT channel*/
val = kyd(); /*destroy keypad config*/
} /* main */
LCDdata(int Data)
{
char
Addr2;
char
DataWr[4];
char
HiBits;
char
LoBits;
char
Ack;
Addr2=
0x70;
HiBits = Data >> 4;
LoBits = Data & 0x0f;
DataWr[0] = HiBits | 0x60;
DataWr[1] = HiBits | 0x20;
DataWr[2] = LoBits | 0x60;
DataWr[3] = LoBits | 0x20;
i2w(Addr2,4,DataWr,
&Ack);
}
LCDcontrol(int control)
{
char
Addr2;
char
DataWr[4];
char
HiBits;
char
LoBits;
char
Ack;
Addr2=
0x70;
HiBits = control >> 4;
LoBits = control & 0x0f;
DataWr[0] = HiBits | 0x40;
DataWr[1] = HiBits;
DataWr[2] = LoBits | 0x40;
DataWr[3] = LoBits;
i2w(Addr2,4,DataWr,
&Ack);
}
LCDinit()
{
char
Addr2;
char
DataWr[4];
char
Data;
char
Ack;
Addr2=
0x70;
I2C(0);
/* Set to 8 bit mode */
/* And Write dummy 8 bit instruction 0001xxxx */
LCDcontrol(0x31);
/* Set to 4 bit mode and perform initialization */
Data = 0x02;
DataWr[0] = 0x42;
DataWr[1] = 0x02;
i2w(Addr2,2,DataWr,
&Ack);
i2w(Addr2,2,DataWr,
&Ack);
Data = 0x0c;