Siemens Industry Online Support
Siemens AG
Entry type: Product note Entry ID: 4126469, Entry date: 08/27/1996

CP 521 BASIC - Product Information

  • Entry
  • Associated product(s)


Concerns the product with Catalog No.:                                      


6ES5 521-8MB11   CP 521 BASIC with serial RS 232C/TTY port                  




If you use the FOR-NEXT loop and exit the loop prematurely, a               

CONTROL-STACK error will occur.                                             


A C-STACK error is signalled if a FOR-NEXT loop is exited 9 times           

(max. possible nesting depth) prematurely. Due to premature                 

exiting of the loop the CONTROL-STACK cannot be cleaned up                  

properly. A similar response will occur in the case of the loops            

DO WHILE and DO UNTIL.                                                      



_Temporary solution:_                                                       


Always program such a loop in a subroutine.                                 



_Example of a subroutine:_                                                  


100 GOSUB 1000:             REM calling the subroutine in                   

    continue in main program             line 1000                          


1000 FOR I=1 TO 10:         REM loop from 1 to 10                           

1010 IF I=5 THEN 1030:      REM loop is already left at I=5                 

1020 NEXT I:                REM I is incremented                            

1030 RETURN:                REM back to main program.                       




Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.