Jump to content
Sign in to follow this  
jbennett

Send text to Hypterminal and don't send if cable disconnected

Recommended Posts

jbennett

Hi everyone,

Hope you all had a good christmas and happy new year.

I have a quick question and wondering if someone can help me.

I'm currently creating some code to send some text to a hyperterminal window, which works fine but when a cable is not connected to the COM PORT my Hyperterminal window doesn't show the text i'm sending (have got echo typed characters locally turned off).

I'm struggling to find a way to determine within my code whether to continue sending the text when Hyperterminal is in this state (caused by unplugging the COM PORT cable). I initially thought I could check that the Connected text is visible and if it's disconnected it will exit the progam. However the HyperTerminal configuration that has been setup still shows as connected when the cable is unplugged (which is necessary) and i'm wondering if there is another check I could perform to make sure the cable is connected to the COM PORT and if not the program will exit. Otherwise i'm stuck with the script trying to send all the keys with nothing displaying to the user which isn't ideal.

Thanks

Jon

p.s. the Hyperterminal window will normally receive an OK after something has been input when the cable is connected. I presume this is because the other device connected to the computer is reponsding but I don't know if there is a way to check if 'OK' data is being received from the COM PORT and if not the program will exit?.

Also I found this on the net http://www.filesland.com/companies/Mu-Cons...screenshot.html

This seems to record data from COM PORTS to a log file, which I could check. So i'm guessing something must be possible?

Edited by jbennett

Share this post


Link to post
Share on other sites
martin

Hi everyone,

Hope you all had a good christmas and happy new year.

I have a quick question and wondering if someone can help me.

I'm currently creating some code to send some text to a hyperterminal window, which works fine but when a cable is not connected to the COM PORT my Hyperterminal window doesn't show the text i'm sending (have got echo typed characters locally turned off).

I'm struggling to find a way to determine within my code whether to continue sending the text when Hyperterminal is in this state (caused by unplugging the COM PORT cable). I initially thought I could check that the Connected text is visible and if it's disconnected it will exit the progam. However the HyperTerminal configuration that has been setup still shows as connected when the cable is unplugged (which is necessary) and i'm wondering if there is another check I could perform to make sure the cable is connected to the COM PORT and if not the program will exit. Otherwise i'm stuck with the script trying to send all the keys with nothing displaying to the user which isn't ideal.

Thanks

Jon

p.s. the Hyperterminal window will normally receive an OK after something has been input when the cable is connected. I presume this is because the other device connected to the computer is reponsding but I don't know if there is a way to check if 'OK' data is being received from the COM PORT and if not the program will exit?.

Also I found this on the net http://www.filesland.com/companies/Mu-Cons...screenshot.html

This seems to record data from COM PORTS to a log file, which I could check. So i'm guessing something must be possible?

If you don't have to use Hyperterminal then the RS232 udf in my signature might be of use. If you have to use Hyperterminal then it won't help.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
jbennett

Is it possible to use your RS232 UDF to perform an initial check to see if anything is connected to a COM1.

Not sure how I would do this?

thanks

Share this post


Link to post
Share on other sites
martin

Is it possible to use your RS232 UDF to perform an initial check to see if anything is connected to a COM1.

Not sure how I would do this?

thanks

Easiest way is to send something and see if you get anything back.

It can be easy to detect that something is connected but it requires an extra function in my udf to give that information. It also depends on what signals are connected and what the equipment the other end does with those signals.

Can you tell me

Q1 "What connections you have to the pins on the connector which plugs into the COM port?"

Q2 (assuming you can answer Q1) "If there are pins not connected would you be able to solder a link between unused terminals on the connector?"

Even if you can't tell me the answer to Q1 then I could make a version which gave you an indication of say 3 signals, and you could see if any of the signals changed when you disconnected the cable.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
jbennett

I'm really not sure. The only thing I know is that there is a connection from the Com Port to some box. I can send data to the box which changes its settings.

I have to stick with using HyperTerminal to send the data but thought I could add an extra check in my code to see if there is a connection before proceeding to send data to HyperTerminal. At the moment I get an echo back when sending data which displays the text 'OK' in the hyperterminal window.

I would really appreciate any code you may have to test some signals though as it would be interesting to see if anything changes. I presume I could then use this information to check if there is a connection which would be cool.

Thanks

Jon

Easiest way is to send something and see if you get anything back.

It can be easy to detect that something is connected but it requires an extra function in my udf to give that information. It also depends on what signals are connected and what the equipment the other end does with those signals.

Can you tell me

Q1 "What connections you have to the pins on the connector which plugs into the COM port?"

Q2 (assuming you can answer Q1) "If there are pins not connected would you be able to solder a link between unused terminals on the connector?"

Even if you can't tell me the answer to Q1 then I could make a version which gave you an indication of say 3 signals, and you could see if any of the signals changed when you disconnected the cable.

Edited by jbennett

Share this post


Link to post
Share on other sites
martin

I'm really not sure. The only thing I know is that there is a connection from the Com Port to some box. I can send data to the box which changes its settings.

I have to stick with using HyperTerminal to send the data but thought I could add an extra check in my code to see if there is a connection before proceeding to send data to HyperTerminal. At the moment I get an echo back when sending data which displays the text 'OK' in the hyperterminal window.

I would really appreciate any code you may have to test some signals though as it would be interesting to see if anything changes. I presume I could then use this information to check if there is a connection which would be cool.

Thanks

Jon

Easiest way for me is to send you an exe which you could run. It displays a terminal window and also indicators for various signals. If the indicators do anything then I can make a version of the dll and udf which gives acces to the same signals. Would you be happy with an exe?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
jbennett

Hi Martin,

Yep that would be fantastic :-)

Cheers

Share this post


Link to post
Share on other sites
martin

Hi Martin,

Yep that would be fantastic :-)

Cheers

OK, I've sent you a PM

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×