![background image](http://html1.mh-extra.com/html/omron/srm1-programing-02-2001/srm1-programing-02-2001_programming-manual_742414291.webp)
4-4
Section
SRM1(-V2) Communications Functions
271
Word
Setting
Function
Bit
DM 6648
00 to 07
Node number (Host Link, effective when bits 12 to 15 of DM 6645 are set to 0.)
00 to 31 (BCD)
00 to 31
08 to 11
Start code enable (RS-232C, effective when bits 12 to 15 of DM 6645 are set to 1.)
0: Disable; 1: Set
Any
12 to 15
End code enable (RS-232C, effective when bits 12 to 15 of DM 6645 are set to 1.)
0: Disable (number of bytes received)
1: Set (specified end code)
2: CR, LF
Any
DM 6649
00 to 07
Start code (RS-232C)
00: 256 bytes
01 to FF: 1 to 255 bytes
Any
08 to 15
End code enable (RS-232C)
00 to FF (BIN)
Any
Note
If an out-of-range value is set, the following communications conditions will re-
sult. In that case, reset the value so that it is within the permissible range.
Communications mode:
Host Link
Communications format:
Standard settings
(1 start bit, 7-bit data; 2 stop bits, even parity,
9,600 bps)
Transmission delay:
No
Node number:
00
Example Program
This example shows a BASIC program that reads the status of the SRM1(-V2)’s
inputs in IR 000. For more details, refer to
4-5
Host Link Commands.
An FCS (frame check sequence) check isn’t performed on the received re-
sponse data in this program. Be sure that the host computer’s RS-232C port is
configured correctly before executing the program.
1000 ’
1010 ’SRM1 Sample Program for BASIC
1020 ’
1050 ’
1060 ’
Set value RS-232C SPEED:9600BPS,PARITY:EVEN,DATA:7,STOP:2
1070 OPEN ”COM:E73” AS #1
1080 *REPEAT
1090 ’
Transmission data input
1100 INPUT ”send data:”,SEND$
1110 ’
FCS Calculation
1120 FCS=0
1130 FOR IFCS=1 TO LEN(SEND$)
1140 FCS=FCS XOR ASC(MID$(SEND$;IFCS,1)
1150 NEXT
1160 FCS$=RIGHT$(”0”+HEX$(FCS),2)
1170 ’
Communications execute
1180 ZZZ$=SEND$+FCS$+”*”+CHR$(13)
1190 PRINT #1,ZZZ$;
1200 ’
Response check
1210 RECCNT=0:TMP$=””
1220 *DRECLOOP
1230 IF LOC(1)<>0 THEN *DREC1
1240 RECCNT=1
1250 IF RECCNT=5000 THEN *DRECERR ELSE *DRECLOOP
1260 *DREC1
1270 TMP$=TMP$+INPUT$(LOC(1),#1)
1280 IF RIGHT$(TMP$,1)=CHR$(13) THEN *DRECEND ELSE RECCNT=0:GOTO *DRECLOOP
1290 *DRECERR