; bulucunun programidir
;16f628a
;RA0 ses çıkışında buzzer var
;RA1 melodi butonu
;RA2 TEKRAR BUTONU
;RB0 TILT INTE INTERRUPTU
define NO_CLRWDT
@ __config _CP_ON & _LVP_OFF & _BODEN_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _BOREN_OFF & _INTOSC_OSC_NOCLKOUT
@ messg "Config word yazıldı"
ses var PORTA.0
tekrarb var PORTA.1
melodib var PORTA.2
melodi var byte
tekrar var byte
RBIE var INTCON.3
RBIF var INTCON.0
T0IF var INTCON.2
INTF var INTCON.1
T0IE var INTCON.5
INTE VAR INTCON.4
GIE VAR INTCON.7
tick var byte
sn10 var byte
flag var byte
patana var byte
patanb var byte
saniyedebir var flag.0
hareket var flag.1
i var byte
INTCON=0
CMCON=7
VRCON=$80
PCON.3=1 ;1=4mhz internal osc select
;0=32khz internal osc select
On Interrupt Goto myint ' Define interrupt handler
OPTION_REG = %11000111 ' Enable PORTB pullups
INTCON = %10110000 ' Enable INTE interrupt
' Enable T0IE interrupt
TRISB=%00001101
TRISA=%00000110
init:
disable interrupt
sn10=0
tick=0
flag=0
melodi=5
gosub muzik
gosub muzik
DATA 0,0,0
data @5,1
data @6,1
data @7,0
data @8,0
read 7,patana
read 8,patanb
pause 1000
read 5,melodi
read 6,tekrar
enable interrupt
loop:
if tekrarb == 0 then goto tekrarl
loop1:
if melodib==0 then goto melodil
loop2:
disable interrupt
while saniyedebir==1
saniyedebir=0
if hareket==1 then
ses=0
hareket=0
sn10=sn10+1
if sn10 >= 5 then
sn10=0
gosub muzik
endif
else
for i=1 to tekrar
gosub muzik
pause 50
next i
endif
wend
enable interrupt
Goto loop ' Do it forever
muzik:
select case melodi
case 1
sound ses,[200,20]
case 2
sound ses,[125,20]
case 3
sound ses,[126,20]
case 4
sound ses,[124,20,125,20,126,20]
case 5
sound ses,[123,20]
end select
ses=0
return
tekrarl:
pause 300
IF tekrarb==0 then goto tekrarl
tekrar=tekrar+1
if tekrar=4 then
tekrar=1
endif
write 6,tekrar
goto loop1
melodil:
pause 300
IF melodib==0 then goto melodil
melodi=melodi+1
if melodi=6 then
melodi=1
endif
write 5,melodi
goto loop2
' Interrupt handler
Disable interrupt ' No interrupts past this point
myint:
if T0IF==1 then
T0IF=0
tick=tick+1
if tick >= 30 then
tick=0
saniyedebir=1
endif
endif
if INTF==1 then
INTF=0
hareket=1
endif
Resume ' Return to main program
Enable interrupt
asm
org 0x2110
de "Mustafa PATAN 05054075509 IZMIT KASIM 2005"
de "Serdar ATAKAN'a yaptigim KOPEK BULUCU devresi"
de "V2.000"
endasm
:020000040000FA
:0200000089284D
:080008000800A3003608840083
:1000100034092C208413A30803198428F030A50088
:1000200022088038A400F030A5030319A5000319A5
:10003000A303031984281C282F2003012018340847
:10004000A21F3408A20803190301A40F292880065F
:1000500010282A28000013288417800584282108E6
:1000600020040319A00A8030201AA1062019A10635
:10007000A018A106210DA00DA10D842883169B00B8
:100080001C141A08842883169A001C1555309D00EC
:10009000AA309D009C149C184B281C118428A30195
:1000A000A200FF30A207031CA307031C842803300F
:1000B000A100DF305D205128A101E83EA000A10988
:1000C000FC30031C6628A00703186328A007000063
:1000D000A10F632820186C28A01C7028000070282D
:1000E0000800A20004307428A80023082102031D80
:1000F0007B28220820020430031801300319023043
:100100002805031DFF308428831303138312000086
:1001100008008B0107309F00831680309F008E15EA
:100120008B17831296288B1B0800B3299320831604
:10013000C730810083129320B0308B009320831648
:100140000D308600831293208316063085008312BB
:10015000BF01C101BA010530BC00212121210030BD
:100160003E20B80001303E20B90007303E20BD00DF
:1001700008303E20BE003D0838020319C028CF28B1
:100180003E0839020319C528CF283808A0003908CD
:10019000A1000730A300D0307120031DD428053002
:1001A000BC002121F228F228B80A0319B90A8316E3
:1001B0009B01831238084320831607309B0083126B
:1001C00038084320831601309B00831239084320EE
:1001D000831608309B008312390843200530BC0089
:1001E000212121210330A300E830502005303E209A
:1001F000BC0006303E20C0009320851800297929D4
:1002000093200519042996293A1C1F293A10BA1C73
:1002100013290510BA10BF0A05303F02031C12292A
:10022000BF0121211E290130BB003B084002031CF5
:100230001E29212132304F20BB0F1529042993207C
:10024000FC28932093203C08013C031D3229932075
:100250000530B6000130B4007C30A2001430052017
:10026000932075293C08023C031D41299320053049
:10027000B6000130B4007D30A20014300520932078
:1002800075293C08033C031D502993200530B60016
:100290000130B4007E30A20014300520932075296F
:1002A0003C08043C031D672993200530B60001304B
:1002B000B4007C30A200143005207D30A200143040
:1002C00005207E30A20014300520932075293C08BB
:1002D000053C031D752993200530B6000130B4009C
:1002E0007B30A2001430052093209320051093202A
:1002F000080093200130A3002C3050209320851853
:10030000822979299320C00A93204008043C031DC8
:100310008D2993200130C00093209320831606304E
:100320009B00831240084320932000299320013032
:10033000A3002C305020932005199F299629932043
:10034000BC0A93203C08063C031DAA2993200130D7
:10035000BC0093209320831605309B0083123C0839
:100360004320932004290B1DBD290B11C10A1E3007
:100370004102031CBD29C1013A148B1CC1298B10F9
:06038000BA1409009320ED
:02400E00101F81
:06420000000000000000B8
:06420A00010001000000AC
:024210000000AC
:104220004D0075007300740061006600610020009D
:1042300050004100540041004E0020003000350085
:1042400030003500340030003700350035003000D4
:104250003900200049005A004D0049005400200058
:104260004B004100530049004D0020003200300057
:104270003000350053006500720064006100720078
:1042800020004100540041004B0041004E00270037
:10429000610020007900610070007400690067000F
:1042A00069006D0020004B004F00500045004B009E
:1042B0002000420055004C005500430055002000EE
:1042C00064006500760072006500730069005600A6
:0A42D00032002E00300030003000F4
:00000001FF