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,297
I'm looking to get some spare keys for this PLC. Does anyone know a source or have a part number? My searches are turning up nothing at the moment.
Replies
1
Views
64
I'm struggling to get an FR-E800SCE to work on CC-Link IE TSN. I'm sure the issue is with the drive, when I plug in the network cable I get no...
Replies
1
Views
90
Hi , Where i can find Mitsubishi PLC Card end of line & replacement model details. i am looking for Q02CPU replacement model. Please advice. thanks
Replies
2
Views
126
Hi guys, Im trying to set the real time clock in my Mitsubishi FX1N, but it shows this error ES: 01800001 I have good communication with...
Replies
3
Views
142
Back
Top Bottom