![Octagon 5554 Скачать руководство пользователя страница 26](http://html.mh-extra.com/html/octagon/5554/5554_user-manual_723598026.webp)
RS–422/485 – 18
PROGRAMMING EXAMPLE
The following QuickBASIC program shows how to initialize the
port for 9600 baud, no parity, 8 data bits and 1 stop bit. It also
sets ports 3 and 4 for RS–485 communication. Also refer to the
5554/5558 Utility Disk file 5554QB.BAS for PRINTS, PRINTSL
code.
DECLARE SUB PRINTS (A$)
DECLARE SUB PRINTSL (A$)
'$INCLUDE: 'BQ.BI'
DECLARE SUB sendstring (port!,A$)
DECLARE SUB rcvchars ()
DECLARE SUB initports()
DIM rcbuf(8, 80)
DIM rcvcnt(8)
DIM rs485(8)
COMMON SHARED boardadd, statusadd, maxports
COMMON SHARED rcvbuf(), rcvcnt(), rs485()
boardadd=&H100
statusadd=b7
maxports=8
CALL initports
CALL PRINTSL("Sending COM1 outport 1")
CALL sendstring(1,"COM1")
CALL PRINTSL("Waiting to receive from any port")
CALL PRINTSL("Press any key to end test.")
DO
CALL rcvchars
'go get some characters
FOR port=1 TO maxports
IF (rcvcnt(port) <> 0) THEN
CALL PRINTS(STR$(port)+"-")
FOR I=1 to rcvcnt(port)
CALL PRINTS(CHR$(rcvbuf(port, I)))
NEXT I
CALL PRINTS("")
rcvcnt(port)=0
END IF
NEXT port
LOOP WHILE (INKEY$="")
CALL PRINTSL("")
END
Содержание 5554
Страница 8: ...ii ...
Страница 12: ...Preface 4 This page intentionally left blank ...
Страница 14: ...Overview 6 This page intentionally left blank ...