background image

  EMBEDDED APPLICATIONS FCT 

 
 
 
 
 

2.3 

 Fixed Cellular Terminal Application {FCT.sc} 

 

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); 
 

 

 

 

 

 
 
 

LZT 123 8016 R1A

  

12 

Содержание Fixed Cellular Telephone

Страница 1: ...Application Note Embedded Applications Fixed Cellular Telephone...

Страница 2: ...Mobile Communications reserves the right to make modifications additions and deletions to this manual due to typographical errors inaccurate information or improvements to programs and or equipment a...

Страница 3: ...Contents 3 1 Introduction 4 2 FCT design 5 2 1 Keypad 5 2 1 1 Operation 5 2 1 2 Set up 5 2 1 3 Keypad Configuration 6 2 2 I2 C LCD 7 2 2 1 Operation 7 2 2 2 Set up 7 2 3 Fixed Cellular Terminal Applic...

Страница 4: ...guage interfacing a keypad and LCD to the radio device can provide a simple man machine interface without the need for external host controllers This application note details the use the I2C interface...

Страница 5: ...ow inputs receives a logic low The key scan routine identifies which KeyColumn driver was active when the key press was detected and the routine provides a return code representing the combination of...

Страница 6: ...olumn driver When used this is referred to as Column 0 Note Keypad Interface Schematic 2 1 3 Keypad Configuration The key pad is configured using intrinsic functions within embedded applications furth...

Страница 7: ...ditional control signals RS E R W The LCD is operating in 4 bit mode so can provide the 7 required signals with a single 8 bit I2 C GPIO converter The I2 C register has been defined as follows BIT P7...

Страница 8: ...EMBEDDED APPLICATIONS FCT LCD Interface Schematic LCD Interface LZT 123 8016 R1A 8...

Страница 9: ...und 2 VDD Logic Supply 2 75V 3 VO LCD Supply 0V 4 RS Register Select 5 R W Read Write 6 E Enable 7 DB0 Data0 8 DB1 Data1 9 DB2 Data2 10 DB3 Data3 11 DB4 Data4 12 DB5 Data5 13 DB6 Data6 14 DB7 Data7 15...

Страница 10: ...old Time th2 10 ns E Cycle Time Tc 140 0 E Rise Fall Time tr tf 25 E Pulse Width High Low Tw 400 R W and RS Setup Time Tsu 60 R W and RS Hold Time Th 20 Data Setup Time tD 36 0 Read Mode Refer to Fig...

Страница 11: ...EMBEDDED APPLICATIONS FCT Read Mode Timing Diagram LZT 123 8016 R1A 11...

Страница 12: ...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...

Страница 13: ...4 scat sndCmd aterr atsnd sndCmd resCmd slen sndCmd 20 resCmdSize prtf nsent AT command n s sndCmd scpy resndCmd sndCmd else if val 0x0b REJECT key LCDcontrol 0x01 scpy sndCmd ATD aterr atsnd ATH resC...

Страница 14: ...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 DataW...

Страница 15: ...PLICATIONS FCT LZT 123 8016 R1A 15 DataWr 0 0x4c DataWr 1 0x0c i2w Addr2 2 DataWr Ack LCDcontrol 0x0f LCDcontrol 0x01 LCDcontrol 0x06 LCDtext char textstr int textlen char n for n 0 n textlen n LCDdat...

Отзывы: