+32767 Limitation (Omron)

Andreik

Member
Join Date
Mar 2009
Location
Makati City
Posts
80
Good day,

I have a Stepper Motor with position feedback. It gives values from -2,147,483,648 to +2,147,483,647. I only need values from some -200 to +46,900. The problem occurs is when the feedback reaches +32767. Instead of an incrementing value, it goes immediately to -32768, -32767, -32766 instead of +32768, +32769 and so on.

This problem is solved when I use "Signed Double Integer (DINT)". The problem this time is when the value reaches (-). Instead of -1, -2, it gives me a value of +65535, +65534 and so on.

I don't know what to do converting these numbers and it confuses me a lot much more scaling them into measurement (mm). Someone please help me.

Thanks,
Andrei K.
 
You say that the stepper motor feedback is -2,147,483,648 to +2,147,483,647 (from the manual I suppose).
The -2,147,483,648 to +2,147,483,647 is the normal range for a signed DINT so that seems to be correct.

I think you have somehow chosen an unsigned INT (range 0..+65535), in stead of a signed DINT. If the error is in the stepper motor or in your program I cannot tell.
 
It's always a good idea to mention the controller model and the software being used.

... when the feedback reaches +32767. Instead of an incrementing value, it goes immediately to -32768, -32767, -32766 instead of +32768, +32769 and so on.
This reflects 16-bit (single) signed integer limits.

This problem is solved when I use "Signed Double Integer (DINT)". The problem this time is when the value reaches (-). Instead of -1, -2, it gives me a value of +65535, +65534 and so on.
This does not look as "problem is solved".
The mentioned wraparound indicates using of unsigned single integer, not double integer.
 
It's always a good idea to mention the controller model and the software being used.


This reflects 16-bit (single) signed integer limits.


This does not look as "problem is solved".
The mentioned wraparound indicates using of unsigned single integer, not double integer.

PLC = CP1E-60DT-D (Omron)
Stepper = ARD-KD (Oriental Motor)

Thanks
 
Are you creating the position PV yourself with a counter, or is this via the modbus comms?


Post your code so that it can be reviewed for the problem.
 
You say that the stepper motor feedback is -2,147,483,648 to +2,147,483,647 (from the manual I suppose).
The -2,147,483,648 to +2,147,483,647 is the normal range for a signed DINT so that seems to be correct.

I think you have somehow chosen an unsigned INT (range 0..+65535), in stead of a signed DINT. If the error is in the stepper motor or in your program I cannot tell.

I've used the signed DINT. Please see attached. Thanks

Data Prob.jpg
 
Last edited:
Are you creating the position PV yourself with a counter, or is this via the modbus comms?


Post your code so that it can be reviewed for the problem.

It is via Modbus RTU. I think there's no problem with the Position Data. The problem is how to properly interpret it. there's no way "-1 = +65535 (FFFF)".
 
The data is probably coming back in 2x words, maybe even Byte Swapped.
What does the Oriental Modbus manual say about the PV value that you are trying to read?
 
The data is probably coming back in 2x words, maybe even Byte Swapped.
What does the Oriental Modbus manual say about the PV value that you are trying to read?

I have 2 observations:
1) If I use Signed INT, it reads (-) Integers but can only read up to +32767.
2) If I use Signed Double INT, -1 becomes +65535 (FFFFh) though it can read more than +32767.

Modbus manual doesn't really say something about the data. All it gave is its Register Address (CCh) with the range of -2,147,483,648 to 2,147,483,647.

I also need to use Move Bit instruction to arrange the data into D10.

position_data.PNG
 
Modbus manual doesn't really say something about the data. All it gave is its Register Address (CCh) with the range of -2,147,483,648 to 2,147,483,647.
This indicates that it is a DINT, requiring 2x words
So the PV data is appearing in 205 & 206?

This sounds right, you will need to concatenate the 2x words together...
 
This indicates that it is a DINT, requiring 2x words
So the PV data is appearing in 205 & 206?

This sounds right, you will need to concatenate the 2x words together...

Yes, as you can see, the value of my D10 is 4469h = +17513. The value is right for this matter. I think there should be some way for this. If not, I will be forced to use some Comparing manipulation with that -1 (FFFFh) problem.
 
In post #6 we can see the raw data via the HEX value FFFF.
FFFFhex = 65535dec.

In other words, the PLC interprets the data correctly, but the data from the stepper motor does NOT follow the signed DINT format.

Conclusion: The problem is in the stepper motor.
 
In post #6 we can see the raw data via the HEX value FFFF.
FFFFhex = 65535dec.

In other words, the PLC interprets the data correctly, but the data from the stepper motor does NOT follow the signed DINT format.

Conclusion: The problem is in the stepper motor.

But wait, look when I changed DINT into INT (both Signed). PLC read "-1" as "-1". (img INT)

Problem solved? Not really. Look when I moved the Motor to position "+32768". PLC read it "-32768". Position "+32769", PLC will then be "-32767". (img INT2)

Look to (img INT3). When I went back to DINT, PLC can now read "+32768" properly. Now, this goes back to problem "-1". Tricky isn't it?

INT.jpg INT2.jpg INT3.jpg
 
The stepper motorn does not provide the correct DINT representation of -1. In hex it shows FFFF, it should be FFFFFFFF.
FFFFhex in a SDINT memory is 65535dec. PLC is correct.
FFFFhex in a SINT memory is -1dec. PLC is correct.

Conclusion: Problem is in the stepper motor.

edit: look at the HEX values. It makes it much easier to figure out what is going on.
 
Last edited:

Similar Topics

Ok this goes off of my recent thread but I thought I would start this one and break it down problem by problem instead. I have a scale reading...
Replies
12
Views
3,599
Hi guys, Have an existing Wonderware V9.5 setup I need to work with. I'm trying to read a DINT tag from an AB Control Logix. When I setup the...
Replies
3
Views
7,386
I have my earlier problem solved but this one is really getting to me. I have my direction issue solved , but I have another issue with my Actual...
Replies
17
Views
4,970
Stuck for words. As many of you already know, on a 16 bit analog input, 0-20mA reads 0-32767; so 4-20mA => 6554-32767. What unit would 6554-32767...
Replies
7
Views
2,520
i am working on a project for counting boxes or plastic trays coming down two decline conveyors, as it stands the system knows if it is a...
Replies
14
Views
3,743
Back
Top Bottom