Controlling an external Machine through a computer

Status
Not open for further replies.

Nitin_Tyagi

Broken In
I wanted to know How to control an external device with the help of a computer. Suppose i make an electrical device which contains of 5 switches and a combination of those can make my device do several things. How is it that i can control it through a computer. Moreover even if I am able to put the switches on or off with the Help of a computer is there any way by which i can write a program to define various actions performed by my machine and make it work by running the program.

Guys! anyone who can help me with that would help me create something you people would like getting ur hands on.
 

rajagopal87

Broken In
Hi ,
Pc's know only 0's and 1's.
however as u want to control those switches it can be easily done with the Pc (provided the switch has only two states ON & OFF). PCs communicate with the external world thru ports. Your PC will have three ports

1.Parallel Port (25 pins that loooong one)
2.Serial Port (9 pins ,a bit smaller one)
3.USB port ( a small rectangular socket)

Of these three, the USB port is the fastest, however its the hardest one to implement in your custom device. Hence unless ur app dont need Tremoooooodus speed u can go for either of the first two. Each has its own advantages.

The serial port communication needs least wiring ( 5 wires max and is the most suitable for wireless commn where only one bit can be sent at a time ). However it is harder to implement.

The parallel port commn needs more wires but as u need to control only 4 switches the wiring can be reduced. It is also the easiest one to implement. However remember , its unsuitable for wireless applns.

Now after deciding which port to use just google for further info. Also contact me if u need any further info ( particularly if u r interested in implementing serial port using Mc, I can help u .)

The following links may help u.
*electrosofts.com/parallel/index.html
*www.epanorama.net/circuits/parallel_output.html

*www.arcelect.com/rs232.htm
*www.beyondlogic.org/serial/serial.htm

Raja
rajagopal87 <<<@>>>gmail+++com
 
OP
Nitin_Tyagi

Nitin_Tyagi

Broken In
If the serial port is not too harder to implement i would like to go for it because I need to carry signals at longer distances. I dont need any wireless application but Ease in implementation is also a big issue for me because I am amateur at it. If the serial port is too harder to implement I can do with the parallel port. I also need Info about program level control I know a bit of Fortran and C language if Someone can tell me how to use them for my purpose It would mean a lot.
 
Last edited:

rajagopal87

Broken In
Do u have any exposure to microcontrollers??? . If u have, then implementing serial port commn will not be a big task. Go for an Mc with inbuilt hardware uart and u r done.

But in case u dont have any exposure to mcs, it will be too much difficult to imp it. In that case I would advice u to go for Parallel port. The programming part , I have no idea abt pascal , however a simple c program will do the job. Just see the following program,


/*flash an led on and off*/

#include <stdio.h>
#include<dos.h>
int main()
{

while(1)
{
outport(0x378,0);
sleep(1);
outport(0x378,1);
sleep(1);
}
return 0;
}

The outport instruction outputs the given value in the parallel port. Here it outputs 1 and 0. 0x378 is the address of the parallel port. The sleep command provides a time delay of 1 sec. You can check this program by using some other port monitoring software or by using the following ckt in ur parallel port.

[data0] ~~ resistor ~~~~~ LED~~~~~~[gnd]
pin2----------XXXXX-----------|>|---------pin 20
330~470ohm ~~~~ ```


here the LED will keep flashing. Since u r placing values 0 & 1 in parallel port the first data bit (least significant) will alone keep changing. The first data bit or data0 is hardware pin2. pin 18 - pin 25 are all gnd and u can use anyone gnd pin.

Hope u can understand the method. If u still had any doubt reg this feel free to contact me.


Raja
 
Last edited:
Status
Not open for further replies.
Top Bottom