TIA Portal convert Profinet Gray Code absolute encoder to revs and part rev

I dont know what your labels refer to. So I can only guess as to what the trace shows.

I also do not understand how it seems in the trace that several bits change at the same time. The idea of a gray code is that only 1 bit is flipped at one time.
Is this trace before or after conversion from gray code to binary ?
Can the encoder be setup to not using gray code ?

I would like to see the whole raw (no conversion) bitpattern i.e:
0011 0001 0010 1101 1111 0111 1010 1101 0010
0011 0001 0010 1101 1111 0111 1010 1101 0011
0011 0001 0010 1101 1111 0111 1010 1101 0111
0011 0001 0010 1101 1111 0111 1010 1101 0110
 
Last edited:
The labels are at the far right of the picture. I only started thinking that the output was Gray Code after I started having problems, the trace shows that at least the bottom section is standard binary. I am using TIA Portal 14 Basic, I know how to display the bit pattern, but how do I record the changes? Or is it just a copy and paste job, line by line?
 
Just monitor the bit patten in a watch table.
Dont move the encoder.
Copy the value from the watch table to a text file.
Move the encoder a little bit.
Copy the value from the watch table to a text file, into a new line.
Move the encoder a little bit.
Copy the value from the watch table to a text file, into a new line.
etc.

It does not have to be that you get values from each finite change of the bit pattern.

Would be nice if you can catch when you pass the point where the position bits gets reset, and the rev bits should increment.

You could also turn the encoder one revolution at a time plus a tiny bit more. Then the revs should increment by exactly 1, either with gray code or with binary code.
 
Code:
Just before what should be the zero point, maximum revs
2#0000_0111_1111_1111_1111_1001_0100_0000

Turning clockwise
2#0000_0000_0000_0000_0001_1000_1100_0101
2#0000_0000_0000_0000_0001_0111_0000_1101
2#0000_0000_0000_0000_0001_0100_0011_1000
2#0000_0000_0000_0000_0001_0010_0110_1011
2#0000_0000_0000_0000_0001_0000_1010_1011
2#0000_0000_0000_0000_0000_1111_0101_1001
2#0000_0000_0000_0000_0000_1101_0111_1111
2#0000_0000_0000_0000_0000_1010_1110_0101
2#0000_0000_0000_0000_0000_1001_0001_0010 just before revs change but only half way actual rev
2#0000_0000_0000_0000_0010_1000_1011_0001 revs now 1
2#0000_0000_0000_0000_0010_0110_1101_0011
2#0000_0000_0000_0000_0010_0011_0101_1010
2#0000_0000_0000_0000_0010_0001_0010_1110
2#0000_0000_0000_0000_0010_0000_0110_0101
2#0000_0000_0000_0000_0010_0000_0000_0001 just before revs drops back to 0
2#0000_0000_0000_0000_0001_1111_1101_0111
2#0000_0000_0000_0000_0001_1111_0001_0111
2#0000_0000_0000_0000_0001_1101_1101_0100
2#0000_0000_0000_0000_0001_1100_1000_1111
2#0000_0000_0000_0000_0001_1010_1011_1000
2#0000_0000_0000_0000_0001_1001_1011_0101 1st actual rev
2#0000_0000_0000_0000_0001_0110_0111_0101
2#0000_0000_0000_0000_0001_0110_0110_0110 just before revs go bak again to 1
2#0000_0000_0000_0000_0011_0101_1011_0001
2#0000_0000_0000_0000_0010_1001_0000_0011 just before revs go to 2
2#0000_0000_0000_0000_0100_1000_1000_0110
2#0000_0000_0000_0000_0100_0000_0000_1111 just before revs drops back to 1
2#0000_0000_0000_0000_0011_1111_1101_0111
 2#0000_0000_0000_0000_0011_1001_0111_0011 2nd actual rev
Don't want to put in any comments that may sway your thoughts.


This is from the manual which is why I thought it was Gray Coded 'As the MC-ENCODER is a gray-coded absolute encoder', but Profinet output definitely isn't.
 
Last edited:
I agree with your comments in the list.
The values are definitely binary.
And revs increase when position rolls over from high to zero. It should be the other way around.
And the fact that bit 13 change at the half-way mark is also very odd.

So to sum it up:
Bits 0-13 are the position. Increases when turned CCW. Decreases when turned CW.
Bits 14-31 are the rev counter. Increases/decreases in opposition to the position. And increases/decreases at the half-way of the position.
Doesnt seem right.

You can either contact Siemens and ask them if that is what it is supposed to do.
Or you can program around it.
You could take bits 0-13 for the position.
And then take bits 14-31 for the revs, but invert the value (!) and divide by 2 (!!).
edit: Alternatively just take bits 15-31 for the revs, and inverted.
 
Last edited:
Thank you, confirmed my conclusion. Could program round it but it would be a pain, so I will wait for Siemens tech support and give them some earache.
 

Similar Topics

Hello gentlemen, Im working on a small project on TIA Portal, about establishing a Modbus TCP connection between my ET200SP plc and a socomec...
Replies
10
Views
214
I am currently am in a PLC class and need urgent help on how the ladder logic would be laid out. I understand how to get the traffic lights to...
Replies
19
Views
386
Hello, If the date on the license manager of tia Portal has expired, can I still work with it? or is this just to keep the program up to date...
Replies
7
Views
184
Im trying to create a level indicator for water Tank i have used the ADD function while the pump is on and level increasing everything works...
Replies
33
Views
970
My PLC (S7-1200 with CPU-1212C) has now been delivered to customer site. They've asked me to do some updates to the software. I can do that on my...
Replies
21
Views
419
Back
Top Bottom