STL programming problem: How to call different DB blocks

slavko

Member
Join Date
Nov 2014
Location
Split
Posts
1
Dear experts,
I m new to the STL programming and I have a problem that I can not solve.
I'm working on a program that controls the temperature in 10 rooms. Every room has three inputs: for room one: IW10 reference temperature value, IW12 measurement, IW14 work mode (0-heating, 1 cooling is send at bit 4) and two outputs QW10-heating,QW12 cooling. For room two IW16 reference temperature value, IW18 measurement, IW20 work mode (0-heating, 1 cooling) and two outputs QW14-heating (also bit 4),QW16 cooling (also bit 4) and so on to room 10.
I am also calculating the number of rooms with present people in front of the total number of rooms which are empty.


This is my program in OB1 a don t know what I should write in the data blocks.
L 1
T #counterr // initialize counter for rooms
L 0
T #occupied_rooms // initialization number of occupied rooms


LOOP: L #counterr



// get input word

L 6 //extension of start word
*I
L 4 //moving from location iw10
+I
T #room_I //starting input word address of the room
L 8 //are internal adress
*D
LAR1
//geting input data

L IW [AR1,P#0.0] // geting referent value
T #ref
L IW [AR1,P#2.0] //geting measurement
T #mjer
L IW [AR1,P#4.4] // geting work mode
= #mod
//copy the contents of arbitrary DB to DB 100
LAR1
PET1: OPN DB [#counterr] //bloks from db1 to db10
L DBW [AR1,P#0.0]
OPN DI 100 //instanc data blok of FB25
T DIW [AR1,P#0.0]
+AR1 P#2.0
TAR1
L 8
/D
L DBLG
>=D
JCN PET1

// call function

CALL FB 25 , DB100
REFERENTA_VRI :=#ref
IZMJERENA_VRIJ:=#mjer
MOD_RADA :=#mod
GRIJANJE :=#grij
HLADENJE :=#hlad
PROMJENA :=#prom
NOP 0

//Counting present rooms

A #prom
JNB praz
L #occupied_rooms
L 1
+I
T #occupied_rooms
praz: NOP 0

//Copy db 100 back in an arbitrary db

LAR1 P#0.0
pet2: OPN DI 100
L DIW [AR1,P#0.0]
OPN DB [#counterr]
T DBW [AR1,P#0.0]
+AR1 P#2.0
TAR1
L 8
/D
L DILG
>=D
JCN pet2

//geting the adres of the output word

L #counterr
L 4
*I
L 6
+I
T #room_Q
L 8
*D
LAR2
//saving data
A #grij
= Q [AR2,P#0.4]
A #hlad
= Q [AR2,P#2.4]
//counterr up
L #counterr
L 1
*I
T #counterr
L 10

>I
JCN LOOP



//calculating the number of rooms with present people in front of the total number of rooms which are empty
L #occupied_rooms
ITD
DTR
L 6.000000e+001
/R
L 1.000000e+002
*R
T MD 100




I would be grateful if someone would tell me what I'm doing wrong.


I can attach the program because the program has a size greater than allowed, if someone is interested I will send him I e-mail with this program.

Thank you in advance
 
You need to add 1 to the counter instead of multiplying by 1

Code:
L     #counterr
      L     1
      *I    
      T     #counterr
 

Similar Topics

Hello everyone, I have been attempting to complete a simple weight conversion program... basically it loads in 3 values from a BCD Thumbwheel...
Replies
3
Views
2,973
I'm new in STL programming, today I was checking some example codes and found this: L 1 L QB 4 SLW T QB 4 SET SAVE...
Replies
5
Views
2,558
Hello everyone! I've just stared with programming on STL and I have problem which I can't understand. I'm writing programs on Step 7 and I'm...
Replies
2
Views
2,176
Hello everyone! I've just stared with programming on STL and I have problem which I can't understand. I have this piece of code:
Replies
1
Views
1,937
I have a programming problem. I was originally asked to read and display a flowmeter with a 4-20mA o/p and display a continuous flow reading. The...
Replies
4
Views
2,344
Back
Top Bottom