473,246 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

Check pin state of Serial Port

Hi! I need to create a simple program to check and monitor the state
of the pins on a serial interface on a ups. I want to be able to tell
what pins are in what state and when but I don't know where to start.
Can anyone help me!
I have searched all over, including google code (which is hard if you
don't already know what you are looking for, but I can't find anything
that will help me to get started. It seems really simple. I have a
Linux computer and a ups, with a serial cable connecting them. I want
to "see" which pins change their state when the power goes out and
when the battery gets low. The plan is to use this to trigger other
events that have NOTHING TO DO WITH SHUTTING THE PC DOWN.

If anyone has any kind of advise that I might be able use, then please
give it to me.

Aug 30 '07 #1
6 2669
On 2007-08-30 12:11, I'mLost wrote:
Hi! I need to create a simple program to check and monitor the state
of the pins on a serial interface on a ups. I want to be able to tell
what pins are in what state and when but I don't know where to start.
Can anyone help me!
I have searched all over, including google code (which is hard if you
don't already know what you are looking for, but I can't find anything
that will help me to get started. It seems really simple. I have a
Linux computer and a ups, with a serial cable connecting them. I want
to "see" which pins change their state when the power goes out and
when the battery gets low. The plan is to use this to trigger other
events that have NOTHING TO DO WITH SHUTTING THE PC DOWN.

If anyone has any kind of advise that I might be able use, then please
give it to me.
This have nothing to do with C++, try a group discussing Linux instead.
A hint, perhaps check if you have something in /dev for that serial
interface.

--
Erik Wikström
Aug 30 '07 #2
On Aug 30, 10:19 am, Erik Wikström <Erik-wikst...@telia.comwrote:
On 2007-08-30 12:11, I'mLost wrote:
Hi! I need to create a simple program to check and monitor the state
of the pins on a serial interface on a ups. I want to be able to tell
what pins are in what state and when but I don't know where to start.
Can anyone help me!
I have searched all over, including google code (which is hard if you
don't already know what you are looking for, but I can't find anything
that will help me to get started. It seems really simple. I have a
Linux computer and a ups, with a serial cable connecting them. I want
to "see" which pins change their state when the power goes out and
when the battery gets low. The plan is to use this to trigger other
events that have NOTHING TO DO WITH SHUTTING THE PC DOWN.
If anyone has any kind of advise that I might be able use, then please
give it to me.

This have nothing to do with C++, try a group discussing Linux instead.
A hint, perhaps check if you have something in /dev for that serial
interface.

--
Erik Wikström
its not it! what I want is to write my own program to pickup on the
state of each pin on the serial interface. How would I go about
finding information about how to, or help, coding this.

Aug 30 '07 #3
I'mLost wrote:
On Aug 30, 10:19 am, Erik Wikström <Erik-wikst...@telia.comwrote:
>On 2007-08-30 12:11, I'mLost wrote:
>>Hi! I need to create a simple program to check and monitor the state
of the pins on a serial interface on a ups. I want to be able to tell
what pins are in what state and when but I don't know where to start.
Can anyone help me!
I have searched all over, including google code (which is hard if you
don't already know what you are looking for, but I can't find anything
that will help me to get started. It seems really simple. I have a
Linux computer and a ups, with a serial cable connecting them. I want
to "see" which pins change their state when the power goes out and
when the battery gets low. The plan is to use this to trigger other
events that have NOTHING TO DO WITH SHUTTING THE PC DOWN.
If anyone has any kind of advise that I might be able use, then please
give it to me.
This have nothing to do with C++, try a group discussing Linux instead.
A hint, perhaps check if you have something in /dev for that serial
interface.

--
Erik Wikström

its not it! what I want is to write my own program to pickup on the
state of each pin on the serial interface. How would I go about
finding information about how to, or help, coding this.
Google for ioctl and (for example) TIOCMGET

--
Regards
Miguel Giménez
Aug 30 '07 #4
On 2007-08-30 17:45, I'mLost wrote:
On Aug 30, 10:19 am, Erik Wikström <Erik-wikst...@telia.comwrote:
>On 2007-08-30 12:11, I'mLost wrote:
Hi! I need to create a simple program to check and monitor the state
of the pins on a serial interface on a ups. I want to be able to tell
what pins are in what state and when but I don't know where to start.
Can anyone help me!
I have searched all over, including google code (which is hard if you
don't already know what you are looking for, but I can't find anything
that will help me to get started. It seems really simple. I have a
Linux computer and a ups, with a serial cable connecting them. I want
to "see" which pins change their state when the power goes out and
when the battery gets low. The plan is to use this to trigger other
events that have NOTHING TO DO WITH SHUTTING THE PC DOWN.
If anyone has any kind of advise that I might be able use, then please
give it to me.

This have nothing to do with C++, try a group discussing Linux instead.
A hint, perhaps check if you have something in /dev for that serial
interface.

its not it! what I want is to write my own program to pickup on the
state of each pin on the serial interface. How would I go about
finding information about how to, or help, coding this.
Please don't quote signatures.

What I meant was that how to read the pins is off topic in this group,
here we discuss the C++ language as defined by the standard. The
standard does not say anything about signals from serial ports or about
reading pins. These are implementation dependent topics (how you do it
varies between different OSes and so on) and should thus be discussed in
a group for discussing your OS.

If you find something suitable under /dev we can discuss how to open it
as a file and read data from it, since the standard specifies that. We
can not, however, discuss how to interpret the data.

--
Erik Wikström
Aug 30 '07 #5
I'mLost wrote:
its not it! what I want is to write my own program to pickup on the
state of each pin on the serial interface. How would I go about
finding information about how to, or help, coding this.
I am sorry, but we can't help you here.
Standard C++ (our topic) does not define any hardware interfaces.
To find out how to access the hardware pins of a serial interface, you
will have to ask in a group dedicated to your OS.
As such low-level hardware access is usually not granted to user
applications, you probably will have to write a device driver.

Bart v Ingen Schenau
--
a.c.l.l.c-c++ FAQ: http://www.comeaucomputing.com/learn/faq
c.l.c FAQ: http://www.eskimo.com/~scs/C-faq/top.html
c.l.c++ FAQ: http://www.parashift.com/c++-faq-lite/
Aug 30 '07 #6
On Aug 30, 5:31 pm, Bart van Ingen Schenau <b...@ingen.ddns.info>
wrote:
I'mLost wrote:
its not it! what I want is to write my own program to pickup on the
state of each pin on the serial interface. How would I go about
finding information about how to, or help, coding this.

I am sorry, but we can't help you here.
Standard C++ (our topic) does not define any hardware interfaces.
To find out how to access the hardware pins of a serial interface, you
will have to ask in a group dedicated to your OS.
As such low-level hardware access is usually not granted to user
applications, you probably will have to write a device driver.

Bart v Ingen Schenau
--
a.c.l.l.c-c++ FAQ:http://www.comeaucomputing.com/learn/faq
c.l.c FAQ:http://www.eskimo.com/~scs/C-faq/top.html
c.l.c++ FAQ:http://www.parashift.com/c++-faq-lite/
Ok. Thanks.
Sorry for the bother

Aug 31 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: ^CeFoS^ | last post by:
Hello to everybody, I've done an application that draws in a frame the trajectory of a robot. The robot position is readed through the serial port, and several commands are wrote through the...
2
by: willie | last post by:
Hi, I'm writing a program which requires the use of three serial ports and one parallel port. My application has a scanning devices on each port, which I can access fine with pyserial. ...
3
by: rusttree | last post by:
Many moons ago, I took a class in embedded control at school. The course focused on a micro-controller mounted on a small electric car that was programmed using simple C code. The...
13
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have...
4
by: joe bloggs | last post by:
I am writing a mobile application to interface with a legacy system and I am planning to use web services to communicate with this system. The legacy system receives data through a serial port. ...
4
by: Frank | last post by:
Hello, how to get information about all serial ports in the PC? I use the following code, but i got only the data of the FIRST serial port. All other serial port information are not available...
5
by: Franklin M. Gauer III | last post by:
Hi All, I've written an ASP.NET application (webservice) that does simple serial communications via the .NET 2.0 SerialComm object. The application runs fine on my development machine. The...
4
by: rowan | last post by:
I'm writing a driver in Python for an old fashioned piece of serial equipment. Currently I'm using the USPP serial module. From what I can see all the serial modules seem to set the timeout when...
6
by: terry | last post by:
Hi, I am trying to send a character to '/dev/ttyS0' and expect the same character and upon receipt I want to send another character. I tired with Pyserial but in vain. Test Set up: 1. Send...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.