DEVICE 16F628A ; Pic type. CONFIG INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, LVP_OFF, MCLRE_off ALL_DIGITAL TRUE ; Alle ingangen digitaal. DECLARE lcd_rspin = porta.4 DECLARE lcd_enpin = porta.3 SYMBOL AAN = 0 SYMBOL UIT = 1 SYMBOL EOM = 1 SYMBOL LCD_LENGTH = 15 SYMBOL SPEED = 190 SYMBOL Tijd = 750 Symbol enter = PortA.0 Symbol backspace = PortA.7 Symbol H1 = PortA.1 Dim BD1 As Word Dim Toets As Byte Dim Teken As Byte Dim AantalIndrukken As Byte Dim VorigeToets As Byte Dim AantalTekens As Byte DIM MESSAGE_ARRAY[16] AS BYTE DIM DATUM AS BYTE DIM Y AS BYTE delayms 500 Cls While 1=1 Gosub OphalenToets ; Als 2x dezelfde toets ingedrukt is dan: If Toets = VorigeToets Then ;kijken naar volgende teken. Inc AantalIndrukken ;Als @gevonden wordt dan If teken < "@" Then AantalIndrukken = 0 Endif Else If BD1< Tijd Then Inc AantalTekens ;Als Bd1 = kleiner dan tijd, vergroot AantalTekens AantalIndrukken = 0 VorigeToets = Toets EndIf Gosub VertaalToetsNaarTeken Gosub TekenOpLcd Gosub Backspace1 Wend OphalenToets: CLEAR BD1 ;Reset timer dummy Repeat Toets = inkey, ;Selecteer toets delayms 1 inc BD1 IF BD1 = Tijd THEN INC AantalTekens:AantalIndrukken = 0:Dec AantalIndrukken ;Als Dummy vol is,vergroot aantaltekens&zet aantalindrukken op 0 If Toets <> 16 Then DelayMS 50 While InKey <> 16: wend DelayMS 10 End If Until Toets <> 16 Return VertaalToetsNaarTeken: select Toets case 0: teken = Lookup Aantalindrukken,[".,1?!;:&()=@"] Case 1: teken = LookUp AantalIndrukken,["abcABC2@"] Case 2: teken = LookUp AantalIndrukken,["defDEF3@"] Case 4: teken = Lookup Aantalindrukken,["ghiGHI4@"] case 5: teken = LOOKUP Aantalindrukken,["jklJKL5@"] Case 6: teken = Lookup Aantalindrukken,["mnoMNO6@"] case 8: teken = Lookup Aantalindrukken,["pqrsPQRS7@"] case 9: teken = Lookup Aantalindrukken,["tuvTUV8@"] case 10: teken = Lookup Aantalindrukken,["wxyzWXYZ9@"] case 12: teken = Lookup Aantalindrukken,["*+-_%/\<>|{}@"] case 13: teken = Lookup Aantalindrukken,[" @"] case 14: teken = Lookup Aantalindrukken,[32] EndSelect Return TekenOpLCD: If AantalTekens = 0 then Inc AantalTekens Print At 2,AantalTekens, Teken Return Backspace1: If Teken = 32 Then Dec AantalTekens : AantalIndrukken= " " Endif Return