˘ ˇˆ˙˝˛ˆ ˚˜ siemens s7 300,400 - aemotaal.com manager m : h ˙ i:˘kf/ bt’ v5.4 1u u kj...

84
Siemens S7 300,400 ! "# [email protected] net . forumn . hassanheha :// http

Upload: phungkhanh

Post on 19-May-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

������������

�������������� ������������ �� ������������������Siemens S7 300,400��

��� !���"�#�������

����������������� ����

[email protected]����

net.forumn.hassanheha://http������������

���������

��������

Page 2: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

������

������������������������������� �����!"����#$%��&$'(�)��*�+�,-�.%�/�012Siemens S7 300,400����

����

�3'.�4�5�����6�'�����5�����7�'%���829���"�:��;$%<����,1�#�,.�%�3�����/�=�4�>���<���>?/� @�������1�'�&��"�;$%<����%�@�,1�#�,.�%�3A�B��:����C�D���!7��C�B��@�!2�%����C

EEE����D��=�4��#F���/3���G���� @�������������1�'��"�:��;$%<����H%��,1�#�,.�%�3��

��:��$�4I�����6�'�!�J���2������������1�'��"�:��;$%<����H%��,1�#�,.�������K�4�5�����7�'%�����%L<2����#(�:���>��<���>?�������2��"�:��;$%<����H%��,1�#�,.�MNO#&(�<:���������

��2(�2�4��/�1����!"�$16��'.�P�/�B.�Q�@���G<���!"���#F:��'���R����;$%<����H%��,1�#�,.�%�3&$'%���STU�$1N�� ��VW�'�0%U�(1X''��U� Y�Z����������<���'��

����

��7�(�> �#-'�)�����"'��������������

Page 3: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

�&$'%��������/��4��A�+�,-��1#�%:���1#�%#%X�[1W1��\�$(-�><#�012�)��*��

A]�Y�%:������Z��#� ����5��-�[1X������/���^�_�+$`��Q�-����������@1W1����M�/�><#�012���A�>�$�a$%���>2���@1W1����!�:/�012�A�EEE�a$%���>����>23����</�>=��

Ab�:�����#���'.��@1W1�����#1�<��]�Y'�$�'F��'�*�N@`��&1K`�� ������:<��'�('(�����?<�/�012���A��!��<���a$%���(�:���!"��5���b�@'���D�.��W1��M�@��+$'�c��U�,1�#�012�*�5</3��%:��

A�Q�@����X^��M2��'�I�O/�$��<K��!"��R�#� ���d����,��<���b�@�><#�012�&��K`����������!"����Xe��!�����'�B�?/��5X'� �����X^����TU������Y-�(����!��<����M2$.�012'�!��f�L���%#������

��������

���%�����;�_#�:<���Q�-�&$'%���[1W1��>���#�012Hardware�M�G�<���g��/���'.�M�:����h���]�T '�Simatic

manager���L<2�����������]�Y�%:�'�Simatic S7 PLC����

�M�:����h��Simatic manager����M�G�<���g��/����8���2�� �+� ���$�%i��%X1#Simatic s7�1U��������U�Kj�V5.4�BT��'��I:��kF/�1U�8���2���1��Q�@� ���U�Kj�l#%�<��� ����D SP3��6K$�Q�-�\�<����5� �g����'�License� ��#�

�!/'�<��^��%#�����Z#��� @�]�Y�!"�&%@������!<�2���[email protected]����

�g��/��'Simatic manager�MD��&(�<:�����O�����_7�m'�I�"�%���012��'%�#1����������M �MD��4��Open , new , close , save , save as , delete , print�C�EEEE��

���MD��8���2���?����i�K����'.�%���012�]�T 4��

Upload station , download , debug , Cross reference , new project , open project�C�EEEEE����

@�a'��������O�'��Y-�*%�����+�+�Q�@��/1�#`�� ��%#%:���%�/�012'�&%@������2��5?#�012��5���B.�Q�&(%������/1�#`���O�m'�,�����d�����

���c��5X�Q�@�g��/�����M#F�<��n����Y-�I��@�0�:<�����D����TK9#� ����1�@���`���TU��

���g��/��� @��D .�M�6O��!"�*o�F����R$��Y-Simatic manager�Z"$.�012'�]�Y�V�W1<��(����*�X���

16��'�M�6O<����p��#�_���g��/����Z�:<#�������X��#F���/3���G����� ��'�$Simatic manager������

��U� ��g��/�����p�+�_���M��������

Page 4: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

%:����1?����/1���Q�-��:#�2���W�:��,.�PLC�g��/����]�����W'�>��%��I/.�Q�-�*o�F���&1K`��>�@�d��/�Siemens simatic step 7 V5.4 SP3��W'�>��]�T �k'9��3'.�q�%�`����#�:�'�M���<���H%<�����Q�@�

M�6O<�����6K����M#F�����O� �p�����O���_�������'�8���2��6K���]�������

��%:��g��/�����M���Siemens simatic step 7 V5.4 SP3�g��/���k��:<2��><#�winrar�M�G�<��'�]O����(%@�Q�@�(1X1��g��/�����,.��?�o����r�$%�1"�CD-1 , CD-2� ��g��/�����n��D��><#�CD-1�dGN����

�_���Q�@setup�$��<K���>�"��6K���������+�+�Q�-�M6/�Q<���:��<����]�Y�%:��>=�skip.���TU��'����B!5<�#�Q<����i�1�����]�Y�%:��>��>=�]�Y�%:��M���<������,J���

���g��/���V<O#�012'�I�"�,'(�g��/�����M�G�<��>�"��6K����g��/��� @���.winrar�I�2��_���%X1#�

winimage�g��/���M���<���1�#�012'�I��@�dGW��winimage�g��/�����MG+'�]�T �I:��M� .'�free����c��U�8��'�M�+��5��@��/1�#.�M��#�_���%���012�M���<��� ��g��/�����*�5</��%:�'����winimage�

V<O#�012�_������TU�Q�@�dGW���6K����_���!U'����

�$�<K�'���7�����Q�-��UY�image�>=�extract�$��<K�������K`��$��<K3���<K�'�partition D��<L��3�partition c�>=�OK����

�,`�"����:"�.%�/�012���2�1��g��/���M�@���O� �!Simatic s7������M��:<���d�2'�,J����#%��,1�#�,.�g��/�����M#F�<�������,.�%:��b'�O���� �PLC�,.� ��#������#%��]�T �

I�<�/�012�BT���g��/�����I�"�TO�/����

�[1�������['�������TU�M:���'�����['����k'.�*��/-���O� �!"�.%�/�,J�'S7-300��A1�/�3'.��(%@�%#%�<���Inputs/Outputs�BT�����?����,.�b�<O���%#%�<�����5@1/'��5�%L<�/�012�!<���

�I����#%�st�MK(�A�Input�A�(%@'�rt�\�K�A�Outputs���A�!�J� ����o����/1�����%#%�<���1�/�012�]�Y�Q�@�*����4��

�u������!��5 �%5X�$%6�Siemens - 5A����u�&%�'CPU S7-314��

�u�(%@v#(1���MK(�k1wx�0���Digital input module 16 input 24 VDC����u�(%@r�\�K�k1#(1��wx�0���Digital output module 16 output 24VDC/0.5A��

�u�c�$RailI��@��/1�����n��D<����������������

����

��

Page 5: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

���7��� ��$�<L/'�g��/�����V<O���1�/file --> new project����

������

� ���'�%#%����['������>2��MK%/example1���>23���%#%X�['����V<O��g��/������1�#�012example1����K�I��/�������X�,1��'�['������&T"�/�V<O#'���

����

������

��

Page 6: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

���7��� �insert��<K��station��<K��>=�s7-300 plc��

����

���1?���MD�#��Kj���2�['������>2��n����5?#�012PLC S7-300����

����

&T"�����!"��5?#�012� �����I��@�dGW��&$'������Hardware configuration�I��:<�/�012�BT���1U'�M��� ���U�/�<K��!<�����?�����/1����/����k�K(^��

Page 7: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

�Q�@�dGW�Hardware configuation��/1�����k�K(^�,�����5��&%#%X�&T"�/�V<O#�012�����������������������������������������������������������

Page 8: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

���7��� ��y+�k'.insert�������

������������

��

Page 9: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

$�<L/�Rail�MD���&T"�/�V<O#�012�Rail��5��ww�,��������

����

>�$�,�������/1�����MK%/�]�Y�%:�'Aw�%5����$%6����1����Power supply�a'�����$F�'�I��@�_�/��$�<L/���7����5?�� �����insert� ���5���:<2�� ������%5����$(�6��[�1/.�M ��5��$��<Ko����7���V<O#�012�

8���2�\�</�����

����

Page 10: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�_�/�>�$�,������Q�@r�&%�1���1������1U'�CPU�$�<L/'� ��#�a'���dGN/'�insert�$��<K����7���V<O���[�1/.�M �M���CPU��5���$�<L/��5���:<2�� ������CPU S7-300�B.�>=�CPU 314�o#(1�����$.�c��U�

�oD���5���&%�'�M �����5?��8�������i�KxES7 314-1AE04-0AA0`��Q�@�,J��F �/�012�����$� ��#�Q�@��=oD��xES7�!U���U�vws��h����>�����,� ��Yz"�v�MD�#�15"�S7-300����:���>�$�,� ��Y-'�

��Oit����:���>�$�,� ��Y-'�%5X�$%6��MD�#�,� �w�MD�#�15"�CPU����:���>�$�,� ��Y-'�r�MD�#�15"�����:���>�$�,� ��Y-'�\'�K�'.�k1K(�!��$�k1#(1�v��k1#(1��MD�#�15"��B�m��Analog�'.�k1K(�

�M�G�<���%5X'�$�%i^��>������o@��5�"�����<������L������$`����.�[1/�M���f�K�15"�(��J��>�$���.�\'�K,J���5��><5/� ��*F����H�K`�����O����Oi�1���'��

��

��������������������������������

