Step 7 - Strange problem with datatype in DB

Johnny T

Member
Join Date
Jul 2003
Location
Fife, Scotland
Posts
642
Hi all,

I was recently transposing a bit of software and found that the original software used DB20.DBW2 as the timebase for a timer. Within DB20 the DBW2 address is assigned as a WORD type.

I thought this was unusual but I tried a few other WORD types from within the same DB and the timer accepted them without complaint. This software is currently running the machine so must work..

When it came to transposing it my equivalent DB is DB260. However whenever I try and enter DB260.DBW2 into the timer I get the error of 'datatype WORD does not fit formal parameter type S5TIME' ?!??!

I wondered if this was a glitch to do with me adding comments to the new DB as the original DB (ie. DB20) has no comments and just has the standard STAT as the variable name. However, I've tried putting my DB260 exactly as it appears in the DB20 (ie. no comment, STAT as the name, WORD as the type etc) and I'm still not getting anywhere?

Anyone any ideas?

I know that I could just set the address in the DB to be of type S5TIME but I'd rather work out why its working if I use DB20 but not if I use DB260..

Its a CPU 313C 2-DP that I'm using and I wondered if maybe DB260 was out of its range but there isn't a System Fault and DB260 seems to behave correctly in other ways?

o_O
 
Since no-one more knowledgeable is biting.......

Could it be that type checking was turned off originally and the data type mismatch has never been type tested by the compiler. And now type testing is on, so any new (non S5T#) data you use is rejected?
 
I'd agree with Jason.

But then again, I don't like using LAD, in STL I never had this kind of problems....:D
 
JasonWade said:
Since no-one more knowledgeable is biting.......

Could it be that type checking was turned off originally and the data type mismatch has never been type tested by the compiler. And now type testing is on, so any new (non S5T#) data you use is rejected?

I don't think so Jason. I've tried re-entering the DB20.DBW2 address and it accepts it. There's no difference between the container at DBW2 in DB20 and the one at DBW2 in DB260. Yet it won't accept DB260.DBW2??

?????
 
I think its CPU dependant but I don't think there's any problems with DB260 on a 313C-2DP CPU?


I will, however, double check tomorrow...
 
This is to do with type checking, but, there are certain conditions where type checking cannot be performed or is ignored.

Examples:

DB1.DBX0.0 is declared as a bool. Using DB1.DBW0 as a timer value will be accepted.

DB1.DBW0 is originaly created as a word and cannot be used as a timer value. DB1 is downloaded to the plc. Delete the offline copy of DB1. Copy DB1 from online to offline. DB1.DBW0 will still be declared as a word but can now be used as a timer value. (The implication here is that type information must be stored in the DB when the DB is created in the offline folder but is not stored online)
 

Similar Topics

Have a look at Network 49. If I put in the DB address then all is well: But if I leave out the DB address as I have done in...
Replies
4
Views
1,970
I am having a step7 v5.4 program where the blocks are encrypted and locked. And the manufacturer is stopped the support. Is there any ways to...
Replies
2
Views
206
Good Morning, Hoping someone with some Siemens experience can give me a hand with this one. Customer has a S7-200 cpu, which has a 6GK7...
Replies
0
Views
264
HI! HOW COULD I OBTAIN THE NAMES OF THE STEPS OF A ROUTINE IN SFC LANGUAGE IN STUDIO5000? Or is there a system variable that gives me those...
Replies
0
Views
356
I'm just trying to figure out the right method of adding a DO card to an existing rack. It's not the *next* open slot, but I have to move the AO...
Replies
5
Views
566
Back
Top Bottom