Siemens S7-200 PLC high-speed counter instruction Initialization

High speed counter instruction is initialized as follows:


(1) first scans through a special internal memory scanning cycle SM0.1 to call a subroutine to complete initialization. Because the use of subroutines, in subsequent scans, no need to call this subroutine, to reduce the scanning time, make the program better.


(2) in initial of of child program in the, according to hope of control set control word (SMB37, and SMB47, and SMB137, and SMB147, and SMB157), as set SMB47=16#F8, is for: allows count, writes new current value, writes new pre reset value, update count direction for added count, if for orthogonal count set for 4x, reset and up moving set for high level effective.


(3) execute HDEF instructions, sets the number of HSC (0-5), set the work mode (0-11). HSC‘s number is set to 1, enter work mode is set to 11, are both orthogonal count reset and start mode.


(4) the new current value current value write 32 bit registers (SMD38,SMD48,SMD58, SMD138, SMD148, SMD158). Write 0, clears the current value realized by MOVD instructions 0,SMD48.


(5) with a new preset value preset value write 32 bit registers (SMD42, SMD52, SMD62, SMD142, SMD152, SMD162). If execution of the MOVD instructions 1000,SMD52, set the preset value is 1000. If written to the preset value is 16#00, then high speed counter in the off position.


(6) in order to capture the current value equal to the preset value of events, conditional CV=PV interrupt events (event 13) associated with a break.


(7) in order to capture the change counting direction will change interrupt event (event 14) associated with a break.


(8) in order to capture the external reset, reset the external interrupt event (event 15) associated with a break.


(9) perform a global interrupt enable directive (ENI) allow HSC interrupted.


(10) S7-200 programming for the high speed counter HSC instruction is executed.


(11) the end subroutine.
Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *