Data Types - Valid or not? How to change? (newbie question alert)

aspAddict

Member
Join Date
Jul 2008
Location
Illinois
Posts
4
Okay, so I'm one of the new guys to the PLC world - I do have programming experience but I am quickly finding out how little I actually know. o_O

I recently had a project handed to me that has me confused - I'll try to summarize for the ADD crowd:

We have an error routine that should scan through several inputs. If a condition is met, the program should dump out a hex value to a database table which is later read by our software. The software then puts a message on the screen with the error code. Simple enough - no rocket surgery involved so far. (y)

So far we have been able to confirm that the software is getting into the system and reading the right table, but it's not getting any data out, even when we force an error condition.

During my troubleshooting, I noticed something odd - there are two symbols that have weird data types. I'm used to seeing hex, boolean, etc. but these two have data types of "DB 1" and "FC 84" that match their addresses. (See screenshots below...)

Thinking I had stumbled onto the problem, I tried to update these addresses to "BOOL" or "HEX" but the Siemens program throws an error and tells me that it's not a valid data type for this address.

I've been F1'ing through the help files to try to figure out how to change these, but so far it seems that there is something preventing me from saying "Allow address DB 1 to accept HEX data types" or "Allow address FC 84 to accept BOOL data types." They seem to be stuck somewhere.

My question is two-fold at this point:
  1. Is it possible to update these addresses at all? (I know that FC84 is a system block and is protected, but I fear that something has corrupted the settings on it...)
  2. If it IS possible to update these, how the heck do I go about doing it? I have tried going into the symbols table and changing them there, but with no luck...
Any suggestions/pointers/vodka would be greatly appreciated.

TIA

Screenshots:
The code
CodeSample.jpg


The "Edit Symbols" window for this rung:
WrongDataTypes.jpg
 
So far we have been able to confirm that the software is getting into the system and reading the right table, but it's not getting any data out, even when we force an error condition.

How do you know that you are reading the correct table data - what exactly have you done to confirm this ?
 
L D[AR2 said:
How do you know that you are reading the correct table data - what exactly have you done to confirm this ?

As much as I hate the phrase, the answer is "This is the way we've always done it."

We have similar systems that can read the data from that particular table, and the software will throw an error if it can't read from that specific table.

What we expect to see happen:
Error condition is met -> Error details are correctly dumped to the table by the PLC -> Software sees the error details and displays them on screen

What I THINK is happening:
Error condition is met -> PLC tries to dump error details to the table but is getting junk data and ignores/discards it without adding it to the table -> Software never sees the data

Like I said, this was just handed to me and I'm learning as I go - any suggestions as to what I should check would be appreciated. Also, if the code looks wrong or if you need more information, please let me know.

Thanks again!
 
Click your mouse on FC84 then hit F1 to read the help on FC84. FC84 will add values to the table until the table is full. Something else must remove entries from the table.


Edit, added info

DB1 is a data block (or table) and contains entries of various data types bools, ints, words etc.
 
Last edited:
L D[AR2 said:
Click your mouse on FC84 then hit F1 to read the help on FC84. FC84 will add values to the table until the table is full. Something else must remove entries from the table.


Edit, added info

DB1 is a data block (or table) and contains entries of various data types bools, ints, words etc.

Okay - I'm reading through it now, it's starting to come together...one question I have is in regards to the FC84 address itself. I want to be able to look inside of that and verify that the DB1 data block exists, but whenever I try, I get the message "This block is protected" - is there some way to gain access to this? My coworker (who has been dealing with Siemens and AB PLCs longer than me) says that when we upgraded the Siemens software, this FC84 block automagically appeared, and he suspects that it a system block that we can't modify...does anyone know if that is accurate, or am I being steered down the wrong path...?

Also, I noticed that there is an option for "Generate Source" under the File menu. The way my coworker has been doing things is like this:

Go online with the PLC -> Edit the blocks -> Download the changed blocks ONLY -> Try again

Should we be regenerating the source and re-downloading everything when we make a change? What is the best practice in this situation?
 
If the block FC84 is a Siemens function then it will be protected and unless you can chummy up to Siemens somehow you probably won't find out whats going on inside.
If you create an S7 block and use the function 'Generate source' you will find an ST source in the sources folder of your S7 project. If you edit the source and add the line 'Know_how_Protect' then recompile the original program block will become protected, to unprotect you need to remove the 'Know_how_protect' line from the source. It is a technique used by software vendors to ensure bespoke code remains as they intended.
 
If DB1 exists, it will be in the Blocks folder. Double click on it to view it in the editor.

Here's an example view

block002.JPG
 
Last edited:
..to add further concerning source code. Source code is simply a text file and is not downloaded to the plc. Source code is compiled to produce blocks (OB, FC, DB, FB) which can be downloaded to the plc.

Source code is very useful when posting code on this forum - it means other forum users can take your source and compile it and run the same code as you.
 
Thanks for the info - I found the DB1 listed in there, and it looks okay, but I think we found the problem...

It looks like my coworker tried to assign some of the variables and such to system addresses - not sure why the software let him do that, but that's neither here nor there...

We called Siemens for some input on what we are running into and during the phone call we determined that the variables were mapped to the wrong memory addresses. According to them, this would cause all kinds of funky output and data exchange depending on the system state at runtime.

They gave us a list of available memory locations that we are allowed to use and we are going to pick through the logic and update everything that is in conflict...

Thanks again for the help - stay tuned for the next episode of "WTF is my code doing?"

🍺
 

Similar Topics

I am using a Beckhoff PLC and trying to convert a REAL to 2 WORDS to send over Modbus. Does anyone know how to do this? Also how would I convert...
Replies
5
Views
743
Looking for information regarding what data types are supported in Crimson 3.1 programs. Cstring is self explanatory. Professor Google hasn't been...
Replies
1
Views
1,140
I'm currently working on a messaging system and Ive been having issues with trying to message over a REAL Data Type from one PLC to another. Has...
Replies
2
Views
1,258
I work at a cheese factory and we recently ran into a problem where in an older controller they where able to use a REAL Data type in OTU and XIC...
Replies
13
Views
2,400
I've got some minimal C code that I wrote some time ago to talk to Siemens PLCs. I used it with a 1200. At the time I only hit I, M, and Q...
Replies
5
Views
1,806
Back
Top Bottom