Redlion Crimson 3.1 DINT to Float conversion for SLC 500

mgranger

Member
Join Date
Aug 2021
Location
Maine
Posts
1
Hello,

I'm taking in two 16 bit ints from the field via modbus, one low order and one high order to combine into their proper 32-bit form. I've handled this by using the following complex tag expression:

return TextToInt(IntToText([SILOXANE.400004],2,16)+IntToText([SILOXANE.400003],2,16),2);

Now, I need this value into a SLC 500 plc where the only data format I have available is float.

I would like to figure out a way to convert the double integer to a float using crimson, then pass it to the plc. Unfortunately, I cannot COP the two 16 bit integer into a real then MOV the real to a float because I do not have the real data type available on my plc.
 
You should be able to add a Crimson Float tag assigned to a SLC float and then add to your function an assignment that writes to it with a typecast:

int a := TextToInt(IntToText([SILOXANE.400004],2,16)+IntToText([SILOXANE.400003],2,16),2);
SLC_F8_10 := float(a);
return a;

Example assumes a Crimson Floating Point tag named SLC_F8_10 but should be something better than that for your application.
 

Similar Topics

Hey guys, hoping someone here could give me a little advice. I'm working with a CR1000-04000 in Crimson 3.1 and I was interested in adding the...
Replies
4
Views
91
Hi, I have a complex database in Crimson 3.0 and in one of the display pages I am trying to get a tag to show the sum of several other tags. The...
Replies
3
Views
157
It states WinPcap must be installed for the Emulator to function. WinPcap.org states that the technology is mature with no updates planned. Am I...
Replies
3
Views
849
Following on from another thread, I just downloaded Crimson 3.2 and it now supports CR and Graphite HMIs. Time for a 'play' :-) It seems to have...
Replies
14
Views
2,009
Action On Release command Set(ConveyorPopup,ConveyorPop_1) rejected w/ string tags. SetStringTag(index, data) wants an index. How does one pass...
Replies
8
Views
945
Back
Top Bottom