Hex to Decimal conversion Micro 850

lurby

Member
Join Date
Mar 2005
Posts
32
I am using a Micro 850E PLC (the new one with implicit messaging capability) to drive a Kinetix 5100 servo drive. The error code number on the drive is sent to the PLC in HEX format...so error code 500 is shown as 1280. I can convert these after the fact but I would like to be able to display the decimal version on my HMI. Error code 1280 doesn't mean anything to my customer but error code 500 does.


Any ideas on how to do this beyond scratching it out on paper after the fact? Is there a way to convert it within the logic?


BTW this new PLC is great. I was not a fan of the Micro 800's and I am still not in love with the programming environment but seamless integration through implicit messaging to both the Kinetix 5100 and Powerflex 525. Price point under $600! Worth the hassle of the pokey CCW.
 
In general, you're looking for a change to the display "radix", not to the actual value.

And that's probably going to be done at the HMI level. What HMI and indicator type are you using ?
 
Thanks for those details !

The most common indicator type, of course, would be a Numeric Dsiplay. The PanelView 800 also has a String Display object.

Neither of those has an applicable Radix option, as far as I can tell. The String has an option for showing a DateTime object, but neither one has the option to show an integer in Hex radix.

So.. yuck.

I've done this with multi-state indicators in a row, where the values 0-15 showed 0-F, and then masked out values from each byte. It's ugly.

I think you might have to write a function in your Micro 850E to assemble a string out of each byte of the value.

In general, you'll mask out each byte to a new tag, then divide to bit-shift it to the right.

Then if the value is between 0 and 9 add decimal 48 to get the character "0" through "9", and if the value is between 10 and 15 add decimal 55 to get the resulting ASCII values for "A" through "F".

Make the fixed length 4, then you can display it in a String Display object in the PV800.

I'm not as familiar with CCW's structured text and user-defined function block syntax as I'd like to be.
 
Update: I've had my dose of Micro 800 learning for the day.

It's fairly straightforward to make a 4-character STRING that shows hexadecimal characters out of a DINT value in CCW.

Screenshot below, CCW v21 archive file example to follow, as a ZIP file.

DINT_to_Hex_String_CCW_StructuredText.PNG
 
There are probably some more elegant ways to do that logic, but for me it's fairly straightforward to follow, and it works fine when you then call the UDFB from your LAD or ST program.

I attached the whole *.ccwarc Archive file, compressed in ZIP format.
 
Update: I've had my dose of Micro 800 learning for the day ...
And probably of ST as well. You have our sympathy.
There are probably some more elegant ways to do that logic, but for me it's fairly straightforward to follow, and it works fine ...
Sure, there are many ways to skin that cat, but clarity is king, memory and CPU cycles are cheap, and this is not code golf.

Bottom line: that code is superb.
 

Similar Topics

I am trying to convert hex values to decimal. I am reading in values from 232ASC module. They come in on ___:4:I: Data[0] & ___:4:I: Data[1]...
Replies
8
Views
3,386
Hey All, i have been fortunate enough to play around with an Applied Motion Products Servo Drive SV200 with 100 watt/ 24vdc congif. I managed...
Replies
2
Views
1,890
Hi I'm using Mitsubishi FX5U with a GOT HMI. I need to enter values on HMI in decimal format then convert to HEX for use on a Modbus RTU link...
Replies
1
Views
3,084
Hi all, great forum I'm learning all the time on here. I'm having a problem with a g308 in that I can read the data in hex, but when I try to...
Replies
0
Views
2,226
i'm newbie in PLC, would u like to help me, plese.. i'm using an instruction MOV, for moving Hexadecimal data #0020 which is &32 in decimal,to...
Replies
3
Views
1,826
Back
Top Bottom