 Projekt Project Hardware Hardware Bedienung Operation BASIC (1) BASIC (1) BASIC (2) BASIC (2) BASIC (3) BASIC (3) Interna Internals Beispiele Examples Erweiterungen Extensions Bibliotheken Libraries Treiber Driver Programme Programs
 Bezugsquellen: Where to buy: Bausatz Kit Leerplatine Empty board | 
AVR-ChipBasic2 - Bibliotheken AVR ChipBasic2 - Libraries
V1.45 (c) 2006-2012 Jörg Wolfram V1.45 (c) 2006-2012 Jörg Wolfram
1 Die Festkomma-Bibliothek FIXLIB (Bibliothekscode 0x10) 1 The fixed point library FIXLIB (library code 0x10)
1.1 Allgemeines 1.1 General Diese Bibliothek erweitert den BASIC-Computer um Festkomma-Berechnungen. This library extends the BASIC computer to fixed-point calculations. Festkomma bedeutet, daß die Stellen vor und nach dem Komma fest vorgegeben sind. Fixed point means that the points are in front and fixed decimal places. Bei dieser Bibliothek lässt sich die Stellenzahl per Initialisierungskommando einstellen. This library can be the number of digits set by initialization command. Intern ist eine Darstellung gewählt, die jeweils 2 Stellen (Wertebereich 0...99) in einem Byte zusammenfasst. Internally, a diagram is selected, each 2 points summarizing (range 0 .. 99) in a byte. Somit sind Vor- und Nachkommastellen auch nur in 2-er Schritten einstellbar. Thus, and decimal places set only in steps of 2.
- 2...32 Vorkomma- und 0...30 Nachkommastellen wählbar 2nd .. 32 0 .. 30 digits and decimal places selectable
- Anzahl der verfügbaren Variablen von der Anzahl der Stellen abhängig Number of variables available on the number of points depending
- Belegt den Array-Bereich 256...511 Occupies the array range 256th .. 511
- Formatierte Textausgabe Formatted text output
- Eingabe über Text im Array möglich Text input on the possible array
- Integer- Datenaustaisch mit dem BASIC-System Integer Datenaustaisch with the BASIC system
- 4 Grundrechenarten, Vergleiche und weitere Funktionen 4 basic calculations, comparisons and other functions
Systembedingt haben nur Parameter die auch angegeben wurden einen definierten Wert. Depending on the system, only the parameters were also given a defined value. Bei einem CALL L,2,0 ist nur der Parameter 1 definiert, der für die Funktion notwendige Parameter 2 aber nicht. In a CALL L, 2.0, only the parameter 1 is defined, the. Necessary parameters for the function 2 but not Somit wird der Variable 0 der Wert zugewiesen, der sich zu diesem Zeitpunkt gerade an dieser Stelle im RAM befindet. Thus, the variable is assigned the value 0, which is at this time at this point is just in the RAM.
1.2 Funktionsübersicht 1.2 Overview of functions | Funktionsnummer Function number | Funktion Function | | 0 0 | Dummy-Funktion, falls die Bibliothek aus dem Hauptmenu aufgerufen wird Dummy function if the library is invoked from the main menu | | 1 1 | Initialisierung Initialization | | 2 2 | Integer-Zuweisung Variable=Wert Integer assignment variable = value | | 3 3 | Zuweisung über Textstring im Array Assignment via text string in the array | | 4 4 | liefert Integerwert der Variablen returns an integer value of the variable | | 5 5 | Textausgabe der Variablen Text output of the variable | | 6 6 | Absolutwert einer Variablen Absolute value of a variable | | 7 7 | Invers-Wert (0-Variable) Inverse value (0-variable) | | 8 8 | Addition V3 = V1 + V2 Addition V3 = V1 + V2 | | 9 9 | Subtrakion V3 = V1 - V2 Subtrakion V3 = V1 - V2 | | 10 10 | Multiplikation V3 = V1 * V2 Multiplication V3 = V1 * V2 | | 11 11 | Division V3 = V1 / V2 Division V3 = V1 / V2 | | 12 12 | Konstantenzuweisung mit vordefinierten Konstanten Constant assignment with predefined constants | | 13 13 | Vorkomma-Anteil einer Variablen (INT) Pre-decimal fraction of a variable (INT) | | 14 14 | Nachkomma-Anteil einer Variablen (FRAC) Fractional share of a variable (FRAC) | | 15 15 | Vergleich zweier Variablen Comparison of two variables | | 16 16 | Variable kopieren Variable copy | | 17 17 | Variable / 2 Variable / 2 | | 18 18 | Variable * 2 Variable * 2 | | 19 19 | Script im Arrayspeicher starten Scripts start in the array storage |
1.2.1 Funktion 0 : Dummy 1.2.1 Function 0: Dummy Dies ist eine Dummy-Funktion, die lediglich 0 zurückliefert falls die Bibliothek aus dem Hauptmenu aufgerufen wird. This is a dummy function that returns 0 if only the library from the main menu appears.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | --- --- | | Parameter 2 Parameter 2 | --- --- | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
1.2.2 Funktion 1 : Initialisierung 1.2.2 Function 1: Initialization Diese Funktion muss vor allen anderen Funktionen aufgerufen werden, um die notwendigen Initialisierungen vorzunehmen. This function must be called before any other functions to make the necessary initializations. Der
Rückgabewert entspricht der Anzahl der Variablen, die eingerichtet
wurden und hängt von der Zahl der Vor- und Nachkommastellen ab. The return value is the number of variables that have been set and depends on the number and decimal places.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Anzahl der Vorkomma-Bytes - 1 (0...15) Number of pre-decimal bytes - 1 (0 .. 15) | | Parameter 2 Parameter 2 | Anzahl der Nachkomma-Bytes Number of decimal bytes | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | Anzahl der initialisierten Variablen Number of uninitialized variables |
1.2.3 Funktion 2 : Wertzuweisung von Integerwert 1.2.3 Function 2: assignment of an integer value Setzt eine Variable auf einen Integerwert. Sets a variable to an integer value. Die Nachkommastellen werden auf 0 gesetzt The decimal places are set to 0
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer Variable number | | Parameter 2 Parameter 2 | Variablenwert Variable Value | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
1.2.4 Funktion 3 : Wertzuweisung von Textstring 1.2.4 Function 3: assignment of text string Setzt eine Variable auf einen durch einen Textstring im Array definierten Wert. Sets a variable to a defined by a text string in the array value. Als Trennzeichen zwischen Vorkomma- und Nachkommastellen kann sowohl das Komma als auch der Punkt genutzt werden. As a separator between digits and decimal places, both the comma and the point to be used. Beim ersten nicht-numerischen Zeichen im String wird die Konvertierung abgebrochen. The first non-numeric characters in the string, the conversion is aborted.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer Variable number | | Parameter 2 Parameter 2 | Textstart im Array Text starting in the array | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
1.2.5 Funktion 4 : Integerwert der Variablen 1.2.5 Function 4: Integer value of the variable Gibt den Integerwert der Variablen aus. Returns the integer value of the variable. Dabei wird entsprechend der Nachkommastellen gerundet. It is rounded according to the decimal point.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer Variable number | | Parameter 2 Parameter 2 | --- --- | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | Integer-Wert der Variablen Integer value of the variable |
1.2.6 Funktion 5 : Textausgabe der Variablen 1.2.6 Function 5: Text of the variables Gibt den Inhalt der Variablen als Textstring aus. Get the contents of the variables from a text string. Mit der Angabe von minimalen Vorkommabytes kann eine rechtsbündige Darstellung bewirkt werden. With the specification of minimum Vorkommabytes can a right-justified representation effected. Ist die Anzahl der maximalen Nachkommabytes kleiner als die der Variablen, wird entsprechend gerundet. Is the number of less than the maximum Nachkommabytes variables is rounded accordingly.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer Variable number | | Parameter 2 Parameter 2 | Bit 7...4: minimale Vorkommabytes -1 Bit 3...0: Nachkommabytes Bit 7 .. 4: minimum Vorkommabytes -1 Bit 3 .. 0: Nachkommabytes | | Parameter 3 Parameter 3 | (optional Ausgabekanal) (Optional output channel) | | Rückgabewert Return Value | 0 0 |
1.2.7 Funktion 6 : Absolutwert einer Variablen 1.2.7 Function 6: Absolute value of a variable Der Absolutwert der Variable 1 wird in die Variable 2 gespeichert. The absolute value of variable 1 is stored in the variable 2. V2 = ABS(V1) V2 = ABS (V1)
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
1.2.8 Funktion 7 : Invers-Wert einer Variablen 1.2.8 Function 7: inverse value of a variable Der Invers-Wert von Variable 1 wird in die Variable 2 gespeichert. The inverse value of variable 1 is stored in the variable 2. V2 = -V1 V2 = V1
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
1.2.9 Funktion 8 : Addition 1.2.9 Function 8: Addition Die Summe von Variable 1 und Variable 2 wird in die Variable 3 gespeichert. The sum of variable 1 and variable 2 is stored in the variable 3. V3 = V1 + V2 V3 = V1 + V2
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | Variablennummer von Variable 3 Variable number of variable 3 | | Rückgabewert Return Value | 0 0 |
1.2.10 Funktion 9 : Subtraktion 1.2.10 Function 9: Subtraction Die Differenz von Variable 1 und Variable 2 wird in die Variable 3 gespeichert. The difference of variable 1 and variable 2 is stored in the variable 3. V3 = V1 - V2 V3 = V1 - V2
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | Variablennummer von Variable 3 Variable number of variable 3 | | Rückgabewert Return Value | 0 0 |
1.2.11 Funktion 10 : Multiplikation 1.2.11 Function 10: Multiplication Das Produkt von Variable 1 und Variable 2 wird in die Variable 3 gespeichert. The product of variable 1 and variable 2 is stored in the variable 3. V3 = V1 * V2 V3 = V1 * V2
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | Variablennummer von Variable 3 Variable number of variable 3 | | Rückgabewert Return Value | 0 0 |
1.2.12 Funktion 11 : Division 1.2.12 Function 11: Division Der Quotient von Variable 1 und Variable 2 wird in die Variable 3 gespeichert. The ratio of variable 1 and variable 2 is stored in the variable 3. V3 = V1 / V2 V3 = V1 / V2
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | Variablennummer von Variable 3 Variable number of variable 3 | | Rückgabewert Return Value | 0 0 |
1.2.13 Funktion 12 : Konstantenzuweisung 1.2.13 Function 12: Constant assignment Für 8 vordefinierte Konstanten lässt sich die Wertzuweisung über diese Funktion vereinfachen. For 8 predefined constants can simplify the assignment of this feature.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer Variable number | | Parameter 2 Parameter 2 | Konstantennummer (0...7) Constant number (0 .. 7) | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
Die 8 Konstanten haben 15 gültige Nachkommastellen und sind wie folgt definiert: The 8 constants have 15 valid decimal places and are defined as follows:
| Konstantennummer Constant number | Wert Value | | 0 0 | 0 0 | | 1 1 | 1 1 | | 2 2 | PI PI | | 3 3 | e (Eulersche Zahl) e (Euler's number) | | 4 4 | ln(2) ln (2) | | 5 5 | ln(10) ln (10) | | 6 6 | SQRT(2) SQRT (2) | | 7 7 | SQRT(3) SQRT (3) | |
1.2.14 Funktion 13 : Vorkomma-Anteil einer Variablen 1.2.14 Function 13: pre-decimal fraction of a variable Der Vorkomma-Anteil der Variable 1 wird in die Variable 2 gespeichert. The pre-decimal percentage of variable 1 is stored in the variable 2. Genaugenommen werden nur die Nachkomma-Bytes auf 0 gesetzt V2 = INT(V1) Strictly speaking, only the decimal bytes set to 0 V 2 = INT (V1)
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
1.2.15 Funktion 14 : Nachkomma-Anteil einer Variablen 1.2.15 Function 14: fractional share of a variable Der Vorkomma-Anteil der Variable 1 wird in die Variable 2 gespeichert. The pre-decimal percentage of variable 1 is stored in the variable 2. Genaugenommen werden nur die Vorkomma-Bytes auf 0 gesetzt V2 = FRAC(V1) Strictly speaking, only the decimal bytes set to 0 V2 = FRAC (V1)
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
1.2.16 Funktion 15 : Vergleich zweier Variablen 1.2.16 Function 15: comparison of two variables Variable 1 wird mit Variable 2 verglichen. Variable 1 is compared to variable 2. Ist
Variable 1 größer als Variable 2, dann ist der Rückgabewert 1, ist
Variable 1 kleiner als Variable 2, ist das Ergebnis 2 und bei Gleichheit
beider Variablen wird 0 zurückgeliefert. Variable 1 is greater
than variable 2, then the return value is 1, is smaller than variable 1
variable 2, the result is 2, and for equality of the two variables is 0
returned.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | Vergleichsergebnis (1,0,2) Comparison result (1,0,2) |
1.2.17 Funktion 16 : Variable kopieren 1.2.17 Function 16: Copy variable Variable 1 wird in die Variable 2 kopiert. Variable 1 is copied to the variable 2.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
1.2.18 Funktion 17 : Multiplikation mit 2 1.2.18 Function 17: multiplication by 2 Variable 1 wird durch Bitschieben mit 2 multipliziert und das Ergebnis in die Variable 2 gespeichert. Variable 1 is multiplied by 2 and bit shifting with the result stored in the variable 2. Diese Funktion ist wesentlich schneller als eine entsprechende Multiplikation. This function is much faster than a corresponding multiplication. V2 = V1 * 2 V2 = V1 * 2
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
1.2.19 Funktion 18 : Division durch 2 1.2.19 Function 18: divide by 2 Variable 1 wird durch Bitschieben durch 2 dividiert und das Ergebnis in die Variable 2 gespeichert. Variable 1 is bit shifting divided by 2 and the result is stored in the variable 2. Diese Funktion ist wesentlich schneller als eine entsprechende Division. This function is much faster than a corresponding division. V2 = V1 / 2 V2 = V1 / 2
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Variablennummer von Variable 1 Variable number of variable 1 | | Parameter 2 Parameter 2 | Variablennummer von Variable 2 Variable number of variable 2 | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
1.2.20 Funktion 19 : Starten eines Scripts im Array 1.2.20 Function 19: Start a script in the array Da
die Bibliothek im Wesentlichen nur die Grundrechenarten bereitstellt,
gibt es eine kleine Script-Engine mit der auch komplexere Funktionen
relativ einfach berechnet werden können. Since the library
essentially provides only basic arithmetic, there is a small scripting
engine with the more complex functions can be calculated relatively
easily. Dazu muss der Code im ersten Drittel des Arrays (Zellen 0...255) stehen. This should be the code in the first third of the array (cells 0 .. 255).
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | Startadresse im Array Starting address of the array | | Parameter 2 Parameter 2 | opt. opt. Parameter 1 Parameter 1 | | Parameter 3 Parameter 3 | opt. opt. Parameter 2 Parameter 2 | | Parameter 4 Parameter 4 | opt. opt. Parameter 3 Parameter 3 | | Rückgabewert Return Value | Rückgabewert, je nach Exit-Befehl Return value, depending on the exit command |
Für
Schleifen etc. stehen vier 8-Bit Countervariablen zur Verfügung Jeder
Befehl besteht aus 2 Bytes, die noch in Halbbytes (Nibbles) unterteilt
sind. For grinding, etc. There are four 8-bit counter variables
are available Each command consists of 2 bytes, which are further
divided into nibbles (nibbles). Ein x steht dafür, dass der Wert des entsprechenden Nibbles nicht ausgewertet wird. An x represents that the value of the corresponding nibbles is not evaluated. Trotzdem ist es sinnvoll diese Nibbles auf 0 zu setzen. Nevertheless, it is useful to put these nibbles to 0. Für
Schleifen etc. stehen vier 8-Bit Countervariablen zur Verfügung, beim
Start eines Scripts werden die ersten drei mit den LOW-Bytes der
Parameter 1...3 vorbelegt, Countervariable 4 wird auf 0 gesetzt.
For grinding, etc. There are four 8-bit counter variables available at
the start of a script, the first three are preset with the LOW-byte
parameters 1 .. 3, Counter variable 4 is set to 0. Systembedingt haben nur Parameter die angegeben wurden einen definierten Wert. Depending on the system parameters have only been given a defined value. Bei einem CALL 7,19,17 ist nur der Parameter 1 auf 17 gesetzt, Parameter 2 und 3 sind undefiniert. In a CALL 7,19,17 only the parameter 1 is set to 17, parameter 2 and 3 are undefined.
| Code Code | Bedeutung Importance | | 0 0 0 V 0 0 0 V | Script beenden, Variablenwert (Integer) von Variable v wird zurückgegeben Stop script variable value (integer) returned is of variable v | | 0 1 x M 0 1 x M | Script beenden, der Wert von Counter M wird zurückgegeben Stop script, the value of M is returned Counter | | 0 2 nn 0 nn 2 | E wird zur Script-Position nn gesprungen E nn is the script jumped position | | 0 3 CV 0 3 CV | Variable V wird mit der Konstanten C initialisiert V variable is initialized with the constant C | | 0 4 x V 0 4 x V | Variable V wird mit dem Wert des optionalen Parameters 1 initialisiert V variable is initialized with the value of the optional parameter 1 | | 0 5 x V 0 5 x V | Variable V wird mit dem Wert des optionalen Parameters 2 initialisiert V variable is initialized with the value of the optional parameter 2 | | 0 6 x V 0 6 x V | Variable V wird mit dem Wert des optionalen Parameters 3 initialisiert V variable is initialized with the value of the optional parameter 3 | | 1 0 WV 1 0 WV | W = V W = V | | 1 1 WV 1 1 WV | W = ABS(V) W = ABS (V) | | 1 2 WV 1 2 WV | W = -V W = V | | 1 3 WV 1 3 WV | W = INT(V) W = INT (V) | | 1 4 WV 1 4 WV | W = FRAC(V) W = FRAC (V) | | 1 5 WV 1 5 WV | W = V * 2 W = V * 2 | | 1 6 WV 1 6 WV | W = V / 2 W = V / 2 | | 1 8 WV 1 8 WV | überspringt die nächste Anweisung, wenn V gleich W ist skips the next instruction if V is equal to W | | 1 9 WV 1 9 WV | überspringt die nächste Anweisung, wenn V ungleich W ist skips the next instruction if V is equal to W | | 1 AWV 1 AWV | überspringt die nächste Anweisung, wenn V größer W ist skips the next instruction if V is larger W | | 1 BWV 1 BWV | überspringt die nächste Anweisung, wenn V kleiner W ist skips the next instruction if V is smaller W | | 4 UWV 4 UWV | W = U + V W = U + V | | 5 UWV 5 UWV | W = U - V W = U - V | | 6 UWV 6 UWV | W = U * V W = V * V | | 7 UWV 7 UWV | W = U / V W = U / V | | 8 M nn 8 M nn | der Counter M wird auf nn gesetzt Counter of M is set to nn | | 9 M nn 9 M nn | zum Counter M wird nn addiert Counter M is added to nn | | AM nn AM nn | überspringt die nächste Anweisung, wenn der Counter M gleich nn ist skips the next instruction if the counter M is nn | | BM nn BM nn | überspringt die nächste Anweisung, wenn der Counter M ungleich nn ist skips the next instruction if the counter M is equal to nn | | CM xn CM xn | der Counter M wird mit Parameter N initialisiert the counter M is initialized with parameters N | | andere Codes other codes | Keine Funktion (NOP) No operation (NOP) |
1.3 Ein Fraktalprogramm als Beispiel 1.3 An example of a fractal In den Zeilen 7 bis 10 werden die Koordinaten für X1, X2, Y1 und Y2 eingetragen. In lines 7 through 10 are the coordinates for X1, registered X2, Y1 and Y2.
 PROGRAM :Fractal 2 PROGRAM: Fractal 2
01 LFIND L,16:A=120:B=76 Lfind L 01, 16: A = 120: B = 76
02 IF L=0 ? 02 IF L = 0? "keine Matlib":END "No Matlib": END
03 A=120:B=76:C=4:VM 2:VID 0 03 A = 120: B = 76: C = 4: VM 2: VID 0
04 Z=80:PAL 0,0,1,5,7 04 Z = 80: 0,0,1,5,7 PAL
05 CALL L,1,1,3:CALL L,2,16,4 05 CALL L, 1,1,3: CALL L, 2,16,4
06 'Koordinatenvorgaben 06 'coordinates specifications
07 DA 0,"-0.95#":CALL L,3,0,0 07 DA 0, "-0.95 #": CALL L, 3,0,0
08 DA 0,"-0.72#":CALL L,3,1,0 08 DA 0, "-0.72 #": CALL L, 3,1,0
09 DA 0,"0.17#":CALL L,3,2,0 DA 09 0, "0.17 #": CALL L, 3,2,0
10 DA 0,"0.33#":CALL L,3,3,0 10 pairs 0, "0:33 #": CALL L, 3,3,0
11 11
12 'DX(V4) und DY(V5) berechnen 12 'DX (V4) and DY (V5) Calculate
13 CALL L,2,6,A 13 CALL L, 2.6, A
14 CALL L,9,1,0,7:CALL L,11,7,6,4 14 CALL L, 9,1,0,7: CALL L, 11,7,6,4
15 CALL L,2,6,B 15 CALL L, 2.6, B
16 CALL L,9,3,2,7:CALL L,11,7,6,5 16 CALL L, 9,3,2,7: CALL L, 11,7,6,5
17 CALL L,16,0,15 17 CALL L, 16,0,15
18 TSET 0 18 TSET 0
19 FOR Y=0 TO B-1:FOR X=0 TO A-1 19 FOR Y = 0 TO B-1: FOR X = 0 TO A-1
20 CALL L,12,8,0:CALL L,12,9,0 CALL L 20, 12,8,0: CALL L, 12,9,0
21 I=0 21 I = 0
22 CALL L,10,8,8,10:'X^2 22 CALL L, 10,8,8,10: 'X ^ 2
23 CALL L,10,9,9,11:'Y^2 23 CALL L, 10,9,9,11: 'Y ^ 2
24 CALL L,8,10,11,6:CALL L,15,6,16 24 CALL L, 8,10,11,6: CALL L, 15,6,16
25 R=~R:IF R=1 GOTO 34 25 R ~ = R: IF R = 1 GOTO 34
26 CALL L,9,10,11,13:'XT CALL L 26, 9,10,11,13: 'XT
27 CALL L,8,0,13,13 27 CALL L, 8,0,13,13
28 CALL L,10,8,9,14:'YT 28 CALL L, 10,8,9,14: 'YT
29 CALL L,17,14,14:CALL L,8,2,14,14 CALL L 29, 17,14,14: CALL L, 8,2,14,14
30 CALL L,16,13,8:CALL L,16,14,9 CALL L 30, 16,13,8: CALL L, 16,14,9
31 'Iteration zu ende 31 'iteration to end
32 I=I+1:IF I<Z GOTO 22 32 I = I +1: IF I <Z GOTO 22
33 PLOT Y,X,0:GOTO 35 33 PLOT Y, X, 0 GOTO 35
34 D=I%(C-1):PLOT Y,X,D+1 D = I 34% of (C-1): PLOT Y, X D, +1
35 IF KEY(0)=$F5 THEN VID 0 35 KEY = IF (0) THEN $ F5 VID 0
36 IF KEY(0)=$F6 THEN VID 1 36 KEY = IF (0) THEN $ F6 VID 1
37 CALL L,8,0,4,0:NEXT 37 CALL L, 8,0,4,0: NEXT
38 CALL L,8,2,5,2 38 CALL L, 8,2,5,2
39 CALL L,16,15,0:NEXT CALL L 39, 16,15,0: NEXT
40 TGET S 40 TGET S
41 ? 41? @0,0;(ST)/10;"s ":VID 1 @ 0.0, (ST) / 10, "s": VID 1
42 GOTO 41 42 GOTO 41
# #
|
2 Die Messroutinen-Bibliothek MEASLIB (Bibliothekscode 0x12) 2 The measurement routines MEASLIB library (library code 0x12)
2.1 Allgemeines 2.1 General Diese
Bibliothek erweitert den BASIC-Computer um Messroutinen für
Widerstände, Dioden, Kondensatoren und Induktivitäten in verschiedenen
Messbereichen. This library extends the BASIC computer to test routines for resistors, diodes, capacitors and inductors in different ranges. Mit der unten angegebenen Schaltung werden folgende Messbereiche erreicht: With the circuit below the following ranges can be achieved:
- Widerstandsmessbereich von 5 Ohm bis 1 MOhm Resistance range from 5 ohms to 1 Mohm
- Dioden-Flussspannung bis 4,88V, maximaler Strom 5mA Diode forward voltage to 4.88 V, maximum current 5mA
- Kapazitäts-Messbereich von 100pF bis 1000uF Capacitance range of 100pF to 1000uF
- Induktivitäts-Messbereich von 20uH bis 800mH Inductance range from 20UH to 800mH
- Platz für eigenes Messprogramm Express Marketing Measurement Program
2.2 Benötigte Hardware 2.2 Required Hardware Auch wenn die benötigte Hardware eher minimalistisch ist, ganz ohne geht es leider nicht. Even if the required hardware is rather minimalist, with no it does not exist. Benutzt werden nur die vier unteren Pins von Port A, so kann auch gleichzeitig ein LCD Modul zur Anzeige angeschlossen werden. Used only the four lower pins of Port A, simultaneously, an LCD module can be connected to the display. Die notwendige Anschlussbeschaltung beschränkt sich auf zwei Widerstände und zwei Schottky-Dioden zum Schutz der Portpins. The necessary connection assignment is limited to two resistors and two Schottky diodes to protect the port pins. Im Folgenden werden die die Pins als PA.0 bis PA.3 bezeichnet. Below the map are called to PA.0 PA.3. Wenn
das Ganze direkt (ohne ChipBasic-Board) aufgebaut werden soll, sollten
an die vier Portpins zusätzlich 180 Ohm Widerstände in Reihe geschaltet
werden. If the whole thing is to be made directly (without chip
Basic Board) should be in addition to the four port pins connected 180
ohm resistors in series.
2.3 Funktionsübersicht 2.3 Functional Overview | Funktionsnummer Function number | Funktion Function | | 0 0 | Start des Demonstrationsprogramms (aktuell nicht genutzt) Start the demonstration program (currently not used) | | 1 1 | PA.1 auf HIGH, Spannungs-Messung an PA.0 und PA.1 PA.1 to HIGH voltage measurement on PA.0 and PA.1 | | 2 2 | PA.2 auf HIGH, Spannungs-Messung an PA.0 und PA.2 PA.2 to HIGH voltage measurement on PA.0 and PA.2 | | 3 3 | PA.3 auf HIGH, Spannungs-Messung an PA.0 und PA.3 PA.3 to HIGH voltage measurement on PA.0 and PA.3 | | 4 4 | PA.3 von LOW nach HIGH, Zeitmessung bis U(PA.0) > Uref (Auflösung 300ns) PA.3 from LOW to HIGH, timing to U (PA.0)> Vref (300ns resolution) | | 5 5 | PA.3 von LOW nach HIGH, Zeitmessung bis U(PA.0) > Uref (Auflösung 500ns) PA.3 from LOW to HIGH, timing to U (PA.0)> Vref (500 ns resolution) | | 6 6 | PA.2 von LOW nach HIGH, Zeitmessung bis U(PA.0) > Uref (Auflösung 300ns) PA.2 from LOW to HIGH, timing to U (PA.0)> Vref (300ns resolution) | | 7 7 | PA.2 von LOW nach HIGH, Zeitmessung bis U(PA.0) > Uref (Auflösung 64us) PA.2 from LOW to HIGH, timing to U (PA.0)> Vref (resolution 64us) | | 8 8 | PA.1 von LOW nach HIGH, Zeitmessung bis U(PA.0) < Uref (Auflösung 300ns) PA.1 from LOW to HIGH, timing to U (PA.0) <Vref (300ns resolution) | | 9 9 | PA.1 von LOW nach HIGH, Zeitmessung bis U(PA.0) < Uref (Auflösung 500ns) PA.1 from LOW to HIGH, timing to U (PA.0) <Vref (500 ns resolution) | | 10 10 | PA.2 von LOW nach HIGH, Zeitmessung bis U(PA.0) < Uref (Auflösung 500ns) PA.2 from LOW to HIGH, timing to U (PA.0) <Vref (500 ns resolution) | | 11 11 | PA.3 von LOW nach HIGH, Zeitmessung bis U(PA.0) < Uref (Auflösung 300ns) PA.3 from LOW to HIGH, timing to U (PA.0) <Vref (300ns resolution) |
2.3.1 Funktion 0 : Demo 2.3.1 Function 0: Demo Startet das eingebaute Demonstrationsprogramm. Starts the built demonstration program. In der aktuellen Version besteht dieses nur aus einem "RET" In the current version this is only a "RET"
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | --- --- | | Parameter 2 Parameter 2 | --- --- | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 0 0 |
2.3.2 Funktion 1 : PA.1 auf HIGH, Spannungs-Messung an PA.0 und PA.1 2.3.2 Function 1: PA.1 to HIGH voltage measurement on PA.0 and PA.1 Setzt die Portpins von Port A und führt Messungen mit dem ADC an den Pins PA.0 und PA.1 durch. Sets the port pins of Port A and performs measurements with the ADC through on pins and PA.0 PA.1. Zur Verbesserung der Genauigkeit werden die Ergebnisse von jeweils 32 Einzelmessungen aufsummiert. To improve the accuracy of the results of each of 32 individual measurements are summed. Mit der Beispielschaltung lassen sich so Widerstände von ca. 5 Ohm bis 5 KOhm mit akzeptabler Gennauigkeit messen. With the example circuit can thus resistance of about 5 ohms to 5 K measured with acceptable Gennauigkeit. Der Ablauf ist dabei Folgender: The sequence is the following:
- Die Pins PA.0, PA.2 und PA.3 werden als Eingang ohne Pullup geschaltet, PA.1 als Ausgang mit HIGH Pegel Pins PA.0, PA.2 and PA.3 be switched as input without pullup, PA.1 starting with HIGH level
- Spannung an Pin PA.1 mit AVCC als Referenz 32 mal messen und die Werte ausfsummieren Voltage at Pin PA.1 with AVCC as reference measure 32 times and the values ausfsummieren
- Spannung an Pin PA.0 mit AVCC als Referenz 32 mal messen und die Werte ausfsummieren Voltage at Pin PA.0 with AVCC as reference measure 32 times and the values ausfsummieren
- PA.1 auf LOW Pegel setzen PA.1 set to LOW level
Rückgabewert ist der Messwert von PA.0, der Messwert von PA.1 wird in die Arrayzelle 1024 abgelegt. Return value of the measured value of PA.0, the measured value of PA.1 is is stored in the cell array 1024th
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | --- --- | | Parameter 2 Parameter 2 | --- --- | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 32 x Messwert von PA.0, Messwert von PA.1 in AR(1024) 32 x PA.0 of reading, reading from PA.1 in AR (1024) |
2.3.3 Funktion 2 : PA.2 auf HIGH, Spannungs-Messung an PA.0 und PA.2 2.3.3 Function 2: PA.2 to HIGH voltage measurement on PA.0 and PA.2 Diese
Funmktion entspricht der Funktion 1 mit dem Unterschied, dass anstelle
Pin PA.2 hier der Pin PA.2 als Quelle verwendet wird und in AR(1024) der
Messwert von Pin PA.2 steht. This corresponds to the function
Funmktion 1 with the difference that instead of pin PA.2 here the pin is
used as the source and PA.2 in AR (1024), the measured value of Pin
PA.2 stands.
2.3.4 Funktion 3 : PA.3 auf HIGH, Spannungs-Messung an PA.0 und PA.3 2.3.4 Function 3: PA.3 to HIGH voltage measurement on PA.0 and PA.3 Diese
Funmktion entspricht der Funktion 1 mit dem Unterschied, dass anstelle
Pin PA.2 hier der Pin PA.3 als Quelle verwendet wird und in AR(1024) der
Messwert von Pin PA.3 steht. Funmktion This corresponds to the
function 1 with the difference that instead of Pin Pin PA.2 here PA.3 is
used as source and in AR (1024) Measuring the value of pin PA.3 stands.
2.3.5 Funktion 4 : PA.3 von LOW nach HIGH, Zeitmessung bis U(PA.0) > Uref (Auflösung 300ns) 2.3.5 Function 4: PA.3 from LOW to HIGH, timing to U (PA.0)> Vref (300ns resolution) Pin
PA.0 wird mit dem Analog-Komparator verbunden, als Vergleichsspannung
dient die interne Bandgap-Referenzquelle mit ca. 1,1 Volt. PA.0
pin is connected to the analog comparator, as a comparison voltage, the
internal band gap reference source is used with about 1.1 volts. Der
Pin PA.3 wird von 0 auf 1 geschaltet und die Zeit gemessen, bis die
Spannung an PA.0 größer als die Spannung der Referenzspannungsquelle
ist. The pin PA.3 is switched to 1 from 0, and the time until the
voltage is greater than the voltage of the reference voltage source to
PA.0. Die zeitliche Aulösung beträgt 300ns, der maximale Messbereich 60 Mikrosekunden. The temporal Aulösung is 300ns, the maximum measuring range 60 microseconds. Es werden 16 Messungen im Abstand von 20ms durchgeführt und die Werte aufaddiert. Have 16 measurements are performed at intervals of 20ms, and adding up the values. Der maximal zurückgelieferte Wert beträgt somit 3200. The maximum value returned is 3200 thus. Der Ablauf ist dabei Folgender: The sequence is the following:
- Die Pins PA.0, PA.1 und PA.2 werden als Eingang ohne Pullup geschaltet, PA.3 als Ausgang mit LOW Pegel Pins PA.0, PA.1 and PA.2 be switched as input without pullup, PA.3 starting with LOW level
- PA.3 AUF HIGH schalten und die Zeit bestimmen, bis die Spannung an PA.0 > Uref ist. PA.3 ON HIGH switch and determine the time until the voltage across PA.0> Uref.
- Nach 60 Mikrosekunden die Messung abbrechen und PA.3 auf LOW Pegel setzen Cancel after 60 microseconds to measure and PA.3 set to LOW level
- Das Ganze 15 mal wiederholen The whole repeat 15 times
Rückgabewert ist die Summe der einzelnen Zeitmessungen. The return value is the sum of individual time measurements.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | --- --- | | Parameter 2 Parameter 2 | --- --- | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 16 x Messwert (in 300 Nanosekunden-Schritten) 16 x measured value (in 300 nanosecond increments) |
2.3.6 Funktion 5 : PA.3 von LOW nach HIGH, Zeitmessung bis U(PA.0) > Uref (Auflösung 500ns) 2.3.6 Function 5: PA.3 from LOW to HIGH, timing to U (PA.0)> Vref (500 ns resolution) Diese Funktion entspricht der Funktion 4, allerdings mit einer anderen Zeitauflösung und einem größeren Messbereich. This function corresponds to the 4, but with a different time resolution and greater range. Die zeitliche Aulösung beträgt 500ns, der maximale Messbereich 6,4 Millisekunden. The temporal Aulösung is 500ns, the maximum measuring range 6.4 milliseconds. Es werden 16 Messungen im Abstand von 20ms durchgeführt und die Werte aufaddiert. Have 16 measurements are performed at intervals of 20ms, and adding up the values. Zum Schluss wird das ergebnis durch 8 geteilt. Finally, the result is divided by 8. Der maximal zurückgelieferte Wert beträgt somit 25600. The maximum value returned is thus 25,600. Der Ablauf ist dabei Folgender: The sequence is the following:
- Die Pins PA.0, PA.1 und PA.2 werden als Eingang ohne Pullup geschaltet, PA.3 als Ausgang mit LOW Pegel Pins PA.0, PA.1 and PA.2 be switched as input without pullup, PA.3 starting with LOW level
- PA.3 AUF HIGH schalten und die Zeit bestimmen, bis die Spannung an PA.0 > Uref ist. PA.3 ON HIGH switch and determine the time until the voltage across PA.0> Uref.
- Nach 6,4 Millisekunden die Messung abbrechen und PA.3 auf LOW Pegel setzen Cancel after 6.4 milliseconds and the measurement PA.3 set to LOW level
- Das Ganze 15 mal wiederholen, die Messwerte aufaddieren Repeat the whole 15 times, add up the values
- Die Summe der Messwerte durch 8 teilen. The sum of the measured values by 8 share.
Rückgabewert ist die Summe der einzelnen Zeitmessungen geteilt durch 8. Return value is the sum of the individual time measurements divided by 8
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | --- --- | | Parameter 2 Parameter 2 | --- --- | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 2 x Messwert (in 500 Nanosekunden-Schritten) 2 x measured value (in 500 nanosecond increments) |
2.3.7 Funktion 6 : PA.2 von LOW nach HIGH, Zeitmessung bis U(PA.0) > Uref (Auflösung 500ns) 2.3.7 Function 6: PA.2 from LOW to HIGH, timing to U (PA.0)> Vref (500 ns resolution) Diese Funktion entspricht der Funktion 5, der LOW-HIGH Übergang findet aber an Pin PA.2 statt. This function is equivalent to 5, the LOW-HIGH transition but occurs at pin PA.2.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | --- --- | | Parameter 2 Parameter 2 | --- --- | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 2 x Messwert (in 500 Nanosekunden-Schritten) 2 x measured value (in 500 nanosecond increments) |
2.3.8 Funktion 7 : PA.2 von LOW nach HIGH, Zeitmessung bis U(PA.0) > Uref (Auflösung 64us) 2.3.8 Function 7: PA.2 from LOW to HIGH, timing to U (PA.0)> Vref (resolution 64us) Diese Funktion entspricht der Funktion 5, der LOW-HIGH Übergang findet an Pin PA.2 statt. This function is equivalent to 5, the LOW-HIGH transition occurs at pin PA.2. Die zeitliche Aulösung beträgt 64us (Zeilenfrequenz), der maximale Messbereich 262 Millisekunden. The time is 64us Aulösung (line rate), the maximum sensitivity of 262 milliseconds. Es werden 2 Messungen im Abstand von 20ms durchgeführt und die Werte aufaddiert. It two measurements are performed at intervals of 20ms, and adding up the values. Der maximal zurückgelieferte Wert beträgt somit 8192. The maximum value returned is 8192 thus. Der Ablauf ist dabei Folgender: The sequence is the following:
- Die Pins PA.0, PA.1 und PA.3 werden als Eingang ohne Pullup geschaltet, PA.2 als Ausgang mit LOW Pegel Pins PA.0, PA.1 and PA.3 be switched as input without pullup, PA.2 starting with LOW level
- PA.2 AUF HIGH schalten und die Zeit bestimmen, bis die Spannung an PA.0 > Uref ist. PA.2 ON HIGH switch and determine the time until the voltage across PA.0> Uref.
- Nach 262 Millisekunden die Messung abbrechen und PA.3 auf LOW Pegel setzen Abort after 262 milliseconds the measurement and PA.3 set to LOW level
- Das Ganze 1 mal wiederholen The whole repeat 1 times
Rückgabewert ist die Summe der einzelnen Zeitmessungen. The return value is the sum of individual time measurements.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | --- --- | | Parameter 2 Parameter 2 | --- --- | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 2 x Messwert (in 64 Mikrosekunden-Schritten) 2 x reading (in 64 microsecond increments) |
2.3.9 Funktion 8 : PA.1 von LOW nach HIGH, Zeitmessung bis U(PA.0) < Uref (Auflösung 300ns) 2.3.9 Function 8: PA.1 from LOW to HIGH, timing to U (PA.0) <Vref (300ns resolution) Pin
PA.0 wird mit dem Analog-Komparator verbunden, als Vergleichsspannung
dient die interne Bandgap-Referenzquelle mit ca. 1,1 Volt. PA.0
pin is connected to the analog comparator, as a comparison voltage, the
internal band gap reference source is used with about 1.1 volts. Der
Pin PA.1 wird von 0 auf 1 geschaltet und die Zeit gemessen, bis die
Spannung an PA.0 wieder kleiner als die Spannung der
Referenzspannungsquelle ist. The pin PA.1 is switched to 1 from
0, and the time measured until the voltage at PA.0 is less than the
voltage of the reference voltage source again. Die zeitliche Aulösung beträgt 300ns, der maximale Messbereich 60 Mikrosekunden. The temporal Aulösung is 300ns, the maximum measuring range 60 microseconds. Es werden 16 Messungen im Abstand von 20ms durchgeführt und die Werte aufaddiert. Have 16 measurements are performed at intervals of 20ms, and adding up the values. Der maximal zurückgelieferte Wert beträgt somit 3200. The maximum value returned is 3200 thus. Der Ablauf ist dabei folgender: The sequence is as follows:
- Die Pins PA.0, PA.2 und PA.3 werden als Eingang ohne Pullup geschaltet, PA.1 als Ausgang mit LOW Pegel Pins PA.0, PA.2 and PA.3 be switched as input without pullup, PA.1 starting with LOW level
- PA.1 AUF HIGH schalten und 300ns warten PA.1 HIGH ON switch and wait 300ns
- Die Zeit bestimmen, bis die Spannung an PA.0 < Uref ist. Determine the time until the voltage at PA.0 <Uref.
- Nach 60 Mikrosekunden die Messung abbrechen und PA.1 auf LOW Pegel setzen Cancel after 60 microseconds to measure and PA.1 set to LOW level
- Das Ganze 15 mal wiederholen The whole repeat 15 times
Rückgabewert ist die Summe der einzelnen Zeitmessungen. The return value is the sum of individual time measurements.
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | --- --- | | Parameter 2 Parameter 2 | --- --- | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 16 x Messwert (in 300 Nanosekunden-Schritten) 16 x measured value (in 300 nanosecond increments) |
2.3.10 Funktion 9 : PA.1 von LOW nach HIGH, Zeitmessung bis U(PA.0) < Uref (Auflösung 500ns) 2.3.10 Function 9: PA.1 from LOW to HIGH, timing to U (PA.0) <Vref (500 ns resolution) Diese Funktion entspricht der Funktion 4, allerdings mit einer anderen Zeitauflösung und einem größeren Messbereich. This function corresponds to the 4, but with a different time resolution and greater range. Die zeitliche Aulösung beträgt 500ns, der maximale Messbereich 6,4 Millisekunden. The temporal Aulösung is 500ns, the maximum measuring range 6.4 milliseconds. Es werden 16 Messungen im Abstand von 20ms durchgeführt und die Werte aufaddiert. Have 16 measurements are performed at intervals of 20ms, and adding up the values. Zum Schluss wird das ergebnis durch 8 geteilt. Finally, the result is divided by 8. Der maximal zurückgelieferte Wert beträgt somit 25600. The maximum value returned is thus 25,600. Der Ablauf ist dabei folgender: The sequence is as follows:
- Die Pins PA.0, PA.2 und PA.3 werden als Eingang ohne Pullup geschaltet, PA.1 als Ausgang mit LOW Pegel Pins PA.0, PA.2 and PA.3 be switched as input without pullup, PA.1 starting with LOW level
- PA.1 AUF HIGH schalten und 300ns warten PA.1 HIGH ON switch and wait 300ns
- Die Zeit bestimmen, bis die Spannung an PA.0 < Uref ist. Determine the time until the voltage at PA.0 <Uref.
- Nach 6,4 Millisekunden die Messung abbrechen und PA.1 auf LOW Pegel setzen Cancel after 6.4 milliseconds and the measurement PA.1 set to LOW level
- Das Ganze 15 mal wiederholen, die Messwerte aufaddieren Repeat the whole 15 times, add up the values
- Die Summe der Messwerte durch 8 teilen. The sum of the measured values by 8 share.
Rückgabewert ist die Summe der einzelnen Zeitmessungen geteilt durch 8. Return value is the sum of the individual time measurements divided by 8
| Parameter Parameter | Bedeutung Importance | | Parameter 1 Parameter 1 | --- --- | | Parameter 2 Parameter 2 | --- --- | | Parameter 3 Parameter 3 | --- --- | | Rückgabewert Return Value | 2 x Messwert (in 500 Nanosekunden-Schritten) 2 x measured value (in 500 nanosecond increments) |
2.3.11 Funktion 10 : PA.2 von LOW nach HIGH, Zeitmessung bis U(PA.0) < Uref (Auflösung 500ns) 2.3.11 Function 10: PA.2 from LOW to HIGH, timing to U (PA.0) <Vref (500 ns resolution) Diese Funktion entspricht der Funktion 9, der LOW-HIGH Übergang findet aber an Pin PA.2 statt. This function is equivalent to 9, the LOW-HIGH transition but occurs at pin PA.2.
2.3.12 Funktion 11 : PA.3 von LOW nach HIGH, Zeitmessung bis U(PA.0) < Uref (Auflösung 500ns) 2.3.12 Function 11: PA.3 from LOW to HIGH, timing to U (PA.0) <Vref (500 ns resolution) Diese Funktion entspricht der Funktion 9, der LOW-HIGH Übergang findet aber an Pin PA.3 statt. This function is equivalent to 9, the LOW-HIGH transition but occurs at pin PA.3.
2.4 Ein Anwendunsbeispiel 2.4 A Anwendunsbeispiel Das nachfolgende Beispiel zeigt die komplette Beschaltung inclusive LCD und einem Taster zur Messbereichsumschaltung. The following example is the complete circuit including LCD and a button shows the range selection. Dieses
könnte man natürlich auch standalone aufbauen und das Programm System
mittels des Clone-Programmes oder den Loader übertragen. This one could also build standalone system and transfer the program using the clone program or the loader. Das gäbe dann ein kompaktes Messgerät, natürlich nur wenn die Genauigkeit ausreichend ist. That would be a compact measuring device, of course, only if the accuracy is sufficient. Neben
der Mess-Bibliothek wird noch ein LCD-Treiber benötigt, das LCD selbst
muss nicht unbedingt angeschlossen sein da parallel die Ausgabe über TV
erfolgt. Besides the measurement library nor an LCD driver is
required, the LCD itself need not be connected in parallel as the output
on TV is.
Mit dem nachfolgenden Programm ergeben sich dann folgende Messbereiche, die mittels des Tasters gewählt werden können. With the following program resulted in the following ranges, which can be selected using the button.
| Messart Type of measurement | Messbereich Measuring range | | Widerstand Resistance | 10Ω ...1MΩ 10Ω ... 1 mW | | Diode Diode | 0 ... 0 ... 4,8V 4.8 V | | Kapazität Capacity | 100pF ... 100pF ... 1000μF 1000uF | | Induktivität Inductance | 10 uH ... 10 uH ... 100mH 100mH |
In den Zeilen 9 bis 13 sind die Skalierungsfaktoren abgelegt. Lines 9 through 13, the scaling factors are stored. Diese
wurden empirisch mit Referenzbauteilen ermittelt, hängen aber zu einem
guten Teil von Fertigungstoleranzen bei den eingesetzten Bauteilen
(inclusive Controller) ab. These were determined empirically with
reference components, but depend to a large extent by manufacturing
tolerances in the components used (including controller). Die
folgende Tabelle gibt eine Zuordnung über die Skalierungswerte zu den
Messbereichen, zum Kalibrieren sollte ein Bauteil genommen werden,
welches wertemäßig ungefähr in der Mitte des Messbereiches liegt.
The following table provides a mapping of the scale values for the
ranges, for calibrating a component should be taken, which is worth
about in terms of the measurement center. Die angegebenen Messbereiche sind nur als Ungefährwerte anzusehen: The given ranges should be considered only as Ungefährwerte:
| Adresse Address | Zeile Line | Messbereich Measuring range | | 1026 1026 | 9 9 | Widerstände 6,5KΩ < R < 1MΩ Resistors 6.5 KΩ <R <1 mW | | 1027 1027 | 9 9 | Widerstände 200Ω < R < 6,5KΩ 200Ω resistors <R <6.5 KΩ | | 1028 1028 | 9 9 | Widerstände 10Ω < R < 200Ω 10Ω resistors R <<200Ω | | 1029 1029 | 10 10 | Diodenspannung 0V < U < 4,8V Diode voltage U 0V <<4.8 V | | 1030,1031 (Endwert,Offset) 1030.1031 (full scale, offset) | 11 11 | Kondensatoren 0,1nF < C < 72nF Capacitors 0.1 nF <C <72nF | | 1032,1033 (Endwert,Offset) 1032.1033 (full scale, offset) | 11 11 | Kondensatoren 72nF < C < 740nF Capacitors 72nF <C <740nF | | 1034,1035 (Endwert,Offset) 1034.1035 (full scale, offset) | 12 12 | Kondensatoren 740nF < C < 22μF Capacitors 740nF <C <22μF | | 1036,1037 (Endwert,Offset) 1036.1037 (full scale, offset) | 12 12 | Kondensatoren 22μF < C < 1000μF Capacitors <22μF C <1000uF | | 1038 1038 | 13 13 | Induktivitäten 50μH < L < 6,7mH Inductors 50μH <L <6.7 mH | | 1038 1038 | 13 13 | Induktivitäten 6,7mH < L < 830mH MH inductors 6.7 <L <830mH |
PROGRAM:Mess4 PROGRAM: Mess4
01 E=30:F=31:LFIND V,160 01 E = 30 F = 31: lfind V, 160
02 IF V=0 GOTO ~L+2 V = 0 GOTO 02 IF ~ L +2
03 VM 7:COLOR 1,5:E=8:F=9 03 VM 7: COLOR 1,5: E = 8: F = 9
04 LFIND L,18:IF L>0 GOTO ~L+2 Lfind 04 L, 18: IF L> 0 GOTO ~ L +2
05 ? 05? "Keine Messlib ";:END "No Messlib"; END
06 GOSUB 89 06 GOSUB 89
07 ? 07? "CB2 KOMPO-Meter":WAIT 20 "CB2 KOMPO-meter": WAIT 20
08 'Korrektur-Faktoren 08 'correction factors
09 DATA 1026,3320,12000,2150 09 DATA 1026,3320,12000,2150
10 DATA 1029,5000 10 DATA 1029.5000
11 DATA 1030,740,96,7660,6 11 DATA 1030,740,96,7660,6
12 DATA 1034,2190,0,1043,0 12 DATA 1034,2190,0,1043,0
13 DATA 1038,6710,8300 13 DATA 1038,6710,8300
14 OUT $47E,15:'disable INPUT 14 OUT $ 47E, 15: 'disable INPUT
15 GOSUB 25:GOSUB 80:'R 15 GOSUB 25: GOSUB 80: 'R
16 IF T=0 GOTO ~L-1 T = 0 GOTO 16 IF ~ L-1
17 GOSUB 41:GOSUB 80:'D 17 GOSUB 41: GOSUB 80: 'D
18 IF T=0 GOTO ~L-1 T = 0 GOTO 18 IF ~ L-1
19 GOSUB 48:GOSUB 80:'C 19 GOSUB 48: GOSUB 80: 'C
20 IF T=0 GOTO ~L-1 T = 0 GOTO 20 IF ~ L-1
21 GOSUB 70:GOSUB 80:'L 21 GOSUB 70: GOSUB 80: 'L
22 IF T=0 GOTO ~L-1 T = 0 GOTO 22 IF ~ L-1
23 GOTO ~L-8 23 GOTO ~ L-8
24 'R Messung 24 'R measurement
25 CALL L,3 25 CALL L, 3
26 X=~R:N=AR(1024)-X:Y=AR(1026) 26 X ~ = R: N = AR (1024)-X: Y = AR (1026)
27 IF X>31000 GOTO ~L+4 27 IF X> 31000 GOTO ~ L +4
28 IF X<200 GOTO ~L+4 28 IF X <200 GOTO ~ L +4
29 X=X/10:SCALE R,0,Y,0,X,N:CLS 29 X = X/10: SCALE R, 0, Y, 0, X, N: CLS
30 ? 30? "(R) ";!$1D;R;" K";%F:RET "(R)", $ 1D, R, "K",% Q: RET
31 CLS :? 31 CLS:? "(R) > 1 M";%F:RET "(R)> 1 M '% Q: RET
32 CALL L,2 CALL 32 L, 2
33 X=~R:N=AR(1024)-X:Y=AR(1027) 33 X ~ = R: N = AR (1024)-X: Y = AR (1027)
34 IF X<200 GOTO ~L+3 34 IF X <200 GOTO ~ L +3
35 X=X/10:SCALE R,0,Y,0,X,N:CLS 35 X = X/10: SCALE R, 0, Y, 0, X, N: CLS
36 ? 36? "(R) ";!$0D;R;" ";%F:RET "(R)", $ 0D, R, "",% Q: RET
37 CALL L,1 37 CALL L, 1
38 X=~R:N=AR(1024)-X:Y=AR(1028) 38 X = ~ R: N = AR (1024), X: Y = AR (1028)
39 SCALE R,0,Y,0,X,N:CLS SCALE 39 R, 0, Y, 0, X, N: CLS
40 ? 40? "(R) ";!$1D;R;" ";%F:RET "(R)", $ 1D, R, "",% Q: RET
41 'D-Messung 41 'D measurement
42 CALL L,2:Y=AR(1029) CALL L 42, 2: Y = AR (1029)
43 X=~R:IF X>32000 GOTO ~L+3 43 X ~ = R: IF X> 32000 GOTO ~ L +3
44 SCALE R,0,Y,0,X,32767:CLS 44 SCALE R, 0, Y, 0, X, 32767: CLS
45 ? 45? "(D) ";!$3D;R;" V":RET "(D)", $ 3D, R, "V": RET
46 CLS :? 46 CLS:? "(D) > 4.88 V":RET "(D)> 4.88 V": RET
47 'C-Messung 47 'C measurement
48 CALL L,4 CALL 48 L, 4
49 Y=AR(1030):O=AR(1031) 49 Y = AR (1030): O = AR (1031)
50 X=~R:IF X>3199 GOTO ~L+3 50 X ~ = R: IF X> 3199 GOTO ~ L +3
51 SCALE R,0,Y,0,XO,32000:CLS 51 SCALE R, 0, Y, 0, XO, 32000: CLS
52 ? 52? "(C) ";!$1D;R;" nF":RET "(C)", $ 1D, R, "nF": RET
53 CALL L,5 CALL L 53, 5
54 Y=AR(1032):O=AR(1033) 54 Y = AR (1032): O = AR (1033)
55 X=~R:IF X>25000 GOTO ~L+3 55 X ~ = R: IF X> 25000 GOTO ~ L +3
56 SCALE R,0,Y,0,XO,25600:CLS SCALE 56 R, 0, Y, 0, XO, 25600: CLS
57 ? 57? "(C) ";!$1D;R;" nF":RET "(C)", $ 1D, R, "nF": RET
58 CALL L,6 CALL L 58, 6
59 Y=AR(1034):O=AR(1035) 59 Y = AR (1034): O = AR (1035)
60 X=~R:IF X>25000 GOTO ~L+3 60 X ~ = R: IF X> 25000 GOTO ~ L +3
61 SCALE R,0,Y,0,XO,25600:CLS SCALE 61 R, 0, Y, 0, XO, 25600: CLS
62 ? 62? "(C) ";!$2D;R;" ";%E;"F" "(C)";! $ 2D R, "",% E, "F"
63 CALL L,7 CALL L 63, 7
64 Y=AR(1036):O=AR(1037) 64 Y = AR (1036): O = AR (1037)
65 X=~R:IF X>4090 GOTO ~L+3 65 X ~ = R: IF X> 4090 GOTO ~ L +3
66 SCALE R,0,Y,0,XO,4096:CLS SCALE 66 R, 0, Y, 0, O, 4096: CLS
67 ? 67? "(C) ";!$0D;R;" ";%E;"F":RET "(C)", $ 0D, R, "",% E, "F": RET
68 CLS :? 68 CLS:? "(C) OVERFLOW ":RET "(C) OVERFLOW": RET
69 'L-Messung 69 'L measurement
70 ? 70? @0,0;:CALL L,8:Y=AR(1038) @ 0.0, CALL L, 8: Y = AR (1038)
71 X=~R:IF X>3199 GOTO ~L+3 71 X ~ = R: IF X> 3199 GOTO ~ L +3
72 SCALE R,0,Y,0,X,3200:CLS 72 SCALE R, 0, Y, 0, X, 3200: CLS
73 ? 73? "(L) ";!$0D;R;" ";%E;"H":RET "(L)", $ 0D, R, "",% E, "H": RET
74 ? 74? @0,0;:CALL L,9:Y=AR(1039) @ 0.0, CALL L, 9: Y = AR (1039)
75 X=~R:IF X>25599 GOTO ~L+3 75 X ~ = R: IF X> 25599 GOTO ~ L +3
76 SCALE R,0,Y,0,X,25600:CLS SCALE 76 R, 0, Y, 0, X, 25600: CLS
77 ? 77? "(L) ";!$1D;R;" mH":RET "(L)", $ 1D, R, "mH": RET
78 CLS :? 78 CLS:? "(L) OVERFLOW ":RET "(L) OVERFLOW": RET
79 'Test auf Tastendruck 79 'test at your fingertips
80 I=0:T=0 80 I = 0: T = 0
81 'IF IN($807)=0 GOTO ~L-2 81 'IF IN ($ 807) = 0 GOTO ~ L-2
82 IF KEY(0)>0 GOTO ~L+3 82 IF KEY (0)> 0 GOTO ~ L +3
83 IF IN($807)=0 GOTO ~L+2 83 IF IN = ($ 807) 0 GOTO ~ L +2
84 RETURN 84 RETURN
85 SYNC 1:I=I+1:IF I<50 GOTO ~L-3 85 SYNC 1: I = I +1: IF I <50 GOTO ~ L-3
86 T=1 86 T = 1
87 RETURN 87 RETURN
88 'my and omega symbols 88 'my and omega symbols
89 DA 100,0,0,9,9,9,14,8,16 89 DA 100,0,0,9,9,9,14,8,16
90 DA 108,0,0,14,17,17,10,27,0 90 DA 108,0,0,14,17,17,10,27,0
91 FOR I=0 TO 15:J=I+100 91 FOR I = 0 TO 15: J = I +100
92 OUT $A00+I,AR(J):NEXT 92 OUT $ A00 + I, AR (J): NEXT
93 RETURN 93 RETURN
# #
|
3 Eine RTC Befehlserweiterung (Bibliothekscode 0x1F) 3 An RTC command extension (library code 0x1F)
3.1 Allgemeines 3.1 General Diese Demo-Bibliothek zeigt, wie der Befehlsumfang des BASIC-Computer erweitert werden kann. This demo library shows how the commands of the BASIC computer can be upgraded. Dazu sind folgende Befehle implementiert: The following commands are implemented:
3.2 Funktionsübersicht 3.2 Functional Overview | Befehl Command | Funktion Function | | _SETSEC n _SETSEC N | setzt den Sekunden-Wert auf den Parameter n, dabei werden die Grenzen überwacht. sets the seconds value to the parameter n, while the limits monitored. | | _SETMIN n _SETMIN N | setzt den Minuten-Wert auf den Parameter n, dabei werden die Grenzen überwacht. set the minute value to the parameter n, while the limits monitored. | | _SETHOUR n _SETHOUR N | setzt den Stunden-Wert auf den Parameter n, dabei werden die Grenzen überwacht. sets the hour value of the parameter n, while the limits are monitored. | | _SETDAY n _SETDAY N | setzt den Tage-Wert auf den Parameter n, dabei werden die Grenzen überwacht. is the daily value of the parameter n, while the limits are monitored. | | _SETMONTH n _SETMONTH N | setzt den Monats-Wert auf den Parameter n, dabei werden die Grenzen überwacht. sets the month value of the parameter n, while the limits are monitored. | | _SETYEAR n _SETYEAR N | setzt den Jahres-Wert auf den Parameter n (0..99) sets the annual value of the parameter n (0 to 99) | | _GETSEC V _GETSEC V | liest den Sekunden-Wert in die Variable V ein reads the second value in the variable V | | _GETMIN V _GETMIN V | liest den Minuten-Wert in die Variable V ein reads the minutes value in the variable V | | _GETHOUR V _GETHOUR V | liest den Stunden-Wert in die Variable V ein reads the hour value in the variable V | | _GETDAY V _GETDAY V | liest den Tage-Wert in die Variable V ein reads the daily value in the variable V | | _GETMONTH V _GETMONTH V | liest den Monats-Wert in die Variable V ein reads the month value in the variable V | | _GETYEAR V _GETYEAR V | liest den Jahres-Wert in die Variable V ein reads in the year value in the variable V |
Sämtliche
Befehle haben nur eine Dummy-Funktion, eine Anbindung an eine konkrete
RTC (zB über I2C) sollte aber kein Problem sein. All commands have only a dummy function, a connection to a specific RTC (eg via I2C) should not be a problem.
created with latex2web.pl v0.62 © 2006-2011 Joerg Wolfram Created with latex2web.pl v0.62 © 2006-2011 Joerg tungsten |