David S Posted May 28, 2018 Report Share Posted May 28, 2018 Hello, I am new to PLC programming, and I´ve been assigned this task at USP-070-B10 with UIS-WCB1, using Unilogic 1.23.25: I have an analog angle measuring sensor, which gives current of 0-20mA( 0mA is for -45°,20mA is for 45°) , which transfers into integer value from 0 to 16383 in INT16, I need: 1) transfer the integer value to value in degrees 2) display the value in degrees on the HMI field 3) compare the value with user written value in another HMI field, and perform actions according to the comparation I am stuck at the first part, transferring the integer value to degrees. I tried the linearize function, which suggest in help that can be used to convert analog input values. But when trying to compile and send project to the PLC, displayed error suggested, that the input value and output value have to be in the same data type. Thus I wanted to try the INT to REAL operator, which I probably did not get, how to set up, because when online the value converted into real does not change with the value on the analog input and stays on 0. Furthemore when I want to linearize the converted value of REAL data type into degrees in REAL datatype, the same error displays, that the input value and output value have to be in the same data type, when this is no longer true. I would appreciate any guidelines to setting up my task. Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted May 28, 2018 MVP 2023 Report Share Posted May 28, 2018 Why are you wanting to use REAL in this application? You can have multiple decimal places of precision using integers. For example, if you want two decimal places of precision in your project, linearize from -4500 to +4500. This will give you an implied two decimal places. You can then display it with the two decimal places on screen and use the number in calculations and other manipulations, remembering that the value is 100 times the actual value. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now