Das eBook Angewandte Mikroelektronik wurde von Hans Lohninger zur Unterstützung verschiedener Lehrveranstaltungen geschrieben. Weitere Informationen finden sie hier.


Funktionsgenerator

;===================================================
;---- Experiment: Funktionsgenerator ---------------
;===================================================
;
            .GLOBAL FNCGEN
FNCGEN:     LD      HL,FNCBUF   ;Zeiger initialisieren
            LD      (FBFPOI),HL
FNCG1:      IN      A,(PIN)     ;Tasten einlesen
            OR      A           ;keine Taste
            JR      Z,FNCG1     ;  gedrückt ?
            LD      HL,LASTF
            CP      (HL)        ;Tasten geändert ?
            JR      Z,FNCG1
            LD      (LASTF),A   ;Tastenzustand merken
            LD      HL,FNCTAB   ;aktive Funktion
$2:         SLA     A           ;  ermitteln
            JR      C,$1
            INC     HL
            INC     HL
            JR      $2
;
$1:         LD      A,(HL)      ;Ausführungsadresse
            INC     HL          ;  des Ladeprogramms
            LD      H,(HL)      ;  berechnen
            LD      L,A
            LD      DE,FNCG1    ;Return-Adresse
            PUSH    DE
            JP      (HL)        ;do it !
;
            .DATA
LASTF:      DEFB    0
            .CODE
;
FNCTAB:     DEFW    ZEROLN      ;Nullinie
            DEFW    SQUARE      ;Rechteckfunktion
            DEFW    PULSE       ;Nadelimpuls
            DEFW    TRIANG      ;Dreiecksfunktion
            DEFW    SAWTOO      ;Sägezahn
            DEFW    SINE        ;Sinus
            DEFW    GAUSS       ;Gauß-Funktion
            DEFW    PARABO      ;Parabel
;
ZEROLN:     LD      B,0         ;Nullinie berechnen
            LD      HL,FNCBUF
$3:         LD      (HL),0
            INC     HL
            LD      (HL),80H
            INC     HL
            DJNZ    $3
            RET
;
SQUARE:     LD      B,0         ;Rechteckfunktion
            LD      HL,FNCBUF
$4:         LD      (HL),0
            INC     HL
            DJNZ    $4
$5:         LD      (HL),0FFH
            INC     HL
            DJNZ    $5
            RET
;
TRIANG:     LD      B,128       ;Dreiecksfunktion
            LD      HL,FNCBUF
$6:         LD      (HL),0
            INC     HL
            LD      A,B
            DEC     A
            ADD     A,A
            LD      (HL),A
            INC     HL
            DJNZ    $6
            LD      B,128
$7:         LD      (HL),0
            INC     HL
            LD      A,B
            DEC     A
            ADD     A,A
            CPL
            LD      (HL),A
            INC     HL
            DJNZ    $7
            RET
;
SAWTOO:     LD      B,0         ;Sägezahn
            LD      HL,FNCBUF
$8:         LD      (HL),0
            INC     HL
            LD      (HL),B
            INC     HL
            DJNZ    $8
            RET

PULSE:      LD      B,254       ;Impuls
            LD      HL,FNCBUF
$9:         LD      (HL),0
            INC     HL
            LD      (HL),0
            INC     HL
            DJNZ    $9
            LD      (HL),0FFH
            INC     HL
            LD      (HL),0FFH
            INC     HL
            LD      (HL),0FFH
            INC     HL
            LD      (HL),0FFH
            INC     HL
            RET
;
SINE:       LD      HL,SINTAB   ;Sinus
            LD      DE,FNCBUF
            LD      BC,512
            LDIR
            RET
;
GAUSS:      LD      HL,GAUSTB   ;Gauß
            LD      DE,FNCBUF
            LD      BC,512
            LDIR
            RET
