Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Need to detect continuity between 2 terminals

by jmlynesjr (Hermit)
on Jan 06, 2013 at 21:17 UTC ( #1011920=note: print w/replies, xml ) Need Help??


in reply to Need to detect continuity between 2 terminals

This is a pretty common thing to do. You should be able to detect RTS/CTS or DCD assuming as martell said the handshaking signals are supported by Device::SerialPort.

Update1: Looks like both modem control(DCD) and handshaking(RTS/CTS) are both supported.

if ($PortObj->can_wait_modemlines) { $rc = $PortObj->wait_modemlines( MS_RLSD_ON ); if (!$rc) { print "carrier detect changed\n"; } } if ($PortObj->can_modemlines) { $ModemStatus = $PortObj->modemlines; if ($ModemStatus & $PortObj->MS_RLSD_ON) { print "carrier detecte +d\n"; } }
# controlling outputs from the port $PortObj->dtr_active(T); # sends outputs direct to hard +ware $PortObj->rts_active(Yes); # return status of ioctl call # return undef on failure

James

There's never enough time to do it right, but always enough time to do it over...

Replies are listed 'Best First'.
Re^2: Need to detect continuity between 2 terminals
by redss (Monk) on Jan 07, 2013 at 02:10 UTC
    Yeah that code example is just what I was looking for.

    I did forget to mention that this is for Win32.

    Unfortunately, Device::SerialPort is not available for Windows, and the Win32::SerialPort module doesnt seem to be available in the Activestate ppm repository.

    Which module should I be using?

      Win32::SerialPort and Win32API::CommPort are both listed on CPAN. Maybe you can install them from there. I am not familiar with Active state.

      James

      There's never enough time to do it right, but always enough time to do it over...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011920]
help
Chatterbox?
[holli]: this really really should not be executed as Javascript
erix's head is getting content indisposed
[holli]: maybe try a GET instead?
[moritz]: I must say, when I was very active on perlmonks, I got really used to the markup and all the workflows
[moritz]: and then I didn't post for a while, and then tried to answer a question. It nearly drove me nuts
[moritz]: when you try to quote part of a question, you have to know/guess/reverse -engineer what kind of markup they used
[holli]: see? https://imgur.com/ a/XpF4b
[moritz]: and stuff it into a <blockquote>...</ blockquote>, which is, like, not at all bulky
[moritz]: specially if you're used to markdown
[holli]: there probably is some nodelet hack that lets you use markdown :)

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (15)
As of 2017-11-20 19:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (291 votes). Check out past polls.

    Notices?