file: C:\hagen\wpfiles\vertexdoc\seimenshints.wp6

Siemens hints - from manuals

Note: Siemens uses the term "Programmable Controller" for the entire crate which contains two computers: CPU 928B ("PLC"), and the 80385 computer CP524/COM525 which is known as the Local Control Unit ("LCU"). Our system also includes a second crate to house the various Siemens digital and analog I/O cards.

1. The backup battery must be fitted in the crate before the PLC is placed in operation. Without a backup voltage, the PLC will remain in the Stop state after system voltage is switched on. Only use battery compartments marked -A1155-B21 (red label) S5...... system manual, page 4-34

2. The rechargeable battery is fitted in the right-hand fan subassembly. Life of bat = 6 yrs.

3. The program in the spare (purchased later) PLC 928B-3UB21, resides on the plug-in flash memory card. The contents of the flash memory is transferred to RAM when an overall reset is performed. In operation, the PLC uses the RAM. A manual overall reset is done as follows:

Turn the mode switch up to STOP. Then, while holding the spring-loaded reset switch down to OVERALL RESET, move the mode switch to RUN, and then back to STOP.

Notes after working with S5 dev. system:

a. it seems impossible to edit code in the PLC; instead, you must edit in the file and then transfer the block(s) to the PLC. Once transferred, you can at least read them from the PLC.

b. "illegal command' seems to be the most common error message; the system will hardly accept a line of code. Check that the variables have been entered in the Assignment file. Also

note that FBs are more accepting than OBs or PBs. Try entering stubborn code into an FB.

If that works, figure out what statements were not worthy of appearing in a PB or OB.

"Flag area is a memory area which the user program can access extremely quickly with certain operations. The flag area should be used ideally for working data required often. Single flag bytes can be used as interprocessor communication flags (IPC flags) to exchange data between CPUs. IPC flags are updated by the system program at the end of the cycle via a buffer in the coordinator or CP/IP." (holdover from slow early PLCs)

Note "the cycle", suggesting again that OB1 is always cycling.

Is there any way to eliminate the cycle? Doing so might spoil the system's handling of I/O image transfer, but the user can also do this function. See S4p3-12, "The cyclic program can be interrupted or even aborted completely by the followng: fault or err, operator iterention using PC stop function or setting the mode selector to "stop", a stop operation." But it looks from S4 Chapter 4, that in STOP mode, the CPU is really dead and won't respond to interrupts.

S4,p3-11: Standard setting for maximum cycle time is 150ms.

FX means "extended function block". Like FBs programming is only in STL, arguments can be passed. S4, p 2-21.

Using block type FX increases the maximum number of possible function blocks from 256 to 512. S4, p2-10

Number your function flocks in descending order starting with FB255, so that they do no collide with the standard function blocks (FB1 through FB 199) S4,p2-24.

Sequence blocks (SB) were originally special program blocks for step by step processing of sequencers. In the meantime, however, sequencers can be programed with GRAPH 5. Sequency blocks have therefore lost their original significane in STEP 4. Sequence blocks now represent an extension of the program blocks and are used as program blocks. S4, p2-10.

Our program uses no sequence blocks.

With OB1 to OB39, you can control program execution, the restart procedure of the CPu and the reaction in the event of an error. You program these blocks yourself. These OBs are called by the system program.

OBs 40 to 255 contain special functions of the system program . You can call these blocks if you require them in your user program. S4p2-10.

All blocks have 5word header before the block body. The programmer also generates a block preheader (DV,SXV,FV,FXV) for block types DB, DX, FB, and FX. S4p2-11

