;Flasher for UME  車/バイクのウィンカー制御 ; by I.N. ;デバイス:PIC16F84A-20/P ;セラミック発振子(セラロック):20MHz ;2002/6/6 ver.1.0 INCLUDE 16F84.H .OSC HS .PWRT ON .WDT OFF .PROTECT OFF ;SRAM(データ用メモリ)開始アドレス ORG 0CH CNTH DS 1 CNTL DS 1 TMP DS 1 ;ボタンカウンタ DOWN6 DS 1 DOWN5 DS 1 ;ランプ状態 STATB DS 1 STAT6 EQU STATB.0 STAT5 EQU STATB.1 STATO EQU STATB.2 TM1 DS 1 ;EEPROM(プログラム用メモリ)開始アドレス ORG 0 GOTO START LUT jmp PC+W retw 12,16,24,32,40,48,56,64 START ;ポートB内蔵プルアップを有効にする setb RP0 clrb RBPU clrb RP0 ;ポート方向のセット ;PortA->Output mov !PORTA,#0h ;PortB->Input mov !PORTB,#0ffh ;ポートA初期値 mov PORTA,#01fh mov CNTH,#0 mov CNTL,#0 mov DOWN6,#0 mov DOWN5,#0 mov STATB,#0 CONT mov W,#255 sb PORTB.5 mov DOWN5,W sb PORTB.6 mov DOWN6,W sb PORTB.7 mov DOWN5,W sb PORTB.7 mov DOWN6,W sb PORTB.5 jmp next1 test DOWN5 sz dec DOWN5 next1 sb PORTB.6 jmp next2 test DOWN6 sz dec DOWN6 next2 test DOWN5 jz next10 jb STAT5, next12 setb STAT5 setb STATO mov CNTH,#0 mov CNTL,#0 next12 jnb STATO, next13 setb PORTA.0 jmp next11 next10 clrb STAT5 next13 clrb PORTA.0 next11 test DOWN6 jz next20 jb STAT6, next22 setb STAT6 setb STATO mov CNTH,#0 mov CNTL,#0 next22 jnb STATO, next23 setb PORTA.1 jmp next21 next20 clrb STAT6 next23 clrb PORTA.1 next21 inc CNTL snz inc CNTH ;DIP-SW mov W,PORTB not W and W,#7h call LUT mov TMP,W cjb CNTH,TMP, no_invert xor STATB, #04h mov CNTH,#0 mov CNTL,#0 no_invert WAIT MOV TM1,#50 LBL1 DJNZ TM1,LBL1 JMP CONT