圣龙扬特-AVR电子

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1547|回复: 2
打印 上一主题 下一主题

bascom 2262软解码

[复制链接]

11

主题

0

好友

3245

积分

版主

Rank: 7Rank: 7Rank: 7

UID
45
帖子
31
精华
0
注册时间
2013-2-27
在线时间
29 小时
跳转到指定楼层
楼主
发表于 2013-2-28 12:13:57 |只看该作者 |倒序浏览
本帖最后由 赵彬 于 2013-2-28 12:21 编辑

用扫描引脚的方法来做的解码,硬件没做远距离测试,也没有在强干扰环境测试。能给大家的只是一种思路。.
$regfile = "m8def.dat"
$crystal = 6000000
$baud = 4800
Config Pinc.1 = Input : Portc.1 = 1
Config Pinc.4 = Input : Portc.4 = 1
Portc.4 = 0
Config Timer1 = Timer , Prescale = 8
Config Pind.2 = Output
Counter1 = &HFFDB
Config Watchdog = 512
Portd.2 = 1
Dim Dsq As Word
Dim Tbm As Word
Dim A(24) As Byte
Dim B(24)as Byte
Dim C(16)as Eram Byte
Dim G As Byte
Dim I As Byte
Dim X As Byte
Dim Kmc As Byte
Dim Zmc As Byte
Dim Bkmc As Byte
Dim Bzmc As Byte
Dim Mc As Byte
Dim Kmcwcz As Byte
Dim Zmcwcz As Byte
Dim Mcpd As Byte
Dim Imc As Byte
Dim Kmcwcf As Byte
Dim Zmcwcf As Byte
Dsq = 0
Tbm = 0
G = 0
Enable Interrupts
Enable Ovf1
On Timer1 T1
Start Timer1

Start Watchdog
Kaishi:
Tbm = 0
Do
If Pinc.1 = 1 Then
Do
Loop Until Pinc.1 = 0
Tbm = 0
Do
Loop Until Pinc.1 = 1
Tbm = Dsq
Dsq = 0
If Tbm >= 67 And Tbm <= 170 Then
Gosub Jiema
End If
End If
Loop
Return

T1:
Counter1 = &HFFDB
Incr Dsq
Incr Tbm

Return
Jiema:
Reset Watchdog
For I = 1 To 24
Do
Loop Until Pinc.1 = 0
If G = 0 Then
A(i) = Dsq
Dsq = 0
End If
If G = 1 Then
B(i) = Dsq
Dsq = 0
End If
Do : Loop Until Pinc.1 = 1
Dsq = 0
Next
Reset Watchdog
G = G + 1
If G = 2 Then
G = 0
End If
Reset Watchdog
If G = 1 Then Goto Kaishi
Gosub Shujuchuli
Return
Shujuchuli:
Kmc = Max(a(24))
Zmc = Min(a(24))
Bkmc = Max(b(24))
Bzmc = Min(b(24))
Mcpd = Zmc * 4
If Zmc >= 1 And Kmc <= Mcpd And Kmc > Zmc Then
  Reset Watchdog
Zmcwcz = Zmc + 1
Kmcwcz = Kmc + 1
Kmcwcf = Kmc - 1
Zmcwcf = Zmc - 1
For Mc = 1 To 24
If A(mc) >= Kmcwcf And A(mc) <= Kmcwcz Then
A(mc) = 1
End If
If A(mc) >= Zmcwcf And A(mc) <= Zmcwcz Then
A(mc) = 0
End If
If B(mc) >= Kmcwcf And B(mc) <= Kmcwcz Then
B(mc) = 1
End If
If B(mc) >= Zmcwcf Or B(mc) <= Zmcwcz Then
B(mc) = 0
End If
Next
Reset Watchdog
For Imc = 1 To 24
'Print "A" ; Imc ; "=" ; A(imc) ;
'Waitms 100
'Print "B" ; Imc ; "=" ; B(imc) ; "  " ;
If A(imc) <> B(imc) Then
Goto Kaishi
End If
Next
'Print 100
Gosub Jm
End If

Return

Xuexi:
For X = 1 To 16
C(x) = A(x)
Waitms 10
Next
Print "xue xi wan cheng"
Portc.4 = 1
Reset Watchdog
Waitms 300
Goto Kaishi
Return

Jm:
Print "ZDZ=" ; Kmc ;
Waitms 100
Reset Watchdog
Print "ZXZ=" ; Zmc ;
Return

回复

使用道具 举报

0

主题

1

好友

3101

积分

超级版主

Rank: 8Rank: 8

UID
31
帖子
36
精华
0
注册时间
2013-2-27
在线时间
5 小时
沙发
发表于 2013-2-28 14:15:07 |只看该作者
表四鄙人纯属随机路过。。。顺带帮顶。。。
回复

使用道具 举报

26

主题

1

好友

3446

积分

超级版主

Rank: 8Rank: 8

UID
7
帖子
140
精华
0
注册时间
2013-2-26
在线时间
20 小时

突出贡献

板凳
发表于 2013-3-1 14:43:45 |只看该作者
这个不错~~~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

Archiver|手机版|圣龙扬特-AVR电子 ( 鲁ICP备05022832号 )

GMT+8, 2024-12-22 23:27 , Processed in 0.204782 second(s), 18 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部