Data blocks DB0, DB1, DB2, DX0,DX1, and DX2 contain parameters reserved for specific functions and you cannot use them as normal data blocks. S4p2-12 (Does this mean you cannot use them - period? Yes - see S4p2-39 for how the system uses these blocks. (The system must have some private blocks of its own, so these blocks are perhaps intentionally viewable, at least by the user). DB0 is a memory map. DX0 is used in the 135U/155U to select parameters.

When you correct blocks in RAM mode, the old block is declared invalid and a new block is entered. Similarly, when blocks are deleted they are not really deleted, they are declared invalid. Deleted and corrected blocks continue to use up memory space - unless you use the COMPRESS MEMORY online function to make space for new blocks. S4p2-13.

You can program and call PBs, OBs and SBs, as if they were the same. S4 p2-14.

questions:

The PLC operating system normally reads and writes the process images to the I/O modules, but p1-9 of S4 says "The user program can access the I/O modules directly via the S5 bus... both the I/O area (P area) and the extended I/O area ( O area): 256 bytes each for inpus and outputs. " When? Why? Answer: the user can employ "advanced" instructions to access memory via absolute addresses. "Not recommended except for advanced programmers".

How about a STACK? Does every jump statement expect to be followed, eventually, by a return (BE = block end)? If that is the case, and every jump stores a return address on the stack (or maybe more), then looping around via jumps (go to's) will eventually overflow the stack and crash the program. Answer: yes, the program will crash after more than 64 nesting levels.

Stored Program--------------------------

Our spare cpu 928B-3ub21 has a 256kbyte flash card in its slot. The catalog says that this cpu can accept flash cards up to 64 kbyte (which is the size of the fixed onboard RAM). When the PLC starts, the contents of the flash are copied automatically into the RAM. How can 256kB be copied into 64kB? Did we buy the wrong flash card? (It seems to work). Answer: only the first 4kB are copied. The manufacturer probably discontinued the smaller flash modules.

Siemens Development System for PLC Code development and loading

We run STEP5 Version 6.6 on a PC. This program has three installation disks plus a (red) "authorization" disk. We have a "single license" which means that only one computer can be authorized at any time to run STEP5. The program is installed on a lab PC for training and for program modification, and also on a laptop, which is easy to take upstairs. To move the authorization from one computer to another, one runs the AUTHOR program on the red disk to retrieve the authorization the first computer and then again to move the authorization into the second computer. STEP5 Version 6.6 is incompatible with Windows 98, so both the lab computer and the laptop run Windows 95.

To start STEP5, chose the Simatic icon at the top of the Windows main screen Start list. Moving to the right, select Step 5v66.~0 and then STEP5 Full-Screen Display. A blue screen should appear with a prompt to select a language. Type E for English and you are immediately in the STEP5 main menu. If the computer does not contain the authorization, it will return to Windows rather instead of the blue screen, sometimes with no message to tell you that your computer does not contain the authorization.

STEP5 uses COM1 to connect directly to a 15-pin D connector on the front of the PLC (CPU 928B). A special Siemens cable is used, which contains a module to convert the RS232 T and R lines into TTY current loops. STEP5 uses the parallel printer port to communicate with the Siemens PROMMER (PROM and Flash memory burner). Whatever setup information exists is found in:

Siemens 10 (small softbound)

Siemens Simatic S5 Step 5 Version 6.6 (Step 5 software reference/development manual)

(PC software development installation guide is at the back of Vertex Vol IV.1)

and

Siemens 11 (even smaller softbound)

Simatic S5 Working with S5-DOS/ST

STEP5 is a rather clumsy DOS program; surround yourself with the various Siemens manuals (refer to the complete list of Vertex & Siemens documentation) while you re-learn to navigate through DOS style prompts, menus, and file operations. Most editing will probably be done in the program file rather than in the PLC, meaning that you are editing source code, which contains comments* as well as instructions. When you edit code directly in the PLC, the instructions appear identical to the source instructions, suggesting that, when the PLC is running, it interprets the source code, rather than running machine code compiled from the source code. Comments are not loaded into the PLC, so if you copy code from the PLC to make a program file, that file will have no comments. All the development work is done with STEP5; there is no need to use external programs to enter or edit files.

Source code for a program, e.g. is contained in an ST file, e.g. Arecibst.s5d Note that the name must contain 8 characters but the last two characters, st, are part of the effective extension,

st.s5d. But a program will have some associated files:

Symbols Absolute operands can be given names, e.g. flag bits F0.0 and F0.1 could be usefully named ZERO and ONE or flagbit 52.6 could be named GREG_ENCODER_FAULT, Data blocks could be named, etc. Vertex used almost no symbolic assignments; F6.6, for example, is named F6.6. When editing, a function key toggles the screen to display either absolute operand designations or their assigned symbols.

Four files are used to keep track of symbols: Arecibz0.seq is the symbol assignment list, where the sysmbols are entered, along with comments. When this file is stored, it is translated into three symbols files, ArecibZ0.ini, ArecibZ1.ini, and ArecibZ2.ini. (see S10,p3-208). These files are used when the PLC is loaded. If errors occur during this translation, they are stored in a file ArecibZT.ini.

*comments in the source code are few and far between. True "line comments" show up in yellow with the S5 development system. The printed listings also include in-line references from the assignment file. Since Vertex used almost no symbolic names, these references appear like "F9.2 = F9.2" which simply means that Vertex gave no name to bit 2 of flag word 9; the S5 development didn't notice that, so it printed the default assignent "F9.2 = F9.2" something like "F9.2 = gregorian overspeed flag". Nevertheless, for many variables, Vertex did enter a comment in the assignment file and the comment is printed below the useless "F9.2 = F9.2".

As an example, the first line of Segment 2 of OB1 is

JU PB 10	PB 10 = PB 10

operating modes

which is an unconditional jump to Program Block 10. The comment, inserted automatically from the Vertex-generated assignment file, indicates that the PB 10 has something to do with operating modes. (Why did Vertex used the system this way? Perhaps to avoid entering misspelled symbols - but the system would have detected them as not being present in the assignment file).

Project file A "project file" *PJ.INI is used to store the settings for a given project, including the various files used in that project (page 1 of the settings). Example: ArecibPJ.ini is used to store or load this project.

Other files (see S10,p3-23,p4-3)

ArecibST.S5D stores the program (program blocks and data blocks)

ArecibZF.INI stores the function key assignment.

******DR.INI stores the printer parameters (stored in the TTEP5 system directory).

ArecibF1.INI stores the footer file (80 characters)

ArecibF2.INI stores the footer file (132 characters)

ArecibLS.INI is a file to store a redirected printout

ArecibXR.INI is a cross reference list (XRF file)

ArecibZ0.INI is the symbols file

Loading and Saving a project in the development system

At start-up, the project last worked on will be loaded. To load a different project, go to page 1 of Settings and click on the project directory. Change the directory if necessary and then, in this same "menu" select the desired PJ file. When that file has been correctly selected, the various project files will automatically fill in the rest of the page 1 settings. The same field is used to select the project directory and the particular project. (The GUI makes this harder than it would be if you could simply enter " c:\xxx\xxxs\xxxxPJ.INI).

Checksum

Page 2 of Settings contains a "Checksum" field which can be set to Yes or No.

A Yes means that when you transfer blocks to the PLC, the checksum is generated, appended to the block and transferred to the PLC. When you read from the PLC, the checkum is used to check the transfer.

NOTES ADDED 12-12-01

REGARDING (mostly) TEST FEATURES OF THE STEP 5 SYSTEM

1. You can edit code in the PLC and also load this edited code

while the PLC is running. (Doesn't have to be stopped). Note:

when you have finished making changes to the code, you will have

some difficulty making the system swallow it. Until the system

has come up with the prompt "Overwrite code in PLC" you're not there.

Be persistant with "enter" and "save" and after a few rejections,

you'll get the desired "Overwrite...." prompt.

2. STATUS VARIABLE DISLAY

You set up this screen with a list of the variables you wish to

monitor. After entering this list (or modifying it) always hit SAVE

so that the list will reappear the next time you enter this screen.

Note: besides saving the default list, you can use SAVE AS to create

multiple lists.

Once the list is entered, you ACTIVATE it with the mouse or

the INSERT (Ins) key. You will then see the values of the variables.

If the program is running, you can watch the variables as they change,

counters countings, etc. (Dynamic display).

If you have gone to this screen after hitting a breakpoint with

"program test", you will see the frozen values of the variables at the

break point.

You can also display a "FIELD" by hitting F4 and then

filling in the command line.

Editing the variable list: To edit, you must have the menu bar

visible at the bottom of the screen, i.e. the status display must

be interupped. To interrupt the display, hit ESC.

Ordinary key strokes, up and down arrows, and Enter all work in

conventional fashion to edit the variable list.

Example: to monitor DD7 of DB11, make an entry "DB11", hit return,

then enter DD7. In our Step 5 program, the contents of this location

are incremented every second by OB16, the 1-sec interrupt routine.

(Our OB16 does this and nothing else). After a warm restart by

toggling the front panel run switch, you will see the frozen old value.

This will be replaced by a zero, and then begin incrementing. Note:

if the initialization routine has trouble, i.e. in establishing

communication with the CP581, it will time out in 90 seconds and

then DD7 will begin to increment.

3. ISTACK DISPLAY (interrupt stack)

You can select this display with the program not running or running.

This seems not to be a dynamic display, but rather reflects various

control conditions, past and present, that were valid at the time the

display was selected. Use the mouse to click on any

symbol. The meaning of that symbol will be displayed at the bottom

of the screen. A red X below a symbol indicates a selected or

existing condition. Examples: that the last restart was a warm

restart; that the last restart was a cold restart; that the program

is running in cyclic mode; that the processor is stopped.....

But what about the interrupt stack?? If the cpu is stopped, you can

hit "INSERT", and the status display will be replaced by the stack of

nested interrupts that were active when STOP occurred. (See page

5-21 of the CPU 928B Version 3Ub1 Programming Guide).

4. BLOCK STATUS DISPLAY (dynamic display of processing within a block)

This

STEP5 EDITING HINTS

JBH 9-28-00

The STEP5/PC development system makes editing quite awkward.

This may be due, in part, to our use of a standard PC rather

than the Siemens custom Programmer PC. Getting around the

menus from one field to another is sometimes difficult, but

not as difficult as editing a field, once you are there. The

editor essentially gives you no prompts. You have to know what

can be entered. A non-acceptable entry, followed by RETURN will

often cause the entry to be erased - purged! Or you may be

answered with a cryptic error message, perhaps "Error No. XX"

for which there seems to be no written key or online help.

Reasons why your entry may not be acceptable:

1. You have used an instruction that is ok in an FB, but not

allowed in an OB or PB.

2. You have written JU FBxx but you have not filled the rest

of this function call: the name of the Fb and the argument list

(which is *** in the case of no arguments).

Comments: Three types of comment can appear in your program:

statement comments, segment comments, and symbolic comments.

Statement comments are those that you enter while editing the

program. They appear to the right of the statement. (See below

for how to access the comment field to enter a comment).

Segment comments form headings for program segments. They are also

entered while using the editor.

Symbol comments are those that have been entered in the

"assignments" file. Suppose that, in the symbols table, you have

assigned the symbol "pwrflag to F10.1, along with a comment

"pwrflag is for the dc supply". In your program, any line that

refers to the F10.0 or "pwrflag" will cause the comment in

the assignent file to appear in your program file. A function key

in the editor allows the editing screen to display either symbol

comments or statement comments, but not both. A print-out of the

program, however, can contain both. The function key, Shift F4,

actually cycles through three options: statement and segment

comments are displayed, symbol and segment comments are displayed,

and no comments are displayed.

It is tricky to enter statement comments. As you edit a line of code,

you must move the cursor to the extreme right side of the operand

field, using the space bar or the tab key. Once you are at the far

right of this field, hit the space bar and you will be at the

beginning of the comment field.

Labels on statments: To jump around in the code, you need

statements such as "JU =CAT". Here, "CAT" is a label on another

statement, e.g. "CAT :A -PWRFLAG" Note that the jump statemnt

must refer to CAT as "=CAT". Note also the dash before "PWRFLAG";

without the dash, the system doesn't have enough sense to look

for an otherwise unidentified symbol in its symbol table.

Shift F3 puts the editor in symbol mode or absolute mode. These are

display options. If you switch to symbol mode, every "F10.0" on

the screen will become "-PWRFLAG". If you switch back to absolute

mode, evern "-PWRFLAG" will change to "f10.0". If you are in

symbol mode and you enter "F10.0", as soon as you enter that line,

the "F10.0" will change to "-PWRFLAG".

Note that you can use the Function keys in the editor to get into

the symbol table - rather than leaving the program to edit the

symbol table and then getting back into the program editor.

To edit a program block. Invoke the editor. Put cursor on line to be

edited. Softkey "edit". Make changes. "enter" - maybe three times.

DEALING WITH THE PROMMER (prom burner)

The Siemens PROM burner came with a software disk "STEP4/ST/PC-PAKET

1.00 ERW.EXT.PROMMER 1/1 as well as a small multilingual manual. The

manual contains instructions for installing the software. However,

it seems that our PC version of STEP5 contains the necessary

software. The prommer works without further software, and , in fact,

the software on the disk refuses to install.

As with the editor, the prompts and keystrokes for PROM operations

are not obvious. One invokes these functions from the main

STEP5 menu's "Management" submenu and "EPROMS" sub-submenu. This

takes you to a screen on which two parameters can be entered or

changed amd then entered. The top parameter should be left as

"WORD", which always the correct response for our S135 system.

The second parameter sets the checksum to "YES" or "NO". A YES must

cause the checksum to be generated and transferred to the PROM as a

data word. A NO probably results in a zero or some more unique

word to be written in the checksum loacation. When the EPROM is

read by the PLC, the PLC calculates the checksum of the incoming data

and compares it to the included checksum. If the included checsum

is "no check sum", the PLC can simply say ok, as if the checksum had

been valid. (Why would one ever turn off the checksum option?).

The other fields on this first PROMMER screen cannot be changed here;

they have been set earlier on page 1 and/or page2 of Settings. Afer

being sure that WORD is selected and checksum is YES, hit F6. All that

changes on the screen is the softkey description at the bottom.

When the "BLOW" function is selected, a screen appears asking for

two parameters. The first,B, is for block. Type A for all and hit enter.

The cursor moves to the PRT field (printer). Leave this field blank

if you don't want to print and exit by hitting the "Insert" key on the

PC. When you are prompted for PROGRAM NUMBER, type 500 if you are

dealing with a FLASH card. Enter the 500 by hitting the "Insert" key

or with a left mouse click. As is often the case, this is not enough;

you have to also hit Insert again , or maybe even 500 Insert Insert.

The lower light (yellow) on the PROMMER will first blink - probably

when the "500 Program" is being downloaded. It will light continuously

while the module is being DELETED (erased) or BURNED (programmed).

How to install the module in the PLC. Simply push the module into its

slot. Then clear the RAM by using STEP5 BLOCKS, DELETE, IN THE PLC,

ALL, OVERALL RESET. The delete erases the ram and the overall reset

causes the contents of the module to be loaded into the ram.

Manual procedure for reloading the RAM from the module. (Not as

foolproof as the STEP5 procedure described above). Suppose the module is installed and its

contents are present in the RAM.

Switch the top switch to the downward position, STOP.

Press the RESET button upward to RESET and hold it there for 5 seconds.

Press the RESET button downward to OVERALL RESET and hold it there.

Switch the RUN switch up and the down.

Release the lower switch.

Repeat the procedure at least once.

Manuyal procedure to erase the RAM:

Pull the module out of its socket. (As long as the module remains plugged

in, you cannot erase the RAM).

Clear the memory as follows:

Switch the top switch to the downward position, STOP.

Press the RESET button upward to RESET and hold it there for 5 seconds.

Press the RESET button downward to OVERALL RESET and hold it there.

After about 5 seconds, switch the RUN switch up.

After another 5 seconds, switch the RUN swith down.

After another 5 seconds, release the lower switch.

plc error: attempting to set or reset q0.0 when the digital output card is

not present results in an error

that stops the PLC. In this case a warm restart jumps past the error

and the (test) program finishes its 5-sec timeout and stops. Another

warm restart doesnt start it againl, since it has finished and is

awaiting a start via OB20 or OB21. Give it a regular cold start and

it encounters the error and immedately hangs again. Then another warm

start again pushes it past the error and lets the program run its

alloted course.

The lamp blinking program, when eventually successful, showed that

the digital output board must be plugged in at the time the PLC crate

is powered up (manuals do mention this) but that no external power

need be applied to the board (except to work the LEDs) and no DB1

need be written and entered.

2-27-01

Siemens manual gives procedure for overall reset which

usually does not work. Here is a procedure discovered by Luis

Murray, which seems to work:

1. Set the top swich to STOP.

2. Push the bottom switch down (OVERALL RESET) and, while holding

it down, lift the upper switch to RUN.

3. Push the bottom switch up momentarily to RESET

4 Set the top switch to STOP

5 Lift the bottom switch to RESET and, while holding it up,

lift the upper switch to RUN.

6 mRelease the bottom switch.

Better Procedure for overall reset: from Notes given to Jorge during

Siemens course:

Start in the STOP position

Hold the Reset swith down

Toggle the RUN/STOP switch twice (note: twice!)

Hold the reset switch up

Place Run/Stop switch to "RUN"

Let the reset switch return to its center position

Timed interrupt routines (e.g. 1 sec, 0.1 sec...)_ will be active if

they are present in the code, i.e. if OB16 is present, it will be

automatically called ever second.

__________

Debugging tools difficult to use with init routines (OB21, OB21, Ob22 ).

A fix is to simply put a long delay loop (30 seconds, say) at the start of

the init routine. This gives time to do a "start PLC" command and

then turn on the breakpoint routine before the program has left the

delay loop.