发表于:2002-11-23 23:19:00
楼主
我用的方法跟microtomato说的类似,用一个字节存放循环的数,每个扫描周期加一。
问题是我测量一个脉冲的宽度,把它用计时器记录下来,在放到四个不同的字节,但是输出数字跟脉冲的宽度不是很吻合,有时差别很大。不知怎么搞得。下面是小程序:
NETWORK 1 //NETWORK TITLE (single line)
//
//NETWORK COMMENTS
//
LD SM0.1
R Q0.0, 8
MOVB 16#FF, QB0
MOVB 0, VB120
MOVW +0, T0
NETWORK 2
LD I0.0
TONR T0, +10000
NETWORK 3 //NETWORK TITLE (single line)
//
//NETWORK COMMENTS
//
LDN I0.0
MOVW T0, VW100
NETWORK 4
LD SM0.0
MOVW VW100, VW106
/I +1000, VW106
NETWORK 5
LD SM0.0
MOVW VW106, AC1
*I +1000, AC1
NETWORK 6
LD SM0.0
INVW AC1
INCW AC1
+I VW100, AC1
NETWORK 7
LD SM0.0
MOVW AC1, VW108
/I +100, VW108
NETWORK 8
LD SM0.0
MOVW VW108, AC0
*I +100, AC0
NETWORK 9
LD SM0.0
-I AC0, AC1
NETWORK 10
LD SM0.0
MOVW AC1, VW110
/I +10, VW110
NETWORK 11
LD SM0.0
MOVW VW110, AC0
*I +10, AC0
NETWORK 12
LD SM0.0
MOVW AC1, VW112
-I AC0, VW112
NETWORK 13
LD SM0.0
ITB VW106, VB206
ITB VW108, VB207
ITB VW110, VB208
ITB VW112, VB209
NETWORK 14
LD SM0.0
ORB 16#E0, VB206
ORB 16#D0, VB207
ORB 16#B0, VB208
ORB 16#70, VB209
NETWORK 15
LD SM0.0
INVB VB206
INVB VB207
INVB VB208
INVB VB209
NETWORK 16
LDB> VB120, 16#03
MOVB 16#00, VB120
NETWORK 17
LDB= VB120, 0
MOVB VB206, QB0
NETWORK 18
LDB= VB120, 1
MOVB VB207, QB0
NETWORK 19
LDB= VB120, 2
MOVB VB208, QB0
NETWORK 20
LDB= VB120, 3
MOVB VB209, QB0
NETWORK 21
LD SM0.0
INCB VB120