Horyzontal timings (working, checked with oscilloscope)
This commit is contained in:
parent
1e40d8f1e1
commit
60243dc95f
@ -1,4 +1,4 @@
|
|||||||
fuses_lo = 0x6F
|
fuses_lo = 0xAF
|
||||||
fuses_hi = 0x99
|
fuses_hi = 0x99
|
||||||
fuses_ext = 0xff
|
fuses_ext = 0xff
|
||||||
lock_byte = 0xff
|
lock_byte = 0xff
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
|
; VIDEO COMPOSITE PAL IO DEVICE
|
||||||
|
; Implemented following timings in http://blog.retroleum.co.uk/electronics-articles/pal-tv-timing-and-voltages/
|
||||||
|
|
||||||
.include "atmega1284definition.asm"
|
.include "atmega1284definition.asm"
|
||||||
|
|
||||||
; define constant
|
; define constant
|
||||||
.equ LED_PIN = PD7 ; use PD7 as LED pin
|
.equ SYNC_PIN = PD7 ; Sync pin is on Port D 7 (pin 21)
|
||||||
|
.equ VIDEO_PIN = PD6 ; Video pin is on Port D 6 (pin 20)
|
||||||
|
|
||||||
; start vector
|
; start vector
|
||||||
.org 0x0000
|
.org 0x0000
|
||||||
@ -9,23 +13,69 @@
|
|||||||
|
|
||||||
; main program
|
; main program
|
||||||
main:
|
main:
|
||||||
sbi DDRD, LED_PIN ; set LED pin as output
|
sbi DDRD, SYNC_PIN ; set pin as output
|
||||||
loop:
|
sbi DDRD, VIDEO_PIN ; set pin as output
|
||||||
sbic PIND, LED_PIN ; if bit of LED pin is clear, skip next line
|
|
||||||
cbi PORTD, LED_PIN ; if 1, turn the LED off
|
v_refresh_loop:
|
||||||
sbis PIND, LED_PIN ; if bit of LED pin is set, skip next line
|
; start 5 long sync pulses
|
||||||
sbi PORTD, LED_PIN ; if 0, light the LED up
|
|
||||||
delay_500ms:
|
; end 5 long sync pulses
|
||||||
ldi r20, 32 ; set register, r20 = 32
|
|
||||||
delay2:
|
; start 5 short sync pulses
|
||||||
ldi r19, 64 ; set register, r19 = 64
|
|
||||||
delay1:
|
; end 5 short sync pulses
|
||||||
ldi r18, 128 ; set register, r18 = 128
|
|
||||||
delay0:
|
; start 304 picture lines
|
||||||
dec r18 ; decrement register, r18 = r18 - 1
|
ldi r16, 2
|
||||||
brne delay0 ; if r18 != 0, jump to label delay0
|
h_picture_outer_loop:
|
||||||
dec r19 ; decrement register, r19 = r19 -1
|
ldi r17, 152 ; line counter
|
||||||
brne delay1 ; if r19 != 0, jump to label delay1
|
h_picture_loop:
|
||||||
dec r20 ; decrement register, r20 = r20 -1
|
; start line sync: 4uS, 96 cycles @ 24Mhz
|
||||||
brne delay2 ; if r20 != 0, jump to label delay2
|
cbi PORTD, SYNC_PIN ; sync goes low (0v) ; 2 cycle
|
||||||
rjmp loop ; if r20 == 0, jump to label loop
|
ldi r18, 32 ; 1 cycle
|
||||||
|
l_sync_pulse_loop: ; requires 3 cpu cycles
|
||||||
|
dec r18 ; 1 cycle
|
||||||
|
brne l_sync_pulse_loop ; 2 cycle if true, 1 if false
|
||||||
|
sbi PORTD, SYNC_PIN ; sync goes high (0.3v)
|
||||||
|
; end line sync
|
||||||
|
|
||||||
|
; start back porch: 8uS, 192 cycles @ 24Mhz
|
||||||
|
ldi r18, 64 ; 1 cycle
|
||||||
|
l_sync_back_porch_loop:
|
||||||
|
dec r18 ; 1 cycle
|
||||||
|
brne l_sync_back_porch_loop ; 2 cycle if true, 1 if false
|
||||||
|
; end back porch
|
||||||
|
|
||||||
|
; start image: 52uS, 1247 cycles @ 24Mhz
|
||||||
|
; 3 bande da 416 cicli
|
||||||
|
|
||||||
|
sbi PORTD, VIDEO_PIN ; video goes high ; 2 cycle
|
||||||
|
|
||||||
|
ldi r18, 138 ; 1 cycle
|
||||||
|
l_sync_video_loop1:
|
||||||
|
dec r18 ; 1 cycle
|
||||||
|
brne l_sync_video_loop1 ; 2 cycle if true, 1 if false
|
||||||
|
|
||||||
|
cbi PORTD, VIDEO_PIN ; video goes low
|
||||||
|
|
||||||
|
ldi r18, 137 ; 1 cycle
|
||||||
|
l_sync_video_loop2:
|
||||||
|
dec r18 ; 1 cycle
|
||||||
|
brne l_sync_video_loop2 ; 2 cycle if true, 1 if false
|
||||||
|
|
||||||
|
sbi PORTD, VIDEO_PIN ; video goes high
|
||||||
|
|
||||||
|
ldi r18, 138 ; 1 cycle
|
||||||
|
l_sync_video_loop3:
|
||||||
|
dec r18 ; 1 cycle
|
||||||
|
brne l_sync_video_loop3 ; 2 cycle if true, 1 if false
|
||||||
|
cbi PORTD, VIDEO_PIN ; video goes low
|
||||||
|
|
||||||
|
; end image
|
||||||
|
|
||||||
|
dec r17 ; decrement line counter
|
||||||
|
brne h_picture_loop ; if not 0, repeat h_picture_loop
|
||||||
|
|
||||||
|
dec r16 ; decrement outside counter
|
||||||
|
brne h_picture_outer_loop ; if not 0, repeat h_picture_loop
|
||||||
|
; end picture lines
|
||||||
|
Loading…
Reference in New Issue
Block a user