Integer to Real Number in ti505 for RMC75P

jhuggart

Member
Join Date
Jul 2007
Location
Birmingham, AL
Posts
21
I am using a ti505 with Tisoft6.3 to send commands over profibus to a Delta Motion RMC75P. The problem I am having is that the command parameters for the motion control must be in real number format and I cannot figure out how to convert from an integer to a real number in the 505. The values that will need to be converted are stored in v-memory.

Does anyone have any suggestions? If so, I would greatly appreciate some example code.

edit: By the way, I understand how real numbers work and that two words are required for their storage. I just can't figure out how to make the integer transfer from one word into two words in real format.
 
Last edited:
Why don't you just call tech support?

We are not expert at all PLCs but we know the general direction to get started. You must use SFPGM ( special function program ) blocks. The documentation for this is in chapter 7 of my TISoft manual. I hope you have a TISoft manual. The SFPGM blocks allow you to write code in a basic like format and convert from integers to float or floats to integers. I know our other TI customers use SFPGM to make blocks that they can call from ladder. It keeps the ladder clean and there is a lot of math that you can do in these blocks. You should learn to use them because the signed integers are very restrictive.

Call Delta Tech support 360-254-8688 and ask for Don D. I have asked our techsupport to work out the SFPGM example but we have never used them before so we are learning too.
 
I do have the TiSoft manual. I will look into writing a SFPGM block. Don and I talked the other day and he had a few suggestions, but I still did not solve the problem so I figured I would see what input the forum members here might have.
 
Call the SFPGM from ladder. There are three SFPGM buffers in the 505 series,
Normal, priority and cyclic.

Then use the following syntax:

MATH V500. := V100

Notice the "dot" after the V500, this will assign the value in integer V100 to
a real number stored in V500 and V501.

If you need to continuously do the conversions, then use a cyclic SFPGM and set the update time to your requirements.

You can do many conversions in one program, also the SFPGM has temporary memory locations that can come in quite handy.
You can also use indexed or indirect addressing for looping applications.
 
Last edited:
jhuggart, call Don. He has been working on this today. Don has figured out how to convert a double to a float too. Ken's example is a simple one. If you need to go beyond +/- 32.767 inches then you need to use two integers. In this case you can do this

Assumming the double represents 0.001 inches
Code:
  float:=65.535*HighInt+0.001*LowInt
  IF LowInt < 0 then
	 float := float + 65.536
  ENDIF
I am not real sure about the syntax. I just know you need to test the LowInt and when it is negative then add what ever the HighInt is multiplied by.
You may find it easiest just to do all the math in floats. SFPGM programming makes it easy.
 
I have tested Ken's method and it is capable of handling all of the real values I will need. I do not need to go beyond 9 inches for this application.
 

Similar Topics

Good morning all, I'm integerating a device with a Rockwell PLC with V34 Studio 5000. The device reports error codes using a single integer to...
Replies
19
Views
1,283
Hi all, I've got a bit of a need to convert an integer (and a real in another situation) to a string with a particular format. This seems possible...
Replies
11
Views
2,442
Hello, Could somebody give for me advice how to seperate real number to integer Entered from Mitsubishi HMI GS Series to Mitsubishi PLC FX-1n...
Replies
2
Views
2,552
Hi everyone :* I am using using unity pro v.13 i want to do the mathematical function of floor() which makes for example 1.2 to 1 and makes 2.9...
Replies
7
Views
3,075
Have a device sending me 2 integers one is the value and the other is the divisor. Would there be a compact way to divide this value not have to...
Replies
11
Views
1,978
Back
Top Bottom