Binary to decimal conversion

Join Date
Aug 2013
Location
Newark
Posts
7
Hi
I'm using a Mitsubishi PLC (FX Series) and want to convert 4 inputs from binary format to decimal.
I can do this via ladder logic using normally open and closed contacts from the 4 outputs and use them to move the equivalent decimal value to a register.
I was wondering if there was a function to do this automatically.
Or even in reverse so that I can input a decimal number, into a HMI for example, and have four outputs switching for a total combination of 16 states.
Cheers for any help offered.
 
I only have an older FX0 manual but it discusses moving parts of bit data into a word and also moving part of a word to bit devices. It appears to be in chunks of 4 bits. An example is MOV D10 K2M0 would move 8 bits (the lower 2 nibbles) from the word D10 to an area starting at bit M0. I hope this helps.
 
Your question is unclear.
There is no decimal format in PLC, only binary or BCD.
If you want to exchange 4-bit values between inputs and a register, do MOV K1X0 D0 or MOV D0 K1X0.
 
First use the SFTR (Bit shift Right) and then the SFTL (Bit Shift Left) to seperate the 4 bit from the input word into a 16 bit word.

Then take the 16 bit word and use the instructions TKY (Ten Key Input) or DSW (Digital Switch) to make the digital number

As far as I remember it, this will do it.
 
If you are using GX IEC Developer, you maybe want to use BITARR_TO_INT and INT_TO_BITARR. Define variables like this:

VAR_GLOBAL
bitArray AT %IX0: ARRAY [0..15] OF BOOL:=[16(FALSE)];
intValue AT %MW0.0: INT:=0;
END_VAR

Best regards,
Vuckovic Goran.
 

Similar Topics

Hey, I'm looking for a bit of guidance on some vba code in RSView32. For the record I know zero (I know its shameful) VBA code. What I'm trying...
Replies
7
Views
5,601
I am trying to mask the first 8 digits of binary code in a Allen Bradley remote I/O module for alarm tracking puposes. I only need to read the...
Replies
3
Views
3,240
In any Logix5000 processor and any version from 15 through 17, I am looking for a way to convert a decimal number of 1 through 8 to a binary that...
Replies
4
Views
4,442
Hello, I am currently using the PanelView Plus 1000 to poll a modbus device use Kepware drivers. The problem I have is I am polling a holding...
Replies
5
Views
4,122
Good morning, I have recently upgraded a program from PLC2 up to RS5000. I have a need to convert a decimal number to binary.(non-bcd)The way...
Replies
3
Views
5,943
Back
Top Bottom