title "VGA/15khz RGB detector by Tim Worthington" ; 15/7/04 ; pin 5 = Horizontal sync input ; pin 6 = Logic output (high < 17KHz > low) ; pin 7 = inverted logic output (low < 17KHz > high) ; pin 2 = same as pin 7 processor 12c509 __config 0xfea w equ 0 f equ 1 gpio equ 0x06 tmr0 equ 0x01 cycount equ 0x0c status equ 0x03 org 0x000 movlw b'10101000' option movlw b'00001100' tris gpio clrf gpio start clrf tmr0 wait btfss tmr0, 1 ;wait for a h-sync pulse goto wait clrf cycount clrf tmr0 do incf cycount, f ;increase cycount every 4 uS btfss tmr0, 3 ;count 8 h-sync pulses goto do movlw d'116' ;h-sync_cut_off(in uS) * h-sync_pulses_counted / cycount_time(in uS) ;58(17.2khz) * 8 / 4 subwf cycount, w btfss status, 0 goto block movlw b'00000010' movwf gpio ;pass goto start block movlw b'00100001' movwf gpio ;block goto start end
Satoremihi7