andre Posted January 15, 2013 Report Posted January 15, 2013 Buon giorno, ho un PLC Rockwell delle serie 5000,leggo in modbus dei dati da uno strumento di Pressione lavora solo con valori INT. Il dato di pressione viene scritto su due WORD, avrei bisogno di unirle per spostarle su campo di tipo FLOAT, come posso fare? Grazie
unicleid Posted January 18, 2013 Report Posted January 18, 2013 Ciao, puoi fare così: crea una TAG di tipo INT[2] che chiamerai tipo INTERO[2] (intero bidimensionale) e copi l'intero che proviene dal MODBUS che corrisponde ai bit 31..16 su INTERO[1] con un'istruzione MOV. Fai lo stesso per la seconda word su INTERO[0]. Poi fai i seguenti due COP: INTERO[0] con destinazione una tag DINT (Length del copy =2) e poi un COP del DINT ottenuto su un REAL (lenght=1) che sarà il tuo risultato finale Io ho messo il tutto in una ADD-ON in modo tale da fare una conversione in un'unica istruzione. Ciao
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