Sign in to follow this  
Followers 0
Guest Guest_Scott

Slc 500 Convert Decimal To Hex

3 posts in this topic

I am Looking fo ideas on how to convert a decimal number to a hex number. I can't use bcd format. It has to be hex. I am input a decimal from a panelview and want to sent to a rexroth valve system which takes hex valves. Any Ideas would be great. Thanks

Share this post


Link to post
Share on other sites
Scott, You'll get more (and better) responses if you'll help us out a little. How about a range of values? A few specific examples along the lines of "703710 decimal needs to convert to ABCDE hex" would be very helpful. What type of processor are you using? Is it really an SLC-500 "brick" as your subject line indicates? Or is it an SLC-5/01; SLC-5/02; SLC-5/03; SLC-5/04 or SLC-5/05? You know - different processors have different capabilities and instructions available. So far, I'm thinking along the lines of a recursive loop (JMP back to an LBL until the conversion task is done) but it sure would be nice to know exactly what we're shooting for here. Finally, have you already got the SLC-to-rexroth interface working? In other words, can you manually type a valid hex number into an SLC memory location and properly move the valve? It would be a good idea to get this piece working before you tackle the conversion - so that you KNOW that you've got the format of the conversion's output specified correctly. Best regards, Ron

Share this post


Link to post
Share on other sites
Scott- I think it's all in how you look at it, literally. I am assuming (I know, I know) that by decimal you are referring to an integer in decimal format. If you are working with binary numbers there really is no conversion. The bit pattern 10101 is 21 decimal is 15 hex. They are all the same number; it's all in how you look at the bits. If your HMI allows you to enter a number in hex format the bit pattern should be correct right out of the HMI. So if you enter 15 hex at the HMI it would display as 21 decimal in the plc. However, it would still be 15 hex at the Rexroth end. Now life gets a bit more complicated if you are entering the value as an integer and you need to convert it to an ASCII string (or vise versa). As Ron stated you need to let us know which processor you are working with as they have different capabilities. Keith

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0