Transferring REAL value into a SINT with 2 arrays

StoneNewB

Member
Join Date
Oct 2014
Location
Ohio
Posts
49
Hello everybody,

A challenge I have in front of me consist of taking a REAL value (0 - 4095) and dumping it into a tag (Sent_Counts) that is aliased to an SMC electro/pneumatic pressure regulator. By default when I Alias the tag, it is formed to 2 arrays.

Sent_Counts.Data[0]
Sent_Counts.Data[1]

How can I take the REAL value and dump it into the arrays of SINTS?
 
If you have to convert a REAL value to an array consisting of two SINTs you will have to truncate or round the floating point value into an intermediary INT or DINT value. In the link provided in gclshortts comment the REAL value is written to an array of two INTs.
 
If you have to convert a REAL value to an array consisting of two SINTs you will have to truncate or round the floating point value into an intermediary INT or DINT value. In the link provided in gclshortts comment the REAL value is written to an array of two INTs.

YES! That was the step I was missing, the intermediary INT value. That is progressive for my end result. I think now I will instruct a bit distribute function and map the Inputs from the intermediary value to the 2 arrays of SINT's.
 
Use the COP instruction, source and destination should be self explanatory. The length attribute is somewhat unintuitive, it is defined as the number of destination elements to copy. In your case that would be 2, as you want to copy 16 bits into that 2x8 bit array.
 
Why would you use a length of 4 in your copy instruction?

The COP instruction length is in terms of destination elements. As widelto says, if your destination is a SINT (8 bits) and you want to copy a REAL (32 bits) into four of these SINTs, your length will be 4.

If you were to go the other way, and copy 4 SINTs into one REAL, your length would be 1 as your destination is 32 bits.
 
Ok, I misunderstood the COP function. The reason I questioned why you would use 4 for length is because in the attached photos of widelto, the destination is "Sint _Test[0]", which is composed of 8 bits, with the length of 4. My initial thought was that you were taking a REAL and dumping it into 1 SINT, "Sint_Test[0]". Now that I understand, the REAL is distributed to Sint_Test[0] through Sint_Test[3]. Is this correct?
 

Similar Topics

Hi, I am wondering about transferring RS Logix 500 & 5000, as well as Rslinx to a new laptop. The one I currently use in the field is ancient. I...
Replies
3
Views
678
I have a micrologix 1100 that I am trying to read three data points from it on my safety plc using studio 5000. Any tips or guidance is appreciated.
Replies
4
Views
848
Dear Sir, We have Windows 10 Dell laptop with RSlogix Studio 5000 installed in it. Now we have purchased a ex-proof laptop with Windows 10 and...
Replies
2
Views
2,612
Hi all, How can you transfer a bool value from one db to another I have used l & t to move words from one DB to another but it won’t let me move a...
Replies
2
Views
1,419
I developed an InTouch application in 10.1 in a virtual machine. I developed all the Windows to be 1024x768 for the touch panel it will be used...
Replies
8
Views
4,726
Back
Top Bottom