SEROUT LCD_Tx,LCD_Baud,["?f"] 'clear LCD screen GOSUB Hard_Reset 'go hard reset EMIC GOSUB EMIC_Setup 'go do EMIC setup GOSUB RTC_Init 'go initialize RTC GOSUB X10_init 'go initialize X10 event pointer Main: KeyCode = 0 'clear variable for new key SERIN KB_In,KB_Baud,KB_TO,Main_4,[KeyCode] 'wait for key press, w/timeout IF KeyCode > Valid_KC THEN 'see if valid MAKE code,yes then do another SERIN PAUSE 20 SERIN KB_In,KB_Baud,[KeyCode] 'for the BREAK code ENDIF IF KeyCode < $7F THEN Main_2 'determine if a valid key GOSUB Hard_Reset 'do EMIC reset GOTO KB_Error 'go say msg for missing key MAIN_2: 'here if valid key received IF Switch(5) = 1 THEN main_3 'see if to speak the key received,no jump Key = $FF 'set a default 'the following hex key codes are for CMD keys (ESC,BKSP 'TAB,ENTER,CTRL,etc). The position in the table 'is used in the LOOKUP table as part of the 'abbreviation code for EMIC. EXP:press ESC corresponds 'to "A" which is sent to EMIC as /A which is the 'abbreviation code for ESCape which is then spoken. 'it is also used as the 'Cmd_Todo" +1 LOOKDOWN KeyCode,[$7E,$71,$70,$63,$62,$55,$49,$47,$46,$45,$2F, $2D,$2C,$2B,$37,$34,$32],Key 'see if CMD key IF Key = $FF THEN Main_2A 'if no CMD key received, jump LOOKUP Key,["ABCDEFGHIJKLMNOPQ"],Temp4 'get ASCII code for EMIC abbreviation SEROUT Tx,EMIC_Baud,[say,"/",Temp4,EOM] 'speak key from EMIC abbr ram GOTO Main_3A Main_2A: 'here if no CMD key, regular alpha key Key1 = KeyCode 'save the KeyCode value GOSUB ConvAsc_0 'go convert to an ASCII value SEROUT Tx,Emic_Baud, [say,Key,Eom] 'send to EMIC to speak keycode = key1 'return KeyCode GOTO Main_3A Main_3: 'here if to sound a tone instead of speaking key SEROUT Tx, EMIC_Baud, [audio,eom] 'put EMIC in audio mode FREQOUT Spk_Out,100,Tone,Tone 'sound tone for key pressed INPUT Spk_Out 'needed for proper operation SEROUT Tx,EMIC_Baud, [EOM] 'turn audio mode off Main_3A: