
adccommunitymod (AutomationDirect) asked a question.
Created Date: December 20,2010
Created By: rrc1962
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
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
Created Date: December 20,2010
Created by: Do-more PE
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.
Created Date: December 21,2010
Created by: rrc1962
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.
Created Date: December 20,2010
Created by: rrc1962
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