ein paar mehr Änderungen
This commit is contained in:
parent
0edbf6ab02
commit
449c594f19
108
src/asm/a4.asm
108
src/asm/a4.asm
|
@ -16,7 +16,6 @@ tcountv dw 100 * twait ; Impulszaehler fuer Verzoegerung * 10ms
|
||||||
; Rueckwaertszaehler
|
; Rueckwaertszaehler
|
||||||
frei db 'frei ', 0 ; Texte
|
frei db 'frei ', 0 ; Texte
|
||||||
belegt db 'belegt ', 0
|
belegt db 'belegt ', 0
|
||||||
dir db 20
|
|
||||||
|
|
||||||
; Konstanten
|
; Konstanten
|
||||||
divider equ 0 ; Platzhalter fuer Ihre Zeitkonstante1
|
divider equ 0 ; Platzhalter fuer Ihre Zeitkonstante1
|
||||||
|
@ -54,13 +53,13 @@ keybd equ 80h ; SBC-86 Tastatur
|
||||||
gokey equ 11h ; Taste "GO"
|
gokey equ 11h ; Taste "GO"
|
||||||
outkey equ 15h ; Taste "OUT"
|
outkey equ 15h ; Taste "OUT"
|
||||||
sseg7 equ 9eh ; Segmentanzeige 7
|
sseg7 equ 9eh ; Segmentanzeige 7
|
||||||
tcpwm equ 184 ; 1843200 Hz / 184 = ca. 10000 Hz = 0.1 ms
|
tcpwm equ 184 ; 1843200 Hz / ??? = ca. 10000 Hz = 0.1 ms
|
||||||
; Taktzyklus
|
; Taktzyklus
|
||||||
; Zeitkonstante fuer PWM-Interrupt
|
; Zeitkonstante fuer PWM-Interrupt
|
||||||
tpwm equ 200 ; Periodendauer des PWM-Signals * 0.1 ms
|
tpwm equ 200 ; Periodendauer des PWM-Signals * 0.1 ms
|
||||||
tlinks equ 10 ; Impulsdauer fuer "ZU" * 0.1 ms
|
tlinks equ 10 ; Impulsdauer fuer "ZU" * 0.1 ms
|
||||||
trechts equ 20 ; Impulsdauer fuer "AUF" * 0.1 ms
|
trechts equ 20 ; Impulsdauer fuer "AUF" * 0.1 ms
|
||||||
tcwait equ 18432 ; 1843200 Hz / 18432 = 100 Hz => 10 ms
|
tcwait equ 18432 ; 1843200 Hz / ????? = 100 Hz => 10 ms
|
||||||
; Zeitkonstante fuer Wartezeitinterrupt
|
; Zeitkonstante fuer Wartezeitinterrupt
|
||||||
twait equ 1 ; Wartezeit fuer offenen Vereinzeler (s)
|
twait equ 1 ; Wartezeit fuer offenen Vereinzeler (s)
|
||||||
shcnt equ 4 ; Shiftcount Anzahl Teile
|
shcnt equ 4 ; Shiftcount Anzahl Teile
|
||||||
|
@ -86,7 +85,7 @@ start:
|
||||||
again:
|
again:
|
||||||
|
|
||||||
; Ihr Programmcode...
|
; Ihr Programmcode...
|
||||||
;Ausgabe der Status Variable
|
|
||||||
mov ax, [status]
|
mov ax, [status]
|
||||||
out leds, ax
|
out leds, ax
|
||||||
|
|
||||||
|
@ -122,13 +121,15 @@ ifzero:
|
||||||
ifbelowzero:
|
ifbelowzero:
|
||||||
|
|
||||||
mov dx, pieces << shcnt
|
mov dx, pieces << shcnt
|
||||||
and dx, 10000010b
|
and dx, 10000001b
|
||||||
mov [status], dx
|
mov [status], dx
|
||||||
|
|
||||||
|
|
||||||
jmp again
|
jmp again
|
||||||
|
|
||||||
|
|
||||||
|
jmp again
|
||||||
|
|
||||||
; Initialisierung Controller und Interruptsystem
|
; Initialisierung Controller und Interruptsystem
|
||||||
|
|
||||||
init:
|
init:
|
||||||
|
@ -195,23 +196,20 @@ init:
|
||||||
isr_opentimer: ; Timer fuer Vereinzeler (Zeit fuer Oeffnung)
|
isr_opentimer: ; Timer fuer Vereinzeler (Zeit fuer Oeffnung)
|
||||||
push ax
|
push ax
|
||||||
|
|
||||||
;Zeit abgelaufen ?
|
inc byte [divider]
|
||||||
mov ah, [divider]
|
cmp byte [divider], tcountv
|
||||||
mov al, [status]
|
jne isr_opentimer_out
|
||||||
test al, 00000010b
|
|
||||||
jz isr_opentimer_out
|
|
||||||
|
|
||||||
inc ah
|
mov ax, [status]
|
||||||
cmp ah, [tcountv]
|
and ax, 11111110b
|
||||||
jnz isr_opentimer_out
|
mov [status], ax
|
||||||
|
|
||||||
mov ah, 0
|
|
||||||
mov byte[dir], trechts
|
|
||||||
and al, 0xfd
|
|
||||||
|
; Ihr Programmcode
|
||||||
|
|
||||||
isr_opentimer_out: ; Ausgang aus dem Service
|
isr_opentimer_out: ; Ausgang aus dem Service
|
||||||
mov [status], al
|
|
||||||
mov [divider], ah
|
|
||||||
mov al, eoi ; EOI an PIC
|
mov al, eoi ; EOI an PIC
|
||||||
out ocw_2_3, al
|
out ocw_2_3, al
|
||||||
pop ax
|
pop ax
|
||||||
|
@ -227,25 +225,15 @@ isr_lt: ; Lichttaster
|
||||||
times shcnt shl al, 1
|
times shcnt shl al, 1
|
||||||
and byte [status], 00001111b
|
and byte [status], 00001111b
|
||||||
or [status], al
|
or [status], al
|
||||||
mov [status], al
|
|
||||||
|
|
||||||
and al, 11111101b
|
|
||||||
cmp al, 0b
|
|
||||||
jz left
|
|
||||||
cmp al, 10b
|
|
||||||
je right
|
|
||||||
|
|
||||||
left:
|
; Ihr Programmcode
|
||||||
mov byte[dir], tlinks
|
|
||||||
jmp isr_lt_out
|
|
||||||
|
|
||||||
right:
|
|
||||||
mov byte[dir], trechts
|
|
||||||
jmp isr_lt_out
|
|
||||||
|
|
||||||
|
|
||||||
isr_lt_out: ; Ausgang aus dem Service
|
isr_lt_out: ; Ausgang aus dem Service
|
||||||
or byte [status], 00000010b
|
or al, 00000001b
|
||||||
|
mov [status], al
|
||||||
|
|
||||||
|
mov [status], al
|
||||||
mov al, eoi ; EOI an PIC
|
mov al, eoi ; EOI an PIC
|
||||||
out ocw_2_3, al
|
out ocw_2_3, al
|
||||||
pop ax
|
pop ax
|
||||||
|
@ -253,24 +241,56 @@ isr_lt_out: ; Ausgang aus dem Service
|
||||||
|
|
||||||
isr_servotimer: ; Timer fuer Servo (Vereinzeler)
|
isr_servotimer: ; Timer fuer Servo (Vereinzeler)
|
||||||
push ax
|
push ax
|
||||||
|
push cx
|
||||||
mov ah, [tcounts]
|
|
||||||
inc ah
|
|
||||||
cmp ah, [dir]
|
|
||||||
jnz auf
|
|
||||||
out ppi_a, al
|
|
||||||
|
|
||||||
auf:
|
mov al, [tcounts]
|
||||||
cmp ah, tpwm
|
inc al
|
||||||
jnz isr_servotimer_out
|
mov [tcounts], al
|
||||||
mov al, ppi_pa6
|
|
||||||
|
;send zero all the time
|
||||||
|
push ax
|
||||||
|
mov al, 0
|
||||||
|
out ppi_a, al
|
||||||
|
pop ax
|
||||||
|
|
||||||
|
mov cl, tpwm
|
||||||
|
|
||||||
|
mov ah, [status]
|
||||||
|
cmp ah, 0x0
|
||||||
|
jz left
|
||||||
|
jnz right
|
||||||
|
jmp isr_servotimer_out
|
||||||
|
|
||||||
|
left: cmp al, tlinks
|
||||||
|
jne cycle
|
||||||
|
in al, ppi_a
|
||||||
|
and al, ~ppi_pa6
|
||||||
|
out ppi_a, al
|
||||||
|
jmp cycle
|
||||||
|
|
||||||
|
|
||||||
|
right: cmp al, trechts
|
||||||
|
jne cycle
|
||||||
|
in al, ppi_a
|
||||||
|
and al, ~ppi_pa6
|
||||||
out ppi_a, al
|
out ppi_a, al
|
||||||
|
|
||||||
|
cycle: cmp al, tpwm
|
||||||
|
jnz isr_servotimer_out
|
||||||
|
|
||||||
|
in al, ppi_a
|
||||||
|
or al, ppi_pa6
|
||||||
|
out ppi_a, al
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Ihr Programmcode
|
||||||
|
|
||||||
isr_servotimer_out: ; Ausgang aus dem Service
|
isr_servotimer_out: ; Ausgang aus dem Service
|
||||||
|
mov byte[tcounts], 0
|
||||||
mov al, eoi ; EOI an PIC
|
mov al, eoi ; EOI an PIC
|
||||||
out ocw_2_3, al
|
out ocw_2_3, al
|
||||||
|
pop cx
|
||||||
pop ax
|
pop ax
|
||||||
iret
|
iret
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue