S7 plc bit

Krish

Member
Join Date
Aug 2004
Posts
25
Could someone please try and explain where the value for the bit "MB 798" see attached .doc file i.e within fc block(interface ), scada input value, etc. I have looked in the interface, it does not appear in that fc block.
The ladder after the CMP blocks are not as they are in my illustration but the same "MB 798" is used in all 3 rungs and is compared to 0 all the time.
The value does change but I do not know where the value comes from.

PS. Thanks for the previous assistance I have had from this forum.





 
Hi

MB798 is a memory byte at address 798. I suspect the 'red' display is due to the fact that the programmer here is tryting to do an INTEGER compare between IN1 and IN2. Although IN2 is a valid integer in each case, an MB address can not hold an integer. By definition, an integer is a 16-bit datatype, not an 8-bit.

Since the wrong datatype has been used, and since there would seem to be no point in comparing any value against 0 three times, can we assume that this use of MB798 is a complete mistake. At least they should be MW- addresses (memory words, 16-bit variables).

I've no idea what actual address should be there - it's all up to what your program is trying to do and how it does it.

Regards

Ken.
 
The MB 798 is not red in the actual program but black and the fc block is operational. The value does change from 0 to other "integer" values during operation.
 
Ken is still right, you can't use the compare integer function with an MB, only with a MW! You will get the error "Actual Data Type BYTE does not fit the formal type INT of the formal parameter". The only way it can be black is if it's not actualy a memory byte but a symbol e.g. "MB980" in stead of MB980. In this case the symbol "MB980" can be defined as MW235 of type integer! This is very confusing and should be avoided at all costs. My advise would be to check your symbol table.
 
The comparison works also with MB798 (byte) and 0 (integer).
The red color is generates by the LAD editor. Perhaps the program had been written in STL.
In order to remove the red color:
Open a block, then OPTIONS ->CUSTOMIZE -> LAD/FBD and remove Type Check of Addresses.
 
I too would have thought you needed to use a MW 798 rather than an MB 798.
I will try it later to see how it goes.

As for the compare, if it is working, it could be to see if any of the bits are set.
For example, you can look elsewhere in the program for bits M 798.0, M798.1 ..... M798.7. If all of those are not set then MB 798 would equal zero.
I have used similar code to check for lost bits in a sequence.
Why it is repeated three times, I couldn't say, but I would suspect either an error, or the code may have "evolved" after some trouble shooting.

I would search for the individual bits to find the answer.

Doug
 
Thanx guys - The bit is indeed a byte value. However I have not had the opportunity to check the other M798 bits to verify Doug's theory.
Will keep u posted.
 
Type Checking in Step 7

MB is red in an integer comaprison because Type checking option is on in the Ladder editor options. Type checking forces you to use an integer (16 bits) in an integer comparison. If you turn this off then you can do it but if someone else opens the project with it on, then they will see the rungs that violate type checking in STL.
 

Similar Topics

Hi I have an old panel builder 32 that I’m replacing for a factory talk me hmi . In the plc for the old panel builder there is a coms bit for the...
Replies
0
Views
85
When I started as a controls engineer way back in the ‘80s everyone used all caps when documenting PLS programs and in AutoCAD. This was still...
Replies
14
Views
1,688
Hi All, I have a click plc the I need to bit strip and 16Bit int. This is to get the alarms from these bits in the int. Do anyone know how to bit...
Replies
1
Views
526
I'm seeing some confusing descriptions on the Bit Sequencer (BIT SEQ) in the GE PLC instruction set and I'm converting one of these to AB so I...
Replies
11
Views
1,906
The topic of reading or writing floating-point values via Modbus seems to come up regularly, and it is to my mind not that difficult. That said...
Replies
0
Views
1,412
Back
Top Bottom