473,320 Members | 1,867 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,320 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 2674
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: 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...
1
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.