Software Example In Basic (Gw-Basic, Q-Basic) - Pepperl+Fuchs IVI-KHA6-4HRX Manual

Control interface unit 4 read/write heads
Table of Contents

Advertisement

IDENT-I • IVI-KHA6-4HRX, IVI-KHD2-4HRX
Commands

6.2.5 Software example in Basic (GW-Basic, Q-Basic)

Sample program for the commands "Read bytes" and "Write bytes":
10
REM Example of programm for Ident-I System V
20
OPEN "com1: 9600, n,8,1,DS,CD,LF" FOR RANDOM AS #1
30
ETX$ = CHR$(3) 'ASCII-Zeichen "End of Text"
40
PRINT "Read 32 bytes in Single mode"
50
CMND$ = "w10020"
60
GOSUB 1000
70
CMND$ = CMND$+CHECKSUM$+ETX$
80
PRINT "Command:";CMND$
90
PRINT #1,CMND$;
100
RESPONSE$=INPUT$(37, #1)
110
PRINT "Response:";RESPONSE$
120
PRINT
130
PRINT "Write bytes in Single mode"
140
INPUT "Enter the text (Press Enter to cancel):", PROGSTRG$
150
IF LEN(PROGSTRG$) = 0 THEN END
160
IF LEN(PROGSTRG$) > 32 THEN PROGSTRG$ = LEFT$(PROGSTRG$, 32)
170
NOOFBYTES$ = RIGHT$ ("0" + HEX$(LEN(PROGSTRG$)), 2)
180
CMND$ = "k100" + NOOFBYTES$ + PROGSTRG$
190
GOSUB 1000
200
CMND$ = CMND$ + CHECKSUM$ + ETX$
210
PRINT "Command:"; CMND$
220
PRINT #1; CMND$;
230
RESPONSE$=INPUT$(5, #1)
240
PRINT "Response: "; RESPONSE$
250
PRINT
260
GOTO 40
1000
REM Checksum calculation
1010
DUMMY = 0
1020
FOR I = 1 TO LEN(CMND$)
1030
DUMMY = DUMMY + ASC(MID$(CMND$, I, 1))
1040
NEXT I
1050
CHECKSUM$ = CHR$(DUMMY MOD 256)
1060
RETURN
Subject to reasonable modifications due to technical advances.
28
Pepperl+Fuchs Group • Tel.: Germany (06 21) 7 76-0 • USA (330) 4 25 35 55 • Singapore 7 79 90 91 • Internet http://www.pepperl-fuchs.com
Copyright Pepperl+Fuchs, Printed in Germany

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ivi-khd2-4hrx

Table of Contents