﻿{"id":966,"date":"2014-12-25T12:43:54","date_gmt":"2014-12-25T04:43:54","guid":{"rendered":"http:\/\/www.tansoo.cn\/?p=966"},"modified":"2014-12-25T14:18:55","modified_gmt":"2014-12-25T06:18:55","slug":"s7-scl%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%9a%ef%bc%882%ef%bc%89%e5%9c%a8scl%e7%a8%8b%e5%ba%8f%e4%b8%ad%e7%b3%bb%e7%bb%9f%e5%ad%98%e5%82%a8%e5%8c%ba%e7%9a%84%e5%ad%98%e5%8f%96%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/www.tansoo.cn\/?p=966","title":{"rendered":"S7-SCL\u5b66\u4e60\u7b14\u8bb0\uff1a\uff082\uff09\u5728SCL\u7a0b\u5e8f\u4e2d\u7cfb\u7edf\u5b58\u50a8\u533a\u7684\u5b58\u53d6\u65b9\u6cd5"},"content":{"rendered":"<p>\u7ecf\u8fc7\u4e00\u5468\u7684\u6162\u6162\u6478\u7d22\uff0c\u53ef\u4ee5\u6309\u4ee5\u524d\u7684\u7b80\u5355T\u578b\u56fe\u7a0b\u5e8f\u5199\u51faSCL\u7a0b\u5e8f\u4e86\u3002\u4f46\u611f\u89c9\u8fd8\u662f\u61f5\u61f5\u61c2\u61c2\u7684\uff0c\u8fb9\u5b66\u8fb9\u603b\u7ed3\u5427\uff0c\u53ef\u80fd\u5b58\u5728\u7406\u89e3\u9519\u8bef\u7684\u5730\u65b9\uff0c\u4ee5\u540e\u4f1a\u597d\u70b9\u7684\u3002<\/p>\n<p>\u5728\u897f\u95e8\u4e86\u7cfb\u7edf\u5b58\u50a8\u533aI\u3001Q\u3001M\u3001PQ\u3001PI\u3001DB\u7b49\u7684\u8bfb\u5199\u64cd\u4f5c\u6709\u51e0\u79cd\u65b9\u5f0f\uff1a\u7edd\u5bf9\u5730\u5740\u3001\u6570\u7ec4\u3001\u7b26\u53f7\u8c03\u7528\u3002\u5b83\u4eec\u7684\u64cd\u4f5c\u6548\u679c\u90fd\u4e00\u6837\uff0c\u73b0\u4e3e\u4f8b\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">FUNCTION FC1 : VOID\r\n\r\nVAR_TEMP\r\n    \/\/ Temporary Variables\r\n    ii: INT;\r\nEND_VAR\r\n\r\nVAR\r\n    \/\/ Byte_Bit\u6570\u7ec4\u76840\uff0d7\u76f4\u63a5\u6307\u5411Byte_Struct.B\u76840\uff0d7\u4f4d\uff0c\u5b58\u50a8\u533a\u57df\u4e00\u81f3\r\n    Byte_Struct : STRUCT\r\n            B : BYTE;     \r\n    END_STRUCT;\r\n    Byte_Bit AT Byte_Struct: ARRAY[0..7] OF BOOL;\r\n    \r\n    \/\/ BIT_VAL\u6570\u7ec4\u76840\uff0d7\u76f4\u63a5\u6307\u5411B_VAL\u76840\uff0d7\u4f4d\uff0c\u5b58\u50a8\u533a\u57df\u4e00\u81f3\r\n    B_VAL : BYTE;\r\n    BIT_VAL AT B_VAL: ARRAY[0..7] OF BOOL;\r\n     \r\nEND_VAR;    \r\n\r\n    \/\/ \u5728SCL\u7a0b\u5e8f\u7cfb\u7edf\u5b58\u50a8\u533a\u7684\u5b58\u53d6\u65b9\u6cd5:\u7edd\u5bf9\u5730\u5740\u3001\u6570\u7ec4\u3001\u7b26\u53f7\u8c03\u7528\r\n    Q0.0 := Input00;  \/\/ \/\/ \u5148\u5728\u7b26\u53f7\u8868\u4e2d\u4e3aI0.0\u5b9a\u4e49\u7b26\u53f7\uff1aInput00 \r\n    Q0.1 := TRUE;\r\n    Q[0,2] := I[0,2]; \r\n    Q[0,3] := TRUE;\r\n    OFF_ON := 1;      \/\/ \u5148\u5728\u7b26\u53f7\u8868\u4e2d\u4e3aQ0.4\u5b9a\u4e49\u7b26\u53f7\uff1aOFF_ON\r\n    \"\u5f00\u51731\" := true;  \/\/ \u5148\u5728\u7b26\u53f7\u8868\u4e2d\u4e3aQ0.5\u5b9a\u4e49\u4e2d\u6587\u7b26\u53f7\uff1a\u5f00\u51731\uff0c\u8c03\u7528\u65f6\u8981\u5e26\u53cc\u5f15\u53f7\r\n    \r\n    PQB272 := INT_TO_BYTE(BYTE_TO_INT(\"\u6a21\u62df\u91cf\u8f93\u51651\") + 80);  \/\/ \u5148\u5728\u7b26\u53f7\u8868\u4e2d\u4e3aPIB272\u5b9a\u4e49\u7b26\u53f7\uff1a\u6a21\u62df\u91cf\u8f93\u51651\r\n    PQB[273] := INT_TO_BYTE(BYTE_TO_INT(PIB[273]) + 90);\r\n    \"\u6a21\u62df\u91cf\u8f93\u51fa1\" := DB10.NEWVAL;    \/\/ \u5148\u5728\u7b26\u53f7\u8868\u4e2d\u4e3aPQB272\u5b9a\u4e49\u7b26\u53f7\uff1a\u6a21\u62df\u91cf\u8f93\u51fa1\r\n\r\n    \/\/ AT \u7528\u6cd5\u4e3e\u4f8b\r\n    Byte_Struct.B := MB100;\r\n    \r\n    FOR ii:= 0 TO 7 BY 1 DO\r\n        \/\/ Statement Section\r\n        Q[1,ii] := Byte_Bit[ii];\r\n    END_FOR;\r\n\r\n    B_VAL := MB100;\r\n    \r\n    FOR ii:= 0 TO 7 BY 1 DO\r\n        \/\/ Statement Section\r\n        Q[2,ii] := BIT_VAL[ii];\r\n    END_FOR;\r\n\r\nEND_FUNCTION\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ecf\u8fc7\u4e00\u5468\u7684\u6162\u6162\u6478\u7d22\uff0c\u53ef\u4ee5\u6309\u4ee5\u524d\u7684\u7b80\u5355T\u578b\u56fe\u7a0b\u5e8f\u5199\u51faSCL\u7a0b\u5e8f\u4e86\u3002\u4f46\u611f\u89c9\u8fd8\u662f\u61f5\u61f5\u61c2\u61c2\u7684\uff0c\u8fb9\u5b66\u8fb9\u603b\u7ed3\u5427\uff0c\u53ef\u80fd\u5b58\u5728\u7406 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[54,55],"class_list":["post-966","post","type-post","status-publish","format-standard","hentry","category-program","tag-s7-scl","tag-plc"],"_links":{"self":[{"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/posts\/966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=966"}],"version-history":[{"count":0,"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/posts\/966\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=966"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}