Serial communication via RS232

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Serial communication via RS232

Post by mol »

Do anybody wrote an app. communicating via COM port?
I need to communicate with fiscal printer and electronic cash.

A few months ago I saw a post about communication via COM, but I ca'nt find it (even via search function...)

Marek
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Serial communication via RS232

Post by Roberto Lopez »

mol wrote:Do anybody wrote an app. communicating via COM port?
I need to communicate with fiscal printer and electronic cash.

A few months ago I saw a post about communication via COM, but I ca'nt find it (even via search function...)

Marek
I've done such thing, but I've used an utility bundled with printer drivers.

That utility can receive a command line indicating the command to the printer or even the complete invoice as a command text file.

So, I've invoked the utility with EXECUTE command and used required parameters.

AFAIK most of fiscal printers comes with some kind of utility.

This way is more easy and reliable for me.

Anyway , there is a library called 'hbcomm' for com port access. From time to time someone ask for it. I'm not fully sure but I guess that it was already posted here.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
radohabjan
Posts: 99
Joined: Mon Nov 30, 2009 7:17 am
Location: Slovenia
Contact:

Re: Serial communication via RS232

Post by radohabjan »

mol wrote:Do anybody wrote an app. communicating via COM port?
I need to communicate with fiscal printer and electronic cash.

A few months ago I saw a post about communication via COM, but I ca'nt find it (even via search function...)

Marek
Hello,

for COM port printer I use normal Clipper commands:
SET PRINTER TO LPT2
SET PRINTER ON ......... SET PRINTER OFF

In autoexec.nt you must add MODE COM1:=LPT2
or you can use command : NET USE LPT2: \\server\printername

Best regards Rado Habjan
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Serial communication via RS232

Post by mol »

But, I need bidirectional communication..
Mario Mansilla
Posts: 271
Joined: Wed Aug 13, 2008 2:35 pm
Location: Córdoba - Argentina

Re: Serial communication via RS232

Post by Mario Mansilla »

Hola Mol :
disculpa recien hoy veo tu post , fijate en un post mio del 23/07/2009 (Serial port) . No se como pegar la direccion directamente , alli hay un error , se corrige colocando :
!Setcom(Handler,2400,8,0) en la apertura .
He probado con mscomm32.ocx hasta win98
Espero que pueda ayudarte .

Saludos Mario Mansilla

Hello Mol:
recent apology today I see your post, look at a post of mine 23/07/2009 (serial port). No such paste the address directly, there is an error, is corrected by placing:
! Setcom (Handler, 2400,8,0) at the opening.
I tried to win98 mscomm32.ocx
I hope you can help.

Saludos Mario Mansilla
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Serial communication via RS232

Post by mol »

Many thanks Mario!
I'll test it.
Best regards, Marek
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Serial communication via RS232

Post by mol »

But... How to write to port or read from the port?
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Serial communication via RS232

Post by Roberto Lopez »

mol wrote:But... How to write to port or read from the port?
viewtopic.php?f=12&t=266&hilit=hbcomm
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Serial communication via RS232

Post by mol »

I've downloaded harbour 2.0 beta 3, and there is hbwin library, which contains communication via RS.
there is a file contrib/hbwin/tests/testprt2.prg
I want to compile it, but compiler still presents error: undefined WinPort and Win_Port function.

I've added libhbcomm.a (I wrote hbwin as a name of library) in IDE configuration, but compile error still exists...
What's going on?

Marek
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Serial communication via RS232

Post by mol »

I think, problem with Win_Port lays in libhbwin.a included in HMG - It's different library!
I've looked into file \hmg\harbour\lib\libhbwin.a and I didn't find any text including "Win_Port" !!!
In \hb20\lib\libhbwin.a such a function is defined!

Could you check it, Roberto?
Post Reply