MartyB

Structured text operator not supported by DWORD data type

3 posts in this topic

I'm working on simple structured text program which takes in DWORD values, does some math on them and then outputs in DWORD type. What data type should I be using and how can I make this work? 

This is one of the lines from the code(everything DWORD) and I get 'operator not supported by DWORD data type'

XPos3 := XPos1 + (2*XIncrement);

 

Converting from dword.png

Share this post


Link to post
Share on other sites

DWORD is a hex format, generic for a double channel.  I assume these are integers, so you would want the data types to be DINTs (signed) or UDINTs (Unsigned).  I would recommend that you make them DINTs or UDINTs from the get go though (Therefore no conversion instructions).  Unless there is a specific reason they need to be DWORDs....

 

Share this post


Link to post
Share on other sites

Thank you for the advice. I just had to convert the data type to DINT and then convert back. Couldn't change variable data type from the get go since I'm receiving and sending them through the network and the receiving device specifies all data has to be in DWORD. 

conversion.png

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now