- 阅读权限
- 100
- UID
- 45
- 帖子
- 31
- 精华
- 0
- 注册时间
- 2013-2-27
- 在线时间
- 29 小时
- UID
- 45
- 帖子
- 31
- 精华
- 0
- 注册时间
- 2013-2-27
- 在线时间
- 29 小时
|
$regfile = "m16def.dat"
$crystal = 4000000
Config Timer1 = Timer , Prescale = 1024
Dim Bz As Bit
Bz = 0
Dim Dsq As Word
Dsq = 65400
Timer1 = Dsq
Dim Shuju(4) As Byte
Config Portb = Output
Config Pind.0 = Input
Portd.0 = 1
Config Pind.1 = Input
Portd.1 = 1
Config Pind.2 = Input
Portd.2 = 1
Config Pind.7 = Input
Portd.7 = 1
Dim B As Byte
B = 1
Dim Bs As Byte
Dim Dy As Word
Dim A As Byte
Dim Jd As Word
Config Pinc.0 = Output
Set Portc.0
Config Pinc.1 = Output
Set Portc.1
Dy = 3600
'转十圈停止
'Bs = 1
Portb = &B00000001
Restore Daima
For A = 1 To 4
Read Shuju(a)
Next
On Ovf1 Timer1_isr
Enable Timer1
Start Timer1
Enable Interrupts
Do
If Pind.0 = 0 Then
Waitms 50
Dsq = Dsq + 10
If Dsq > 65400 Then
Dsq = 65400
End If
End If
If Pind.1 = 0 Then
Waitms 50
Dsq = Dsq - 10
End If
If Pind.7 = 0 Then
Waitms 30
Toggle Bz
End If
If Pind.2 = 0 Then
Start Timer1
End If
If Jd >= Dy Then
Jd = 0
Stop Timer1
'Portb = &B11111111
End If
Loop
End
Daima:
Data &B00000001 , &B00000010 , &B00000100 , &B00001000
:
Timer1_isr:
Timer1 = Dsq
If Bz = 0 Then
Incr B
Else
Decr B
If B < 1 Then
B = 4
End If
End If
If B > 4 Then
B = 1
End If
Portb = Shuju(b)
Jd = Jd + 90
Return
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
|