The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 06-23-2009
tigreped tigreped is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 1
Question Software controlling serial port pins

Hi. I have a project where I intend to connect a simple Infra-Red circuit to a computer. I must then make a software to control this device via software, i.e., I will not be using microcontrollers in the circuit.

I believe the best way to do it is using the serial port, /dev/ttyS0, and the function ioctl(). The thing is that I've found some code and tried a lot, but none seems to be clear enough or to do exactly what I want.

I understand that out of the 9 pins, there are some that I can't change, like the ground(GND) but seems like the others I can, through some sort of AND and OR operations, using iotcl;

I'm also having some doubts about what is HIGH and LOW because using TIOCMGET it shows some pins are HIGH, and when I test them I check no vcc on them, whereas some indicated as LOW do not have voltage.

Also, there seems to be some default configuration on the ttyS0 port, since with a LED, I touch the negative to the GND(5) and the pins 3 4 and 7 seem to be HIGH, lighting up the LED, while the remaining pins do not light it up.

So, I'm assuming that the pins that by default light the LED are set with HIGH values by the system

By the way, I'm running Ubuntu 9.04, Kernel 2.6.28, GNOME 2.26.1.

So, I would like some neat explanations to help me understand how to use the pins of the serial port to implement this unorthodox and most simple device.

The point is, such device may use GND to as its ground, and some all the time HIGh pin as its VCC, and other 2 pins, one to simply send pulses that will activate the infra-red signal, and other to receive electrical pulses from any infra-red device.

As an end, I desire to use this scheme to comunicate two computers with one of such infra-red serial connected device in each, and to controll the emission and receiving of the bits(pulses) by software.

That will allow me to define my start and end bits, size of word, etc.

Note that it is all didatic end, not much like pratical, but still usefull as a learning process envolving C programming to manipulate serial port and a little bit of electronics.

The circuit schematics is this:
Construíndo um Transmissor Infravermelho Para o seu PC | Clube do Hardware

No one needs to read it in portuguese to understand how to mount it up.

Now, the big challenge is to hook it up to a serial cable connected to the serial port and start programming it. Any, really, any constructive comments will be highly appreciated.