Chapter 5 Applied Instructions S : Source; D : Conversion result The binary-coded decimal value in S is converted into a binary value, and the conversion result is transferred to D . The 16-bit binary-coded decimal value in S should be in the range of 0 to 9,999, and the 32-bit binary-coded decimal value in S should be in the range of 0 to 99,999,999. Decimal constants and hexadecimal constants are converted into binary numbers automatically. Users do not need to use the instruction. SM1049 is an Ox motion subroutine error flag, and SM953 is an O100 error flag.
Explanation When X0.0 is ON, the binary-coded decimal value in K1M0 is converted Example into a binary value, and the conversion result is stored in D10. X0.0 Additional remark Applications of the instructions BCD and BIN: 1. If a motion control module wants to read a binary-coded decimal value created by a DIP switch, users have to use the instruction BIN to convert the value into a binary value, and store the conversion result in the motion control module. 2.
If users want to display a value stored in a motion control module on a seven-segment display on which binary-coded decimal numbers can be displayed, they have to use the instruction BCD to convert the value into a binary-coded decimal value, and transfer the conversion result to the seven-segment display. 3. When X0.0 is ON, the binary-coded decimal value in K4M0 is converted into a binary value, and the conversion result is stored in D100. Subsequently, the binary value in D100 is converted into a binary-coded decimal value, and the conversion result is stored in K4M20.
X0.0 5-37 API Instruction code Operand Function Converting a binary-coded decimal 19 D BIN P S, D number into a binary number Device Xn.n Yn.n M S K 16# F KnM KnS D W T C V Z S D Pulse instruction 16-bit instruction (5 step s) 32-bit instruction (5 steps ) .0 BIN K1M0 D10 0 BIN K4M0 D100 BCD D100 K4M20