You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old August 5th, 2006, 12:40 PM   #1
BoSChoW
Member
Slovenia

BoSChoW is offline
 
Join Date: Apr 2006
Location: Nova Gorica
Posts: 107
Please help me: Area length error when reading

Hi all,
I have a problem, when i try to run my application an error appear on the PLC S-300 CPU 313C. The diagnostic buffer says area lenght error, what does it mean? how do i correct this? anyone had some experiences with this cind of error might help me solve my problem.

Thanks for your help and your time. Regards.
  Reply With Quote
Old August 5th, 2006, 12:50 PM   #2
BNA
Member
Denmark

BNA is offline
 
BNA's Avatar
 
Join Date: Sep 2003
Location: Give
Posts: 109
Read this thread !


http://www.plctalk.net/qanda/showthread.php?t=12230
Regards
Brian
  Reply With Quote
Old August 6th, 2006, 05:59 AM   #3
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 10,788
The thread that BNA posted a link to, discusses two possible causes for the error.

1. That the HW config is not setup correctly, so that the real HW does not macth the one setup in STEP7.

2. That the HMI tries to access data that does not exist on the PLC.

But the most common cause is this:
3. That the userprogram tries to access data addresses or i/o addrsses that does not exist on the PLC.

To locate the problem exactly, investigate the diagnostics buffer and look for "address being accessed" or something like that. I dont remember the phrasing exactly. The word-number and type (Input, output, merker, DB) will be stated.
Then use the cross reference to find out where in the program the address is being used.
Notice that the address that is used in the program can be of another type than word, it may be a bit, or a byte, or a doubleword. So you have to look for all posible types.
__________________
Jesper
  Reply With Quote
Old August 6th, 2006, 06:25 AM   #4
SimonGoldsworthy
Member
United Kingdom

SimonGoldsworthy is offline
 
SimonGoldsworthy's Avatar
 
Join Date: Mar 2005
Location: England
Posts: 1,079
Are you performing any indirect addressing in your program ?

If not, then my most common cause when encountering this error is that the instance data block(s) are out of date and are not the correct size (too small).
  Reply With Quote
Old August 6th, 2006, 06:53 AM   #5
BoSChoW
Member
Slovenia

BoSChoW is offline
 
Join Date: Apr 2006
Location: Nova Gorica
Posts: 107
Hi all and thank you guys, Simon yes i am useing indirect addresing for the inputs. In my application i have 16 steps, each step consists of 16 inputs. The user defines which input is being used... The error accours when the first step is executed...so the cause may be with the indirect addressing or perhaps with the error masseges on the HMI OP7. I will try and locate the error. Again thanks a lot guys.
  Reply With Quote
Old August 6th, 2006, 09:42 AM   #6
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 10,788
Quote:
1. That the HW config is not setup correctly, so that the real HW does not macth the one setup in STEP7.
I think that I have to explain a little more, otherwise what I wrote before could be misinterpreted.

For normal i/o access ("I" and "Q" addresses), there is a "proces image" of a certain size on the configured CPU.
The "Area lenght error" only appears if the program tries to access i/o outside the proces image. If the program tries to access i/o that is not configured in the hardware setup, but is within the proces image, then there will be an error, but not the "Area length error".

For access to peripherial i/o ("PI" and "PQ" addresses), then the addresses must match the configured hardware exactly in all cases. If not, then you will get the "Area length error".
__________________
Jesper
  Reply With Quote
Old August 6th, 2006, 03:24 PM   #7
BoSChoW
Member
Slovenia

BoSChoW is offline
 
Join Date: Apr 2006
Location: Nova Gorica
Posts: 107
Hey guys,
I have located my error. It happans in the case statement. And i dont know how to correct it. In the first case when all the conditions are solved the application should go to the next case statement but instead the error appears. My case statement looks like this:

CASE setp OF
1: stepping:=2;
2: stepping:=3;
.
.
.
15: stepping:=16;
end_case;

step:=stepping;
  Reply With Quote
Old August 6th, 2006, 04:03 PM   #8
SimonGoldsworthy
Member
United Kingdom

SimonGoldsworthy is offline
 
SimonGoldsworthy's Avatar
 
Join Date: Mar 2005
Location: England
Posts: 1,079
I know this doesn't identify the problem, but wouldn't it be a lot simpler to code this as:

step:=setp+1; ?
  Reply With Quote
Old August 6th, 2006, 04:18 PM   #9
PeterW
Member
Canada

PeterW is offline
 
Join Date: Jun 2006
Location: Edmonton
Posts: 2,418
Can't see it being the case statement itself, probably the step that's processed is causing it. I would presume depending on the value of step, it will jump off somewhere.

