Lazarus
Programming => General => Topic started by: lucydog11 on February 04, 2023, 03:26:30 am
-
With Delphi i use a serial port driver to talk to my USB controller board .
How do i talk to USB ports on Linux or MacOS ( im working with both) ? Its a PIC based USB board that uses CDC ( serial protocal using ascii )
Larry K
-
Not sure what you're asking here. Your CDC hardware is connected to your PC with a USB cable? Or something else?
Check out the packages "SdpoSerialLaz" or synaSER and see if they look like what you're after: they let you communicate with a device in a serial mode via a USB port. (I use synaSER to talk to most of my development boards here.)
Hope that's responsive to what you're looking for.
-
On unix (definitely including Linux, probably including MacOS or whatever it's called these days) it's a standard serial device. My own preference is to use the standard serial.pp (with a separate thread if necessary), there's a couple of demos plus some useful additional stuff to find the device etc. at https://github.com/MarkMLl/serialcomms
MarkMLl
-
Ok, thanks i will try those two suggestions . I'm just getting use to lazasus now, but i'm really impressed . I was able to install a component i had wrote for delphi ..into Lazarus last night .
-
I'm spending limited time on the forum these days, but is you have urgent questions about serial.pp or the link I gave you also PM me since I'll get a notification via email.
serial.pp is very much intended to be low-level. I did quite a lot of work on it when I was doing RS232 monitoring work, and it's done in such a way that you can e.g. have a thread that responds to each received character by storing it with a timestamp and snapshot of the control lines.
It's tested on both Linux and SunOS/Solaris, but hasn't been explicitly tested on a Mac. That's important, since my understanding is that both MoacOS and SunOS are BSD derivatives, and BSD's implementation of the select() syscall differs from the way is was later done by Linux.
The stuff I linked to can help when you're trying to find the device name (i.e. /dev/ttyUSBnn etc.) of e.g. a measurement instrument you've just plugged in.
MarkMLl