Hardware Interfacing thru C..
Hardware Interfacing thru C..
(OP)
Hi,
I m relatively a beginner in C, but after covering some major topics, i want to learn something abt interfacing hardware like printer parallel port or some LED etc thru C.
can anyone guide me, or refer to any online material..
Thanks,
FaRaZ.





RE: Hardware Interfacing thru C..
RE: Hardware Interfacing thru C..
<nbucska@pcperipherals.com>
RE: Hardware Interfacing thru C..
RE: Hardware Interfacing thru C..
Reading Chinese is simple, too, after you learn a few
thousand symbols...
<nbucska@pcperipherals.com>
RE: Hardware Interfacing thru C..
I guess I can't argue with that.
faraznasim:
Humm what exactly would like to write to a serial port, I'll give you a windows example if you want.
RE: Hardware Interfacing thru C..
Once you have opened the port, it's as simple as transmitting (WriteFile()) and receiving (ReadFile()) bytes.
Also take a look at the SetCommTimeouts() and SetCommState() functions, with the relevant COMMTIMEOUTS and DCB data structures as input. The MSDN library gives you all the help you'll need on these topics, and its available online as well.
Hope this helped.
RE: Hardware Interfacing thru C..
The C programming enviornment for a 'nix machine is
much easier than going through much rigamarole in the
windows enviornment.
If you feel comfortable going into say the Linux land,
you will find all sorts of tools that will assist you
in playing with I/O.
I might recommend the following link:
http://www.linuxdocs.org/HOWTOs/mini/IO-Port-Programming-6.html#ss6.1
as a rather painless introduction to the subject.
Cheers,
Rich S.
RE: Hardware Interfacing thru C..
Some things are fairly straightforward, like getting to RTS/CTS and DSR/DTR bits on a serial port via the MSCOMM.DLL package. Just don't expect reliable real-time performance when you do. You can blink and read Morse Code, for example, but don't think you'll be able to bit-blast a 100kHz burst pattern for X10 emulation accurately at zero-crossing through most Windows tools.
If you're just trying to print something to a parallel port, just open the printer as a stream i/o device and "printf" to it. If you want to light a couple of LED's, I'd suggest putting them on the serial port (or just watch the lights on an external modem.) For much beyond that, get an I/O board with a Mfgr's driver interface to C, or get ready to write your own replacement port driver, a task NOT for newbies.
Howrd
RE: Hardware Interfacing thru C..
http://www.lvr.com/
The direct page for parallel ports is
http://www.lvr.com/parport.htm
See the section on windows drivers that can be used to allow direct IO on windows, some are free, some are commercial, but it may help your problem.
Cheers
B