📄 isd4004-yazdkit-com.bas
字号:
'-------------------------------------------------------------------------------
'----------------- in the name of god ------------------------------------------
'----------------- barname ic sokhango ba isd 4004 -----------------------------
'----------------- Http://www.yazdkit.com --------------------------------------
'----------------- Http://www.yazdkit.Ir ---------------------------------------
'----------------- Info@yazdkit.com --------------------------------------------
'----------------- designed by M.A.DASHTI & M.H.DASHTI ----------------------
$regfile = "m8def.dat"
$crystal = 1000000
Config Pinb.0 = Output
Led_read Alias Portb.0
'-------------
Config Pind.5 = Output
D7 Alias Portd.5
Config Pind.0 = Input
S1 Alias Pind.0
Config Pind.1 = Input
S2 Alias Pind.1
'-------------------------------------------------------------------------------
Config Pinb.4 = Input
Config Pinb.2 = Output
Config Pinb.3 = Output
Config Pinb.5 = Output
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 64 , Noss = 0
Spiinit
Enable Interrupts
Enable Spi
'-------------------------------------------------------------------------------
Dim Lsb As Byte
Dim Msb As Byte
Dim Yazdkit As Word
Dim Setplay As Byte
Dim Play As Byte
Dim _stop As Byte
Dim Setrec As Byte
Dim Rec As Byte
Dim Powerup As Byte
Dim Setmc As Byte
Dim Mc As Byte
Dim Stoppwrdn As Byte
Dim Rint As Byte
Powerup = &B00000100
Setplay = &B00000111
Play = &B00001111
Setrec = &B00000101
Rec = &B00001101
Setmc = &B00010111
Mc = &B00011111
_stop = &B00001100
Stoppwrdn = &B00001000
Rint = &B00011000
'------------------------------------------------------------------------------
Config Debounce = 30
D7 = 1
Led_read = 1
Wait 2
D7 = 0
Led_read = 0
Wait 1
'-------------------------------------------------------------------------------
Chek_pin:
Do
If S1 = 1 Then
Goto Khandan
Else
Goto Neveshtan
End If
Loop
'-------------------------------------------------------------------------------
'-------------------------------------------------------------------------------
'-------------------------------------------------------------------------------
'-------------------------------------------------------------------------------
Khandan:
Spiout _stop , 1
Led_read = 1
D7 = 0
Do
If S1 = 0 Then Goto Neveshtan
Debounce S2 , 1 , Play_music , Sub
Loop
'===============================================================================
Play_music:
D7 = 1
Lsb = 0
Msb = 0
Spiout Powerup , 1
Waitms 35
Spiout Lsb , 1
Spiout Msb , 1
Spiout Setplay , 1
Spiout Play , 1
Waitms 30
For Yazdkit = 1 To 8000
Debounce S2 , 1 , Stop_play_music
Waitms 100
Next
Stop_play_music:
D7 = 0
Spiout _stop , 1
Waitms 50
Wait 1
Return
'-------------------------------------------------------------------------------
'-------------------------------------------------------------------------------
'-------------------------------------------------------------------------------
'-------------------------------------------------------------------------------
Neveshtan:
Spiout _stop , 1
Led_read = 0
D7 = 0
Do
If S1 = 1 Then Goto Khandan
Debounce S2 , 1 , Record_music , Sub
Loop
'-------------------------------------------------------------------------------
Record_music:
D7 = 1
Lsb = 0
Msb = 0
Spiout Powerup , 1
Waitms 35
Spiout Powerup , 1
Waitms 65
Spiout Lsb , 1
Spiout Msb , 1
Spiout Setrec , 1
Spiout Rec , 1
Waitms 30
For Yazdkit = 1 To 8000
Debounce S2 , 1 , Stop_record_music
Waitms 100
Next
Stop_record_music:
D7 = 0
Spiout _stop , 1
Waitms 50
Wait 1
Return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -