[S5-155U CPU948]Need Help on This Code !

apple

Member
Join Date
Jun 2006
Location
Taipei
Posts
24
Hi~Everyone,I don't understand what mean this code, need your guys help, Thanks!!

I have two FX block(FX131 and FX132) ,they call the same FX140, but when FX131 call FX140 and FX132 call FX140, the result is different of FX140.

When FX131 call FX140, FX140's code is :
JU =M001
L DH 700B0005
M001:
L KB140
ASM KH00EC
JU =M002
L KH6500
M002:
NOP 0
NOP 0
NOP 0
NOP 0
AN F141.1
AN F141.2
=F131.0
***

and
When FX132 call FX140, FX140's code is :
JU =M001
L DH 700B0005
M001:
L KB140
ASM KH00EC
JU =M002
L KH6500
M002:
NOP 0
NOP 0
NOP 0
NOP 0
XG
T DD106
***

My question is :
(1)What's mean "ASM"?? I find nothing in 948 manual.
(2)How to use different code in the same Function Block, by the different target call...??

Sorry my poor English, hope you can understand my question.
Thank your help!!
 
In step 5 it is possible for the program to modify memory and change the code that executes in any block - looks like thats what happening here.

I don't have access to the manual at present, but I think ASM means insert the following op-codes in memory and execute them as mc5.
 
I have this feeling of deja-vu.... apple, do a search for 'ASM' for more info
 
In S5 PLC it's possible to write self modifying program since programmer has access to almost all of PLC memory. It looks like we have it here. Are your examples made from the 1st segment of FX140?
If yes then it's may be modified by other FB, if not it may modify itself during operation.
If it's one of protected block's maybe what we see isn't what we really have. Look at this exaple:
We see:
L DH 700B0005
But if SAC (Step Address Counter) has been modified before (there are many possibilities how it can be made), for exaple SAC set to 1 word after address of above comand we have:
JUR 5 (opcode 700B0005).
 
As addition to previous post.
ASM KH 00EC - call of one of the procedures written in assembler and included in CPU firmware (KH 00EC maybe procedure number 236).
So it may be that instructions before ASM are to inform internal procedure about calling block: 0005 - FX identifier, 140 - FX number.
 
Last edited:
Thanks your reply!! Let me study more.
Maybe it is "self modify code" WOW~
And this code is in FX140 segment2, segment1 is JU =M001 then BE .
Another protect block .

So, when FX131 call FX140, it just do this..
AN F141.1
AN F141.2
=F131.0

and when FX132 call FX140,it is...
XG
T DD106
right??

Anyway~ Thanks your help!!
 
Try monitor this statements online, maybe CPU doesn't do what you are expecting. Sometimes in protected blocks Siemens makes area in the block for transferring parameters from/to internal procedures. But Step5 interprets words in the memory like commands for display. Remebmer Step5 not PLC CPU!

And something as a little example. Make FB with IN parameter named DBBU type KY and write following commands:
LW = DBBU
T FW254
L DH 0000 2000
A F254.0
JC =M001
L DH 7803 1100
M001: +D
MSB
TRD +2
NOP 0
NOP 0
Download it to PLC and call from program, look what you will se instead of NOP's (depending of value of formal parameter).
 
Last edited:
I've lost one command after M001 corrected version is:
....
L DH 7803 1100
M001: L FY 255
+D
...
 
Last edited:

Similar Topics

i have an old PLC : S5 155U (CPU 948) i need to connect it to ABB PLC using Profibus-DP, ABB will act as Master and S5 as slave. I need to...
Replies
3
Views
3,009
Iam new to siemens systems and trying to install S5-155U CC with a CPU 948 in a very old plant.The CPU is OK and RUN LED is Green and iam able to...
Replies
2
Views
1,444
Hi! Everyone~ I want to know is there some way can copy program code from one cpu to another cpu, and append it? My system has two cpu948, A and...
Replies
5
Views
2,210
Hi~ I have a question about Intouch. this is,could Intouch directly read/write date(DD,DW,I,F...etc) from/to PLC via H1Server? assume all setup...
Replies
3
Views
2,386
Hi~Everyone!! I have some question about datablock (DB)? 1.CPU how to exchange data via DB?? I have a two CPU in one Rack, one is PLC1-1 and the...
Replies
1
Views
1,732
Back
Top Bottom