Nematron an S5 115U

free_tv

Level-2
Beiträge
17
Reaktionspunkte
0
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo zusammen,

ich muss einen alten Nematron PC durch wincc flexible ersetzen.
Dazu benötige ich noch einige Variblen vom alten Nematron PC

Die Anleitung wie der Nematon in die S5 schreibt habe ich gefunden, leider komme ich damit nicht ganz klar, vielleicht kann mir jemand helfen.

Folgendes steht in der Beschreibung von Nematon (Basic)

Mein Problem (siehe Beispiel unten)

A = 3584 ' Data block = 14, Data word = 0

Muss ja DB14,DW0 sein, aber wie komme ich da auf 3584?

The READPLC and WRITEPLC Functions
The READPLC and WRITEPLC functions transfer information to the Siemens PLC or from
the Siemens PLC.
Syntax: READPLC (c, a, v(q))
READPLC (c, a, v(q), t)
READPLC (c, a, v(q), t, n)
WRITEPLC (c, a, v(q))
WRITEPLC (c, a, v(q), t)
WRITEPLC (c, a, v(q), t, n)
c specifies the Workstation communication channel as 1 or 2.
Use the same channel that you specified in the OPENPLC
function. Specify c as a constant, variable, or expression.
a specifies the PLC block and word number, placed in the
upper and lower byte; for example, 0A01HEX represents data
block 10, data word 1. Specify a as a numeric variable, array
element, or constant.
Since the Siemens PLC transfers only data blocks, the system
considers data to be 16-bit words. Sixteen discrete input or
output values may be transferred in one word. The minimum
(and default) value for the number of words n is 1. The
maximum number of data words transferred in one function
call is 64.
v(q) The v(q) parameter must be an array.
t specifies the task code to indicate the action performed on the
PLC. The READPLC and WRITEPLC functions perform
identically. Since the task code determines the direction of
data flow, the two names are used for documentation purposes
only. Specify t as a numeric variable, array element, or
constant. If you omit t, the system defaults to 1.
t Meaning
1 Read data block or blocks.
2 Write data block or blocks.
3 Unsolicited read data block or blocks.
Task 3 is identical to 1, but with task 3
the driver waits 10 seconds for the PLC
to send data. The PLC must be
programmed to initiate communication.
You must specify n to equal the number
of words sent by PLC.
n specifies the number of data words to be transferred. Specify n
as a numeric variable, array element, or constant. If you omit
t, the system defaults to 1.


Hier ein Beispiel Programm

This program reads the latch status of 16 switches in Siemens Input Word 8, then asserts
Output Word 12 according to the bit pattern read. The system then resets the latched-switch
status.
100 ' EXAMPLE PROGRAM
200 DIM V(1)
300 ' Read latched switch status, write to lights, reset latches
400 ' C = CHANNEL, P = PLCTYPE
500 C = 1 : P = 5
600 E = OPENPLC (C, P)
700 IF E <> 0 THEN 900
800 GOTO 1000
900 GOSUB 3600
1000 ' The following reads switch status:
1100 T = 1 : N = 1
1200 A = 3584 ' Data block = 14, Data word = 0
1300 E = READPLC (C, A, V(0), T, N) ' Returns bit data in V(0)
1400 IF E <> 0 THEN 1600
1500 GOTO 1700
1600 GOSUB 3600
1700 ' Following writes to lines:
1800 T = 2 : N = 1
1900 X = 1024
2000 '
2100 ' V(1) is latched switch status
2200 E = WRITEPLC (C, X, V(0), T, N)
2300 IF E <> 0 THEN 2500
2400 GOTO 2700
2500 GOSUB 3600
2600 ' Following resets latches:
2700 B = 1536 ' DATA BLOCK = 6, DATA WORD = 0
2800 T = 2 : N = 1
2900 '
3000 ' V(0) = 0xxxxH same data resets
3100 E = WRITEPLC (C, B, V(0), T, N)
3200 IF E <> 0 THEN 3400
3300 GOTO 3500
3400 GOSUB 3600
3500 GOTO 1000
3600 PRINT "ERROR= ",E
3700 RETURN
 
Zurück
Oben