4/17/2015 11:37 AM | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Posts: 25 Rating: (0) |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4/17/2015 1:40 PM | |
Posts: 5225 Rating: (1195) |
Maybe the following solution will work for you.. (to be continued) AttachmentFB80_convert BCD inputs.zip (178 Downloads) |
4/17/2015 1:47 PM | |
Posts: 5225 Rating: (1195) |
(continue) The coding in the ZIP file looks something like:
The code provides the ability for you to "connect" up to 32 individual inputs onto the FB. The FB can then convert the inputs to BCD or DINT or REAL. A picture shows how you would use it (guessing). It is assumed that you use individual inputs from the PLC and that you use the BCD setting on your device. The SCL file is the one that you can import into your PLC project - provided that you have TIA V13. Please consider rating this posting with stars.. if it is worth something to you. (wink) Question are also welcome. |
This contribution was helpful to1 thankful Users |
4/17/2015 10:32 PM | |
Posts: 5225 Rating: (1195) |
Hi, There is an alternatives to using the BCD number. According to the picture that you attached you could use "Binary with sign". The possible measuring range is [-500, 000 to 9,999, 999]. I am however unsure how the negative numbers are formatted (1) pin D25 as a sign bit only or (2) D0 to D25 as twos-compliment number. If we could ignore the negative numbers and we need to represent seven digits, then 17 bits ( digital inputs) are needed. The 17 bits can represent maximum integer number of 131,070. Notice that the 16-bit unsigned number goes to 65,535. So the question: Does your REAL measurement go beyond 655.35; do you really need to go up to 999.99? You will have to make a choice what method you will be using. you have to choose between BCD (uses 20 digital inputs) or binary (uses 17 digital inputs). The option is yours to use 20 vs17 digital inputs - it might be easier to fault find BCD numbers because you work in groups of four bits. The program that you need to convert the 17 digital inputs to the REAL number slightly differs from the one that was posted before. So what do you think? w |
4/18/2015 1:21 AM | |
Posts: 25 Rating: (0) |
|
4/18/2015 8:31 AM | |
Posts: 5225 Rating: (1195) |
Hi. Does the instrument give out a number in meters or in 10mm increments? ------------------- From these words I understand d) From the absolute measurements the span will be 60m. Now you are saying 308m >>> 308 000 on the instrument. ... 308 000 as BINARY encoded number needs 18 bits. ... 308 000 as BCD encoded number needs 6 x 4 = 24 bits. Questions * How many digits do you get from the measurement instrument? * Which of the assumptions are correct and which are wrong? * Do you want to work with a BINARY encoded number * What resolution do you need from the measurement device EXAMPLE 6 digits on instrument by 5 digits to PLC Does all this writing make sense to you? |
Follow us on