Hi. Using realterm 2.0.0.70 as an ActiveX object in VBScript, an error box pops up when there is no sleep inserted (see code below) or the sleep delay is too short and a response is sent back by the device attached to the port.
The error appears despite the operation being successful as the script message box shows (see picture). There is no visible problem other than a pop message with an error. Of course I imagine there is an error somewhere.
The scripts sends 3 bytes and recieves 3 bytes (in this case the sent and recieved bytes are the same). The data format is 8N1, at 19200 bauds. The device attached to the port is a USB-to-RS485 dongle, connected to a basic RS485 device of my own fabrication. The start bit of the 3 bytes send back by my application starts (goes low) after the time equivalent of 3 bits after the end of the last end bit sent by the script. Or 150 microseconds after the last end bit.
When there is no response from the device (my device turned off but the dongle is connected and active) there is no error message from Realterm.
There is also no error when I imitate the same operation from Realterm's GUI interface ("Send ASCII" button) and the 3 bytes send back by my device appears in the black monitor window.
Here is the no-error script. If you delete or quote off the lines with the "sleep" command (add "REM" or ' at the beginning of the line), Realterm will pops an error.
Removing lines defining properties have no effect.
There is no real problem as it's de facto solved with the short sleep delays. Yet it's curious why there is an error even thought everything worked properly as far as the end result is concerned.
With CreateObject("realterm.realtermintf")
.Visible=False
.HalfDuplex=True
.baud=19200
.Port=3
.PortOpen=1
.LinefeedIsNewline=False
.CaptureFile="C:\Users\User\Documents\PCB\SerialControl\temp.txt"
.Capture=1
.CaptureEnd=3
Wscript.Sleep 20
.PutChar 45
.PutChar 124
.PutChar 252
.StartCapture
Wscript.Sleep 200
'MsgBox "wait and close"
.Close()
End With
MsgBox "Realterm operation OK",,"test"
Sorry for posting it in "request". I clicked "Bug" but it posted here.
More details: In fact it doesn't work well when there is the error message. Only the first bit is sent. I think the sleep delay is needed for the PC hardware or Widows Script Host to operate properly. The good thing is that it doesn't need to sleep between PutChar and StartCapture. It's like pausing before and after allows the computer to do these two tasks immediately one after the other.