最佳答案
SMB0 System Status Bits
Special Memory Byte 0 (SM0.0 - SM0.7) provides eight bits that are updated by the S7-200 CPU at the end of each scan cycle. Your program can read the status of these bits and then make decisions based on a bit抯 value.
S7-200 SM
Symbol Name Addr. User programs read SMB0 status data
Always_On SM0.0 This bit is always ON.
First_Scan_On SM0.1 This bit is ON for the first scan cycle only. One use is to call an initialization subroutine.
Retentive_Lost SM0.2 This bit is turned ON for one scan cycle if retentive data was lost. This bit can be used as either an error memory bit or as a mechanism to invoke a special startup sequence.
RUN_Power_Up SM0.3 This bit is turned ON for one scan cycle when RUN mode is entered from a power-up condition. This bit can be used to provide machine warm-up time before starting an operation.
Clock_60s SM0.4 This bit provides a clock pulse that is OFF for 30 seconds and ON for 30 seconds, for a cycle time of 1-minute. It provides an easy-to-use delay or a 1-minute clock pulse.
Clock_1s SM0.5 This bit provides a clock pulse that is OFF for 0.5 seconds and then ON for 0.5 seconds for a cycle time of 1 second. It provides an easy-to-use delay or a 1-second clock pulse.
Clock_Scan SM0.6 This bit is a scan cycle clock that is ON for one scan and then OFF for the next scan. This bit can be used as a scan counter input.
Mode_Switch SM0.7 This bit indicates the current position of the Mode switch (OFF=TERM position and ON=RUN position). You can use this bit to enable Freeport mode only when the switch is in the RUN position. Normal communication with the PC/programming device can be re-enabled by switching to the TERM position.
在S7-200中系统状态位SMB0所对应的每一位都有特定的含意,SM 0.1是一个只在启动时初次扫描常闭点,状态为1,在S7-300或400中可以在OB00、OB101及OB102中分别写二条指令来用你指定的状态位替代,如果你仍希望用 M 0.1则可以写为:
OB100 (Warm restart)
Network 1
AN M0.1
= M0.1
OB101 (Hot restart)
Network 1
AN M0.1
= M0.1
OB102 (Cold restart)
Network 1
AN M0.1
= M0.1
这样 M0.1 在CPU启动时(启动有三种模式,冷/暖/热分别调用不同的OB)自动将M0.1在第一个程序循环周期内置为状态1。
提问者对于答案的评价:
谢谢
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc318696.html