5/13/2014 8:33 PM | |
Posts: 5225 Rating:
|
My Friend.. probably I am not understanding your statement.. forgive me for that. There is more difference in positive numbers and negative numbers other than the most significant bit being OFF (positive) or ON (negative). A negative number is the two's-complimet value of its positive counterpart. (two's-compliment: positive value bit-by-bit inverted plus 1) That will cause the (x) + (-x) = 0. Newer PLCs and panels make provision for byte sized signed values. The S7-200 does not handle these as standard. It is possible to manipulate the byte to give the correct signed value. If you however use these in calculations, you will find the overlap system bit will activate. If the value is given from new panel to S7-200 as signed byte number, the number is already converted in the "two's compliment" format. When this number is used in calculations and feed back to the panel.. there is the danger. -- I will assume that a panel gives a signed byte number. In the example the value is written to VB10 (panel >> PLC). Inside the PLC the VB10 is processed to an integer.. * VB10 >> VB101 * VB100.0 to VB100.7 receives the value of VB10.7 Now VW100 is a signed integer with which calculations can be done. At the end of the cycle the conversion can be done in reverse. * VB101 >> VB10 -- M.Alawini -- it is up to you now to explain what you have in mind. We hope to hear from you. w |
Last edited by: GrasserF at: 5/14/2014 12:11 PMnew subject after splitting from /tf/WW/en/Posts/107985#top |
|
This contribution was helpful to
3 thankful Users |
5/14/2014 6:12 AM | |
Joined: 1/28/2009 Last visit: 9/10/2024 Posts: 6849 Rating:
|
Hello William B. , Thank you for your explanation.I agree, a Byte can be a negative value but can it incoperate in Arithmatic functions (Math function) as negative value has the importance?Normally,LAD and FBD editors checks type data incoperated. It is possible to use a byte as negative value, you should disable check and it is your responsibility to accept the sequences.Check the attachment. Regards, HD Hosseini |
Last edited by: hdhosseini at: 5/14/2014 9:23 AM@ William B. I know S7-200 works with Microwin .Snapshot is from STEP 7 , It is not a rule bounded to STEP 7 Only. It is an IEC Standard .It is applicable to : 1-STEP 7 2-TIA Portal 3-PCS 7 And software from other manufacturers.Type check is compulsory and in most of cases you should convert it to target data type.Perhaps, I should discuss that with an expert in Microwin in more details.It is also nice to split this question as an independent discussion! |
|
5/14/2014 8:06 AM | |
Posts: 5225 Rating:
|
Please tread lighly with your suggestion. If you are using global variables (MW, VW, ++) there are no data type checking (example: INT vs WORD). Only when creating local variables within the subroutine, these are checked for data types. Adding to what you said.. If you handle the SINT from a panel, the math functions ill actually work correctly. (Calculations have wrap around function that works to your advantage.) If it the compare functions ( < and > , but not = or <> ) that is going to work right. For the compare functions you can write coding to compensate.. Reading the most significant bit tells you it is a negative value. Alternatively you can subtract the two compare values and compare the result to zero. I will sum it up.. S7-200 does not by default handle signed bytes correctly. It is possible to write coding to handle the byte as if it is a signed number. -- Unless M.Alawini has more, this thread is answered. w |
Last edited by: William B. at: 5/14/2014 8:41 AM@ HD Hosseini: Please review the JPG attached to your last posting. Does this not apply to STEP7? S7-200 use Microwin software - STEP7 rules do not always apply. |
|
Follow us on