how to talk to the serial and parallel ports through a C program

Andreas Kohn andreas.kohn at gmx.net
Mon Jun 9 13:39:38 PDT 2003


Am Mon, 2003-06-09 um 18.44 schrieb Dan Malaby:
> I was wondering if there was a good place to go to get programing examples 
> on how to
> talk to the serial and parallel ports. I have looked in the developers 
> handbook but have not
> any luck finding what I want.
> 
> Any pointers would be appreciated
>
> Thanks

Hello, 

at least for parallel ports, ppi might help you. There is a short
example in the ppi(4) man page:

     To present the value 0x5a to the data port, drive STROBE low and
then
     high again, the following code fragment can be used:
 
             int             fd;
             u_int8_t        val;
 
             val = 0x5a;
             ioctl(fd, PPISDATA, &val);
             ioctl(fd, PPIGCTRL, &val);
             val |= STROBE;
             ioctl(fd, PPISCTRL, &val);
             val &= ~STROBE;
             ioctl(fd, PPISCTRL, &val);

HTH, 
-- 
Andreas Kohn <andreas.kohn at gmx.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20030609/c6c5d64c/attachment.bin


More information about the freebsd-questions mailing list