AutomationDirect Customer Forum  

Welcome to the AutomationDirect Customer Forums.
These forums are intended as a place for AutomationDirect customers to help one another, share information, and share ideas.
The forums are not routinely monitored by AutomationDirect Technical Support staff. While staff members may answer questions occasionally, for a prompt response to a problem please contact Technical Support directly at: 1(800) 633-0405 or (770) 844-4200 or e-mail Tech Support.

For product questions, start here: Online Manuals and Product Inserts


Go Back   AutomationDirect Customer Forum > General Applications

Reply
 
Bookmark and Share Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 12-20-2010, 04:15 PM
rrc1962 rrc1962 is offline
Registered User
 
Join Date: Dec 2010
Posts: 80
Convert decimal to binary in DL05

I have a DL05 with analog input. Connected to the analog side is a 0-10V pot. The value that is written to the PLC memory is in binary and (I presume) is scaled so that 0V = 0 and 10V = 65535. The PLC is connected to a PC via serial modbus and the PC is sending a number which should be in decimal format. I need to compare this number to the binary number produced by the analog module.

I see a conversion instruction for going from BCD to binary but nothing to deal with decimal numbers.

The decimal number coming from the PC is between 0 and 10 with 4 decimal places. Another thought I had was to scale the number from the PC so that it's full range represented 0 - 65535 instead of 0.0000 to 10.0000.

How would you all go after this?

From a precision perspective, I'm good with one decimal place. Could I round the floating point number (4.5692) to (4.6), multiply that by 10 (46), write that to the 05 V memory then use the conversion instruction to go from BCD to binary? I recall from another post that multiplying a decimal with one decimal place by 10 produced it's BCD equivalent. Or I could configure the analog module to write in BCD and not have to convert anything. Will this work?

Thanks

Last edited by rrc1962; 12-20-2010 at 04:43 PM.
Reply With Quote
  #2  
Old 12-20-2010, 05:19 PM
Do-more PE Do-more PE is offline
Registered User
 
Join Date: Aug 2008
Location: Cumming, GA
Posts: 2,102
Writing a floating point number to a DL05 isn't going to work since the DL05 can't handle floating point.

With that being said, I would round the number, multiply by 10 then write it to the DL05. It should come in as a binary formatted number which you could then directly compare to the a scaled version of the analog number.
__________________
If you have an urgent issue, please contact AutomationDirect's Technical Support team.

AutomationDirect.com Technical Support: 1(800) 633-0405 or (770) 844-4200 Email Tech Support
Reply With Quote
  #3  
Old 12-20-2010, 11:06 PM
rrc1962 rrc1962 is offline
Registered User
 
Join Date: Dec 2010
Posts: 80
Quote:
Originally Posted by ADC App Assist View Post
Writing a floating point number to a DL05 isn't going to work since the DL05 can't handle floating point.

With that being said, I would round the number, multiply by 10 then write it to the DL05. It should come in as a binary formatted number which you could then directly compare to the a scaled version of the analog number.
What I did was scale my input on the PC so it also ranged from 0 - 4095, same as the range from the analog module. So when I run the slider to about half way, I get about 2000. Same value written to the PLC when the pot is about half way.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 09:01 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.