标签:bsp lan temp _for com port blank body lower
Function |
"LCA_DI" Convert Char Array to DInt "LDI_CA" Convert DInt to Char Array |
Example |
Parameter |
Input CA Array[0..9] of Char Temp |
Programming |
#DI := "LCA_DI"(#CA); "LDI_CA"(INUM := #DI, OCHR => #CA2);
|
Result |
Library |
"LCA_DI" Convert Char Array to DInt |
Parameter |
Input |
Programming |
#TTOL_NUM := 0; #TONE_NUM := 0; #TMOD_NUM := 1; #TUP_BOU := DINT_TO_INT(IN := UPPER_BOUND(ARR := #ICHR, DIM := 1)); #TLW_BOU := DINT_TO_INT(IN := LOWER_BOUND(ARR := #ICHR, DIM := 1)); FOR #TI := #TUP_BOU TO #TLW_BOU BY -1 DO #TONE_NUM := INT_TO_DINT(ABS(CHAR_TO_INT(#ICHR[#TI])) - 16#30); IF #TONE_NUM < 0 OR #TONE_NUM > 9 THEN #TONE_NUM := 0; END_IF; #TTOL_NUM := #TTOL_NUM + DINT_TO_UDINT(#TONE_NUM * #TMOD_NUM); #TMOD_NUM := #TMOD_NUM * 10; END_FOR; #LCA_DI := #TTOL_NUM; |
"LDI_CA" Convert DInt to Char Array |
Parameter |
Input |
Programming |
#TMOD := 0; #TMOD_NUM := 1; #TUP_BOU := DINT_TO_INT(IN := UPPER_BOUND(ARR := #OCHR, DIM := 1)); #TLW_BOU := DINT_TO_INT(IN := LOWER_BOUND(ARR := #OCHR, DIM := 1)); FOR #TI := #TUP_BOU TO #TLW_BOU BY -1 DO #TMOD := UDINT_TO_INT((#INUM / #TMOD_NUM) MOD 10); #OCHR[#TI] := INT_TO_CHAR(ABS(#TMOD) + 16#30); #TMOD_NUM := #TMOD_NUM * 10; END_FOR;
|
Video |
[TIA PORTAL][CONVERT] Convert Char Array to DInt...DInt to Char Array..Useful and easy function
标签:bsp lan temp _for com port blank body lower
原文地址:https://www.cnblogs.com/sstan1020/p/13193481.html