欧姆龙 PLC 串行口

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

Do
    Do 
        str_in = str_in & Link.ReadExisting
    Loop While ((str_in.Length < length_predicted) And ((DateAndTime.Now.Ticks - tmr_indicator) < lng_length))
    ....
    'Checking FCS code
    'Checking PLC Response code (No Command Error)
    ...    
    'Assume we're waiting for frame(s)
    'The matter that must be checked is the penultimate and the last
    'character received from PLC.
    if mid$(str_in,str_int.length - 1,1)<>"*" then 'Means some frame(s) are ready to be received
        'First Process Data 
        'Clear RS232 Input Buffer
        str_out = Link.readExisting
        'str_out = ""
        link.Write(vbCr)'Indicates Host Computer is ready to receive data
        ...
    end if
    ...
Loop While loop_condition