;
;---- Tabelle der Gauß'schen Kurve -----------------
;
GAUSTB:     DEFW    0000H, 0000H, 0000H, 0000H, 0000H
            DEFW    0000H, 0000H, 0000H, 0010H, 0010H
            DEFW    0010H, 0010H, 0010H, 0010H, 0010H
            DEFW    0010H, 0020H, 0020H, 0020H, 0020H
            DEFW    0030H, 0030H, 0040H, 0040H, 0050H
            DEFW    0050H, 0060H, 0070H, 0080H, 0090H
            DEFW    00A0H, 00B0H, 00D0H, 00F0H, 0100H
            DEFW    0120H, 0150H, 0170H, 01A0H, 01D0H
            DEFW    0200H, 0240H, 0280H, 02D0H, 0320H
            DEFW    0370H, 03D0H, 0440H, 04B0H, 0530H
            DEFW    05B0H, 0650H, 06F0H, 07A0H, 0860H
            DEFW    0920H, 0A00H, 0AF0H, 0C00H, 0D10H
            DEFW    0E40H, 0F80H, 10D0H, 1240H, 13D0H
            DEFW    1570H, 1730H, 1900H, 1B00H, 1D10H
            DEFW    1F40H, 2190H, 2410H, 26A0H, 2960H
            DEFW    2C40H, 2F40H, 3260H, 35A0H, 3910H
            DEFW    3CA0H, 4060H, 4430H, 4830H, 4C50H
            DEFW    5090H, 5500H, 5980H, 5E20H, 62F0H
            DEFW    67D0H, 6CC0H, 71E0H, 7700H, 7C40H
            DEFW    8190H, 86F0H, 8C60H, 91D0H, 9750H
            DEFW    9CD0H, A240H, A7C0H, AD30H, B290H
            DEFW    B7E0H, BD20H, C250H, C750H, CC40H
            DEFW    D100H, D5A0H, DA20H, DE60H, E270H
            DEFW    E650H, E9F0H, ED50H, F070H, F350H
            DEFW    F5E0H, F830H, FA40H, FC00H, FD60H
            DEFW    FE80H, FF50H, FFC0H, FFF0H, FFC0H
            DEFW    FF50H, FE80H, FD60H, FC00H, FA40H
            DEFW    F830H, F5E0H, F350H, F070H, ED50H
            DEFW    E9F0H, E650H, E270H, DE60H, DA20H
            DEFW    D5A0H, D100H, CC40H, C750H, C250H
            DEFW    BD20H, B7E0H, B290H, AD30H, A7C0H
            DEFW    A240H, 9CD0H, 9750H, 91D0H, 8C60H
            DEFW    86F0H, 8190H, 7C40H, 7700H, 71E0H
            DEFW    6CC0H, 67D0H, 62F0H, 5E20H, 5980H
            DEFW    5500H, 5090H, 4C50H, 4830H, 4430H
            DEFW    4060H, 3CA0H, 3910H, 35A0H, 3260H
            DEFW    2F40H, 2C40H, 2960H, 26A0H, 2410H
            DEFW    2190H, 1F40H, 1D10H, 1B00H, 1900H
            DEFW    1730H, 1570H, 13D0H, 1240H, 10D0H
            DEFW    0F80H, 0E40H, 0D10H, 0C00H, 0AF0H
            DEFW    0A00H, 0920H, 0860H, 07A0H, 06F0H
            DEFW    0650H, 05B0H, 0530H, 04B0H, 0440H
            DEFW    03D0H, 0370H, 0320H, 02D0H, 0280H
            DEFW    0240H, 0200H, 01D0H, 01A0H, 0170H
            DEFW    0150H, 0120H, 0100H, 00F0H, 00D0H
            DEFW    00B0H, 00A0H, 0090H, 0080H, 0070H
            DEFW    0060H, 0050H, 0050H, 0040H, 0040H
            DEFW    0030H, 0030H, 0020H, 0020H, 0020H
            DEFW    0020H, 0010H, 0010H, 0010H, 0010H
            DEFW    0010H, 0010H, 0010H, 0010H, 0000H
            DEFW    0000H, 0000H, 0000H, 0000H, 0000H
            DEFW    0000H
;
PARABO:     LD      HL,PARATB   ;Parabel
            LD      DE,FNCBUF
            LD      BC,512
            LDIR
            RET