Page 11: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�>�$����K(.�,.�%:�CPU�>�$��/�L���!"�r�>�$��/�L���c�</�v5/.�l�������K�� ���M�i1<����%�1��&�1������>�$� ��.%�/'�]�Y�Q�-��X�����%�@�c�$� ���D .s�>=� ��#�a'���insert�$�<L/'�SM300�M��#�1U�'��$�<L/��5��'�\��K^�'�k�K(^���%�'����XDigital input module�;1������k1#(1����$�<L/�>=�

Digital input module sm321 16/24VDC������

����������������������������������

Page 12: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

������

�k��:<2�� ��#���=��<����*�FX`��!"�I/.��?�o������/1��������X� ��!5<�/�,.�Q�-���#�����8O���M��/�>=Copy/past�(1X'�����U$�<L/�!<����/1�����8O/��5�"��5?#��+�����MO2.�&T"�/�(1X'��?�o����#�]�T �

��/�L��,J���5���><5/��5��@�M�i�O�Address�M���<���1�/'�Addresses�/1����� ��M����5?��!<�������������������������������������

Page 13: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

g��/�����Q�-��/1��������K(.�%��,1�/��T�U'�&T"�����Z�G/�*�5</3��%:�����

�Q��#����MK�(��<����/����'.�����:��'.�g����� ��ST�O���%#�/����M �,.�0�:/�,.�%�3Blocks���!"�&%#%@�[�1/.��5�'Simatic S7�!�J� �4��

Organization blocks OB��Function blocks FB��

Functions FC��Data blocks DB��

System function SFC��System function blocks SFB��

S%��Q�@�[1/�M �p����a$%����TU�!"�b�:</�012'����

OB-Organization block��� ���d�21���MD�#�������M���1U'CPU���'.�����:��B.�T�O���><#�3'�g��/�����'�����N<�� ���>����g��/

�B.�!"����M���OB�1U�g��/�����M��#�BT���!2�2`��c1����'�OB1� ��&$'(�M �ST�O���><#����M��#�1U'��T�O���n�''�]�Y�%:��T�O�<���(�:#�>=�k'9��3'.�M���<��M����g��/�����T�O���><#�l���g��/�����T�O����$'(

�I��@�Z��#�g��/��������� �&$'(one cycle time����

�B$'(�M����M���<���yX�O������������i�K�� 1���c��U'Real time interrupts����6"� ���N#.�!U'�OB�[1/�������U(%@�,1�#'�CPU� ��!U'����:<�����OB31�Q<�'�OB40��

��

Page 14: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�MK�(�I� ��<�#�,.�d����g��/�����,� ��Y-� ��#'OB1���%L<2��><#���o:����D '�g��/�����>���(����Y-'�/.�!"��5���N��><#�,.�Q�@��X��<�o�������H�K.�[�1OB1M�+�B9����

���k��:<2���g��/���k'.�*��/-�d����M����.%����,J�'OB1��/1������/9�/.�,.�%:��d�"�Hardware config�

�Z������a$%���!"4���V<O/�3'.Project�Q�@�dGN����MK%/�>=�S{��/��>��BT����|�Q�-�M6/�Q<��&%��'�&��blocks����:���5?#'

�!��<���M����4����

����

�Q�@� �����dGN���%�@'OB1��/���� ����!U'�����<����+������5?��OB1�dGN/�OK����<�����+�+�V<O<"��MK�(OB1��

���g��/�����M�@���O� '�g��/������/1����b�:<����.%�/�012�,J�'4��

������G<����[�1/.�3'.4��

��������[�1/.� ��[1/�B.����M��:<���%�@�����:����5��@�B��/�!<����/������[�1/.��������!"��N/�,.�%�3�������'�;�N��'�p����'�����������@��5��@�B��/�!<������$`��c��U����������������������:���oD�"��

���,1�#�Q<���T�U'�����L��]�T '��#�� '�����i'��������!U����$`��[�1/.�,.� ��/�,.�����@��X'��T5�'�

���F���<��'�>����!"������� �#'��<����(�:����!"��

Page 15: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�g��/������M��:<���%�:"�]�T PLC�&%#%@�[�1/.�c��U'��/������ ��%��'�[1/�Q�@�����:���,1���,.�%�o"��1������@1W1��!U��/������ ���

���&%��'��/�K���-�1U'���G<�����/�K�(%@�1U�I��b�:<�2�>�����k'.Bit�'.�}��/�K�Byte�'.����� wx��/�K�

word��X'(F����� �'.�vr��/�K�double word�/������[1/�l��� ����.�����

�k'`��[1����4�!7��D��Binary type����������TK9#�1U't�'.�w�����5 �'.�d�"�ON - OFF�1�����Q�@�]�Y����< �><#�[1�����TU����M��:<���%�@'�d�"�

�!�J�4��� ��,1���>�$�M�D��wx��/�K��4b#1001 0110 0011 0001��

b���o@'�!7��=�>�����,.��U��:����U��~>����������!5"����$`���@1������.�F��<��'�>����� ���Mi�O���!U����

�!/�D���[1����4�����6������$`�Integer numbers�����(���-�!U'�����i��#��@����$.�!U'wx�'.�>�$�vr!7��=�>�$���

���%����Y����$`�wx<����� ��<����/�K��oD���#��@���o@�,'(�B(�:���B��:�����?����!"��wrt��� �����p'��<��!U'vr�x}A�Q�-�vr�x��|�&$�+^���Y����$`�������!"signed integers��� ���p'��<�'t'�x��v��|�����6�����X1�������$`�������!"unsigned integers���

���%����Y����$`����.vr�����6����/�K�double integers�!�J��M�������5�<�/��5<��< �%�:"�4��L#150��

���l��D���[1����4��#��:������$`��1U'Real ( floating point ) numbers��

����J���G�6���Q�@��<��'4��x.ye+/-z��

�l��x&%��'��/�L��B��:���>����� ��V��6���*F������yB��:���>�����!"�B������*F������

e�>�����a.�!�:��wt��|A�&$�+-�!U'�a`���

za`��MD������!�:��rvttt�!�J� ��<���oD���4r�ve+4��

t�tv�s��<����4v��se-2���&$�+-�I���.��<�������2�,� ��Y-'�&$�+-�I���.��<���3��X1��M� �>�����,� ��Y-'A��

���1U'��������[1����4���#�<���!������G<��[1/Timer type��

�!�J� ��<�#'�4s5t#100ms����� ���S��:��>������TU�I<������#wtt��/�=�!������

���8��L���[1����4��#$�<���M@�k%#���G<�date���

�!�J� ��<�#'�4d#2008-04-08��#$�< �}�M#��.�rtt}�����!�����n�'���G<�time of day��

�!�J� ��<�#'�4tod#hh:mm:ss.ms�oD��tod#23:30:24.500����

Page 16: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�Z����n�'���G<�time���!�J� ��<�#'4t#Od_0h_0m_0s_0ms�oD��t#Od_10h_50m_28s_880ms��

���!�J� ��<�#'��#$��'�n�'���G<�4��

DT#2008-04-08-20:25:30.850����

���"������G<��c��U'String�P�6�����o@� ����<��'��xyz��M�����Q�@��<��'��(�%:���c��U�]�T ��c#897�����

@�����:���*��X-�;1�������/������[1/� ��% 9<���1U�,�������TU�!"�;1�����'�!��<���'�g��/�����!"��5��g��/�����!"�9�K�q%�#�3�Q<��]�T����2����������:�����%L<2���

�������������$ �%���� ��&����

���&%��'��/�K�'Y���G<��H1<���Q�@�><��!<���!U���7��D����������������:��bit������M�������-�15"�!��<���'�

��?/�H�K.�����5��@�M��:��B.�Z�����'.��/�K��5<�����W'�'.��5�t��5<�����W'�'.�w�012'�������M����&%��1����/�L���H1<���Q�@�><��!<��������:�����U�� T/bit��

���o��:�����/1�:��b�:</�,.�%�3�����:���M�D���M��Addressing4���

���������oK%���Digital inputs4����M�����TK9��4Ix.y�l���I�'�k1K(�I/.�F�$�x�>�$�Byte�� ��p'��<��!U't�k�Q6�`��%����Q<�'�CPU�

�,1�#�,.� ��#����:<����wr��'.�r�����.�y��/�L���>�$�!5"�bit��������MK�(�Byte� ���p'��<#'�t�'�����oD��4I0.2 - I10.7 - I127.5��

������������ '�(���Digital outputs)����F�����,.���R�������oK%����MD��!U'Q� ��3%��I�oD���4Q1.3 - Q7.6 - Q47.3��

����*�+��������,��Memory flags)���

�F�����TK9�'M�oD���4M100.0 - M4.5 - M0.7����

������&��Counters)���F�����TK9�'C�[1��������(�%:���>�����@1�<��CPU�oD���4C1 - C10 - C126��

�������������� *�+���Timers)���

�F�����TK9�'T�[1����������#�<���>�����@1�<��CPUoD����4T2 - T10 - T70����

Data block��/���������1��4��

Page 17: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�!�J��M�����TK9�'�4DByDBXz.u���l��y�'��/������c1���>�$�1U�z��������>�$�Data byte�'�u��/�L���>�$�bit���oD��4DB10.DBX1.2 - DB100.DBX10.7 - DB120.DBX34.6��

����

A And�����><�'�����5 �!��1<���Q�@�M�i1<�������@�MD��!U'�,��=3��,1�#�,.�%�3����</�c��U�,1�#�!��� ����:�� w��

�oD��!�J��k'%�������4��z=A And B��

��A B z��

AAAAAAAAAAAAAAAA��t�t�t��w�t�t��t�w�t��w�w�w��

���,1�#�3�k'%�����TU� �Z�������5��w�,� �3-�A , B��������5���:��w��

���>�����M��������:���M�D��Ladder diagram LAD���

AAAAAAAAI0.0---------I0.1-------------Q1.2���AAAAAAA���AAAAAAAAAAAAAA���AAAAAAAAAA���AAAAAA���

���(1������?�������:���M�D��Statement list STL��

A I0.0��A I0.1��

Q1.2������

� �����J��[�1/`��Q�@�Z�����!U'Data type����I-Inputs , Q-Outputs, M-Memory flag, L-Local variable, D-Data block bit, T-

Timer, C-Counter����

AN And Not����

�Z�G��!:�������:W'���U%�.� ����:�� ���><�'�����5 �!��1<���Q�@�M�i1<�������@�MD��!U'NC����oD��!�J��k'%�������4��

z=A And Not B����

A B B' z��AAAAAAAAAAAAAAAAAA��

t�t�w�t��w�t�w�w��

Page 18: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

t�w�t�t��w�w�t�t��

���>�����M��������:���M�D��Ladder diagram LAD���

AAAAAAAAI0.0---------I0.1-------------Q1.2���AAAAAAA���AAAAAAAAAAAAAA��AAAAAAAAAA���AAAAAA���

���(1������?�������:���M�D��Statement list STL��

A I0.0��AN I0.1��

Q1.2������

� �����J��[�1/`��Q�@�Z�����!U'Data type���I,Q,M,L,D,T,C��

��O Or����

��@�MD��!U'�%��'�,1�#�,.�%�3����</�c��U�,1�#�!��� ����:�� ���><�'�����5 �B��1<���Q�@�M�i1<������d�"w��

�oD��!�J��k'%�������4��z=A Or B��

��A B z��

AAAAAAAAAAAAAAAA��t�t�t��w�t�w��t�w�w��w�w�w��

�����(1������?�������:���M�D��Statement list STL��

O I0.0��O I0.1��

Q1.2������

��Q�@�Z�����!U'� �����J��[�1/`Data type��I,Q,M,L,D,C,T��

����

ON Or Not����

���Uo �'.���U%�.� ����:�� ���><�'�����5 �B��1<���Q�@�M�i1<�������@�MD��!U'NC���

Page 19: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�oD��!�J��k'%�������4��z=A Or Not B��

��A B B' z��

AAAAAAAAAAAAAAAA��t�t�w�w��w�t�w�w��t�w�t�t��w�w�t�w��

����(1������?�������:���M�D���Statement list STL��

O I0.0��ON I0.1��

Q1.2������

� �����J��[�1/`��Q�@�Z�����!U'Data type��I,Q,M,L,D,C,T��

��X Exclusive Or��

����

�,1�#�3�l���!��1��,��=��I��[�"�M ��:��B��1��,�@�"�c��U�,1�#�l���MK�%<����M�i1<�������@�MD��!U',�O�<L��,��=3��,� ��Y-�3-����</�c��U��

������oD��!�J��k'%��4��z=A XOr B��

��A B z��

AAAAAAAAAAAAAAAA��t�t�t��w�t�w��t�w�w��w�w�t��

�����(1������?�������:���M�D��Statement list STL��

X I0.0��X I0.1��

Q1.2������

� �����J��[�1/`��Q�@�Z�����!U'Data type��I,Q,M,L,D,C,T��

Page 20: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��XN Exclusive Or Not��

����

�MK�%<����M�i1<�������@�MD��!U'�,1�#�3�l���!��1��,��=��I��[�"�M ��:��B��1��,�@�"�c��U�,1�#�l��,�����<��,��=3��,� ��Y-�3-����</�c��U��

�oD��!�J��k'%�������4��z=A XN Or B��

��A B z��

AAAAAAAAAAAAAAAA��t�t�w��w�t�t��t�w�t��w�w�w��

�����(1������?�������:���M�D��Statement list STL��

XN I0.0��XN I0.1��

Q1.2������

� �����J��[�1/`��Q�@�Z�����!U'Data type��I,Q,M,L,D,C,T��

����

Assign-�����

���o@�!�#�BT���,�1�:���!"�n���!<�������:������</�M��#���.�1U'��[�1/`��!�@�Z���#�1U'��I, Q, M, L, D��

����������D�`��!"�S���%L<2�'�Z�2��� ��������

R Reset����

� #FL<���1�#�1U't#�BT���,�1�:���!"�I�����MD��4R Q0.1 - R M20.7 - R DB100.DBX2.1��

��S Set����

� #FL<���1�#�1U'w�I��#�BT���,�1�:���!"���

Page 21: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�MD��4S M10.2 - S Q3.1 - S DB10.DBX14.6����

NOT Negate RLO����

� ��n�������@��Kj����</�8�:���1�#�1U't�Q�-�w� ��'.�w�Q�-�t����

�1U��� ��<�#'NOT����

SET Set RLO --> 1����

���1�#�1U'� #FL<w��������������:������</�,����!"�Result of Logic Operation RLO�������@�!"�]�Y���%L<2��,���^�]�Y'Set��

���oD�4��

SET����Q10.3��

��CLR Clear RLO --> 0��

��� #FL<���1�#�1U't�!"�RLO����

����������������������������������������

�������� ��&���.�/�01�������231�4&���56���7 �&*8�����&��9��:� ;���<�������� = 3��>��*������� *�+���Timers������&����counters��,?=�231�� '�(������@A�����5���!���*���� ��/�B�C��� DC�

����;���E?�*����$����4&��5/� F�� �G*87��5?���H���I�����������=�H���J,=�5?��� �����KL1�M����� �3 ?�N��5?����OP�7�� �����,�Q���� F���OP�7�� ��/�R�/�5�� ��?������������� �������$ F

����;������ ;����� ��&���:����5/�J,�Q���5?����D ���R?S��2*T �L�5?���UV�W1��� ;��R?��� F�G� ��@�� ��?��� &�� F������/��*����� �8 8#��5����%?���E&��X=��2&��"� �3� �� �=�X=��Y��� ���5���

�� ���=1�R��Z�=����

���������������������������������������������

���#�<���Q�-��UT���,J�'Timers����

�!�J� �!U�g��/�����MK�(��5��%L<2�� ��#�!<��'�8���2�!"�&(1X1������#�<���[�1/.4��A��K���M�G�����#���On-Delay Timer : SD��A��K���M6"���#���Off-Delay Timer : SF��

A�!N�/���#���Pulse Timer : SP��A�%<���!N�/���#���Extended Pulse Timer : SE��

Page 22: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

A�M�����K���M�G�����#���Retentive (Stored) On-Delay Timer : SS��������

��;�(���[�X3#��5����Q�\X���]�Q���^�&*;���0_��)����

���#�<���M�G�<��S�"�1���X�1���������!U�M�G�<���&$�+-�,.�b�<O���,1�#�!<����������1U���#�<��� ��\�L��'���#�<����5�"ON�1U���#�<���d�N���n�''�t4���

����

�!O""�#��[X�����K���M�G���1U'�On-Delay Timer� ��\�L��������M�<���t�Q�-�w�&$�+-�n/� ��Y-�� �F����5<#�%��n�'� ���U(1X'�n�'��'���'�&(1X1��M�G�<��t� ��kF��'�w�Q�-�t<���&$�+-����M�G���

����

�!"'�3 %���[X�����K���M6"��#���Off-Delay Timer� ��\�L��������M�<�#�t�Q�-�w�M�G�<���&$�+-����� ��M�G�<���&$�+-�k��</��%�@'w�Q�-�t� ��k��</3��������K9<��w�Q�-�t�S$%�� �F��\�L���!"�t��

����

'`� %���[X�����B.�M�G�<���&$�+-�(1X'�%�@�[1�����TU�!"'�!N�/���#���� ���5���</t�Q�-�w��U$���<2�'����#�<���d�W� ��� ���� .�n�1�t� ��M�<�#���#�<���\�K�,z"�t�k-�w� ��(1:#�>=�w�Q�-�t�S$%�� ���%:��t�

� ��M�.�M�G�<���&$�+-�(1X'� ���,� ��Y-� ��'��N�/�M�+�Q�@�B.t� ��M�<�#���#�<���\�K�,z"�w�Q�-�t����M�G�<���&$�+-��

����

9������[X���1U'��S$%�� �F����#�<����N�/�\�L��[1�����TU�!"�%<���!N�/���#���t�n�'� @��?�����G��� ��M�G�<���&$�+^�k��</��M �,.��?�o�����M�G�<���&$�+-�(1X't�Q�-�w�\'�L����N����&%#%X��#�%��!�:#�

� ��M�.� �F��&$��<���N�/�M�G�<���&$�+-�n/� ��Y-�I/.�B.t�M?#�012���#�<���\�K�,z"�w$���<2���������

Y� (���[X���� ����#�<���\�K������M�<���[1�����TU�!"'�,FL���K���M�G�����#���1U'�t�Q�-�w� ���%:���S$%�t� ��M�G�<���&$�+-�k��</�� ��t�Q�-�w���.�MD��M�G����&$�+-�$���<2����U���<�#�3'�SET�%:�� ��'�

� ��t����������������������

Page 23: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����������

�F���><#�I/.�>�:��one word���� ���/1�����#���Mwx�&� �Y�!"��/�K�CPU�����

� ���/�L���P�6L��><#�I/.'tA��Q�-��������STU�M�/� ��#'�!7��=�M�+�!"�n�1���������Accumulator-

1�M�+�!"�Hexadecimal H, BCD�]�T��\��<�3��%�@�g��/�����!"��5:��M��:<���]�Y'������6���H%�z����#�<������'.������M����� ��#�]�T �����<��4��

W#16#txyz

�l��W#16� ��,1���>�$�!�:��wx�/�K���t�n�1���;������#���A�tt�C�tw�C�wt�C�ww�A�wt���/�=�!�����Cwtt���/�=�!�����Cw���/�=��Cwt��/�=���

xyz�M�����5�@����:��n�1��������BCD�����M������n�1��� @����:<��� ��#�'.�4S5t#aH_bM_cS_dMS���

�,.�l��a�@�����������C�b�Z7��%����Cc�!/�1D����Cd�'���/�=�!����H,M,S,MSn�1���F�����1U���������������������������������

���� *���9��2�&*;��������#��^�&*;���0_��)����

FR Enable Timer����

�!"�,1�����`���TU�M�G�<�����:���&$16��'STL�!�J��M������,1��'�d�"�4��FR <Timer> where Timer --> T1,T2,...,T256

���oD�4��

�A I0.1��FR T2��

Page 24: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��L Load Current Timer Value into ACCU 1 as Integer��

���1U���`���TU�M�G�<�����:���&$16��4��

L <Timer> where Timer : T1,T2,...,T256

�!"���#�<��������M���<��M�:<�#'Accumulator-1�V��i�>�$�M�+�!"�Integer�����oD�4��

L T1����

LC Load Current Timer Value into ACCU 1 as BCD����

�1U���`���TU�M�G�<�����:���&$16��4��LC <Timer> where Timer : T1,T2,...,T256

�!"���#�<��������M���<��M�:<�#'Accumulator-1�M�+�!"�BCD���oD�4��

LC T1������

R Reset Timer����

�1U���`���TU�M�G�<�����:���&$16��4��R <Timer> where Timer : T1,T2,...,T256

!�'`���W1���Q�-���#�<����W'�&(�@-'���#�<���0��#^�M�:<�#'�����oD�4��

A I2.3��R T25��

��������

SP Pulse Timer����

�1U���`���TU�M�G�<�����:���&$16��4��SP <Timer> where Timer : T1,T2,...,T256

�!N�/���#���M�G�<��M�:<�#'�����k�D�4��

A I 2.0

FR T1 //Enable timer T1E

Page 25: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

A I 2.1

L S5T#10s //Preset 10 seconds into ACCU 1E SP T1 //Start timer T1 as a pulse timerE

A I 2.2

R T1 //Reset timer T1E A T1 //Check signal state of timer T1E

��Q 4.0� ����

SE Extended Pulse Timer����

�1U���`���TU�M�G�<�����:���&$16��4��SE <Timer> where Timer : T1,T2,...,T256

%<���!N�/���#���M�G�<��M�:<�#'�����k�D�4��

A I 2.0

FR T1 //Enable timer T1E A I 2.1

L S5T#10s //Preset 10 seconds into ACCU 1E SE T1 //Start timer T1 as an extended pulse timerE

A I 2.2

R T1 //Reset timer T1E A T1 //Check signal state of timer T1E

��Q 4.0

L T1 //Load current timer value of timer T1 as binaryE T MW10

LC T1 //Load current timer value of timer T1 as BCDE T MW12

����

SD On-Delay Timer����

�1U���`���TU�M�G�<�����:���&$16��4��SD <Timer> where Timer : T1,T2,...,T256

���M�G�����#���M�G�<��M�:<�#'�K�����k�D�4����

A I 2.0

FR T1 //Enable timer T1E

Page 26: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

A I 2.1

L S5T#10s //Preset 10 seconds into ACCU 1E SD T1 //Start timer T1 as an on-delay timerE

A I 2.2

R T1 //Reset timer T1E A T1 //Check signal state of timer T1E

��Q 4.0

L T1 //Load current timer value of timer T1 as binaryE T MW10

LC T1 //Load current timer value of timer T1 as BCDE T MW12

����

SS Retentive On-Delay Timer����

�1U���`���TU�M�G�<�����:���&$16��4��SS <Timer> where Timer : T1,T2,...,T256

,FL���K���M�G�����#���M�G�<��M�:<�#'�����k�D�4��

A I 2.0

FR T1 //Enable timer T1E A I 2.1

L S5T#10s //Preset 10 seconds into ACCU 1E SS T1 //Start timer T1 as a retentive on-delay timerE

A I 2.2

R T1 //Reset timer T1E A T1 //Check signal state of timer T1E

��Q 4.0

L T1 //Load current time value of timer T1 as binaryE T MW10

LC T1 //Load current time value of timer T1 as BCDE T MW12

������

SF Off-Delay Timer����

�1U���`���TU�M�G�<�����:���&$16��4��SF <Timer> where Timer : T1,T2,...,T256��

Page 27: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�K���M6"���#���M�G�<��M�:<�#'�����k�D�4��

A I 2.0

FR T1 //Enable timer T1E A I 2.1

L S5T#10s //Preset 10 seconds into ACCU 1E SF T1 //Start timer T1 as an off-delay timerE

A I 2.2

R T1 //Reset timer T1E A T1 //Check signal state of timer T1E

��Q 4.0

L T1 //Load current timer value of timer T1 as binaryE T MW10

LC T1 //Load current timer value of timer T1 as BCDE T MW12

����������

�k�K(^���%�'� ���/������M�/����2'�!U�����:<���STU�,.�>�:���&%�'�&� �T���$'���\��K^���%�'�Q�-'���R�����:���5/.�Q�@�TO���!5"��N#.'��5�O/�&� �T���MK�(��/������M�����%L<���]�T ��#F ���������:���

����</�Q�@�%�<:��3�!5"���'���RLO��5#(�O�� ��#�3'�k'9��3'.��UT�O���><�"�!��<���'��������������:����T�O�<���I�X1<��3-g��/�����!"�>��<�������:��b�@�%�@�I����!"�I��b�:</�012'��Kj�,����Q�-��

��������

Load L����

L <Address�����

�!"�&(1X1�����/������M���<���1�#�1U'Address�Q�-�ACCU1�����.�c��U�,� ��Y-'Load��#1<���M�/�><#�I/z"�!����ACCU1�Q�-�ACCU2�!"�&%#%�����/������M����'�

ACCU1�q%�#�B.�M���������@����

���`��Z���#'Load�n/� �*�12��/����������.� ��B.�Q�@�Byte�'.�Word�'.�Double Word����

�,z"�]�T Address�,1�#�,.� ��#�Digital input(Byte/Word/DWord���,1�#�'.Digital output��'.���#�����8O��Memory�'.�Analogue input�'.�Data block�!�K�(���G<��'.�L��

Page 28: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

���D�.��4��

L IB20��L MW200��L QD10��

L PIW224��L DB50.DBD20��

������

�M�����>���Y-�I/.���o/�,.���#'Byte� ���/�L���!"��5������><#�I/z"�w�Q�-�}�;��i�L���ACCU1�� ���/�L���,1��'��A�vr�$�Oi.�ttttttttAttttttttAtttttttt�M�����>���Y-'�Word�><#�

� ���/�L���!"��5�����w�Q�-�wx�!"�ACCU1� ���/�L���,1��'�w��A�vr�$�Oi.��5� �ttttttttAtttttttt�M�����>���Y-'�Double word�!"�M�������>�����M�����><�"�ACCU1� ���/�L���!"�wAvr��

�����`�Load status word into Accumulator-1 L STW��

����

�M���<���1�#�15"���`��>2�� ��VW�'�1U��� 'Status word @���:��!<��'�������CPU��Kj�����-�%:��� ���/�L���!"��5������><#'�]�T��$��<K��M�@�!"���R����%�@�����@w�Q<�'�}�,1�<"��/�L����������.�

$�Oi.����

���`�Load Address register-1 Or 2 From Accumulator-1 LAR1 , LAR2����

��#1<���Q�@��=�#�3�1U'�]�T ��%L<�#���`���TUACCU1 ,ACCU2��<�#'�&� �T��� ��(%���*FX����M��:<����5��%6�#�!<��'��i�L�������:���!"���`���TU��%L�����%�<�������

���������

���`�Transfer T <Address������

��#1<����������`���TU��1�#ACCU1�;�I��-�$������,������Q�-�Address�,1�#�,.� ��#�BT��'�4��QB/QW/QD/PQW/MB/MW/MD/L/DBB/DBW/DBD

��D�.���4��

T QB10��T MW32��

T DB20.DBD48��T PQW446��

����

Page 29: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

���`�Transfer contents of Accumulator-1 into Status word T STW����

�Q�-�k'`���:�<����/�L���M�����1�#�1U'Status word��?����,'(����:�������!"��5:W'�!"���R����%�@�H�K`��g7�<����Q�-��

���,���`�'L,T����'`���D .� ����U����X�]�Y��5?#�012'�������������@�koK����%L<2��Q"��%�<���koK�

S$'%������

����

��m1����4�%:���o������D�`�����X�!"��$1�`��>5"�!"��%L<�����&%@�����p�+�B.�������Q�@�Z��:����<:#Comments��

����#1<��� ����5� �><������:���STUAccumulator-1�'�Accumulator-2<����,FL�'����#%����,�������

�!"Accumulator-1��/�K�M ��/$����><��l����bit��1����������:���������5�=��#�������������

AW AND Word : 16-Bit����

�&$16�����`��TK9#'4��AW��

AW Constant����

�!"�Q�'`���������M�������`��M���><#�l��ACCU1���/�D����������M����'�ACCU2���k�D�4��

L IW20 //Load contents of IW20 into ACCU 1-LE L IW22 //Load contents of ACCU 1 into ACCU 2. Load contents of IW22 into

ACCU 1-LE AW //Combine bits from ACCU 1-L with ACCU 2-L bits by AND; store result in

ACCU

wA LE T MW 8 //Transfer result to MW8

������

�M�@������!"'AND�=�����n�Constant�!"�Q�'`���������M���<��><#�ACCU1�M�@�><#'�AND��!"�g������,1�#'�>��������&�+���ACCU1�!�J��MD��4��

��L IW20 //Load contents of IW20 into ACCU 1-LE

AW W#16#0FFF //Combine bits of ACCU 1-L with bit pattern of 16-bit constant

Page 30: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�tttt�wwww�wwww�wwww�� by AND; store result in ACCU 1-LE JP NEXT //Jump to NEXT jump label if result is unequal to zero, (CC 1 = 1�

��OW OR Word :16-Bit��

����

�&$16�����`��TK9#'4��OW��

OW Constant����

�!"�Q�'`���������M�������`��M���><#�l��ACCU1���/�D����������M����'�ACCU2���k�D�4��

L IW20 //Load contents of IW20 into ACCU 1-LE L IW22 //Load contents of ACCU 1 into ACCU 2. Load contents of IW22 into

ACCU

wA LE OW //Combine bits from ACCU 1-L with ACCU 2-L by OR, store result in ACCU

wA LE T MW8 //Transfer result to MW8

����

�M�@������!"'OR��=�����nConstant�!"�Q�'`���������M���<��><#�ACCU1�M�@�><#'�OR����&�+�����!"�g������,1�#'�>����ACCU1�!�J��MD��4��

L IW20 //Load contents of IW 20 into ACCU 1-LE OW W#16#0FFF //Combine bits of ACCU 1-L with bit pattern of 16-bit constant

�tttt�wwww�wwww�wwww�� by OR; store result in ACCU 1-LE JP NEXT //Jump to NEXT jump label if result is unequal to zero (CC 1 = 1�

��XOW Exclusive OR Word : 16-Bit��

���&$16�����`��TK9#'4��

XOW��XOW Constant��

���!"�Q�'`���������M�������`��M���><#�l��ACCU1���/�D����������M����'�ACCU2��

k�D�4���L IW20 //Load contents of IW20 into ACCU 1-LE

L IW22 //Load contents of ACCU 1 into ACCU 2. Load contents of ID24 into

ACCU 1-LE

Page 31: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

XOW //Combine bits of ACCU 1-L with ACCU 2-L bits by XOR, store result in

ACCU

wA LE T MW8 //Transfer result to MW8

�����!"'�M�@�XOR�n��=����Constant�!"�Q�'`���������M���<��><#�ACCU1�M�@�><#'�XOR��!"�g������,1�#'�>��������&�+���ACCU1�!�J��MD��4��

��L IW20 //Load contents of IW20 into ACCU 1-LE

XOW 16#0FFF //Combine bits of ACCU 1-L with bit pattern of 16-bit constant

�tttt�wwww�wwww�wwww�� by XOR, store result in ACCU 1-LE JP NEXT //Jump to NEXT jump label if result is unequal to zero, (CC 1 = 1�

AD AND Double Word : 32-Bit����

�M�:���1�#�1U'AW�H1<���Q�@� ��'�vr��#1<���M �B.��/�K�ACCU1, ACCU2����

�&$16�����`��TK9#'4��AD��

AD Constant�������!"�Q�'`���������M�������`��M���><#�l��ACCU1���/�D����������M����'�ACCU2��

�k�D�4��L ID20 //Load contents of ID20 into ACCU 1E

L ID24 //Load contents of ACCU 1 into ACCU 2. Load contents of ID24 into

ACCU

wE

AD //Combine bits from ACCU 1 with ACCU 2 by AND, store result in ACCU

wE

T MD8 //Transfer result to MD8

���M�@������!"'AD�n��=����Constant�!"�Q�'`���������M���<��><#�ACCU1�M�@�><#'�AD����&�+����

�!"�g������,1�#'�>����ACCU1�!�J��MD��4��

L ID 20 //Load contents of ID20 into ACCU 1E AD DW#16#0FFF_EF21 //Combine bits of ACCU 1 with bit pattern of 32-bit

constant

�tttt�wwww�wwww�wwww�wwwt�wwww�ttwt�tttw�� by AND; store result in

ACCU 1E

Page 32: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

JP NEXT //Jump to NEXT jump label if result is unequal to zero, (CC 1 = 1� ����

����

OD OR Double Word : 32-Bit����

$16�����`��TK9#'�&4��OD��

OD Constant�������!"�Q�'`���������M�������`��M���><#�l��ACCU1���/�D����������M����'�ACCU2��

�k�D�4��L ID20 //Load contents of ID20 into ACCU 1E

L ID24 //Load contents of ACCU 1 into ACCU 2. Load contents of ID24 into

ACCU 1E OD //Combine bits from ACCU 1 with ACCU 2 bits by OR; store result in

ACCU 1E T MD8 //Transfer result to MD8

�M�@������!"'OD�n��=����Constant�!"�Q�'`���������M���<��><#�ACCU1�M�@�><#'�OD����&�+�����!"�g������,1�#'�>����ACCU1�!�J��MD��4��

��L ID20 //Load contents of ID20 into ACCU 1E

OD DW#16#0FFF_EF21 //Combine bits of ACCU 1 with bit pattern of 32-bit

constant

�tttt�wwww�wwww�wwww�wwwt�wwww�ttwt�tttw�� by OR, store result in

ACCU 1E

JP NEXT //Jump to NEXT jump label if result is not equal to zero, (CC 1�� w�

��XOD Exclusive OR Double Word : 32-Bit��

���&$16�����`��TK9#'4��

XOD��XOD Constant��

���!"�Q�'`���������M�������`��M���><#�l��ACCU1���/�D����������M����'�ACCU2��

Page 33: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

���k�D�4��

L ID20 //Load contents of ID20 into ACCU 1E L ID24 //Load contents of ACCU 1 into ACCU 2. Load contents of ID24 into

ACCU 1E XOD //Combine bits from ACCU 1 with ACCU 2 by XOR; store result in ACCU

wE

T MD8 //Transfer result to MD8

���M�@������!"'XOD�n��=����Constant�!"�Q�'`���������M���<��><#�ACCU1�M�@�><#'�XOD�

�!"�g������,1�#'�>��������&�+���ACCU1�!�J��MD��4��

L ID20 //Load contents of ID20 into ACCU 1E XOD DW#16#0FFF_EF21 //Combine bits from ACCU 1 with bit pattern of 32-bit

constant

�tttt�wwww�wwww�wwww�wwww�wwwt�ttwt�tttw�� by XOR, store result in

ACCU 1E JP NEXT //Jump to NEXT jump label if result is unequal to zero, (CC 1 = 1

�����STU�[�1/.�M ��5��@��1���!<���>U`����6��'�H�K.�Q�-��G�i� �����$`��M#1��� �������������:

�!U��������4��A�����6������$`��Integer numbers 16 bits���

A���%����O@�N��������6������$`��Double integers 32 bits��A��#��:������$`��Real numbers��

A1����5�@���:�������$`���(Binary coded decimal BCD����

����

BTI BCD to Integer����

��#1<���M#1�<���1�#���`���TU'Accumulator-1��G�i� ��BCD� ��,1���v� ���p'��<�����$.�ttt��C����oD��V��i�>�$�Q�-�4��

�>����x}����?/�!"�!�J� �,1�#�BCD��/�K���$9��MD�#�>�$�M ��4wttw�A�wttt�A�twwt�A�tttt����%�@'��G�6���Q�-�M#1�<�Integer�!�J� �,1�#��4tttw�A�wtww�A�ttwt�A�tttt��

���k�D�4����

L MW10 //Load the BCD number into ACCU 1-LE BTI //Convert from BCD to integer; store result in ACCU 1-LE

T MW20 //Transfer result (integer number) to MW20

��

Page 34: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

ITB Integer (16-Bit) to BCD����

�&$16���Q�-�����6���&$16��� ��>�����k1�#�l�������:�������:�����1�#���`���TU'BCD���k�D�4��

L MW10 //Load the integer number into ACCU 1-LE ITB //Convert from integer to BCD (16-bit); store result in ACCU 1-LE

T MW20 //Transfer result (BCD number) to MW20

��BTD BCD to Integer-32 bits��

���>�$�M#1�<���1�#���`���TUvr��G�i� ���/�K�BCD��G�6���Q�-�Double integer��

�>�����H16�����������,1��'BCD�!U��4�C���C����!�J� �����2�'.���X1��4���>����rv�xs}A�,1�#��4wtttAtwttAtwwtAtwtwAttwwAttwtAttttAwwww��

�V��i�Q�-�I�#1���%�@'�4ttttAwtttAwtttAwttwAttwwAttttAttttAwttt�����k�D�4��

L MD10 //Load the BCD number into ACCU 1E BTD //Convert from BCD to integer; store result in ACCU 1E T MD20 //Transfer result (double integer number) to MD20

��������

ITD Integer - 16 Bit to Double Integer - 32-Bit����

��#1<���M#1�<���1�#�1U'Accumulator-1�V��6���&$1i� ��wx�Q�-��/�K�vr��"�Wz��]�Y'��/�K��$�Oi.tttttttttttttttt� ���/�L���Q�-�wx�Q<�'�vw�!"�Accumulator-1��

��/�L��� ��&$�+^���/�K�M�/'wx��/�L���Q�-�vr������k�D�4����

L MW12 //Load the integer number into ACCU 1E ITD //Convert from integer (16-bit) to double integer (32-bit); store result in

ACCU 1E T MD20 //Transfer result (double integer) to MD20

��DTB Double Integer (32-Bit) to BCD��

����O@�N����(��Y�����i� �����$`��M#1�<���1�#�1U'vr�&$16���Q�-��/�K�BCD��

Page 35: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

���k�D�4����

L MD10 //Load the 32-bit integer into ACCU 1E DTB //Convert from integer (32-bit) to BCD, store result in ACCU 1E

T MD20 //Transfer result (BCD number) to MD20

����

DTR Double Integer - 32-Bit to Floating-Point - 32-Bit��IEEE-FP��

����#1<���M#1�<���1�#�1U'Accumulator-1��#��:���&$16���Q�-��O@�N����(�����6����G�6��� ��

�!�J��M�����4��x.ye+/-z|A��

�l��|A�M���x���.�>��������:���&$�+^��!U�x�'�>����� ��V��6���*F����15"�y�'�B��:���*F����|A��'�a`��&$�+-�!U���/�D��z�>�����a.�!U�wt�oD��>�����$�6<K��%:��4��wtrs���A �MD����!�J��4w�trs��e+4A��

���k�D�4����

L MD10 //Load the 32-bit integer into ACCU 1E DTR //Convert from double integer to floating point (32-bit IEEE FP); store result

in ACCU 1E T MD20 //Transfer result (BCD number) to MD20

��INVI Ones Complement Integer -16-Bit��

��U��#1<���M#1�<���1�#���`���TAccumulator-1�!"����<���� #FL�'��#1<�����B(��`��a1�:����Q�-�

Accumulator-1����

�M �����1U�������M���B(��`��a1�:���'t�Q�-�w�M '�w�Q�-�t�oD��4���>�����4wtwtAttwwAwwttAtwtt����,1�#�4twtwAwwttAttwwAwtww��

���k�D�4����

L IW8 //Load value into ACCU 1-LE INVI //Form ones complement 16-bitE T MW10 //Transfer result to MW10

����

Page 36: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

INVD Ones Complement Double Integer -32-Bit����

�H1<���Q�@� ��'�������Z��������`��MD��1U'vr��/�K�Double integer�����k�D�4����

L ID8 //Load value into ACCU 1E INVD //Form ones complement (32-bitE�

T MD10 //Transfer result to MD10

��NEGI Twos Complement Integer -16-Bit��

����#1<���M#1�<���1�#�1U'Accumulator-1�!"��#1<����� #FL�'�>�����!7��D���a1�:����Q�-�

Accumulator-1���B(��`��a1�:����1U�������M���!7��D���a1�:���'�|w��

���>�����oD��4wtwwAwttwAtttwAwtwt���B(��`��4twttAtwwtAwwwtAtwtw���!7��D���4twtwAtwwtAwwwtAtwtw��

���k�D�4��

L IW8 //Load value into ACCU 1-LE NEGI //Form twos complement 16-bitE

T MW10 //Transfer result to MW10

����

NEGD Twos Complement Double Integer -32-Bit����

�Z��������`��8O/�1U'�B1<���Q�@� ��'vr�O@�N����(�V��i�>�$��/�K�����

NEGR Negate Floating-Point Number -32-Bit, IEEE-FP����

�B��:���>�����&$�+-�8�:���1�#���`���TU�!"����#��:�����o:���'Y���n/� ��Y-�|�,1��A8�:��'������k�D�4��

L ID8 //Load value into ACCU 1 example: ID 8 = 1.5E+02

NEGR //Negate floating-point number (32-bit, IEEE-FP); stores the result in

ACCU

wE

Page 37: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

T MD10 //Transfer result to MD10 example: result = -1.5E+02

����

CAW Change Byte Sequence in ACCU 1-L 16-Bit����

��/�K��������W'�M#%�<���1�#���`���TU'Accumulator-1�l���Q�'`����������,.Accumulator-1��Q�O2'����@� �<�� �(%@� ��,1�<#��High and Low���� �<@1�����5����� �M 'Bytes��Y-'�Q�O2'����@�

�Q�-��/�?/Accumulator-1� ��,1�<#�15"��15O�����T5��s�Bytes�!�J� ��5������,1�#�4��ACCU1-H-H , ACCU1-H-L , ACCU1-L-H , ACCU1-L-L

� ��,1�<���@1����M }���/�Kbits���M#%�<���1�#���`���TU'ACCU1-L-H , ACCU1-L-L�Q�@�*���^�����ACCU1-H-H , ACCU1-

H-L �oD��!U��� �4

wwtwAttwtAttttAwtwt�k��:<62��%:��CAW�,1���4��wwtwAttwtAwtwtAtttt��

���k�D�4����

L MW10 //Load the value of MW10 into ACCU 1E CAW //Reverse the sequence of bytes in ACCU 1-LE

T MW20 //Transfer the result to MW20

������

CAD Change Byte Sequence in ACCU 1 32-Bit����

�������M#%�<#��1�#���`���TU'Accumulator-1�H1<���Q�@�Words , Bytes�!�J� �4���!�i`������<���,� ��Y-4��

ACCU1-H-H , ACCU1-H-L , ACCU1-L-H , ACCU1-L-L <���,1�#��%:������ CAD� ACCU1-L-L , ACCU1-L-H , ACCU1-H-L , ACCU1-H-H

����#1<���n/� ��Y-�oD�Accumulator-14���

ttwtAwwwwAwtwwAtttw�k��:<2��%:��,1���CAD�!�J� �4��tttwAwtwwAwwwwAttwt��

���k�D�4����

L MD10 //Load the value of MD10 into ACCU 1E CAD //Reverse the sequence of bytes in ACCU 1E

T MD20 //Transfer the results to MD20

RND Round��

Page 38: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����#1<�����<:#���`���TUAccumulator-1��Y-'�V��i�>�$�;��.�Q�-�I��#1<���M#1�<���1�#'�B��@�>�$�

!X'F���>�����,1�#��#��<���,z"�!X'�'�B(�"� ���$� ����"������_6/�!"�������,� ����

�>�����oD��4wtt��><#��Q�-�I�#����wtt�>����'�wtt��A�Q�-�I�#����><#�wttA�����k�D�4����

L MD10 //Load the floating-point number into ACCU 1-LE RND //Convert the floating-point number (32-bit, IEEE-FP) into an integer (32-bit�

and round off the resultE T MD20 //Transfer result (double integer number) to MD20

��TRUNC Truncate��

�����(��#��:������$`��M#1�<���1�#���`���TU'vr��O@�N����(�V��i�>�$�Q�-��/�K�vr�0T���]�Y'��/�K�

�>�����oD�������������wtt���V�6#�wtt�>����'�w�t��A�V�6#�w�tA�����k�D�4����

L MD10 //Load the floating-point number into ACCU 1-LE TRUNC

Convert the floating-point number (32-bit, IEEE-FP) to an integer (32-bit� and round result. Store the result in ACCU 1E

T MD20 //Transfer result (double integer number) to MD20

��RND+ Round to Upper Double Integer��

����#1<�����<:#���`���TU'Accumulator-1�V��i�>�$��Gi.�Q�-��#1<������#��<���1�#'�B��@�>�$�

�!"��#1<�����]��� #FL�'�B��:���>�����B'��#�'.� ���� .Accumulator-1����

�oD��4�>����wst���,1�#�wsw�>����'�wsw��A�,1�#�wswA�����k�D�4����

L MD10 //Load the floating-point number (32-bit, IEEE-FP) into ACCU 1-LE RND+ //Convert the floating-point number (32-bit, IEEE-FP) to an integer (32-bit�

and round result. Store output in ACCU 1E T MD20 //Transfer result (double integer number) to MD20

Page 39: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

RND- Round to Lower Double Integer����

1<�����<:#��N#.���`���TU'��#Accumulator-1��Gi.�V��i�>�$��� .�Q�-��5�#1�<���1�#'�B��@�>�$��!"�g������ #FL�'�B��:���>�����B'��#�'.� �Accumulator-1��

���>�����oD�wrt�s�,1�#�wrt�>����'�wst�vA�,1�#�wswA��

���k�D�4����

L MD10 //Load the floating-point number into ACCU 1-LE RND- //Convert the floating-point number (32-bit, IEEE-FP) to an integer (32-bit�

and round result. Store result in ACCU 1E T MD20 //Transfer result (double integer number) to MD20

��3� ����Comparison instructions����

��#1<���,$�����5� ����'`��STUACCU1 , ACCU2����G�'�RLO������!"�!�#��� ����<��������2��<#�!��<���p����4��

���!�J� ��/$���������J����o:���k��:<2��><#4��

����/$��������o@Comparison signs��

���ACCU1 is equal to ACCU2� ���ACCU1 is not equal to ACCU2

��ACCU1 is greater than ACCU2

��ACCU1 is less than ACCU2

��� ACCU1 is greater than or equal to ACCU2

��� ACCU1 is less than or equal to ACCU2

����

��/$��������o@�%:���<�#�0���Z#��� @�>�������(�l��� ���/$������[1/�%#%���><#�]�T I , D , R��!�J� 4����

�I Compare Integer 16-Bit���D Compare Double Integer 32-Bit��

�R Compare Floating-Point Number 32-Bit������

���������>�����O���Z ��#���3� ��ab��3 A���

Page 40: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

Compare Integer 16-Bit - ? I������

�Format����I, <>I, >I, <I, >=I, <=I

����

��#1<����/$����><����U'ACCU1 , ACCU2�V��i�>�$�&$1i�!"�wx����G�'��/�K�RLO���������<��������k�D�4����

L MW10 //Load contents of MW10 (16-bit integerE� L IW24 //Load contents of IW24 (16-bit integerE�

�I //Compare if ACCU 2-L (MW10) is greater (>) than ACCU 1- L (IW24E� ��M 2.0 //RLO = 1 if MW10 > IW24

������#1<���,.��?�o����RLO�!�J� ���G<��4��

��#1<���,1���;1������������Z�����Y-RLO�!U�A�w����#1<���,1���������Z��<#�>���Y-RLO�!U�A�t��

�������'���o:���n/� ��#.��

����Q/ c������������>�����O���Z ��#���3� ��de�3 A���

Compare Double Integer 32-Bit����

Format����D, <>D, >D, <D, >=D, <=D

����#1<����/$����><����U'ACCU1 , ACCU2��O@�N����(�'Y�V��i�>�$�&$1i�!"�vr����G�'��/�K�

RLO���<��������������k�D�4����

L MD10 //Load contents of MD10 (double integer, 32 bitsE� L ID24 //Load contents of ID24 (double integer, 32 bitsE�

�D //Compare if ACCU 2 (MD10) is greater (>) than ACCU 1 (ID24E� ��M 2.0 //RLO = 1 if MD10 > ID24

����

����������>����S&���Z ��#���3� �de�3 A���

Page 41: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

Compare Floating-Point Number 32-Bit����

Format����R, <>R, >R, <R, >=R, <=R

������

��#1<����/$����><����U'ACCU1 , ACCU2���(�'Y�B��@�>�$�&$1i�!"�vr����G�'��/�K�RLO����<����������

���k�D�4����

L MD10 //Load contents of MD10 (floating-point numberE� L 1.359E+02 //Load the constant 1.359E+02E

�R //Compare if ACCU 2 (MD10) is greater (>) than ACCU 1 (1.359-E+02E� ��M 2.0 //RLO = 1 if MD10 > 1.359E+02

������������

�������� ��/�5��J �������� ��� ��R�?*;���0��#��0f������

�3'.�4���K�%<��������:��Nested operations�����

� ���MK�%��c��U�,���`��>?:��!"���/-'�Z����B��1��M�i1��'.�Z����!��1��M�i1������:���M �n���"�!��<���k�D����MD��c�Y'��TU� ���d�L���!@%<�#�����:��4��

��

Page 42: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

�����@�c��U�Z������k�D����!O"AND�!<���@� ���OR����:���(����.%�/'� �<�2�2.�������

������������������������

O And before Or����

�!U��5�����:����G�6��'�4O���M�@�><#�STU�!"ORing�����@�g7�</�Q�@�ANDing�!��<���Q��D���� ���TU�VN<#'�����2�4��

��

Page 43: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

A( And with Nesting Open����

��5�����:����G�6��'�4A�����

�M�:���1�#���`���TU'ANDing�����@�g7�<���ORing�!��<���k�D����MD������2�4����

����

����

AN( And Not with Nesting Open����

�;��i�L���o�6O<���8O/���`���T5�'A��!�#����I�D�'��������O( Or with Nesting Open��

ON( Or Not with Nesting Open��X( Exclusive Or with Nesting Open��

Page 44: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

XN( Exclusive Or Not with Nesting Open����

�Z�R��#�5����!"�><#'�!��<�����`���a1�����TU�Z�G���������G��B.�MD��p1<O��a1��I�"�MK�%��B.4����

��Nesting Closed�����1U�a�1�`��MK�%�� ��(%@�Q6�.�,.��?�o����#'��!�<O�������(%@�,1�#�,.�%�3'����(%:���#'���

�Z�G��������T�O�<���!"�9�K�g��/�����!�:#�01�"�3-'����

�0��< �����'.�Q�-�,J�'�&$�+^���"����(16��������0�:���&$16���Q�-�3'.��?�/���`��>5O��'�&$�+-��"��4����

����

� ��k��</3��%�@�!U'�Q�'`���"������/%�@���5"t�Q�-�w�Q���'�Positive edge���/�D��'���X1�����"�����'.�� ��k��</3��%�@w�Q�-�t�Q���'�Negative egde�< 3���.�c��U'����������"������!�J� ���G<����TU�0�4��

��FN Edge Negative��

���T�O�<�����O� �Q�@�!��<���k�D����T�O�<������!O�m1���*�(`��>5O/�!��'����������"�����0��< 3�1U'4��

���M�+�!"���#����,1�#��T5�'�d�"�g��/�����T�O���&$'%��(1X1��,1�#�\�L���,z"�k�D�����TU��?�o�� �'

Impulse$'(�k1������'.�g��/�����T�O���&����

FP Edge Positive����

�T�O�<�����O� �Q�@�!��<���k�D����T�O�<������!O�m1���*�(`��>5O/�!��'���X1�����"�����0��< 3�1U'4��

Page 45: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

����M��:</�_� ��:��0�:<���,J�'Counters�Q�@�><��!<�������:���,z"��:#�2�&�?��'��(�%:���'.��'.�Q�@`�%:�����-�!U�(�%:���M�+�!"���-�(�%:����5��-�Mi'�!<����������M�����'.�MO2`�%:��BCD�'.�

Binary���2`��!"�M�6O<����]�Y�b�:<�/�012'�(�%:�����O6��'.����:�������Q�@�(�%:��������d�W�'.������<����������4��

��FR Enable Counter��

���'�I���#�BT���������Z����%�@�(�%:���M�G���!"�*%����!�:#�1U'�,1�#���/-'�%:���*%��1U���U�(16�����8�

�I��@�><��!<�������:��� ��B`�FU�X�(�%:�������k�D�4����

A I 2.0 //Check signal state at input I 2.0��FR C3 //Enable counter C3 when RLO transitions from 0 to 1��

������

L Load Current Counter Value into ACCU 1����

���#1<���M�����B.�MK�(���������(�%:�ACCU1-L��#1<���M�/�><#�,.�%:��ACCU1�Q�-�M�������ACCU2��

���k�D�4��

L C3 //Load ACCU 1-L with the count value of counter C3 in binary format����

�Q�-�(�%:��� ���/������M�/���O� �VW1#�!��<���M����ACCU1����

Page 46: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

LC Load Current Counter Value into ACCU 1 as BCD����

�Q�-�I��-�$������(�%:��� ���/������M��#� ��'�Z��������`��M�@�8O����1�#�1U'ACCU1�M�+�!"�BCD�����k�D�4��

LC C3 //Load ACCU 1-L with the count value of counter C3 in binary coded

decimal��format��

���(�%:��� ���/������M�/���O� �VW1#�!��<���M����'C3�Q�-�ACCU1�M�+�!"�BCD��

����

Page 47: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��R Reset Counter��

���M���<���1�#�1U'��t���;1������������Z����%�@�I��-�$������(�%:���MK�(��

�k�D�4��A I 2.3 //Check signal state at input I 2.3��

R C3 //Reset counter C3 to a value of 0 if RLO transitions from 0 to 1����

S Set Counter Preset Value����

� ��%:���������(�%:���M���<���1�#ACCU1-L�&$1i�!"�,1���l����BCD;1������������Z����%�@���A I 2.3 //Check signal state at input I 2.3��

L C#3 //Load count value 3 into ACCU 1-L��S C1 //Set counter C1 to count value if RLO transitions from 0 to 1��

��CU Counter Up��

���(�%:��������&(�#��B.��w���� ��M�.�(�%:��������,.�������������Z����%�@���������>�����Q�-�k1i1���%�@'

���������\'�K����Q�@`�%:��� @�(�%:���_�1<#'�*��X^���T5����=9��B.�%X1#�3�(�%:���!"��w����/�K�Q�@OV - Overflow�����:���g7�</���������/�K�Q�@�Status bit register��

���k�D�4��

A I 2.1 //If there is a positive edge change at input I 2.1��CU C3 //Counter C3 is incremented by 1 when RL0 transitions from 0 to 1��

����

��CD Counter Down��

���(�%:����#1<���f��/z���1�#�1U'��w���� ���� .�(�%:�������������'�;1������������Z����%�@��t�����Yz"

����2�>����%�.�%:#�3'�,�6����� @�_�1<#�(�%:���,z"��O6���Q�-�(�%:��������n�i'���k�D�4��

L C#14 //Counter preset value��A I 0.1 //Preset counter after detection of rising edge of I 0.1��

S C1 //Load counter 1 preset if enabled��A I 0.0 //One count down per rising edge of I 0.0��

CD C1 //Decrement counter C1 by 1 when RL0 transitions from 0 to 1 depending

on input��I 0.0��

AN C1 //Zero detection using the C1 bit��Q 0.0 //Q 0.0 = 1 if counter 1 value is zero��

��

Page 48: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��<<����,1�#�g��/�����T�O���������,z"�����2����O����� �I�X1��c��U� �#�>���������<����B.����<������������

�*����g��/�����!:������M���<�������q%�#�l�����U�I�@�q%�</����1U'� �:��y+�TO����g��/������'����BT���%#%����,�������T5��,�1�@�Z#��� @�S%#%���><#��Kj�,����Q�-�T�O�<���I�X1��><��� �:����+����</�Q�@

�I��-��UT#����

'���U�,�<���@���#%����UJump�'�Loop�Z#��� @�I��-�;�UT���><#�BT���,�1�:�����%L<2��><#� �<�����!"'�Label�Q�@�,���`��%�<:#'�0����.%���,.�Q�@��:�$.��U(%@����$`�'�0'����� ���@1���� ��,1���

�T�O�<������������������������:������</RLO�M�i�O<���!�#����"'���������

JU Jump Unconditional����

Format��JU jump label��

jump label : Symbolic name of jump destination����

�,����Q�-�k��</3�'�g��/�����T�O�<��!:������M���<�������><#�����:���STU�!"label�B.����</�Q�-��?����,'(����`��(1X'�&$'�W��?�o����������������@JU�'�label�8O/�!"�block���

��D��k�4��

��A I 1.0��A I 1.2��

JC DELE //Jump if RLO=1 to jump label DELEL MB10��INC 1��

T MB10��JU FORW //Jump unconditionally to jump label FORW��

DELE: L 0��T MB10��

FORW: A I 2.1 //Program scan resumes here after jump to jump label FORW��������

JL Jump to Labels��Format��

JL jump label��jump label Symbolic name of jump destinationE��

����

Page 49: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�(%:<�����=1���I��@�Z��#����1U'multiple jump� ���>�$������%#%���><#�l���t�'�r�x�(%�#�BT���1U'���#1<���Q�@�*����I/.�l����=1�������@����</ACCU1-L-L Byte����< �%�@'��=1����5X'�%#%���><#�

�I/z"���`���TU�,1�#�k'`��������$1�2�&%@�Q�@�I<��< �><#JL�F������@1�<��label�><#�BT���,�������!��<���������,1�#'�I��-�k��</3�JU��#1<��������!"�I��-�k��</3��><#�BT���,������F�����@1�<��

ACCU1-L-L�l��D��'��O6��JU<�����n/� ��Y-�I��-�k��</3��(��#�BT���,������F�����@1�<����#1w��T�U'��;���W��<"3���#1<�����Q6�`��%���� ��M�.���K`��������,1�#�Q<�w��D .�!��<���k�D����VW1#�012'�

4��L MB0 //Load jump destination number into ACCU 1-L-L��

JL LSTX //Jump destination if ACCU 1-L-L > 3��JU SEG0 //Jump destination if ACCU 1-L-L = 0��JU SEG1 //Jump destination if ACCU 1-L-L = 1��

JU COMM //Jump destination if ACCU 1-L-L = 2��JU SEG3 //Jump destination if ACCU 1-L-L = 3��

LSTX: JU COMM��SEG0: * //Permitted instruction��

u��JU COMM��

SEG1: * //Permitted instruction��u��

JU COMM��SEG3: * //Permitted instruction��

u��JU COMM��

COMM: * //Permitted instruction����u������

JC Jump if RLO = 1����

Format��JC jump label��

jump label Symbolic name of jump destination����

����</�Q�@�*������`���TU�!"'RLO�n/� ��Yz"�w�;�(%�����,������Q�-�k��</3��><#�label�,1�#�,.��1�#'��,����Q�-�k��</3��8O/�MK�(�k��</3��,1�#�,�������!����,����'.�Z��2block��

�k�D��4��A I 1.0��A I 1.2��

JC JOVR //Jump if RLO=1 to jump label JOVR��L IW8 //Program scan continues here if jump is not executed��

T MW22��

Page 50: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

JOVR: A I 2.1 //Program scan resumes here after jump to jump label JOVR����

JCN Jump if RLO = 0����

Format��JCN jump label��

jump label Symbolic name of jump destination������

����</������!"�k��</3��><#���`���TU�!"'RLO�8��'��O6��wZ��������`���Oi�1��8O/�I�'������k�D�4����

A I 1.0��A I 1.2��

JCN JOVR //Jump if RLO = 0 to jump label JOVR��L IW8 //Program scan continues here if jump is not executed��

T MW22��JOVR: A I 2.1 //Program scan resumes here after jump to jump label JOVR��

����

JCB Jump if RLO = 1 with BR����

Format��JCB jump label��

jump label Symbolic name of jump destination������

���`���������STU�!"���.�MD�JC�d�W����������BRbit�������RLO�'.��Oi�*�12�w�����k�D�4��

A I 1.0��A I 1.2��

JCB JOVR //Jump if RLO = 1 to jump label JOVR. Copy the contents of the RLO

bit into the BR bit��L IW8 //Program scan continues here if jump is not executed��

T MW22��JOVR: A I 2.1 //Program scan resumes here after jump to jump label JOVR��

����

JNB Jump if RLO = 0 with BR����

Page 51: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

Format��JNB jump label��

jump label Symbolic name of jump destination����

�k�D�4��A I 1.0��A I 1.2��

JNB JOVR //Jump if RLO = 0 to jump label JOVR. Copy RLO bit contents into the

BR bit��L IW8 //Program scan continues here if jump is not executed��

T MW22��JOVR: A I 2.1 //Program scan resumes here after jump to jump label JOVR��

��JBI Jump if BR = 1��

��Format��

JBI jump label����

jump label Symbolic name of jump destination������

��</o����`���TU'�F������(%���g��/�����!"� �:��,����Q�-�klabel��������G��Q�@�*����BR�!"�Status

register word�Q�-�w����

JNBI Jump if BR = 0����

Format��JNBI jump label��

��jump label Symbolic name of jump destination��

Description������

�F������(%���g��/�����!"�,����Q�-�k��</o��1U'label"���/�K���G�������!BR�Q�-�t������������

JO Jump if OV = 1����

Format��

Page 52: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

JO jump label��jump label Symbolic name of jump destination��

�F������(%���g��/�����!"�,����Q�-�k��</o��1U'label��/�K���G�������!"�OV����B.Overflow����Q�-w���k�D�4��

L MW10��L 3��

uI //Multiply contents of MW10 by "3���JO OVER //Jump if result exceeds maximum range OV=1��

T MW10 //Program scan continues here if jump is not executed��A M 4.0��R M 4.0��

JU NEXT��OVER: AN M 4.0 //Program scan resumes here after jump to jump label OVER��

S M 4.0��NEXT: NOP 0 //Program scan resumes here after jump to jump label NEXT��

������

JOS Jump if OS = 1����

Format��JOS jump label��

jump label Symbolic name of jump destination���F������(%�����,������Q�-�k��</3��1U'label��/�L��������!"�OS�Q�-�w���k�D�4��

L IW10��L MW12��

uI��L DBW25��

|I��L MW14��

AI��JOS OVER //Jump if overflow in one of the three instructions during��

calculation OS=1���See Note��

T MW16 //Program scan continues here if jump is not executed��A M 4.0��R M 4.0��

JU NEXT��OVER: AN M 4.0 //Program scan resumes here after jump to jump label OVER��

S M 4.0��NEXT: NOP 0 //Program scan resumes here after jump to jump label NEXT��

Page 53: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��������������������

Note����

In this case do not use the JO instruction. The JO instruction would only check the��previous -I instruction if an overflow occurred��

������

JZ Jump if Zero����

Format��JZ jump label��

jump label : Symbolic name of jump destination��������!"CC 1 = 0�'�CC 0 = 0�F������(%������W1����Q�-�k��</3��><#�label��

�k�D�4��L MW10��SRW 1��

JZ ZERO //Jump to jump label ZERO if bit that has been shifted out = 0��L MW2 //Program scan continues here if jump is not executed��

INC 1��T MW2��

JU NEXT������

ZERO: L MW4 //Program scan resumes here after jump to jump label ZERO��INC 1��

T MW4��NEXT: NOP 0 //Program scan resumes here after jump to jump label���

NEXT������

JN Jump if Not Zero��Format��

Page 54: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

JN jump label��jump label : Symbolic name of jump destination��

�F������(%�����,������Q�-�k��</3��><#�!��<���������Z�����Y-label���CC 1=0/CC 0=1 or CC 1=1/CC 0=0���

�k�D�4��L IW8��

L MW12��XOW��

JN NOZE //Jump if the contents of ACCU 1-L are not equal to zero��AN M 4.0 //Program scan continues here if jump is not executed��

S M 4.0��JU NEXT��

NOZE: AN M 4.1 //Program scan resumes here after jump to jump label NOZE��S M 4.1��

NEXT: NOP 0 //Program scan resumes here after jump to jump label NEXT������

JP Jump if Plus����

Format��JP jump label��

jump label : Symbolic name of jump destination������

�B.��O6��� ���� .�����@��Kj����</������!"CC 1 = 1 and CC 0 = 0�(%�����,������Q�-�k��</3��><#��F�����label�����k�D�4����

L IW8��L MW12��

AI //Subtract contents of MW12 from contents of IW8��JP POS //Jump if result >0 that is, ACCU 1 > 0��

AN M 4.0 //Program scan continues here if jump is not executed��S M 4.0��

JU NEXT��POS: AN M 4.1 //Program scan resumes here after jump to jump label POS��

S M 4.1��NEXT: NOP 0 //Program scan resumes here after jump to jump label NEXT���

����

JM Jump if Minus��

Page 55: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��Format��

JM jump label��jump label : Symbolic name of jump destination��

����

�B.��O6��� ��M�.�����@��Kj����</������!"CC 1 = 0 and CC 0 = 1�(%�����,������Q�-�k��</3��><#��F�����label�����k�D�4����

L IW8��L MW12��

AI //Subtract contents of MW12 from contents of IW8��JM NEG //Jump if result < 0 that is, contents of ACCU 1 < 0��

AN M 4.0 //Program scan continues here if jump is not executed��S M 4.0��

JU NEXT��NEG: AN M 4.1 //Program scan resumes here after jump to jump label NEG��

S M 4.1��NEXT: NOP 0 //Program scan resumes here after jump to jump label NEXT��

����

JPZ Jump if Plus or Zero����

Format��JPZ jump label��

jump label : Symbolic name of jump destination������

B.��O6���B'����'.� ���� .�����@��Kj����</������!"���CC 1=0/CC 0=0 or CC 1=1/CC 0=0���F������(%�����,������Q�-�k��</3��><#label��

���k�D�4����

L IW8��L MW12��

AI //Subtract contents of MW12 from contents of IW8��JPZ REG0 //Jump if result >=0 that is, contents of ACCU 1 >= 0��AN M 4.0 //Program scan continues here if jump is not executed��

S M 4.0��JU NEXT��

Page 56: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

REG0: AN M 4.1 //Program scan resumes here after jump to jump label���REG0��

S M 4.1��NEXT: NOP 0 //Program scan resumes here after jump to jump label NEXT��

����

JMZ Jump if Minus or Zero����

Format��JMZ jump label��

jump label : Symbolic name of jump destination������

�B.��O6���B'��#�'.� ��M�.����<���������!"CC 1=0/CC 0=0 or CC 1=0/CC 0=1�Q�-�k��</3��><#��F������(%�����,�����label���

���k�D�4����

L IW8��L MW12��

AI //Subtract contents of MW12 from contents of IW8��JMZ RGE0 //Jump if result <=0 that is, contents of ACCU 1 <= 0��AN M 4.0 //Program scan continues here if jump is not executed��

S M 4.0��JU NEXT��

RGE0: AN M 4.1 //Program scan resumes here after jump to jump label RGE0��S M 4.1��

NEXT: NOP 0 //Program scan resumes here after jump to jump label NEXT����������

JUO Jump if Unordered����

Format��JUO jump label��

jump label : Symbolic name of jump destination����

�B.�&(%�����R����<���������!"CC 1 = 1 and CC 0 = 1����J��3����� ��B.�!"�Z��<#��TU'�4��A�Oi�Q�@��������%�@���

A�y��K�M������.�k��:<2��%�@���������������M��:<�����A�Z���<���!"�9�K�(1X'������!"��#��:������$`���/$����%�@�Format��

Page 57: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

������Q�-�k��</3��><#��U%�@'�F������(%�����,label����

L MD10��L ID2��

D //Divide contents of MD10 by contents of ID2��JUO ERRO //Jump if division by zero that is, ID2 = 0��

T MD14 //Program scan continues here if jump is not executed��A M 4.0��R M 4.0��

JU NEXT��ERRO: AN M 4.0 //Program scan resumes here after jump to jump label ERRO��

S M 4.0��NEXT: NOP 0 //Program scan resumes here after jump to jump label NEXT��

����

LOOP Loop����

Format��LOOP jump label��

jump label : Symbolic name of jump destination������

�F������(%�����,������Q�-�k��</3��><#label1<�����������#ACCU1-L�><#�&���M �!"'��O6��� ���� .���#1<���M����ACCU1-L�$�%����w��

�k�D�4��Example for calculating the factor of 5��

��L L#1 //Load the integer constant (32 bit) into ACCU 1��

T MD20 //Transfer the contents from ACCU 1 into MD20 :initialization��L 5 //Load number of loop cycles into ACCU 1-L��

NEXT: T MW10 //Jump label = loop start / transfer ACCU 1-L to loop counter��L MD20��

�uD //Multiply current contents of MD20 by the current contents of MB10T���MD20 //Transfer the multiplication result to MD20��

L MW10 //Load contents of loop counter into ACCU 1��LOOP NEXT //Decrement the contents of ACCU 1 and jump to the NEXT jump

label if��ACCU 1-L > 0��

L MW24 //Program scan resumes here after loop is finished��L 200��

�I����

Page 58: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��7�m'�*�@%<2�������R�Z�:<���5��b�:</�012�!<�������:<���STU�g��/����� �� �:��*FX�*�5/-�'.����:��_

���.����.�M�6O<�����5��b�:/�012'����

BE Block End����

��G�6���TK9#���`���TU'BE�*�5/z���1�#��������1U'����<����!"�Block�,� �*�12�T�O�<���%���OB�'.�FC�'.�FB1�'�g��/�����M�G���������!"�!��<�����`��Q�-�&�+����M�<�#'�[1/�B.�'.��!"�oD���TU�,� �OB1�,z"�

�k'.� ��T�O�<���*%��!�:#��TUBlock!������M����T�O�<���k���<2���%@'�H�K.�&��������k�D�4����

A I 1.0

JC NEXT //Jump to NEXT jump label if RLO = 1 , I 1.0 = 1

L IW4 //Continue here if no jump is executed

T IW10

A I 6.0

A I 6.1

S M 12.0

BE //Block end

NEXT: NOP 0

Continue here if jump is executed

����

��BEC Block End Conditional��

����

�,1���B.�I��Z������������Z�����Y-�3-�ST�O���><#�3�I/.��%@�������Z������MD����`���TU'RLO=1�!"���.��������Z�����%@�����RLO=0���`��Q�@�g��/�����$'���%�@�BEC�3�I/z"�T�O�<���><#��

���k�D�4����

A I 1.0 //Update RLO��BEC //End block if RLO = 1��

L IW4 //Continue here if BEC is not executed, RLO = 0��T MW10��

������

BEU Block End Unconditional����

Page 59: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��� ��'�I������"�%X.�3BE�*�5/z���1�#�l���Block����</�'.���+�Q�@�(��<@3��,'(�RLO��

������

CALL Block Call��Format��

CALL : logic block identifier������

�,.�l��logic block identifier�,1�#�,.� ��#�4����

FC : Function --> CALL FCn��SFC : System function --> CALL SFCn��

FB : Function block --> CALL FBn1,DBn2��SFB : System function block --> CALL SFBn1,DBn2��

������

#���`���TU'�*�@%<23��%L<�FC,FB,SFC,SFB�$��<@3��!"��W1������BF������5�2���'.��5�����*�12��>�$�\�$(-�;1X'Data Block DB� ��M������6����FB , SFB���`�����< ���#���!"�VW�'�1U��� �

�Q�-�g��/�����T�O���M�����1�#�1U'�����������2`��!"FC,FB,SFC,SFB�$��<@��B.�,'(�;1������<������.�!�#�BT���������Q�-�g��/�����(1:#�T�O�<����5</��%:�'�I��#1Callg��/�����!:������M���<���!"���

���'.��U{��/-�><#�B.�M:O����&(1X1��k�'(�*�@%<23�M�:<�#���`���TU�,.�$��<@3��!"��W1�����#�]�T

�!�:��3�Q<��*�@%<23��M����5X�$(-CPUg��/������T�O���!"�9�K�����

�� �'����%���Q�-����G<�����#��������@��:�$`��[�1/`�� ����O�m'����(�B.�*�@%<2��%�@��%X����5���$1�`��U(1X'������!"���O�m1��Passing parameters����

����J����D�`�� ��]�Y�VN<#�012'4����

Example : Assigning parameters to the FC6 call��������

CALL FC6��Formal parameter Actual parameter��

NO OF TOOL := MW100��TIME OUT := MW110��

FOUND := Q 0.1��ERROR := Q 100.0��

Page 60: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

����

�MK�(�I<�����><#����!U����`��,1��������G<����,.�l��FB�&(%�����>�������-�!5"��$�`��,1������.�T�O�<�����1������>�����]���Q�@�B1<�#�BT���,�1�:���'.����G<�����

��Example : Calling FB99 with instance data block DB1��

����

CALL FB99,DB1��Formal parameter Actual parameter��

MAX_RPM := #RPM1_MAX��MIN_RPM := #RPM1��

MAX_POWER := #POWER1��MAX_TEMP := #TEMP1��

����������

Call FB����

Format��CALL FB n1, DB n1��

���O�m1���k�'%���*�@%<23��%L<�#���`���TUFB�!<����*�@%<23��><#'�g��/������/�i�Z#��� @��5��@�>��,�1�: address����<����?����,'(�d�"�RLO�%#%�����U���#'��5��#1<����Data block DB����6����

�M�����!"��U%:�����Q�-��UT�O���%:��g��/������#�l���!����<���M�����8O�����O�m1������%���T�O���,1�#'��5��#'�!:������g��/�����F�$��U{��@-�>���Y-��UF����'.��5�2������%���*�@%<2�� �Symbol��

�����O�m1������%���Q�-��/�������#���Passing parameters��

��X�L�����5X''��5��oK%����$(�6��%#%���><#�,.����%���*�@%<2��%�@����"����G<�����(�M���,.�l��'�!�J��k�D����MD���5��4��

��CALL FB99,DB1��

Formal parameter Actual parameter��MAX_RPM := #RPM1_MAX��

MIN_RPM := #RPM1��MAX_POWER := #POWER1��

MAX_TEMP := #TEMP1����

��Kj�k�D�4��CALL FB99,DB2��

Formal parameter Actual parameter��

Page 61: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

MAX_RPM := #RPM2_MAX��MIN_RPM := #RPM2��

MAX_POWER := #POWER2��MAX_TEMP := #TEMP2��

����

Call FC������

Format��CALL FC n��

����

�[1���� ����O�m'����(�*�@%<23��%L<�#���`���TUFC����</�'.��5��#1<���Q�-��?����,'(�RLO��UT�O���%:�'��UF����'.��5�2����U{�@%<2�� ��#�]�T �!:������M���<���M����g��/�����T�O���k���<2��><#��

����

���O�m1������%���Q�-��/�������#���Passing parameters����

��X�L�����5X''��5��oK%����$(�6��%#%���><#�,.����%���*�@%<2��%�@����"����G<�����(�M���,.�l��'�!�J��k�D����MD���5��4��

��CALL FC6��

Formal parameter Actual parameter��NO OF TOOL := MW100��

TIME OUT := MW110��FOUND := Q0.1��

ERROR := Q100.0������

Call SFB����

Format��CALL SFB n1, DB n2��

���8���2� ���i�L�����O�m1���k�'%���*�@%<23��%L<�#���`���TU'standard function blocks (SFBs)

supplied by Siemens�%#%����N#.���#'�Data block�Q�@�Z���#�����5��@�Z���#'����%������6�����/�������#����]�T '�������������:<����

���k�D�4����

CALL SFB4,DB4��

Page 62: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

Formal parameter Actual parameter��IN: I0.1��

PT: T#20s��Q: M0.0��

ET: MW10������

��Call SFC��

��Format��

CALL SFC n������

�[1���� ��8���2�\�</-� ����O�m'����(�*�@%<23���`���TUstandard functions (SFCs) supplied

by Siemens����</�'.��U�1<�����?����,'(�RLO��5�@�g<�#������[�1/�����������I�1��Z�2�����5��@�Z���#'�/�������#����]�T '���O�m1���k�'%��� ��H�K`���

���k�D�4����

CALL SFC43 //Call SFC43 to re-trigger watchdog timer - no parameters����������������������

������O���Z ��#��B/�E*���*������ ;����� ��&�������

Integer math instructions������

�U���%L<����������������G<���'��/������[�1/.�!"�]�Y��/($'.�,.�Z�2��� �����6������$`�� ��,�@1/�c��!"S7��

���%����Y�����6������$`����U'wx��/�K�Integers���%����Y�����6������$`�'�vr�Q���'��/�K�Double or Long Integers���

��

Page 63: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��=9�� @���.Status word���������:�����!"��/�L���]�����%L<2�� ��#'�]�Y� ��#�!��<���k'%���"������g��/�����k'�<� 4��

���Add ACCU 1 and ACCU 2 as Integer -16-Bit : +I��

�� �X*����� DCACCU1-L�� �X*���B�C�ACCU2-L�������*����9D���ACCU1-L����

��������G<�'Status wordZ������k'%����!"��� ����<��������������������k�D�4����

L IW10� Load the value of IW10 into ACCU 1-L

L MW14

Load the contents of ACCU1-L into ACCU2-L �Load the value of MW14 into ACCU1-L

I�|

Add ACCU 2-L and ACCU 1-L; store the result in ACCU 1-L T DB1.DBW25�

The contents of ACCU 1-L (result) are transferred to DBW25 of DB1 ��

����������������������

Subtract ACCU 1 from ACCU 2 as Integer -16-Bit : -I���� �X*���g��ACCU1-L�� �X*���5��ACCU2-L�������*����9D���ACCU1-L��

����#1<�����G<�����<��������'Status wordZ������k'%�����������

���k�D�4����

L IW10

Load the value of IW10 into ACCU 1-L L MW14

Load the contents of ACCU 1-L into ACCU 2-L

Page 64: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

Load the value of MW14 into ACCU 1-L

IA Subtract ACCU 1-L from ACCU 2-L; store the result in ACCU 1- L

T DB1.DBW25

The contents of ACCU 1-L (result) are transferred to DBW25 of DB1

��Multiply ACCU 1 and ACCU 2 as Integer 16-Bit : *I��

�� �X*���h�DACCU1-L�� �X*������ACCU2-L���������*����9D���de�����3 A�ACCU1����

��=9���?�o����Status wordZ������k'%���������g7�<����������k�D�4��

��L IW10�

Load the value of IW10 into ACCU 1-L L MW14�

Load contents of ACCU 1-L into ACCU 2-L Load contents of MW14 into ACCU1-L

I�u

Multiply ACCU 2-L and ACCU 1-L, store result in ACCU 1 T DB1.DBD25�

The contents of ACCU 1 (result) are transferred to DBW25 in DB1

Divide ACCU 2 by ACCU 1 as Integer 16-Bit : /I���� �X*�����;�ACCU1-L�� �X*���B/�ACC2-L�������*����9D���ACCU1�`�P�ACCU1-

L�����;����i� 3�B/�WX*���ACCU1-H��;������ ��B/�WX*�������

��=9���?�o����Status word�!��<���k'%������������<�����4����

Page 65: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

���k�D�4����

L IW10� Load the value of IW10 into ACCU 1-L

L MW14� Load the contents of ACCU 1-L into ACCU 2-L

Load the value of MW14 into ACCU 1-L I

Divide ACCU 2-L by ACCU 1-L store the result in ACCU 1: ACCU 1-L: quotient, ACCU 1-H: remainder

T MD20� The contents of ACCU 1 (result) are transferred to MD20

��Add Integer Constant 16-bitj�)���

���(�'Y�V��i�>�$��"�W-wx��#1<���Q�-��/�K�ACCU1-L�!"����<�����W''�ACCU1-L���=9<���,'(��Q�@Status word��

�!U���`��k��:<23����:����G�6�����4��Integer�����|��L IW10�

Load the value of IW10 into ACCU 1-L L MW14�

Load the contents of ACCU 1-L to ACCU 2-L� Load the value of MW14 into ACCU 1-L

I�|

Add ACCU 2-L and ACCU 1-L; store the result in ACCU 1-L r��|

Add ACCU 1-L and 25; store the result in ACCU 1-L T DB1.DBW25�

Transfer the contents of ACCU 1-L (result) to DBW25 of DB1 ��

Add ACCU 1 and ACCU 2 as Double Integer 32-Bit : +D����#1<����"�Wz����`���TU��1�#'ACCU1��#1<���Q�-�ACCU2�!"����<�����W''�ACCU1��������G�Status wordZ������*F����!"�k'%�����������

�������:����G�6���!U���%L<2o���4D��|��

�k�D�4��

Page 66: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

L ID10� Load the value of ID10 into ACCU1

L MD14� Load the contents of ACCU1 to ACCU2� Load the value of MD14 into ACCU1

D|� Add ACCU2 and ACCU1; store the result in ACCU1

T DB1.DBD25� The contents of ACCU 1 (result) are transferred to DBD25 of DB1

��Subtract ACCU 1 from ACCU 2 as Double Integer 32-bit : -D��

��#1<���p������`���TU��1�#ACCU1��#1<��� ��ACCU2�!"����<�����W''�ACCU1����G����������Status word�Z������k'%��� ����<�����������������

��U���������:����G�6���!���4D�A����

�k�D�4��L ID10�

Load the value of ID10 into ACCU 1 L MD14�

Load the contents of ACCU 1 into ACCU 2� Load the value of MD14 into ACCU 1

D �A

Subtract ACCU 1 from ACCU 2; store the result in ACCU 1 T DB1.DBD25

The contents of ACCU 1 (result) are transferred to DBD25 of DB1

��Multiply ACCU 1 and ACCU 2 as Double Integer 32-Bit : * D��

��#1<���;�N����`���TU��1�#ACCU1��#1<���!"�ACCU2�!"����<�����W''�ACCU1����G����������Status wordS� Y�Z������k'%�����������<�����������������

�����G�6�����������:����4D��u���

�k�D�4��L ID10�

Load the value of ID10 into ACCU 1 L MD14�

Load contents of ACCU 1 into ACCU 2 Load contents of MD14 into ACCU1

Du� Multiply ACCU 2 and ACCU 1; store the result in ACCU 1

T DB1.DBD25� The contents of ACCU 1 (result) are transferred to DBD25 in DB1

Page 67: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��Divide ACCU 2 by ACCU 1 as Double Integer 32-Bit : / D��

��#1<�����������`���TU��1�#ACCU2��#1<���Q�@�ACCU1�!"����<�����W'����ACCU1�g��� ����������G�����!�������Kj���.�c��U�l���!������8��'�d�"�����Status word�����'����<���������

Z������k'%�������

���������:����G�6�����4D������k�D�4����

L ID10� Load the value of ID10 into ACCU 1

L MD14� Load the contents of ACCU 1 into ACCU 2

Load the value of MD14 into ACCU 1 D�

Divide ACCU 2 by ACCU 1; store the result (quotient) in ACCU 1 T MD20�

The contents of ACCU 1 (result) are transferred to MD20 ��

MOD : Division Remainder Double Integer 32-Bit����#1<��������!���� #FL<����`���TU��1�#ACCU2��#1<���Q�@�ACCU1�!"�ACCU1�����������'����������G��><#����<���Status wordS� Y�Z������k'%�����������

�!U���������:����G�6�����4MOD�����k�D�4��

L ID10� Load the value of ID10 into ACCU 1

L MD14� Load the contents of ACCU 1 into ACCU 2

Load the value of MD14 into ACCU 1 MOD�

Divide ACCU 2 by ACCU 1, store the result (remainder) in ACCU 1 T MD20�

The contents of ACCU 1 (result) are transferred to MD20

��Add Integer Constant 32-Bitj�)���

�&$1i�!"�V��i�n��=��"�Wz����`���TU��1�#vr��#1<���Q�-��/�K�ACCU1�!"����<�����W''�ACCU1�Q�@���=9<����%@����Status word��

���G�6���!U���`���T5�����:������4��Integer 32-bit�����|��

��

Page 68: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�k�D�4����

L MD20

L MD24

|D� Add ACCU 1and ACCU 2; store the result in ACCU 1

L#-200|� Add ACCU 1 and -200; store the result in ACCU 1

T MD28

������������������������������������������������

���>�Z ��#��B/���� ;����� ��&������S&�����@&���k���������l��Floating-Point Math Instructions��

����

��������G�'��/������('%��k'%X�b�:��3'.�.%�/Status word�������������:������<������������

Page 69: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

���5��p1���������M�.'�Q6�9��f�K�9�K�B.�MD���3�!<��'���1������('%����M��#�k'`��*F���"��

"�!/�D���*F������.�0�6��MD��Status word���<����!"��=(������'��<������������������

�!"���U%�.�M�����><#� ����:��Q�@�><��!<��'��:�$`����2�2`������:���b�:��.%����,J�'ACCU1�><#'��!"��KJ��M����ACCU2�!"�����:������</� #FL��><#�>=�ACCU1�,.��?�o���������:���*�5</��%:��

U�����:���H1<���Q�@�><����vr�!"�M��� ���U���W'.�,.�Z�2�!<��'��#��:������$`����(�!U'��/�K��/������[�1/.�[1W1���

��Add ACCU 1 and ACCU 2 as a Floating-Point Number 32-Bit IEEE-FP : +R��

����

����:���I<G�i'���`���TU��1�#R�|��#1<����"�Wz�ACCU1��#1<���Q�-�ACCU2��<�����W''��!"��ACCU1�Q�@���=9<���,'(�RLO���������G�����Status wordZ������k'%�����������<����������

���k�D�4����

OPN DB10

L ID10� Load the value of ID10 into ACCU1

L MD14� Load the value of ACCU 1 into ACCU2 Load the value of MD14 into ACCU1

R�|�

Page 70: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

Add ACCU2 and ACCU1; store the result in ACCU1 T DBD25

�The content of ACCU1 (result) is transferred to DBD25 in DB10

��Subtract ACCU1 from ACCU2 as a Floating-Point Number 32Bit IEEE-FP : - R��

����

����:���I<G�i���`���TUR�A��#1<���p�����1�#'�ACCU1��#1<��� ��ACCU2�!"����<�����W''�ACCU1�Q�@���=9<����%@����RLO���������G�'�Status wordZ������k'%��������'����<����������

���k�D�4����

OPN DB10

L ID10� Load the value of ID10 into ACCU1

L MD14� Load the value of ACCU 1 into ACCU2 Load the value of MD14 into ACCU1

R �A�

Subtract ACCU1 from ACCU2; store the result in ACCU1 T DBD25�

The content of ACCU1 (result) is transferred to DBD25 in DB10

��Multiply ACCU1 and ACCU2 as Floating-Point Numbers 32-Bit IEEE-FP : * R��

����

����:���I<G�i���`���TUR�u��#1<���;�N���1�#'�ACCU1��#1<���!"�ACCU2�!"����<�����W''�ACCU1�Q�@���=9<���,'(�RLO���������G�����Status wordZ������k'%��������'����<����������

���k�D�4����

OPN DB10

L ID10� Load the value of ID10 into ACCU1

L MD14� Load the value of ACCU1 into ACCU2 Load the value of MD14 into ACCU1

R�u�

Page 71: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

Multiply ACCU2 and ACCU1; store the result in ACCU1 T DBD25�

The content of ACCU1 (result) is transferred to DBD25 in DB10 ����

Divide ACCU2 by ACCU1 as a Floating-Point Number 32-Bit IEEE-FP : / R������

�!U���`���T5�����:����G�6��R����#1<����������1�#�l��ACCU2��#1<���Q�@�ACCU1��W''��!"����<���ACCU1�Q�@���=9<���,'(�RLO���������G�����Status word�k'%��������'����<��������

Z����������k�D�4����

OPN DB10

L ID10� Load the value of ID10 into ACCU1

L MD14� Load the contents of ACCU1 into ACCU2

Load the value of MD14 into ACCU1 R�

Divide ACCU2 by ACCU1; store the result in ACCU1 T DBD20�

The content of ACCU1 (result) is transferred to DBD20 in DB10

Absolute Value of a Floating-Point Number 32-Bit IEEE-FP : ABS������

�:���STU'����������������Q�@�k16����������&$�+-���R� ����'.��O6��� ���� .���X1���������n/� �*�12��������=9<���'.���=9<���,'(�d�"�>�����������&(1:��'�&$�+^��0T����1�#�l����O6��� ��M�.�����2Status

word����

�>�����oD�"w�svA�,1�#�w�sv�>����'�w��x�|�,1�#w��x�����k�D�4����

L ID8���Load value into ACCU1 - example: ID8 = -1.5E+02��

ABS���Form the absolute value; store the result in ACCU1��

Page 72: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

T MD10���Transfer result to MD10 - example: result = 1.5E+02��

����

Generate the Square of a Floating-Point Number 32-Bit : SQR������

`���TU��1�#������;����������>�����;�W�Mi�����I�O/����#1<��ACCU1�!"����<���� #FL�'�ACCU2�Q�@���=9<���,'(�RLO���������G�����Status word�Z������k'%��������'����<��������

���$`��('%���f�L�������k�D�4����

OPN DB17� Open data block DB17

L DBD0� The value from data double word DBD0 is loaded into ACCU1

This value must be in the floating-point format SQR�

Calculate the square of the floating-point number 32-bit, IEEE-FP in ACCU1� Store the result in ACCU1

AN OV� Scan the OV bit in the status word for - 0

JC OK� If no error occurred during the SQR instruction, jump to the OK jump label

BEU� Block end unconditional, if an error occurred during the SQR instruction

OK: T DBD4� Transfer the result from ACCU 1 to data double word DBD4

����������

Generate the Square Root of a Floating-Point Number 32-Bit : SQRT������

��#1<����!:���<���$T����;�������`���TU��1�#ACCU1��O6���B'����'.� ���� .�,1���,.�������!"����<���� #FL�'ACCU1�Q�@���=9<����%@����RLO���������G�'�Status word�����'����<��������

������!"�Z������k'%������������ $����

Page 73: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�k�D�4����

L MD10� The value from memory double word MD10 is loaded into ACCU1

This value must be in the floating-point format SQRT�

Calculate the square root of the floating-point number 32-bit IEEE-FP in ACCU1 Store the result in ACCU1

AN OV� Scan the OV bit in the status word for - 0

JC OK� If no error occurred during the SQRT instruction, jump to the OK jump label

BEU� Block end unconditional, if an error occurred during the SQRT instruction

OK: T MD20� Transfer the result from ACCU1 to memory double word MD20

��������

Generate the Exponential Value of a Floating-Point Number 32-Bit : EXP������

�;������1�#���`���TUExponential value�!"�(1X1����>�����ACCU1�!"����<�����W'�>=�ACCU1��Q�@���=9<���,'(RLO���������G�����Status wordI��-�$������Z������k'%��������'����<����������

��Exponential value�!:������n��D���!U�0'�:��1U��� �e�>�����'.�r��w}�r}�w}�a`��Q�-��@1"���

�Q�:���(1X1���Exp(x���>�����!�:�A�e�A�a`��Q�-��@1"���A�x�A�����k�D�4����

L MD10� The value from memory double word MD10 is loaded into ACCU1

This value must be in the floating-point format EXP�

Calculate the exponential value of the floating-point number 32-bit, IEEE-FP in ACCU1 at base e. Store the result in ACCU1

AN OV� Scan the OV bit in the status word for - 0

JC OK� If no error occurred during the EXP instruction, jump to the OK jump label

BEU�

Page 74: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

Block end unconditional, if an error occurred during the EXP instruction OK: T MD20�

Transfer the result from ACCU 1 to memory double word MD20 ����

Generate the Natural Logarithm of a Floating-Point Number 32-Bit : LN������

�!:������><#$�R1����;������1�#���`���TU���a�2��AeA�����#1<���ACCU1�!"����<���� #FL�'�ACCU1������Q�@���=9<����%@����RLO���������G�����Status word�k'%��������'����<��������

���f�L���Z������O6��� ���� .�����:���I��@�><#�BT���>�����,1�#�,.���������$`��('%�����k�D�4����

L MD10� The value from memory double word MD10 is loaded into ACCU1

This value must be in the floating-point format LN�

Calculate the natural logarithm of the floating-point number 32-bit, IEEE-FP in ACCU1, Store the result in ACCU1

AN OV

Scan the OV bit in the status word for - 0 JC OK�

If no error occurred during the instruction, jump to the OK jump label BEU�

Block end unconditional, if an error occurred during the instruction OK: T MD20�

Transfer the result from ACCU 1 to memory double word MD20

��������������

Generate the Sine of Angles as Floating-Point Numbers 32-Bit : SIN������

��#1<�����#'�F�����X�;������1�#���`���TUACCU1����:#�!�����>�$�I/.�$��<@��Q�@��#'��� @����X$%����8��'�B�7�%�����?�������!"�]�Y�%:�����<�����W''ACCU1�Q�@���=9<���%@����RLO����G�'�

�����Status word���$`��('%���f�L���S� Y�Z������k'%��������'����<�����������

Page 75: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

���k�D�4����

L MD10� The value from memory double word MD10 is loaded into ACCU1

This value must be in the floating-point format SIN�

Calculate the sine of the floating-point number 32-bit, IEEE-FP in ACCU1 Store the result in ACCU1

T MD20� Transfer the result from ACCU1 to the memory double word MD20

��Generate the Cosine of Angles as Floating-Point Numbers 32-Bit : COS��

������#1<�����#'�F����������X�;�������`���TU��1�#ACCU1�����#'��� @���:#�!�����>�$�I/.�$��<@��

��X$%���8��'�B�7�%�����?�������!"����<�����W''ACCU1�!"���=9<����%@����RLO���������G�'�Status word<���������('%�����f�L��'�S� Y�Z������k'%��������'������

���k�D�4����

L MD10� The value from memory double word MD10 is loaded into ACCU1

This value must be in the floating-point format COS�

Calculate the cosine of the floating-point number 32-bit, IEEE-FP in ACCU1 Store the result in ACCU1

T MD20� Transfer the result from ACCU 1 to memory double word MD20

������

Generate the Tangent of Angles as Floating-Point Numbers 32-Bit : TAN������

��#1<�����#'�F���Mm�;������1�#���`���TUACCU1�����#1<���,.�$��<@��ACCU1���:#�!�����>�$��B�7�%�����?������#'��� @���!"����<�����W''ACCU1�!"���=9<����%@����RLO���������G�'�Status

wordS� Y�Z������('%����k'%�������'����<�������������

Page 76: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

�k�D�4��

L MD10� The value from memory double word MD10 is loaded into ACCU1

This value must be in the floating-point format TAN�

Calculate the tangent of the floating-point number 32-bit, IEEE-FP in ACCU1 Store the result in ACCU1

AN OV� Scan the OV bit in the status word for -0

JC OK� If no error occurred during the TAN instruction, jump to the OK jump label

BEU� Block end unconditional, if an error occurred during the TAN instruction

OK: T MD20� Transfer the result from ACCU 1 to memory double word MD20

Generate the Arc Sine of a Floating-Point Number 32-Bit : ASIN������

TU��#1<����5��X�!<����#'�F��������;������1�#���`���ACCU1�$��<@3��!"��W1������B�7�%����#%�<�����B'��#�'.� ���� .�,1�#�>������TU�,.wA�B'��#�'.� ��M�.'�w�|�!"����<�����W''ACCU1���=9<���,'(�

�Q�@RLO���������G�����Status word'%���f�L��'�S� Y�Z������k'%�������������<����,1��'����$`��(� ���&$16��pi/2A�'�pi/2�|�l��pi=3.14159���

���k�D�4��

L MD10� The value from memory double word MD10 is loaded into ACCU1

This value must be in the floating-point format ASIN�

Calculate the arc sine of the floating-point number 32-bit,IEEE-FP in ACCU1 Store the result in ACCU1

AN OV� Scan the OV bit in the status word for -0

JC OK� If no error occurred during the ASIN instruction, jump to the OK jump label

BEU� Block end unconditional, if an error occurred during the ASIN instruction

OK: T MD20� Transfer the result from ACCU 1 to the memory double word MD20

Page 77: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

���Q�@�Z���#��o����8O/ACOS��#1<����5�������X�!<����#'�F���;�����ACCU1��

�'ATAN��#1<����5�m�!<����#'�F���;�����ACCU1����

X1��o"��#'�F���M?����������I/.���R��#1<����('%��%ACCU1���X�('%��8O/����<�����X�('%����.�� ���p'��<#�B'�F��wA�'�w|��

������������������������������������������������������������������������

Page 78: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��������������

�����Q*(����� � ;����� ������ �3 ?�C7S��������������������������������������������������������

�;1�����4����

���O�m'����(�M�@Function��/$1����k'F:��]�2�,�'�;���������J�����:����]#%�'�4��A��1�:��kF@�,'%��]���������A�d1�����<��!������

A��1�:��Q�'`��kF:��������]�2����kF:���!�����]�����!D�=���A���/�D����������]�2������X$�L������1�:����kF:���!�����]�����l�=���

Page 79: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

A��1�:��kF:���!�����]���������<��!������A��1�:��]�����k1����1����$�<�.�&$1i�!"�k1��(�%@�Z#��� @�������;����������#��@�&$1i��

A���1�:��Mi1�����"�D �D1����>� ���:���>2���A��1�:��Q�'`��kF:���������"�D �D2����>� ���:���>2���

A���/�D���kF:���������"�D ������X$�L������1�:�D3����>� ���:���>2���A����#��<����������PI=3.14159��

����$�%�1����%�X����

����

�I���k1����&%�'�,�'�;����(������]�������������:���M����� @�$16��!�:������<���&$16������<��������

����

����������

����

����(�*��/z���1�/�012�3'.Function��5��$�,� ��#.�FC1oD������i��@�%#%���!"�.%�/'����%���V<O���1�/�>=Declaration ���/�������#��<���i�L����012'����%���Q�-'�

�%�<2�l������%��� ��>���Q�@.�!"��U%����Inputs , InOut , Outputs , Temp , Return�!�J���%L<�/�012�l����T�U'�4��

��Inputs��

Page 80: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

��diameter1 Real diameter of conductor��

diameter2 Real diameter of insulated wire��density1 Real Density of conductor��density2 Real Density of First layer��

density3 Real Density of Second layer��length Real Length of wire��

��Temp��

��diameter3 Real diameter of wire with first layer��

section1 Real Conductor cross section area��section2 Real First layer cross section area��

section3 Real Second layer cross section area��thickness1 Real Thickness of first layer��

thickness2 Real Thickness of second layer��weight1 Real Conductor weight��weight2 Real First layer weight��

weight3 Real Second layer weight��pi Real pi Constant 3.14159��

buffer1 Real Buffer for calculations��buffer2 Real Buffer for calculations��buffer3 Real Buffer for calculations��buffer4 Real Buffer for calculations��buffer5 Real Buffer for calculations��

��Outputs��

��totalW Real Total weight of wire��

����

��5��:<�/�012�!<������G<�����/(%��,.�%:��,J�'�g��/�������i�L�����������M�:���1�/�012��5@�1/.'�;1�����4��

���Calculations of Conductor Cross section area in square cm�

L 3.14159

T #pi

L #diameter1

SQR

T #buffer1

Page 81: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

L #buffer1

L #pi

�uR

T #buffer2

L #buffer2

L 4.0

�R

T #buffer3

L #buffer3

L 1000.0

�R

T #section1

�Then multiply by density to get weight of 1 cm�

L #section1

L #density

�uR

T #buffer1

�To get weight of 1 m of conductor multiply by 100�

L #buffer1

L 100.0

�uR

T #buffer2

L #buffer2

L #length

�uR

T #weight1

Now calculation of first layer cross section area

L #diameter3

L #diameter1

A� R

T #buffer1

Page 82: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

L #buffer1

L #3.0

�R

T #thickness2

L #thickness2

L 2.0

�uR

T #thickness1

L #thickness1

L #diameter1

�|R

T #diameter3

L #diameter3

SQR

T #buffer1

L #diameter1

SQR

T #buffer2

L #buffer1

L #buffer2

A� R

T #buffer3

L #buffer3

L #pi

�uR

T #buffer4

L #buffer4

L 4.0

�R

T #buffer5

L #buffer5

L 1000.0

�R

Page 83: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

T # section2

Then multiply by density then by 100 then by length

L #section2

L #density2

�uR

T #buffer1

L #buffer1

L 100.0

�uR

T #buffer2

L #buffer2

L #length

�uR

T #weight2

�Calculation of cross section of layer2�

L #diameter2

SQR

T #buffer1

L #diameter3

SQR

T #buffer2

L #buffer1

L #buffer2

A� R

T #buffer3

L #buffer3

L #pi

�uR

T #buffer4

L #buffer4

L 4.0

�R

Page 84: ˘ ˇˆ˙˝˛ˆ ˚˜ Siemens S7 300,400 - aemotaal.com manager M : h ˙ I:˘kF/ BT’ V5.4 1U U Kj Simatic s7M G

T #buffer5

L #buffer5

L 1000.0

�R

T #section3

L #section3

L #density

�uR

T #buffer1

L #buffer1

L 100.0

�uR

T #buffer2

L #buffer2

L #length

�uR

T #weight3

�calculation of total weight�

L #weight1

L #weight2

�|R

T #buffer1

L #buffer1

L #weight3

|� R

T #totalW

���������������������������������������������������������������7�(�> �#-'�)�����"'��

����������������� ����

[email protected]����

net.forumn.hassanheha://http����