Fixed Cellular Terminal Application {Fct.sc - Sony Ericsson Fixed Cellular Telephone Application Note

Embedded applications
Table of Contents

Advertisement

2.3

Fixed Cellular Terminal Application {FCT.sc}

LZT 123 8016 R1A
EMBEDDED APPLICATIONS FCT
The overall code that was generated is given below.
char KEY_IN2 = 10;
char KEY_IN3 = 11;
char KEY_IN4 = 12;
char RI = 1;
char DTR = 2;
char DCD = 3;
char DSR = 4;
char CTS = 5;
char CharTable[20] =
{1,2,3,0x0a,0x0b,4,5,6,0x0c,0x0d,7,8,9,0x0e,0x0f,0x2a,0,0x23,0x12,0x13};
main()
{
int val, aterr, resCmdSize;
int i; /*counter for keyread loop*/
char resCmd[20];
char resndCmd[30];
char sndCmd[30];
char valstr[2];
char PREVKEYPRESSED = 0;
char CALLING = 0;
/*setup All Key pins*/
spc(RI,0); /* turn off RI */
spc(DTR,0); /* turn off DTR */
spc(DCD,0); /* turn off DCD */
spc(DSR,0); /* turn off DSR */
spc(CTS,0); /* turn off CTS */
io(4,KEY_IN2,0); /*switch in I2*/
io(4,KEY_IN3,0); /*switch in I3*/
io(4,KEY_IN4,0); /*switch in I4*/
valstr[0] = '\0';
valstr[1] = '\0';
sndCmd[0] = '\0'; /*NUL terminate send string*/
resndCmd[0] = '\0'; /*NUL terminate send string*/
aterr = atcrt(); /*AT channel setup */
scpy(sndCmd, "ATD");
LCDinit(); /*Setup LCD */
val = kyc(0xFF, 1); /*use maximal keyboard*/
while(1)
{
val = kyr();
if(val != 0xFF)
{
if(!PREVKEYPRESSED)
{
PREVKEYPRESSED = 1;
prtf("key pressed = %x",val);
val = CharTable[val];
if((val < 0x0a) || (val == 0x2a) || (val == 0x23))
{
if(val <0x0a)
{
itoa(val,valstr,2);
}
12

Advertisement

Table of Contents
loading

Table of Contents