How to convert a DINT into a Word Array

Jpik

Member
Join Date
Feb 2021
Location
Morris, IL
Posts
1
Thank you so much for your help!

I am trying to use an INT or DINT as a setpoint for my remote device using Modbus TCP/IP.

My code is:
Temperature:= WORD_TO_DINT(Process_VAR);
Where Process_VAR is a word array containing 2 words.

:confused:I get the error that "Cannot convert "ARRAY [1..2] OF WORD to WORD".

How can I use a number to relay setpoint information to my remote device please?
 
Welcome to forum.


You can't diretly address array of 2words (or any lenght) to single integer. You need point to one variable only.


Temperature:= WORD_TO_DINT(Process_VAR[1]);
var2:= WORD_TO_DINT(Process_VAR[2]);


Unless process_VARA array is floating point variable whhich is readed like two words.


Then you would need move these two words to double word and then move bit pattern to real variable (or read directly reals).
 

Similar Topics

I have a Structure in my project which has a few nested UDTs. They are ultimately of type DINT. What I would like to do is copy the values out of...
Replies
5
Views
2,252
Greetings fellow PLC programmers, I know there is a simple way to get the system date time of the RSLogix system. But, is there then a way to...
Replies
12
Views
8,591
I need to iterate though the bits in a DINT, but it seems you can't indirectly address a DINT at the bit level..... So my next thought was...
Replies
9
Views
3,432
I'm not a ladder or AB guy and the people asking me are using both, so this has me stumped. Long story short, they have several arrays of...
Replies
11
Views
5,335
Hey all, I've reviewed many threads regarding converting one data type to another and I have something I'm working on that I'm stumped on and...
Replies
9
Views
5,917
Back
Top Bottom