COM port cash register lazarus / 8-Other ---------------------------------------------------------------------- christensen · 2012-10-17 18:24 Hi, I have a cash register machine (Activa Magic) and i want to connect to the PC via COM port(the only choice). How can i use COM port for cash machine? there is a library for this? or a project? ---------------------------------------------------------------------- TurboRascal · 2012-10-17 19:22 You should use Synaser library for the serial port communication, but what you can do with the device is dependent of its capabilities, you should get some programmer documentation for it. ---------------------------------------------------------------------- taazz · 2012-10-17 19:23 there are 3 libraries for com ports that I am aware of Synaser from the developer of the synapsy socket lib.TurboPower Async ProTCom Synaser says it support FPC and linux, I haven't used it my self so  I do not know the state of the library. In case that you decide to port one of the rest I would try to 1st extract the COM specific parts form AsyncPro CLX version which is a based on Kylix and claims to work on both windows and linux so I'm assuming that it will have the least amount of work to port do not try to port all the library though its huge and it has other capabilities too that are of no importance to you like fax. Here are the links to get you started. http://www.ararat.cz/synapse/doku.php/download http://sourceforge.net/projects/comport/?source=directory http://sourceforge.net/projects/tpapro/?source=directory ---------------------------------------------------------------------- garlar27 · 2012-10-17 20:32 I'm using synaser without problems on windows and Linux. Here is a quick example (I didn't have time to write all variable's declaration but I think you'll understand): Code: [Select]uses   Classes, SysUtils, synaser; type    // if you need add something particular to the class:    MyConnClass =class(TBlockSerial)    end; var    AConn: TBlockSerial;    MyConn: MyConnClass; // in case you need this    ABuffer: string; begin    AConn := TBlockSerial.Create;    AConn.Connect('COM1');    AConn.Config(BaudRate, DataBit, DataParity, DataStopBit, false, false);    if (AConn.LastError <> sOK) and (Not AConn.cpomComportAccessible) then begin       WriteLn(Format('Error: #%D : %S', [LastError, LastErrorDesc]));       AConn.cpomReleaseComport;       Exit;    end; //  SERIAL CONNECTION IS READY  //    AConn.SendString('data');    ABuffer := AConn.RecvPacket(ATimeout); end. ---------------------------------------------------------------------- christensen · 2012-10-18 10:24 Thanks guys, I've installed Synaser 4 but went i try to run your code i get the this error: Code: [Select]project1.lpr(0,0) Fatal: Can not find unit synaser used by Program. Check if package laz_synapse is in the dependencies. My system: Lazarus 1.0 FPC 2.6.0, Windows 7 32bit Ultimate ---------------------------------------------------------------------- BigChimp · 2012-10-18 10:31 Seems like you didn't compile the laz_synapse package first (which synaser probably depends on), so Lazarus doesn't know where to find it. Did you follow the installation instructions? ---------------------------------------------------------------------- christensen · 2012-10-18 11:17 I've compiled and install it. Take a look at the screen shot ---------------------------------------------------------------------- BigChimp · 2012-10-18 12:00 Argh. Ok, that does look good. I'm out of ideas for now... ---------------------------------------------------------------------- christensen · 2012-10-18 12:20 I've copied into project folder all lib files and now it recognize "synaser" but the "class(TBlockSerial)" isn't!  MyConnClass = class(TBlockSerial)  I've put BLCKSOCK into uses section and the same. ---------------------------------------------------------------------- garlar27 · 2012-10-18 14:04 I'm using synaser, synapse V3.9. In the project options dialog I set the other path (-Fu) to use the 3rdParty units for instance: Quote../3rdParty/synapse.v39;../3rdParty/synaser.v39the only drawback is that when I compile the project I get warnings and hints from synaser and takes longer to compile something that never changes but it works for me.