RS232 / USB read/write?

Nick Sabalausky a at a.a
Mon Feb 1 12:18:19 PST 2010


"Brian Hay" <bhay at construct3d.com> wrote in message 
news:hk51h7$1t39$1 at digitalmars.com...
> I'm a bit green with D. I've done some basic D1 + Tango + Derelict stuff 
> but am keen to learn more about D2 + Phobos.
>
> As a learning project I thought I'd like to try reading/writing data 
> streams from/to RS232 and/or USB devices, something I've never done before 
> in any language.
>
> Can anyone give me some pointers and online references? Are there any D 
> libraries for this?

If you're doing it on Windows, there's the "inpout32.dll" ( 
http://logix4u.net/Legacy_Ports/Parallel_Port/Inpout32.dll_for_Windows_98/2000/NT/XP.html ) 
that's commonly used for basic hardware I/O (or at least for the old 
standard serial/parallel ports). I've used it in a C program before to drive 
a homemade parallel-port EEPROM burner. It works well (although my homemade 
burner didn't work quite as well ;) ). It is a C thing, but it should be 
easy to make a D binding for it (just look up accessing C libs from D on the 
digital mars site or the D wiki). If you have any timing-critical portions, 
just make sure to either disable the GC and/or avoid any hidden (or 
non-hidden) allocations during those portions. 




More information about the Digitalmars-d-learn mailing list