Simon Posted September 27, 2010 Share Posted September 27, 2010 How do I convert an integer value in an input field to bcd on an output channel to be used by a plc? Link to comment Share on other sites More sharing options...
AzeoTech Posted September 29, 2010 Share Posted September 29, 2010 If you only have 4 characters max, its something like this: sum((asca(format("%04d",Value)) - 48) * {4096, 256, 16, 1}) where val is the interger value. You can pretty much make this a Conversion and apply it to your output channel. If you need more than 4 characters, just continue the array, by multiplying by 16 the biggest number: {65536, 4096, 256, 16, 1} and change the %04d to %05d (or however many elements you have in the array) Link to comment Share on other sites More sharing options...
Simon Posted September 29, 2010 Author Share Posted September 29, 2010 working! i wasn't even close to that Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.