銆怌odesys銆戝瓧鑺傛暟缁勮浆闀垮瓧鑺傦紝闀垮瓧鑺傝浆瀛楄妭鏁扮粍锛屽悓鐐逛綅鍧愭爣绯讳綅缃亸绉昏绠-CODESYS璧勬簮涓嬭浇鍖-閰峰痉缃 - CoDeSys杞欢鏁欑▼涓嬭浇,CoDeSys宸ユ帶璧勮闂ㄦ埛
HSC6490-cn涓浗鍒堕狅紝涓浗鑺瘇
鏌ョ湅: 1165|鍥炲: 0

銆怌odesys銆戝瓧鑺傛暟缁勮浆闀垮瓧鑺傦紝闀垮瓧鑺傝浆瀛楄妭鏁扮粍锛屽悓鐐逛綅鍧愭爣绯讳綅缃亸绉昏绠

[澶嶅埗閾炬帴]

璇ョ敤鎴蜂粠鏈鍒

鍙戣〃浜 2023-4-20 13:24:51 | 鏄剧ず鍏ㄩ儴妤煎眰 |闃呰妯″紡
1銆佸瓧鑺傛暟缁勮浆鍙屽瓧鑺
///杩斿洖涓や釜byte鍚堟垚鐨勯暱瀛楄妭
FUNCTION_BLOCK FB_ByteToHex
VAR_INPUT
     hByte:BYTE;
     lByte:BYTE;
END_VAR
VAR_OUTPUT
     HexData:DWORD;
END_VAR
VAR
     HexStr,strByte1,strByte2:STRING;
END_VAR
//杩愬姩浠g爜锛
strByte1:=BASIC.BYTE_TO_STRH(hByte);
strByte2:=BASIC.BYTE_TO_STRH(lByte);
HexStr:=Standard.CONCAT(STR1:=strByte1,STR2:=strByte2);
HexData:=BASIC.HEX_TO_DWORD(Hex:=HexStr);
2銆佸弻瀛楄妭杞瓧绗︿覆
///杩斿洖闀垮瓧鑺傛媶鍒嗙殑涓や釜byte
FUNCTION_BLOCK FB_HexToByte
VAR_INPUT
     HexData:WORD;
END_VAR
VAR_OUTPUT
     hByte:BYTE;
     lByte:BYTE;
END_VAR
VAR
     HexStr,strByte1,strByte2:STRING;
END_VAR

杩愯浠g爜锛
HexStr:=DWORD_TO_STRH(IN:=HexData);
strByte1:=mid(STR:=HexStr,LEN:=2,POS:=5);
strByte2:=mid(STR:=HexStr,LEN:=2,POS:=7);
hByte:=HEX_TO_BYTE(strByte1);
lByte:=HEX_TO_BYTE(strByte2);   
3銆佸悓鍧愭爣绯诲潗鏍囩偣浣嶅亸绉昏绠
//宸茬煡绗簩宸ュ叿璺濈涓濇潌涓績浣嶇疆璺濈锛岃绠楀綋鍓嶄綅缃笅绗簩浣嶇疆杩愬姩鍒颁腑蹇冪殑鍧愭爣  閫傜敤浜3杞存満鍣ㄤ汉
FUNCTION_BLOCK FB_CalcToolXY
VAR_INPUT
     lrX:LREAL;//褰撳墠浣嶇疆X
     lrY:LREAL;//褰撳墠浣嶇疆Y
     lrC:LREAL;//褰撳墠浣嶇疆C
END_VAR
VAR_OUTPUT
     ResultX:LREAL;//杈撳嚭浣嶇疆X
     ResultY:LREAL;//杈撳嚭浣嶇疆Y

END_VAR
VAR
     lrOffsetX:LREAL:=-1.7;//-2.218; //宸茬煡浣嶇疆鐨刋鍋忓樊
     lrOffsetY:LREAL:=54.95;//55.495;//宸茬煡浣嶇疆鐨刌鍋忓樊
     COSC,SINC,test3,test4:LREAL;
     pi:LREAL:=3.1415926;
END_VAR

杩愬姩浠g爜锛
COSC:=COS((lrC*pi)/180);
SINC:=SIN((lrC*pi)/180);
ResultX:=lrX+COSC*lrOffsetX-SINC*lrOffsetY;
ResultY:=lrY+SINC*lrOffsetX+COSC*lrOffsetY;
+10
涓嶈禐涓涓紵
鎵撹祻榧撳姳涓涓嬶紒
鍥炲

浣跨敤閬撳叿 涓炬姤

鎮ㄩ渶瑕佺櫥褰曞悗鎵嶅彲浠ュ洖甯 鐧诲綍 | 绔嬪嵆娉ㄥ唽 鏂版氮寰崥鐧婚檰

鏈増绉垎瑙勫垯

椤堕儴qrcode搴曢儴
鍏虫敞閰峰痉缃戣闃呭彿锛岃幏鍙栨洿澶氳祫璁紒

QQ|灏忛粦灞|鎵嬫満鐗|Archiver|閰峰痉璁哄潧 ( 鑻廔CP澶16065247鍙-1 )|缃戠珯鍦板浘

GMT+8, 2024-11-23 19:37 , Processed in 0.216466 second(s), 53 queries .

閰峰痉缃

© 2001-2013 Hicodesys. 鎶鏈敮鎸 by 閰峰痉缃

蹇熷洖澶 杩斿洖椤堕儴 杩斿洖鍒楄〃