
adccommunitymod (AutomationDirect) asked a question.
Created Date: August 24,2017
Created By: CaerYnArfon
**** 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.****
Well having had one problem solved by this forum was hoping you could shed some light on the following. I need to calculate a value from the following equation RPM = Speed/pi x Diameter. So typical values are RPM = 300/3.142 * 450 300 and 450 are both at V memory addresses. I then need to take that result 0.2122.... 4 decimal places is enough Divide it by 0.1203 and multiply the result by 415 which gives us 732.142... I then need to pass that Integer only value (732) to The V460 address which is the F0-2AD2DA-2 slot 3 Port 1 Analogue output which gives me a voltage of approx 1.9 volts. (controlling speed) However no matter what Math ibox i use the results are crazy they bear no resemblance to the figures above. I assume its all to do with what kind of data type we are using? Decimal. Binary BCD whatever... But how do I know? Then how do I know what to convert to and back again etc. Also, how come at any point in the ladder, I can't just OUT a value to V460 (red dot) but I can OUTD to V460 the value is the same in both cases and as a decimal value from 0 - 4150 Any ideas. I know this is probably fundamental DL06 programming but I 've come in to this cold from a general electronics and programming in VB and C background and haven't had any formal training whatsoever so kind of stabbing in the dark... :-( Thanks guys.
Created Date: August 24,2017
Created by: CaerYnArfon
Well having had one problem solved by this forum was hoping you could shed some light on the following.
I need to calculate a value from the following equation RPM = Speed/pi x Diameter.
So typical values are RPM = 300/3.142 * 450
300 and 450 are both at V memory addresses.
I then need to take that result 0.2122.... 4 decimal places is enough
Divide it by 0.1203 and multiply the result by 415 which gives us 732.142... I then need to pass that Integer only value (732) to
The V460 address which is the F0-2AD2DA-2 slot 3 Port 1 Analogue output which gives me a voltage of approx 1.9 volts. (controlling speed)
However no matter what Math ibox i use the results are crazy they bear no resemblance to the figures above.
I assume its all to do with what kind of data type we are using? Decimal. Binary BCD whatever...
But how do I know?
Then how do I know what to convert to and back again etc.
Also, how come at any point in the ladder, I can't just OUT a value to V460 (red dot) but I can OUTD to V460 the value is the same in both cases and as a decimal value from 0 - 4150
Any ideas.
I know this is probably fundamental DL06 programming but I 've come in to this cold from a general electronics and programming in VB and C background and haven't had any formal training whatsoever so kind of stabbing in the dark... :-(
Thanks guys.
Created Date: August 24,2017
Created by: Do-more PE
Take a look at Appendix I of the DL06 User Manual for a start on how numbering systems (data types) work. Maybe that will get you going. I'm sure someone else will be along shortly to elaborate more on the subject.
Created Date: August 24,2017
Created by: plcnut
Also, how come at any point in the ladder, I can't just OUT a value to V460 (red dot) but I can OUTD to V460 the value is the same in both cases and as a decimal value from 0 - 4150
OUT defaults to an OUT coil.
If you type the / (Forward slash) at any time that an OUT instruction is being edited, then you will get the input for an OUT Box.
Created Date: August 24,2017
Created by: Mike Nash
I need to calculate a value from the following equation RPM = Speed/pi x Diameter.
So typical values are RPM = 300/3.142 * 450
300 and 450 are both at V memory addresses.
I then need to take that result 0.2122.... 4 decimal places is enough
Your equation is wrong to start with. You mean 300/(3.142 * 450) if you really want 0.2122.
Next, if you want REAL results, all of your Vmem values must the REAL before you use the MATHR IBox.
A REAL number requires an OUTD because it is a double. I don't know which instruction you are using though so I can't check on my D0-06.
Created Date: August 24,2017
Created by: bcarlton
Determining data type - open a dataview window. Insert the variable location. Change the view types for that item as needed until it reads correctly.
If the data type is 'decimal ' then convert to REAL using the BTOR instruction
If the data type is BCD (view is BCD/Hex) then convert to REAL using BIN then BTOR.
Created Date: August 25,2017
Created by: CaerYnArfon
As always.... WELL DONE everyone :-)
Thanks... the sound of pennies dropping all over the place lol
Cheers guys