Siemens S5 code to RSLogix 5000 conversion

Latzi

Lifetime Supporting Member
Join Date
Nov 2007
Location
Brisbane
Posts
118
Hi Gents,


I am just wondering if there is someone here who could decipher the following code for a Siemens S5 PLC system.

I ma converting the software and I just realized that I missed this bit and I am only a few hours away from the conversion and don't have time to read the manual to understand what the code is trying to do.
=============================================
NAME: COD:16
DECL: DUAL IW
DECL: SBCD QBI
DECL: BCD2 QBY
DECL: BCD1 QW
BE
==============================================
Then it returns to :
==============================================
NAME: AFMSLAG

L KF +500
T FW 200
L KF +3600
T FW 202
JU FB 221
NAME: MUL/DIV
INP : FW 200
MULT: FW 202
DIV : DW 95
OUTP: FW 208
JU FB 241
NAME: COD:16
DUAL: FW 208
SBCD: -BIT=0
BCD2: FY 202
BCD1: FW 204
L FW 204
T DW 96
BE
============================================

Where DW 96 is an analog output (might go to a BCD to analog hardware converter)

Not sure how to convert the SBCD ,BCD2,BCD1,etc ..Not sure what the code is trying to achieve.

Thanks in advance.
 
It's been a long time since I had to play with an S5, so please take everything below as a semi-educated guess and not gospel. I wouldn't normally jump in unless I was a bit more sure of what I was saying but if your time is running out and you need some answers, hopefully this is of some use to you :)

Hi Gents,

=============================================
NAME: COD:16 I think this is defining the data types that
DECL: DUAL IW need to be input when COD:16 is called below
DECL: SBCD QBI So Dual is an Input Word, SBCD is an output
DECL: BCD2 QBY [bit???], BCD2 is an output [byte???] and BCD1
DECL: BCD1 QW is an output word
BE
==============================================
Then it returns to :
==============================================
NAME: AFMSLAG

L KF +500 I think the L and T are
T FW 200 "Load KF +5-- To FW200" and
L KF +3600 so on
T FW 202
JU FB 221 Jump to FB221
NAME: MUL/DIV Declaration?
INP : FW 200 Take FW200,
MULT: FW 202 Multipy by FW202
DIV : DW 95 Divide by DW95
OUTP: FW 208 Store in FW208
JU FB 241 Jump to FB241
NAME: COD:16 Call the [function???] COD:16
DUAL: FW 208 With all these parameters
SBCD: -BIT=0 The output of the function
BCD2: FY 202 is stored in FW204
BCD1: FW 204 Which is then loaded into DW96 below
L FW 204
T DW 96
BE
============================================

If my semi-educated guess about COD:16 being a function block of some sort, you'd need to find the logic for it. But at a blind guess, based on the name of the block and the data in it, I'd be guessing that it's splitting a Word into two BCD segments, or something similar. If DW96 is wired to a display of some sort, at least you know it's only indication and not critical for running, so you'd have the ability to have a play with it and work out what it needs.

Hope that's not totally useless :)
 
FB241 converts a binary number to BCD. It can be replaced in S7 by FC82 from the S5-S7 conversion section of the standard library in Step7.

Not sure about FB221? Looks like it would multiply INP by MULT and then divide by DIV so: (500 * 3600)/DW95 (check that correct DB is dalled!)

Nick
 
Last edited:

Similar Topics

Hello, I'm from Belgium, and i have a problem to communicate between rslogix 5000 and simocode pro C module off Siemens. The communication...
Replies
3
Views
5,868
Siemens S7/TIA v18: "Remote" updates/bug fixes to PLC code & HMI screens..... Hi, The PLC application I'm working on will soon be delivered to...
Replies
5
Views
577
I thought I was nearly finished on this TIA Portal/s7-1212C project (famous last words)... Up until now, I'd developed the PLC/HMI such that the...
Replies
10
Views
1,515
New to S7. Are the "Network 1/2/3/..." simply individual "rungs" of the ladder or is there more to it than that? Thanks
Replies
2
Views
546
I'm pretty well a 100% GE/Emerson Rx3i programmer, and zero practical experience with Siemens programming. However I have just been given a PDF...
Replies
2
Views
1,588
Back
Top Bottom