;
;----- Tabelle der Parabel 2. Ordnung --------------
;
PARATB:     DEFW    FE00H, FA10H, F620H, F230H, EE50H
            DEFW    EA80H, E6B0H, E2E0H, DF20H, DB70H
            DEFW    D7C0H, D410H, D070H, CCE0H, C950H
            DEFW    C5C0H, C240H, BED0H, BB60H, B7F0H
            DEFW    B490H, B140H, ADF0H, AAA0H, A760H
            DEFW    A430H, A100H, 9DD0H, 9AB0H, 97A0H
            DEFW    9490H, 9180H, 8E80H, 8B90H, 88A0H
            DEFW    85B0H, 82D0H, 8000H, 7D30H, 7A60H
            DEFW    77A0H, 74F0H, 7240H, 6F90H, 6CF0H
            DEFW    6A60H, 67D0H, 6540H, 62C0H, 6050H
            DEFW    5DE0H, 5B70H, 5910H, 56C0H, 5470H
            DEFW    5220H, 4FE0H, 4DB0H, 4B80H, 4950H
            DEFW    4730H, 4520H, 4310H, 4100H, 3F00H
            DEFW    3D10H, 3B20H, 3930H, 3750H, 3580H
            DEFW    33B0H, 31E0H, 3020H, 2E70H, 2CC0H
            DEFW    2B10H, 2970H, 27E0H, 2650H, 24C0H
            DEFW    2340H, 21D0H, 2060H, 1EF0H, 1D90H
            DEFW    1C40H, 1AF0H, 19A0H, 1860H, 1730H
            DEFW    1600H, 14D0H, 13B0H, 12A0H, 1190H
            DEFW    1080H, 0F80H, 0E90H, 0DA0H, 0CB0H
            DEFW    0BD0H, 0B00H, 0A30H, 0960H, 08A0H
            DEFW    07F0H, 0740H, 0690H, 05F0H, 0560H
            DEFW    04D0H, 0440H, 03C0H, 0350H, 02E0H
            DEFW    0270H, 0210H, 01C0H, 0170H, 0120H
            DEFW    00E0H, 00B0H, 0080H, 0050H, 0030H
            DEFW    0020H, 0010H, 0000H, 0000H, 0010H
            DEFW    0020H, 0030H, 0050H, 0080H, 00B0H
            DEFW    00E0H, 0120H, 0170H, 01C0H, 0210H
            DEFW    0270H, 02E0H, 0350H, 03C0H, 0440H
            DEFW    04D0H, 0560H, 05F0H, 0690H, 0740H
            DEFW    07F0H, 08A0H, 0960H, 0A30H, 0B00H
            DEFW    0BD0H, 0CB0H, 0DA0H, 0E90H, 0F80H
            DEFW    1080H, 1190H, 12A0H, 13B0H, 14D0H
            DEFW    1600H, 1730H, 1860H, 19A0H, 1AF0H
            DEFW    1C40H, 1D90H, 1EF0H, 2060H, 21D0H
            DEFW    2340H, 24C0H, 2650H, 27E0H, 2970H
            DEFW    2B10H, 2CC0H, 2E70H, 3020H, 31E0H
            DEFW    33B0H, 3580H, 3750H, 3930H, 3B20H
            DEFW    3D10H, 3F00H, 4100H, 4310H, 4520H
            DEFW    4730H, 4950H, 4B80H, 4DB0H, 4FE0H
            DEFW    5220H, 5470H, 56C0H, 5910H, 5B70H
            DEFW    5DE0H, 6050H, 62C0H, 6540H, 67D0H
            DEFW    6A60H, 6CF0H, 6F90H, 7240H, 74F0H
            DEFW    77A0H, 7A60H, 7D30H, 8000H, 82D0H
            DEFW    85B0H, 88A0H, 8B90H, 8E80H, 9180H
            DEFW    9490H, 97A0H, 9AB0H, 9DD0H, A100H
            DEFW    A430H, A760H, AAA0H, ADF0H, B140H
            DEFW    B490H, B7F0H, BB60H, BED0H, C240H
            DEFW    C5C0H, C950H, CCE0H, D070H, D410H
            DEFW    D7C0H, DB70H, DF20H, E2E0H, E6B0H
            DEFW    EA80H, EE50H, F230H, F620H, FA10H
            DEFW    FE00H


Last Update: 2008-05-31