STL Pointers again!!

STL???

Member
Join Date
Sep 2005
Location
UK
Posts
879
Hi,
I'm trying to write a FB which shows daily shift performance. Instead of just displaying everything, i want to increment/decrement the day to one screen using a + and - minus key.

So far i've wrote the incrementer and calculated the offsets i need to write 95 bytes from 1 DB to another. I've used 2 temp variables to store the offsets ~ source + destination, but i'm stuck on the syntax for SFC21 (if its possible) to write the 95 bytes

attached is my progress so far.


FUNCTION_BLOCK "VIEW DATA FB"
TITLE =
VERSION : 0.1


VAR_TEMP
SOURCE_ADDRESS : BYTE ;
DESTINATION_ADDRESS : BYTE ;
CMP_1 : BOOL ;
CMP_2 : BOOL ;
CMP_3 : BOOL ;
CMP_4 : BOOL ;
CMP_5 : BOOL ;
CMP_6 : BOOL ;
CMP_7 : BOOL ;
END_VAR
BEGIN
NETWORK
TITLE =BUTTON PUSH + & -

//PLUS

A M 10.0;
FP M 10.1;
JNB DEC;
L "VIEW DATA".INDEX;
INC 1;
T "VIEW DATA".INDEX;

//MINUS

DEC: A M 10.2;
FP M 10.3;
JNB CLR;
L "VIEW DATA".INDEX;
DEC 1;
T "VIEW DATA".INDEX;

//RESET BUTTON PRESS

CLR: CLR ;
= M 10.0;
= M 10.2;
NETWORK
TITLE =CHECK BUTTON PUSH RANGE + CORRECT IF NECCERSARY

A( ;
O( ;
L "VIEW DATA".INDEX;
L 8;
>=I ;
) ;
O( ;
L "VIEW DATA".INDEX;
L 0;
<=I ;
) ;
) ;
JNB NW3;
L 1;
T "VIEW DATA".INDEX;

NETWORK
TITLE =CALCULATE OFFSET

NW3: L "VIEW DATA".INDEX;
JL END;
JU ZRO; // INDEX 1- 7 ZRO NEVER USED
JU MON;
JU TUE;
JU WED;
JU THUR;
JU FRI;
JU SAT;
JU SUN;
END: NOP 0;
ZRO: BEU ;
NETWORK
TITLE =

MON: L 6;
T #SOURCE_ADDRESS;
L 0;
T #DESTINATION_ADDRESS;
JU NW5;

TUE: L 102;
T #SOURCE_ADDRESS;
L 96;
T #DESTINATION_ADDRESS;
JU NW5;


WED: L 198;
T #SOURCE_ADDRESS;
L 192;
T #DESTINATION_ADDRESS;
JU NW5;

THUR: L 262;
T #SOURCE_ADDRESS;
L 288;
T #DESTINATION_ADDRESS;
JU NW5;

FRI: L 390;
T #SOURCE_ADDRESS;
L 384;
T #DESTINATION_ADDRESS;
JU NW5;

SAT: L 486;
T #SOURCE_ADDRESS;
L 485;
T #DESTINATION_ADDRESS;
JU NW5;

SUN: L 582;
T #SOURCE_ADDRESS;
L 548;
T #DESTINATION_ADDRESS;
JU NW5;



NETWORK
TITLE =

NW5: L #SOURCE_ADDRESS;
SLW 3;
LAR1 ;

L #DESTINATION_ADDRESS;
SLW 3;
LAR2 ;

END_FUNCTION_BLOCK


i would apprieciate any help you could give me to finish this off

Thanks again STL

 
Thanks for that Simon ~ just gotta understand it now.

Ill let you know how i get on

Thanks STL
 
Thank you

Worked like a charm! constructing Any Pointers is my Achilles heal at the moment.

Regards

STL
 

Similar Topics

Hey guys. I have problem with pointers in STL. My program has to write 255 to MB [ MD 300]. Let's say I write 20 to the MD 300, MB [20]=255, I...
Replies
2
Views
1,258
Hello, I try to understand a function block where a string is copied from an address (source) to another address (destination) by using...
Replies
4
Views
7,480
i am new to simatic manager and i am trying to figure what this part do in the code : A I 5.6 = DB50.DBX 4.6...
Replies
3
Views
128
Hello everyone, can anyone help me with covert the STL code to ladder. Iam using plc s71200. A %DB1.DBX33.7 // angel of vaccum...
Replies
2
Views
205
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
314
Back
Top Bottom