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
|
||||
frei db 'frei ', 0 ; Texte
|
||||
belegt db 'belegt ', 0
|
||||
dir db 20
|
||||
|
||||
; Konstanten
|
||||
divider equ 0 ; Platzhalter fuer Ihre Zeitkonstante1
|
||||
@ -54,13 +53,13 @@ keybd equ 80h ; SBC-86 Tastatur
|
||||
gokey equ 11h ; Taste "GO"
|
||||
outkey equ 15h ; Taste "OUT"
|
||||
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
|
||||
; Zeitkonstante fuer PWM-Interrupt
|
||||
tpwm equ 200 ; Periodendauer des PWM-Signals * 0.1 ms
|
||||
tlinks equ 10 ; Impulsdauer fuer "ZU" * 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
|
||||
twait equ 1 ; Wartezeit fuer offenen Vereinzeler (s)
|
||||
shcnt equ 4 ; Shiftcount Anzahl Teile
|
||||
@ -86,7 +85,7 @@ start:
|
||||
again:
|
||||
|
||||
; Ihr Programmcode...
|
||||
;Ausgabe der Status Variable
|
||||
|
||||
mov ax, [status]
|
||||
out leds, ax
|
||||
|
||||
@ -122,13 +121,15 @@ ifzero:
|
||||
ifbelowzero:
|
||||
|
||||
mov dx, pieces << shcnt
|
||||
and dx, 10000010b
|
||||
and dx, 10000001b
|
||||
mov [status], dx
|
||||
|
||||
|
||||
jmp again
|
||||
|
||||
|
||||
jmp again
|
||||
|
||||
; Initialisierung Controller und Interruptsystem
|
||||
|
||||
init:
|
||||
@ -195,23 +196,20 @@ init:
|
||||
isr_opentimer: ; Timer fuer Vereinzeler (Zeit fuer Oeffnung)
|
||||
push ax
|
||||
|
||||
;Zeit abgelaufen ?
|
||||
mov ah, [divider]
|
||||
mov al, [status]
|
||||
test al, 00000010b
|
||||
jz isr_opentimer_out
|
||||
inc byte [divider]
|
||||
cmp byte [divider], tcountv
|
||||
jne isr_opentimer_out
|
||||
|
||||
inc ah
|
||||
cmp ah, [tcountv]
|
||||
jnz isr_opentimer_out
|
||||
mov ax, [status]
|
||||
and ax, 11111110b
|
||||
mov [status], ax
|
||||
|
||||
mov ah, 0
|
||||
mov byte[dir], trechts
|
||||
and al, 0xfd
|
||||
|
||||
|
||||
|
||||
; Ihr Programmcode
|
||||
|
||||
isr_opentimer_out: ; Ausgang aus dem Service
|
||||
mov [status], al
|
||||
mov [divider], ah
|
||||
mov al, eoi ; EOI an PIC
|
||||
out ocw_2_3, al
|
||||
pop ax
|
||||
@ -227,25 +225,15 @@ isr_lt: ; Lichttaster
|
||||
times shcnt shl al, 1
|
||||
and byte [status], 00001111b
|
||||
or [status], al
|
||||
mov [status], al
|
||||
|
||||
and al, 11111101b
|
||||
cmp al, 0b
|
||||
jz left
|
||||
cmp al, 10b
|
||||
je right
|
||||
|
||||
left:
|
||||
mov byte[dir], tlinks
|
||||
jmp isr_lt_out
|
||||
|
||||
right:
|
||||
mov byte[dir], trechts
|
||||
jmp isr_lt_out
|
||||
|
||||
; Ihr Programmcode
|
||||
|
||||
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
|
||||
out ocw_2_3, al
|
||||
pop ax
|
||||
@ -253,24 +241,56 @@ isr_lt_out: ; Ausgang aus dem Service
|
||||
|
||||
isr_servotimer: ; Timer fuer Servo (Vereinzeler)
|
||||
push ax
|
||||
|
||||
mov ah, [tcounts]
|
||||
inc ah
|
||||
cmp ah, [dir]
|
||||
jnz auf
|
||||
out ppi_a, al
|
||||
push cx
|
||||
|
||||
auf:
|
||||
cmp ah, tpwm
|
||||
jnz isr_servotimer_out
|
||||
mov al, ppi_pa6
|
||||
mov al, [tcounts]
|
||||
inc al
|
||||
mov [tcounts], al
|
||||
|
||||
;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
|
||||
|
||||
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
|
||||
mov byte[tcounts], 0
|
||||
mov al, eoi ; EOI an PIC
|
||||
out ocw_2_3, al
|
||||
pop cx
|
||||
pop ax
|
||||
iret
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user