I wrote a controller using the parallel port for our 2nd year engineering project (miniature submarine)... The fact that the sub was powered in 220V made me extra careful not to fry my laptop
Soldering components is not fun.
Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
Hardware interfacing...
heh, soldering isn''t too bad
Well I found a bit of info (lots of it regarding warnings, so ill probably pick up another internal card to use), but most of it was for pascal/delphi etc, I couldnt really find anything in regards to C++... but quite alot was sortof "theory" type stuff about it, but I still need more...
CEO Plunder Studios
Well I found a bit of info (lots of it regarding warnings, so ill probably pick up another internal card to use), but most of it was for pascal/delphi etc, I couldnt really find anything in regards to C++... but quite alot was sortof "theory" type stuff about it, but I still need more...
CEO Plunder Studios
quote:
I wrote a controller using the parallel port for our 2nd year engineering project (miniature submarine)... The fact that the sub was powered in 220V made me extra careful not to fry my laptop
At uni I once had a project, where a 25kV circuit needed to be controlled by a computer (for a particle deflection coil). Now the computer was an extremly expensive (and brand new) SGI workstation... Guess how I felt, when it came to the first test... Fortunately it worked
elis-cool:
You should really be careful. If you work with low voltage components, then normally you can''t do too much harm (esp. to yourself). However, you can still seriously damage the parallel port signal drivers in your chipset, if you don''t respect their maximum drain current. So using a cheap separate interface card is definitely a good idea.
What exactly do you want to do (on the hardware side) ?
/ Yann
I just want to muck around with it, eg Im not _really_ awesome or anything, I have taken an electronics course, and I just want to maybe put together some stuff that I can control with the comp eg, LED''s, maybe a little counter circut (eg with those 8 pin LED type things, like on Microwaves and stuff... I have put together a several-pcb boarded counter with them), which most of the processing would be done by the PC, like you enter a number and it displays it. And then maybe move on to hooking stuff up so I can control it via the PC, like lights and stuff, which is where I would most definatly be using a relay... eg more practical things
CEO Plunder Studios
CEO Plunder Studios
You will need to dig up an old hardware interface books. I know one of my books had info about it.... i think as PC underground... it is an old book published by Abacus or Databecker. I''ll post any info if I can dig it up.
Whe I do something, I go at it full speed.
Download and Memorize the Windows DDK. It will do you a lot of good! I know some really cool companies were hiring a while back, including professional sound recording equipment makers.
Download and Memorize the Windows DDK. It will do you a lot of good! I know some really cool companies were hiring a while back, including professional sound recording equipment makers.
Hi elis-cool,
I'm just working on controlling a relais via the serial port. If you want to do something like that without microchips, you have to control a single pin of the port which you use as output. In the case of the serial port, this could be the RTS (ready to send, pin 7 on a 9-pin port) or the DTR (data terminal ready, pin 4 on a 9-pin port). Signal ground is pin 5 on a 9-pin port. I use the DTR, but this is up to you. To set the DTR or RTS in Win32 environment, you need the Win32 API function SetCommState. I tried it out, it works. The voltage levels are -12V/+12V.
A drawback of the COM port is that you do not have a Vcc pin, so you can use the port only for sending signals, not for powering a circuit.
Hope that helps
blw
640 kByte of memory is all that any application should ever need
(Bill Gates 1981)
[edited by - blw on June 30, 2002 1:14:41 PM]
I'm just working on controlling a relais via the serial port. If you want to do something like that without microchips, you have to control a single pin of the port which you use as output. In the case of the serial port, this could be the RTS (ready to send, pin 7 on a 9-pin port) or the DTR (data terminal ready, pin 4 on a 9-pin port). Signal ground is pin 5 on a 9-pin port. I use the DTR, but this is up to you. To set the DTR or RTS in Win32 environment, you need the Win32 API function SetCommState. I tried it out, it works. The voltage levels are -12V/+12V.
A drawback of the COM port is that you do not have a Vcc pin, so you can use the port only for sending signals, not for powering a circuit.
Hope that helps
blw
640 kByte of memory is all that any application should ever need
(Bill Gates 1981)
[edited by - blw on June 30, 2002 1:14:41 PM]
Perhaps you''re interested in some code:
HANDLE hCom;
DCB dcb;
char *portname = "COM1";
// open handle for COM1
hCom = CreateFile(portname, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if(hCom == INVALID_HANDLE_VALUE)
{
// some error handling
}
else
{
// read status of COM1
GetCommState(hCom, &dcb);
// set DTR high
dcb.fDtrControl=DTR_CONTROL_ENABLE;
// write new status to COM1
SetCommState(hCom, &dcb);
}
For another COM-port, just change portname. Switching DTR back to low is done by DTR_CONTROL_DISABLE. For the RTS pin, it works the same way.
HANDLE hCom;
DCB dcb;
char *portname = "COM1";
// open handle for COM1
hCom = CreateFile(portname, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if(hCom == INVALID_HANDLE_VALUE)
{
// some error handling
}
else
{
// read status of COM1
GetCommState(hCom, &dcb);
// set DTR high
dcb.fDtrControl=DTR_CONTROL_ENABLE;
// write new status to COM1
SetCommState(hCom, &dcb);
}
For another COM-port, just change portname. Switching DTR back to low is done by DTR_CONTROL_DISABLE. For the RTS pin, it works the same way.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement