今天有空就为楼主做了个实验......用S7224XP的....1秒可以达到100次完成没问题....附上程序
TITLE=程序注释 *****I0.3<------>Q0.1,I0.2<--------->Q0.0,I0.4<---------->Q0.2
BEGIN
Network 1
LD SM0.1
LD M0.0
ED
OLD
CALL SBR0
Network 2
LD M0.0
EU
CALL SBR1
Network 3
LD SM0.0
MOVD HC5, VD10
MOVD HC4, VD14
END_ORGANIZATION_BLOCK
SUBROUTINE_BLOCK 初始化:SBR0
TITLE=子程序注释
BEGIN
Network 1 // 网络标题
// 网络注释
LD SM0.0
HDEF 4, 0
HDEF 5, 0
ATCH INT0, 4
ENI
MOVB 0, SMB67
PLS 0
MOVB 0, SMB77
PLS 1
Network 2 // 网络标题
// 网络注释
END_SUBROUTINE_BLOCK
SUBROUTINE_BLOCK 起动:SBR1
TITLE=子程序注释
BEGIN
Network 1 // 网络标题
// 网络注释
LD SM0.0
CALL SBR2
CALL SBR4
CALL SBR3
END_SUBROUTINE_BLOCK
SUBROUTINE_BLOCK 配置HSC4:SBR2
TITLE=子程序注释
BEGIN
Network 1 // 网络标题
// 网络注释
LD SM0.0
MOVB 2#11111100, SMB147
MOVD 0, SMD148
MOVD 0, SMD152
HSC 4
END_SUBROUTINE_BLOCK
SUBROUTINE_BLOCK 配置PTO:SBR3
TITLE=子程序注释
BEGIN
Network 1
LD SM0.0
MOVB 2#10001101, SMB67
MOVW 20, SMW68
MOVD 100, SMD72
PLS 0
Network 2
LD SM0.0
MOVB 2#10000101, SMB77
MOVW 20, SMW78
MOVD 500000, SMD82
PLS 1
Network 3 // 网络标题
// 网络注释
END_SUBROUTINE_BLOCK
SUBROUTINE_BLOCK 配置HSC5:SBR4
TITLE=子程序注释
BEGIN
Network 1
LD SM0.0
MOVB 2#11111000, SMB157
MOVD 0, SMD158
MOVD 100, SMD162
HSC 5
Network 2 // 网络标题
// 网络注释
END_SUBROUTINE_BLOCK
INTERRUPT_BLOCK 输入中断:INT0
TITLE=中断程序注释
BEGIN
Network 1 // 网络标题
// 网络注释
LD SM0.0
MOVD HC4, VD0
+D +300, VD0
MOVB 2#10100000, SMB147
MOVD VD0, SMD152
ATCH INT1, 29
HSC 4
DTCH 4
RI Q0.2, 1
END_INTERRUPT_BLOCK
INTERRUPT_BLOCK 计数中断:INT1
TITLE=中断程序注释
BEGIN
Network 1 // 网络标题
// 网络注释
LD SM0.0
CALL SBR2
SI Q0.2, 1
ATCH INT0, 4
DTCH 29
END_INTERRUPT_BLOCK