Mitsubishi BIN & BCD Instruction

sona

Member
Join Date
Aug 2008
Location
WARWICKSHIRE
Posts
7
I am having problems understanding the Fx BIN and BCD intruction. I am writting the program and testing in on the Mits simulator program.

Am I understanding the following lines correctly.

[x0]------------------------[ bin KIX1 D0]

X1 = 1
X2 = 2
X3 = 4
X4 = 8

When x0,x1,x4. are closed k1x1 value (9) D0 value(9)
When x0,x1,x2. are closed k1x1 value (3) D0 value(3)

All works well if the value is 9 or less.

when x0,x2,x4. are closed k1x1 value(10) D0 value (16)
when x0,x3,x4. are closed k1x1 value(12) D0 value (18)

The value in D0 is alway + 6 higher.

Why is this happening , where has the extra 6 come from ?

A similar thing happens with the following line.

[x0]-----------------[bcd k1x1 D1O]

All works well up to a max of 9 .

Go above this and the simulator comes up with ( operation error )

Why does it do this ?

Sorry for the long post.

SonA
 
While I am not familiar with the Mitsubishi instruction set the 'K1X1' value appears to be an accurate representation of the input bits. If that were a BCD value then the D0 value appears to be a hex representation of that BCD encoded value. it's not an 'extra six'. It's the method of displaying the value of bits in a register.

Upon reading of the manual this instruction interprets the source value as a BCD, converts it to a binary number, then stores that in the destination. So it's behaving exactly the way the manual states. You get an erorr when the source is no longer a valid BCD number.
 
Last edited:
I havent checked the manual but the K1 value sets the number of bytes - i think
so you have K1 - K2 or K3 available to you
Try one of these variations as you may be seeing a 'Carry' instead.
 
Last edited:
I havent checked the manual but the K1 value sets the number of bytes - i think
so you have K1 - K2 or K3 available to you
Try one of these variations as you may be seeing a 'Carry' instead.
You're right, Ian. Mitsubishi groups them in 4 bit chunks. The value after K is how many groups of 4 bits, starting at the Xn register, so K1X1 would use X1 thru X4, K2X1 would use X1 thru X8, etc...

In this case, K1X1 is correct.

🍻

-Eric
 
It's been a long time since I did thumbwheels into a Mitsubishi, but I believe it is limited to 0-9 since that is what a thumbwheel gives by digit. the ones digit would be 0-9
the tens would also be 0-9 and you would have to multiply by 10 in the plc. this method was a big hog on inputs.
 
correction:

Just tried this in the simulator, If you had more then 1 digit thumbwheel, no need to do the math I described above.
I did [BIN K3M0 D0], and with m0,m3,m4,m7,m8, and m11 on Do had a value of 999. Still an input hog though!
 
Good point, Bob. That also explains why he gets an error when he tries to convert a BCD value of 'A' with the BIN instruction.

🍻

-Eric
 
Still an input hog though
There are multiplex strategies for using less inputs and polling them on different scans but i prefer to wire them direct personally
 
Hello all,

Many thanks for every one's replies.(y)

After reading all the replies. The penny dropped ! o_O

Some times it's hard getting information into my thick skull.

Thanks again

S on A
 
When you convert BCD to binary,e.g 0016 to binary, K is measured by tens, therefore if converted to binary, with each chunk 0000(00H)->1111(0FH) is measured by 16. The system will compensate it by six if converted into binary for the carrier state for tens is 'A'(1010B) state for binary. Might as well try 'H' on the input.
 
Well done on your comments.
Welcome to this site.
Please check the post dates
This one was solved in 2012.
 

Similar Topics

Hey i have this program that convert 4 digits ascii ->bcd and after that bcd -> bin Can some one explain step by step what is happend? and what...
Replies
0
Views
1,288
hi all i am new here i have a mitsubishi smart touch hmi i.e ms-60t-pe but i cannot find a software to edit and download a program in it any help...
Replies
3
Views
92
I have Toyopuc PLC PC10G-CPU and some communication modules of it. With this modules I'm able to connect with Ethernet, Ethernet/IP, FLnet, FRMT...
Replies
0
Views
52
In this sample programming, what does U4 mean? Any assistance would be greatly appreciated.
Replies
8
Views
169
Hi, I have a project with a R04CPU, RD77GF16 and a RJ71PN92 modules. The cell is given to me to change the program since the previous integrator...
Replies
2
Views
92
Back
Top Bottom