Sign in to follow this  
Followers 0
whtrader

Decimal to Hex

11 posts in this topic

Hi all, I need advice on this issue I am having. How do you convert D100 - &150 to D101 - #150. If I used convert the &150 will be #96. Is there a trick to achieve this? Pls advice. Thanks.

Share this post


Link to post
Share on other sites
The BCD instruction is what you need

Share this post


Link to post
Share on other sites
There's no instruction that converts &150 to #150 because the equivalent values are not equal.

Share this post


Link to post
Share on other sites
These sure one of wanting to introduce a value in decimal to the PLC? The natural thing is to put it in BCD. He works and it visualizes in BCD as if you made it in decimal.

Share this post


Link to post
Share on other sites
Thanks for the reply. Actually I am doing a floating point multiply for example 10.90 * 100 = 109.0. Then I do a FIX on 109.0 thus getting +109. I want to use this value as a set point for my pulse counter which is in # format. I tried converting &109 to hex which is #69. Thus the count is incorrect. Thinking back is it possible to convert the counter value to floating and do a compare from there. Pls advice. Thanks.

Share this post


Link to post
Share on other sites
Use the increment/decrement instructions to make a counter yourselves which can handle decimal values. I don't see any other method easily.

Share this post


Link to post
Share on other sites
At this point we do not know what hardware you are working with. What processor do you have?

Share this post


Link to post
Share on other sites
I am not sure how this work. I was planning to read the counter value in CT21. Edited by whtrader

Share this post


Link to post
Share on other sites
Unless I have missed something, I think you may be getting your display formats confused. The FIX instruction result is a signed binary value. It appears to me that counter value on the CT021 is also signed binary. The processor is dealing with binary (or hex, same thing) values. What were you planning to do with the value you read from the CS1W-CT021?

Share this post


Link to post
Share on other sites
I was planning to use the result of the multiply for example 10.90 * 100 = 109.0 to compare with the value read from CS1W-CT021. I have used CPM1A and believe the counter value is in hex format. Pls advice. Thanks.

Share this post


Link to post
Share on other sites
I would suggest that you read the W902 (CS1W-CT021) manual. The CS1 is a completely different system than a CPM1A.

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