Posted 12 Apr 2010 Hi I am trying to work out the cos value of say 0.25, but get totally different answers to a conventional calculator! I have tried inverting it, multiplying etc and to no avail... can anyone assist me. Thanks in advance Share this post Link to post Share on other sites
Posted 13 Apr 2010 PLease post what you have done so far and maybe we can help? Share this post Link to post Share on other sites
Posted 14 Apr 2010 This is my test ...if I put an angle in a VD0, I should get the correct result out VD16 ! I have swopped around the division IN1 & IN2 but this does not help What could I possibly be missing? Thanks in advance Share this post Link to post Share on other sites
Posted 14 Apr 2010 Sorry it will not allow me to upload a program file so here it is in PDF Format EII_Sensor.pdf Share this post Link to post Share on other sites
Posted 14 Apr 2010 It looks like you are using a strange value for your PI (PI=3.14....) in your second MOV step and you may need to reverse your 180 and your VD8 inputs on the DIV. These minor changes should come out a little closer to your calculator. Share this post Link to post Share on other sites
Posted 17 May 2010 (edited) See manual to se if COS-command input value is in degrees or radians. Help says: The Cosine (COS) instruction evaluates the trigonometric function of the angle value IN and places the result in OUT. The input angle value is in radians. To convert an angle from degrees to radians, multiply the angle in degrees by 1.745329E-2 (approximately p / 180).SM1.1 is used to indicate overflow errors and illegal values. If SM1.1 is set, then the status of SM1.0 and SM1.2 is not valid and the original input operands are not altered. If SM1.1 is not set, then the math operation has completed with a valid result and SM1.0 and SM1.2 contain valid status.Error Conditions that Set ENO = 0: 0006 Indirect address SM1.1 OverflowSpecial Memory bits: SM1.0 Zero result SM1.1 Overflow SM1.2 Negative result So, INPUT VALUE IS IN RADIANS. If you do not know about it, 2*PI (rad) = 360degrees. Ghange you routin. Edited 17 May 2010 by Homer_BL Share this post Link to post Share on other sites