Angel Posted August 22, 2006 Share Posted August 22, 2006 Hi, After seeing some threads regarding using the NetComm object for RS232 communication I decided to give it a try for one of my projects. What I want to do is send commands to a device (a sort of modem) which is connected to the COM1 of my PC and receive the answers from the device. The modem replies by sending some (text) data plus a device status at the end of the reply. So I need to get this last line in the reply to properly control the modem. It was reasonably easy, using some of the examples in the forum to get this to work, more or less, but I have one problem left which I have not been able to fix so far. I hope someone else can give me some advice because I've tried a lot of things and none seem to work. It seems that I can write to the port with no problems. I can also read from it and I get the data into AutoIt. This suggests that the main settings of the serial port are correct (correct datarate, handshaking, etc). However for some reason I do not get the _last_ line that is transmited by the modem. If I close my AutoIt program (to free the port) and open HyperTerminal (or another terminal program such as TeraTerm), as soon as a I type some key into the terminal window the last line appears in the hyperterminal window, as if it was there waiting there! But the AutoIt program could not see the data (.InBufferCount was zero). Has someone had a similar experience in the past using the NetComm or the MsCOmm controls? Is there some way to force a "flush" of the data in the port buffer? What settings could cause a problem like this? I hope someome can help me! Cheers, Angel Link to comment Share on other sites More sharing options...
DaleHohm Posted August 22, 2006 Share Posted August 22, 2006 (edited) Did you try closing the port ? $NetComm1.PortOpen = False Dale Edit: actually, looks like this should do it: ' Setting InputLen to 0 tells MSComm to read the entire ' contents of the input buffer when the Input property ' is used. $NetComm1.InputLen = 0 look for MSComm examples at MSDN Edited August 22, 2006 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Angel Posted August 22, 2006 Author Share Posted August 22, 2006 Did you try closing the port ? $NetComm1.PortOpen = False Dale Edit: actually, looks like this should do it: ' Setting InputLen to 0 tells MSComm to read the entire ' contents of the input buffer when the Input property ' is used. $NetComm1.InputLen = 0 look for MSComm examples at MSDN I already tried setting the InputLet to 0. I do that before opening the port. It stilll doesn't work. I will try closing the port and see what happens. Thanks. Angel Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now