Select the file /etc/udev/rules.d/lesĬhange the existing line that starts with KERNEL = "tty" to the following: Rebooting will revert back to inactive ttyS0. However this permission setting will last only as long as your session. This is a fairly simple matter of setting permissions.Īs super user (or sudo, administrator or whatever) you can do:ġ) chmod 666 ttyS0 from within the /dev directory. So you need to activate it before you can get any comms going. Then of course, by default the serial port on a Linux box is inactive. "do stuff here depending on character received etc."Īlso use SerFlush(MySerialHandle) to flush the buffer if necessary. SerRead(MySerialHandle,bffr,1) // The 1 here is to read 1 character This will cause the port to be polled every 200mSec. Place a Timer on the form and set its interval to 200. SerWrite(MySerialHandle, bffr,2) //The 2 here is to send 2 characters SerSetParams(MySerialHandle, 9600,8,EvenParity,1,) Įg: Write the following two characters YU Remember: ttyS0 = CommPort #1 ttyS1 = CommPort #2 and so on. To get the serial (Comm) or in Linux ttyS0 to work very easily, simply add to the 'Uses' clauses 'Serial' (without the quotes of course). Then I discovered that all along, the tools I needed where right there under the Lazarus/FPC bonnet!! I could not get Synaser to work, ever - all in all a very frustrating few months. I struggled for ages trying to find a way to easily use the serial port.
0 Comments
Leave a Reply. |