Jump to content

Recommended Posts

Posted

Hi everybody,

I've got only a little question.

Is it possible to read the CTS (or DCD) status?

I found that it's possible to set the RTS status, but how to read at the receiver-end the CTS (or was it the DCD?)?

(I use a crosslink cable)

I use the UDF from this topic.

I'm very sorry for my bad english!

Thank you for your reply!

Kind Regards

Veronesi

Posted

Hi everybody,

I've got only a little question.

Is it possible to read the CTS (or DCD) status?

I found that it's possible to set the RTS status, but how to read at the receiver-end the CTS (or was it the DCD?)?

(I use a crosslink cable)

I use the UDF from this topic.

I'm very sorry for my bad english!

Thank you for your reply!

Kind Regards

Veronesi

At the moment my udf doesn't tell you the state of the CTS, DTR lines. I think I said in the udf thread somewhere that I could do it but so far I haven't. If it's needed then I can add a function to report the state of the various lines. I need 2 things; someone to say yes please do it, then a few weeks so that I can fit it in when it happens to be convenient for me.

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.
Posted

At the moment my udf doesn't tell you the state of the CTS, DTR lines. I think I said in the udf thread somewhere that I could do it but so far I haven't. If it's needed then I can add a function to report the state of the various lines. I need 2 things; someone to say yes please do it, then a few weeks so that I can fit it in when it happens to be convenient for me.

Hi Martin,

thank you for your reply.

Yes, it would be a great work if you could do it!

Unfortunately I need this function very fast. But it would be great if you could ever do it!

Thank you very much!

Kind Regards

Veronesi

Posted

Hi Martin,

thank you for your reply.

Yes, it would be a great work if you could do it!

Unfortunately I need this function very fast. But it would be great if you could ever do it!

Thank you very much!

Kind Regards

Veronesi

OK, but, as I warned, it won't be fast; I have other things I must do.

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.
Posted (edited)

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

Global $com = ObjCreate("NETCommOCX.NETComm")
$com2 = ObjEvent($com, "_NETComEvents_")

Global const $comEvSend = 1 
Global const $comEvReceive = 2
Global const $comEvCTS = 3
Global const $comEvDSR = 4
Global const $comEvCD = 5
Global const $comEvRing = 6
Global const $comEvEOF = 7

With $com
    .CommPort = 1
    .PortOpen = True
    .Settings = "9600,N,8,1"
    .InBufferCount = 0  
EndWith


While 1
    Sleep(1000)
    ;$com.CommEvent()
WEnd
Exit

Func _NETComEvents_OnComm()
    $evt = $com.CommEvent()
    Switch $evt
        Case $comEvRing  ; Change in the Ring Indicator.
            Consolewrite("Ring Line" & @CRLF)
        Case $comEvCD  ; Change in the CD line.
            Consolewrite("CD Line" & @CRLF)
        Case $comEvCTS  ; Change in the CTS line.
            Consolewrite("CTS Line" & @CRLF)
        Case $comEvDSR  ; Change in the DSR line.
        Consolewrite("DSR Line" & @CRLF)
    EndSwitch
EndFunc

Func MyErrFunc()
; Set @ERROR to 1 and return control to the program following the trapped error
    SetError(1)
    MsgBox(0, "Error", "Error communicating with modem on COM" );& $com.CommPort)
    Exit
EndFunc;==>MyErrFunc
@Veronesi:

Try this code. It requires NETComm OCX by Richard Grier, which is freely available on the net; download it.

You can also use $evt = $com.DSRholding(), $evt = $com.CTSholding(), and $evt = $com.CDholding() depending on your needs.

Nevertheless, I would be very happy if Martin could make it easy for us.

Regards

Ajit

Edited by ajit

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...