Or possibly, you have no 'else' in there, so what value does stepping have if the case variable is not within the 1 to 15 boundaries?

If setp is outside 1 to 15 it will pass over without effecting the variable stepping.

So its either something in one of the steps 2 to 16 or its whatever happens if its setp is outside the expected number.
  Reply With Quote
Old August 6th, 2006, 04:31 PM   #10
BoSChoW
Member
Slovenia

BoSChoW is offline
 
Join Date: Apr 2006
Location: Nova Gorica
Posts: 107
Simon, i made my application like this to avoid repetition. I have avtomatic and stepping mode. And i wanted to use a single CASE for both automatic and stepping, but yes your proposal resolves my problem, but i will have to make the second CASE for the stepping mode. Tommorow i will fix the error hopefully.

Peter i have alll the else conditions, but somehow when the step:=2 the error appears and i dont know why, but i will do as simon has suggested.

Thanks a lot guys for your help and support.
  Reply With Quote
Old August 7th, 2006, 10:44 AM   #11
BoSChoW
Member
Slovenia

BoSChoW is offline
 
Join Date: Apr 2006
Location: Nova Gorica
Posts: 107
Hi. I made the changes as Simon suggested but the error is still present, something is wrong with my addresing. I just tiped step and stepping between the VAR and END_VAR, is something wrong wtih this ? I dont know, can somebody suggest a better way to do CASE statements?

Thank you very much for your time and help.
  Reply With Quote
Old August 7th, 2006, 11:05 AM   #12
Gambrinus
Member
Latvia

Gambrinus is offline
 
Join Date: Oct 2005
Location: Riga
Posts: 248
It will be better to fix your problem. If you have possibility to do it, try to comment by // all (this means temporary disabling) from place where execution jumps after CASE. When ERR LED switches off, re-enable step by step your program lines until error occurs.
Second. Organize your pointers content transferring to not used M or DB area to analize it from VAT.
Error may be simple and stupid, my expirience says.
  Reply With Quote
Old August 7th, 2006, 11:32 AM   #13
Ken M
Member
Scotland

Ken M is offline
 
Join Date: Mar 2004
Location: .
Posts: 1,137
Hi BoSChoW

I'm not convinced your problem is in your CASE statement. This may be where you see the symptom, but it certainly looks correctly constructed.

If SETP wasn't declared as an integer, it wouldn't run (or compile) at all. If STEPPING and STEP weren't declared as integers you couldn't assign values to them as you do. So all clear so far. Even if SETP has a value of 0 or 16, this shouldn't fault the CASE statement: if it doesn't find a match it just carries on without taking any action.

You are controlling the value of STEPPING and STEP from the code so we can predict (to an extent) the outcome of these. What about SETP? How is its value established? Could it be that a non-valid integer value is being created there somehow? Is it set by your HMI?

Regards

Ken
  Reply With Quote
Old August 7th, 2006, 01:35 PM   #14
SimonGoldsworthy
Member
United Kingdom

SimonGoldsworthy is offline
 
SimonGoldsworthy's Avatar
 
Join Date: Mar 2005
Location: England
Posts: 1,079
Going back to an earlier post, as follows:

Quote:
Originally Posted by BoSChoW
I have located my error. It happans in the case statement. And i dont know how to correct it.
What did you do to establish that the error occurred in the Case statement ?
  Reply With Quote
Old August 10th, 2006, 09:26 AM   #15
BoSChoW
Member
Slovenia

BoSChoW is offline
 
Join Date: Apr 2006
Location: Nova Gorica
Posts: 107
Hi guys, i have finally solved my problem. The error was in the comparison of the words... I had compared a word that existed with one that dosen't thats why the PLC went to RED led. So to solve the problem i just had to correct this.

And yes all of you were right there was nothing wrong with the CASE statement. And i wanna thanks all of you for helping me out on this one. Thank you very much.

Regards.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Cut to length accuracy JamesWSY LIVE PLC Questions And Answers 8 February 7th, 2006 11:11 AM
Cut to Length Application JamesWSY LIVE PLC Questions And Answers 1 December 6th, 2005 09:19 AM
Using variable length with Siemens CP343 Christian Dam LIVE PLC Questions And Answers 2 October 23rd, 2005 03:29 PM
Hostlink DM area over 9999 up till 64K access. premus LIVE PLC Questions And Answers 3 July 26th, 2005 05:48 PM
S7 Area Length Fail kennyb LIVE PLC Questions And Answers 6 January 31st, 2005 03:37 PM


All times are GMT -5. The time now is 11:29 AM.


.