Does anyone know how to convert from a decimal number to a true binary output. For example convert the number 15 to 1111 and then be able to turn on outputs using the four bits.
Not exactly sure what your after. If you move a 15(integer) into an output group you will get the least four outputs to come on no conversion necessary. However alot of people use hex just because its easier to see the higher bits.
Not exactly sure I understand your reply. Maybe I should clarify. What I am after is being able to convert a decimal number to binary and then be to use the bits from the conversion for discrete logic. For example, the number 12 convers to 1100 binary. I need to be able to use the four individual bits for basic logic.
If Decimal_Number is defined as a DINT (or INT or SINT) then the least significant bit is accessable as Decimal_Number.0 and so on. Doe that give you what you need?
What processor/plc? Basically binary conversion is not necessary in a plc. If in CLGX you mov decimel 12 or binary 1100 into Local:7:O.Data then you will turn on Local:7:O.Data.02 and Local:7:O.Data.03. If you do a decimel move or a binary move the results are the same. If you just want to see it in binary you can change the "style" of the tag.
Hi folks!
New here, and to PLCs really. I'm playing around with a project, can't make head nor tail of it.
I've got to convert a number from decimal to binary, and represent it on 12 outputs of the C Memory as binary, from 0 to 4095. No idea where to start.
Anyone have any suggestions on how to go about this??
Any help would be much appreciated!
Cheers!
Bill
Hey Bernie, thanks a lot, was banging my head off a wall trying to get that. It puts it out backwards, but it is good.
What is that expression, an internal function?? I can't find anything explaining about it.
Thanks for your help, very much appreciated!