symbol address = w0 symbol KeyStroke = b2 symbol KB_Data = b3 'KeyBoard Data symbol Char = b4 '# of KeyBoard Strokes symbol CountTabs = b5 symbol temp_byte = b6 symbol temp_byte2 = b7 symbol temp_byte3 = b8 symbol KeyStrokeLimit = b9 symbol hours = b10 symbol mins = b11 symbol month = b12 symbol date = b13 symbol CallLimit = 12 symbol NameLimit = 25 symbol CityLimit = 25 symbol StateLimit = 13 symbol CountyLimit = 71 symbol RSTSLimit = 10 symbol RSTRLimit = 10 symbol FrequencyLimit = 9 symbol ModeLimit = 80 'inclueds end fill symbol LCDPin = 1 symbol WP = 5 'Write Protecte Pin CountTabs = 0 KeyStroke = 0 KeyStrokeLimit = 10 ' For Call sign keyled %00000100 IntLCD: High LCDPin pause 75 SerOut LCDPin, T2400, ("?f?c2") pause 40 SerOut LCDPin, T2400, ("?x00?y0CALL CITY ST") SerOut LCDPin, T2400, ("?x00?y2COUNTY NAME RST") SerOut LCDPin, T2400, ("?x00?y1") pause 1000 WaitForIt: kbin [1000, WaitForIt],KB_Data if KB_Data <> 20 then WaitForIt sertxd("wait KB_Data = ",#KB_Data,cr,lf) SerOut LCDPin, T2400, ("?c3") gosub TimeStamp pause 250 KeyBoard: i2cslave %10100000, i2cslow, i2cword pause 50 kbin [1000, KeyBoard],KB_Data 'wait for new signal 'sertxd("KB_Data = ",#KB_Data,cr,lf) IF KB_Data = 102 THEN Delete IF KB_Data = 13 THEN TAB KeyStroke = KeyStroke + 1 sertxd("") lookup KB_Data,("'''''''''''''~'''''''Q1'''ZSAW2''CXDE43'' VFTR5''NBHGY6'''MJU78'''KIO09''./L:P-"),Char sertxd(Char) i2cslave %10100000, i2cslow, i2cword low WP ' write protect eeprom writei2c address,(Char) pause 10 high WP ' write protect eeprom readi2c address,(temp_byte) if temp_byte <> Char then ee_error 'sertxd("address = ",#address,"temp = ",temp_byte,cr,lf)}_ let address = address + 1 if address > 4000 then memory_full IF KB_Data = 20 THEN TimeStamp ' 20 = Ctrl IF KB_Data = 90 THEN ENTER if KeyStroke > KeyStrokeLimit then SkipLCD 'sertxd("KeyStroke = ",#KeyStroke," KeyStrokeLimit = ",#KeyStrokeLimit) SerOut LCDPin, T2400, (Char) SkipLCD: goto KeyBoard TAB: CountTabs = CountTabs + 1 if CountTabs = 1 then Name if CountTabs = 2 then City if CountTabs = 3 then State if CountTabs = 4 then County if CountTabs = 5 then RSTS if CountTabs = 6 then RSTR if CountTabs = 7 then FREQUENCY if CountTabs = 8 then MODE if CountTabs = 9 then ENTER memory_full: sertxd("FULL") end ee_error: sertxd("ERR",#temp_byte," ",#KB_Data) end Name: if KeyStroke < CAllLimit then let temp_byte3 = CAllLimit - KeyStroke gosub AddSpaces endif SerOut LCDPin, T2400, ("?x11?y3") KeyStroke = 0 KeyStrokeLimit = 5 goto KeyBoard City: if KeyStroke < NameLimit then let temp_byte3 = NameLimit - KeyStroke gosub AddSpaces endif SerOut LCDPin, T2400, ("?x11?y1") KeyStroke = 0 KeyStrokeLimit = 6 goto KeyBoard State: if KeyStroke < CityLimit then let temp_byte3 = CityLimit - KeyStroke gosub AddSpaces endif SerOut LCDPin, T2400, ("?x18?y1") KeyStroke = 0 KeyStrokeLimit = 2 goto KeyBoard County: if KeyStroke < StateLimit then let temp_byte3 = StateLimit - KeyStroke gosub AddSpaces endif SerOut LCDPin, T2400, ("?x00?y3") KeyStroke = 0 KeyStrokeLimit = 10 goto KeyBoard RSTS: if KeyStroke < CountyLimit then let temp_byte3 = CountyLimit - KeyStroke gosub AddSpaces endif SerOut LCDPin, T2400, ("?x14?y3") KeyStroke = 0 KeyStrokeLimit = 3 goto KeyBoard RSTR: if KeyStroke < RSTSLimit then let temp_byte3 = RSTSLimit - KeyStroke gosub AddSpaces endif SerOut LCDPin, T2400, ("?x17?y3") KeyStroke = 0 KeyStrokeLimit = 3 goto KeyBoard FREQUENCY: if KeyStroke < RSTRLimit then let temp_byte3 = RSTRLimit - KeyStroke gosub AddSpaces endif SerOut LCDPin, T2400, ("?f?x00?y0FREQ MODE") SerOut LCDPin, T2400, ("?x00?y2DATE TIME") SerOut LCDPin, T2400, ("?x00?y1") KeyStroke = 0 KeyStrokeLimit = 7 goto KeyBoard MODE: if KeyStroke < FREQUENCYLimit then let temp_byte3 = FREQUENCYLimit - KeyStroke gosub AddSpaces endif SerOut LCDPin, T2400, ("?x10?y1") KeyStroke = 0 KeyStrokeLimit = 5 goto KeyBoard ENTER: if KeyStroke < MODELimit then let temp_byte3 = MODELimit - KeyStroke gosub AddSpaces endif temp_byte = "K" temp_byte2 = "B" gosub EEpromTime temp_byte = "7" temp_byte2 = "Z" gosub EEpromTime temp_byte = "T" temp_byte2 = "I" gosub EEpromTime temp_byte3 = 11 gosub AddSpaces KeyStroke = 0 KeyStrokeLimit = 10 ' For Call sign CountTabs = 0 low WP Char = cr writei2c address,(Char) pause 10 high WP readi2c address,(temp_byte) if temp_byte <> Char then ee_error let address = address + 1 if address > 4000 then memory_full Char = lf writei2c address,(Char) pause 10 high WP readi2c address,(temp_byte) if temp_byte <> Char then ee_error let address = address + 1 if address > 4000 then memory_full goto IntLCD Delete: address = address - 1 KeyStroke = KeyStroke - 1 SerOut LCDPin, T2400, ("?b") goto KeyBoard ''''''''''''' SubRoutines ''''''' 'Call = 10, City = 6, State = 2, 'County = 7, Name = 8, RST = 3 TimeStamp: ' Program to read time/date on DS1307 RTC ' NOTE:!!! No room to add the YEAR. YEAR is hard codded in i2cslave %11010000, i2cslow, i2cbyte pause 20 readi2c 0,(temp_byte,mins,hours,temp_byte,date,month,temp_byte,temp_byte) temp_byte = "2" temp_byte2 = "0" gosub EEpromTime temp_byte = "0" temp_byte2 = "7" gosub EEpromTime bcdtoascii month, temp_byte,temp_byte2 sertxd("month",temp_byte,temp_byte2) gosub EEpromTime bcdtoascii date, temp_byte,temp_byte2 sertxd("date",temp_byte,temp_byte2) gosub EEpromTime bcdtoascii hours, temp_byte,temp_byte2 sertxd("hours",temp_byte,temp_byte2) gosub EEpromTime bcdtoascii mins, temp_byte,temp_byte2 sertxd(" mins",temp_byte,temp_byte2," ") gosub EEpromTime temp_byte = "0" temp_byte2 = "0" gosub EEpromTime bcdtoascii hours, temp_byte,temp_byte2 sertxd("hours",temp_byte,temp_byte2) gosub EEpromTime bcdtoascii mins, temp_byte,temp_byte2 sertxd(" mins",temp_byte,temp_byte2," ") gosub EEpromTime temp_byte = "0" temp_byte2 = "0" gosub EEpromTime return EEpromTime: i2cslave %10100000, i2cslow, i2cword low WP ' write protect eeprom writei2c address,(temp_byte) pause 10 high WP ' write protect eeprom readi2c address,(temp_byte3) 'sertxd("<>",temp_byte," ",Char,cr,lf) if temp_byte3 <> temp_byte then ee_error let address = address + 1 if address > 4000 then memory_full writei2c address,(temp_byte2) pause 10 high WP ' write protect eeprom readi2c address,(temp_byte3) if temp_byte3 <> temp_byte2 then ee_error let address = address + 1 if address > 4000 then memory_full return AddSpaces: temp_byte2 = 0 PadLog: if temp_byte2 = temp_byte3 then RReturn i2cslave %10100000, i2cslow, i2cword low WP ' write protect eeprom writei2c address,(" ") pause 10 high WP ' write protect eeprom readi2c address,(temp_byte) 'sertxd("<>",temp_byte," ",Char,cr,lf) if temp_byte <> " " then ee_error let address = address + 1 if address > 4000 then memory_full temp_byte2 = temp_byte2 +1 goto PadLog RReturn: return