Sign in to follow this  
Followers 0
kig_01

[Help] BIN and DECO Function

4 posts in this topic

can you help me to explain this program Thank you! Regards kurniawan

Share this post


Link to post
Share on other sites
BIN converts a string bit from BCD to binary. So in your example, bits M200 through M207 (2 nibbles, hence the K2) are converted to binary and written into M100-M115 (4 nibbles). DECO takes a series of bits representing a number and converts it to a string with the nth number bit on. The first parameter is supposed to be a register containing a numeric value. The second is the result string of bits starting location, and the third is the number of output bits to write. I have no idea why the first parameter is M100 and not a register like D100, or a series of bits like K4M100.

Share this post


Link to post
Share on other sites
Actually, the third parameter is the number of bits in the source to evaluate. So if you have: [DECO D100 M0 K6] It would decode (DECO) the bottom 6 bits of D100 and turn on the nth bit of a series of bits starting at M0. The destination series of bits would be 64 (2^6) bits long (M0-M63). DECO can also use a bit address as the source address, and treats the bit as a header address. In your case, it looks at bits M100-M105 as a number (n), and turns it into a series of 64 bits starting at M0, and turns the nth bit on. So, the full rung takes a BCD number stored in bits M200-M207, and turns on that bit in the series M00-M63. So if your M200 bit pattern is: 0011 0100 Which is BCD for: 3 4 Then the BIN instruction would move that to your M100 bit pattern as: 0000 0000 0010 0010 And the DECO instruction would decode the bottom six bits: 10 0010 Which is decimal for: 34 And turn on the 34th bit in the M0 series (which is bit M33) turning off all the rest of the bits in the series. Now as to WHY it's doing this.... I have no idea!

Share this post


Link to post
Share on other sites
thank you very much for your explanation I think you are expert in programming mitsubishi PLC, I have the project to replace goldsec PLC into modicon PLC.......so i must translate programming language this PLC. goldsec is one of korean PLC but under license by mitsubishi. technical support for golsec PLC is too bad Edited by kig_01

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0