发布于 2003-05-19 16:04:06
0楼
The Receive Message function is automatically terminated in case of an overrun or a parity error. You must define a start condition, and an end condition (maximum character count) for the Receive Message function to operate. A receive is started when the communication line has been quiet or idle for the number of milliseconds specified in SMW90 or SMW190. When the Receive instruction in your program is executed, the receive message function initiates a search for an idle line condition. If any characters are received before the idle line time expires, the receive message function ignores those characters and restarts the idle line timer with the time from SMW90 or SMW190. Start character detection: The start character is any character which is used as the first character of a message........自由口格式的问题你去看联机文档。
因为自由口是字符模式,mscomm也要设成字符模式。要想把数字发送出去,可以这么转换:
TEXT1 = "字符串1" '前面的字符串
TEXT3 = "字符串2" '后面的字符串
iNum = 123 '数字字节
TEXT2 = chr$(iNum)
MSCOMM1.OUTPUT = TEXT1 + TEXT2 + TEXT3 + chr$(13)
这样PLC收到的TEXT2部分就是数字123(十六进制7B)