'******************************************************************** ' System : C-Control/BASIC mit Microprozessor MC68HC05B6 ' Programm: Service.bas ' Version : V1.03 ' Autor : (c) DG1XPZ 16.08.1997 ' Länge : 4000 Byte ' Funktion: -liest alle Ports aus und ermöglicht das Setzen dieser ' -Prüft Ladezustand des internen Akkus ' ' ' Systemvoraussetzungen: ' - Terminalprogramm ' - Service-Stecker mit Spannungsteiler 12.5V (10KOhm + 40KOhm) ' Schwerpunkt: ' - setzen und lesen aller Ports ' - Meßwerte des internen Akku's anzeigen (9.85 bisher max.) ' (Nur möglich mit "Service-Stecker") ' ' - V1.01: ' - V1.02: ' - V1.03: Datum/Zeit stellen ' - Plan: ' auf Ports 9-16 erweitern ' PWR-Ports setzen können '******************************************************************** ' *** Daten-Definition *** define keyboard ad[8] define AD1 ad[1] define AD2 ad[2] define AD3 ad[3] define AD4 ad[4] define AD5 ad[5] define AD6 ad[6] define AD7 ad[7] define AD8 ad[8] define D1 Port[1] define D2 Port[2] define D3 Port[3] define D4 Port[4] define D5 Port[5] define D6 Port[6] define D7 Port[7] define D8 Port[8] define D9 Port[9] define D10 Port[10] define D11 Port[11] define D12 Port[12] define D13 Port[13] define D14 Port[14] define D15 Port[15] define D16 Port[16] define D1_8 Byteport[1] define D9_10 Byteport[2] define DA1_ DA[1] define DA2_ DA[2] define Kommando byte 'define Freq_1 word 'define Freq_2 word define Zelle word define Akku word define Voll word define DA1_Wert byte define DA2_Wert byte define hour_ byte define minute_ byte define second_ byte '*** Programmoperationen *** #start print "Service-Modul V.:1.03 (c)PZ 12/00" : PRINT pause 75 #Menue_I print:print print "*********************" print "* Menue I *" print "*********************" print "* 1 - interner Akku *" print "* 2 - Ports *" print "* 3 - Datum/Zeit *" print "*********************" define i byte for i=1 to 5 beep 440,2,0 beep 200,2,0 next get Kommando if Kommando = 49 then goto Akkudaten if Kommando = 50 then goto Menue_II if Kommando = 51 then goto Zeit goto start end '********** ENDE-HAUPTPROGRAMM ************************************************************* '#alarm 'pulse summer 'summer=on ' beep 440,2,0 ' beep 200,2,0 'summer=off 'return '********** Tastatur-Interface ********************************** #Menue_II print:print print "************************" print "* Menue II *" print "************************" print "* 1 - Analog 1-8 *" print "* 2 - Digital lesen *" print "* 3 - Digital setzen *" print "* ESC - Menue I *" print "************************" get Kommando if Kommando = 49 then goto Analog if Kommando = 50 then goto Digital_lesen if Kommando = 51 then goto Digital_setzen if Kommando = 27 then goto Menue_I goto Menue_II #DIGITAL_lesen Print:print print "*****************" print "* Digital lesen *" print "*****************" Deact D1_8 #Digital_lesen1 print "Freq1:";Freq;"Hz"; print " Freq2:";Freq2;"Hz"; print " D1-8:"; if D1=ON then print"1"; else print"0"; if D2=ON then print"1"; else print"0"; if D3=ON then print"1"; else print"0"; if D4=ON then print"1"; else print"0"; if D5=ON then print"1"; else print"0"; if D6=ON then print"1"; else print"0"; if D7=ON then print"1"; else print"0"; if D8=ON then print"1"; else print"0"; print " D9-16:"; if D9=ON then print"1"; else print"0"; if D10=ON then print"1"; else print"0"; if D11=ON then print"1"; else print"0"; if D12=ON then print"1"; else print"0"; if D13=ON then print"1"; else print"0"; if D14=ON then print"1"; else print"0"; if D15=ON then print"1"; else print"0"; if D16=ON then print"1" else print"0" if rxd then goto eingabe Pause 50 goto Digital_lesen1 #DIGITAL_setzen Print:print print "******************************" print "* Digitale Ports setzen *" print "* -fuer Port1 die 1 druecken *" print "* -ab Port10 - A bis G *" print "******************************" #Digital_setzen1 get Kommando if Kommando = 49 then goto Digi1 if Kommando = 50 then goto Digi2 if Kommando = 51 then goto Digi3 if Kommando = 52 then goto Digi4 if Kommando = 53 then goto Digi5 if Kommando = 54 then goto Digi6 if Kommando = 55 then goto Digi7 if Kommando = 56 then goto Digi8 if Kommando = 57 then goto Digi9 if Kommando = 97 then goto Digi10 if Kommando = 98 then goto Digi11 if Kommando = 99 then goto Digi12 if Kommando = 100 then goto Digi13 if Kommando = 101 then goto Digi14 if Kommando = 102 then goto Digi15 if Kommando = 103 then goto Digi16 if Kommando = 27 then goto Menue_I #weiter_Digital_setzen Print "DA1:";DA1_wert; "i.A."; Print " DA2:";DA2_wert; "i.A."; print " D1-8:"; if D1=ON then print"1"; else print"0"; if D2=ON then print"1"; else print"0"; if D3=ON then print"1"; else print"0"; if D4=ON then print"1"; else print"0"; if D5=ON then print"1"; else print"0"; if D6=ON then print"1"; else print"0"; if D7=ON then print"1"; else print"0"; if D8=ON then print"1"; else print"0"; print " D9-16:"; if D9=ON then print"1"; else print"0"; if D10=ON then print"1"; else print"0"; if D11=ON then print"1"; else print"0"; if D12=ON then print"1"; else print"0"; if D13=ON then print"1"; else print"0"; if D14=ON then print"1"; else print"0"; if D15=ON then print"1"; else print"0"; if D16=ON then print"1" else print"0" goto Digital_setzen1 #Digi1 print "D01 "; if D1=ON then D1=OFF else D1=ON goto weiter_Digital_setzen #Digi2 print "D02 "; if D2=ON then D2=OFF else D2=ON goto weiter_Digital_setzen #Digi3 print "D03 "; if D3=ON then D3=OFF else D3=ON goto weiter_Digital_setzen #Digi4 print "D04 "; if D4=ON then D4=OFF else D4=ON goto weiter_Digital_setzen #Digi5 print "D05 "; if D5=ON then D5=OFF else D5=ON goto weiter_Digital_setzen #Digi6 print "D06 "; if D6=ON then D6=OFF else D6=ON goto weiter_Digital_setzen #Digi7 print "D07 "; if D7=ON then D7=OFF else D7=ON goto weiter_Digital_setzen #Digi8 print "D08 "; if D8=ON then D8=OFF else D8=ON goto weiter_Digital_setzen #Digi9 print "D09 "; if D9=ON then D9=OFF else D9=ON goto weiter_Digital_setzen #Digi10 print "D10 "; if D10=ON then D10=OFF else D10=ON goto weiter_Digital_setzen #Digi11 print "D11 "; if D11=ON then D11=OFF else D11=ON goto weiter_Digital_setzen #Digi12 print "D12 "; if D12=ON then D12=OFF else D12=ON goto weiter_Digital_setzen #Digi13 print "D13 "; if D13=ON then D13=OFF else D13=ON goto weiter_Digital_setzen #Digi14 print "D14 "; if D14=ON then D14=OFF else D14=ON goto weiter_Digital_setzen #Digi15 print "D15 "; if D15=ON then D15=OFF else D15=ON goto weiter_Digital_setzen #Digi16 print "D16 "; if D16=ON then D16=OFF else D16=ON goto weiter_Digital_setzen #Zeit print:print print "************************" print "* Zeit/Datum stellen *" print "************************" print "* 1 - Anzeigen *" print "* 2 - stellen *" print "* ESC - Menue I *" print "************************" get Kommando if Kommando = 49 then goto anzeigen if Kommando = 50 then goto stellen if Kommando = 27 then goto Menue_I goto Zeit #anzeigen print day;".";month;".";year;" ";hour;":";minute;":";second if rxd then goto menuzeit Pause 50 goto anzeigen #stellen print "Jahr :";:input year:print year print "Monat:";:input month:print month print "Tag :";:input day:print day print "Stunde:";:input hour:print hour print "Minute:";:input minute:print minute print "Sekunde:";:input second:print goto anzeigen #menuzeit get Kommando goto zeit #Analog Print:print print "****************************" print "* Analog-Port 1-8 auslesen *" print "****************************" #Analog1 print "A1:";0+ad1 mod 1000 / 100;0+ad1 mod 1000 mod 100 / 10;0+ad1 mod 1000 mod 100 mod 10;" "; print "A2:";0+ad2 mod 1000 / 100;0+ad2 mod 1000 mod 100 / 10;0+ad2 mod 1000 mod 100 mod 10;" "; print "A3:";0+ad3 mod 1000 / 100;0+ad3 mod 1000 mod 100 / 10;0+ad3 mod 1000 mod 100 mod 10;" "; print "A4:";0+ad4 mod 1000 / 100;0+ad4 mod 1000 mod 100 / 10;0+ad4 mod 1000 mod 100 mod 10;" "; print "A5:";0+ad5 mod 1000 / 100;0+ad5 mod 1000 mod 100 / 10;0+ad5 mod 1000 mod 100 mod 10;" "; print "A6:";0+ad6 mod 1000 / 100;0+ad6 mod 1000 mod 100 / 10;0+ad6 mod 1000 mod 100 mod 10;" "; print "A7:";0+ad7 mod 1000 / 100;0+ad7 mod 1000 mod 100 / 10;0+ad7 mod 1000 mod 100 mod 10;" "; print "A8:";0+ad8 mod 1000 / 100;0+ad8 mod 1000 mod 100 / 10;0+ad8 mod 1000 mod 100 mod 10;" " if rxd then goto eingabe pause 50 goto Analog1 #Akkudaten print "Menue Akkudaten ausgewählt" #Akkudaten1 akku = ad1 * 50 / 51 akku = akku * 5 print "Akku:";0 + akku / 100;".";0+akku mod 100 / 10;0+akku mod 100 mod 10;"V "; Zelle = akku / 7 print "Zelle:";0 + zelle / 100;".";zelle mod 100 / 10;zelle mod 100 mod 10;"V "; akku = ad1 * 50 / 51 akku = akku * 50 ' gem Diagramm Zellen Null-Wert ' fast Ende Anzahl für % ' 1.14V * 7 = 798 if akku <= (8050) then goto little #Big ' 100% - 11% if (Akku-7980) >= 3276 then Voll = (Akku-7980) / 9 if (Akku-7980) > 327 and (Akku-7980) < 3276 then Voll = (Akku-7980) * 10 / 91 if (Akku-7980) <= 327 then goto Big2 print "Voll:";0 + voll mod 1000 / 100;0 + voll mod 1000 mod 100 / 10;".";0 + voll mod 1000 mod 100 mod 10;"% "; goto weiter #Big2 'unter 36% genauer Voll = (Akku-7980) * 100 / 91 print "Voll:";0 + voll mod 1000 / 100;0 + voll mod 1000 mod 100 / 10;".";0 + voll mod 1000 mod 100 mod 10;"% "; goto weiter #little ' >10% (andere Kennlinie unter 10%) Voll = (Akku-7000) * 10 / 105 if akku < 7000 then voll = 0 print "Voll:";0 + voll mod 1000 / 100;0 + voll mod 1000 mod 100 / 10;".";0 + voll mod 1000 mod 100 mod 10;"% "; #weiter print "Zeit:";hour;":";minute;":";second if rxd then goto eingabe pause 50 goto Akkudaten1 #eingabe get Kommando if Kommando=27 then goto Menue_I return '************** Tabellen ******************************************** 'table temptable "tables\kty10.tab" ' --- Verarbeitung des Tastaturereignisses anhand der Tastennummer --- ' ----- Vergleichstabelle table keycodes 0 23 46 68 90 111 132 152 173 193 214 235 tabend