INIT_PORT problem in Win 10

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

INIT_PORT problem in Win 10

Post by zolysoftsolutions »

Hi my friends,

Is somebody who still are using INIT_PORT for SMS sending trough usb modem?
I used in my application 5 years without problems til now, and now cannot open port.

The modem is okay, is located on Com9, with his own application send and recieve normally the sms.

Can be a firewall problem or something specific win 10?

Zoli B.
_______________________________
Open eyes for you!
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: INIT_PORT problem in Win 10

Post by edk »

For years I have successfully done communication with fiscal devices connected via USB and COM - no problems with Win 10. Instead of Clipper Tools commands I use the serial commincation API: https://github.com/Petewg/harbour-core/ ... cation-API
Sample: https://github.com/harbour/core/blob/ma ... ts/com.prg
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

Re: INIT_PORT problem in Win 10

Post by zolysoftsolutions »

Hi EDK,
Thank you for trying help me.

hb_comInit( 'COM6', 9600, 8, 0, 1, 64 ) return .F.

.
modem.png
modem.png (46.56 KiB) Viewed 2072 times
:(

Zoli B.
_______________________________
Open eyes for you!
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: INIT_PORT problem in Win 10

Post by edk »

zolysoftsolutions wrote: Tue Apr 14, 2020 2:44 pm Hi EDK,
Thank you for trying help me.

hb_comInit( 'COM6', 9600, 8, 0, 1, 64 ) return .F.

.

modem.png

:(

Zoli B.
:?: hb_comInit( 'COM6', 9600, 8, 0, 1, 64 ) :?:
hb_comInit(nPort, nBaud, cParity, nSize, nStop)
nPort := 'COM6' => nPort:=6
cParity := 8 => cParity:="N" for None (N) ; Odd (O) ; Even (E); Mark (M); Space (S)
nSize:=0 => nSize:=8 (bits)
64 :?: :?: :?:

try:

Code: Select all

#include <hmg.ch>
#include "hbcom.ch"

Function Main
Local nPort:=6
msgdebug (hb_comOpen( nPort ))
msgdebug (hb_comGetDevice ( nPort ))
msgdebug (HB_ComInit( nPort, 9600, "N", 8, 1 ))
msgdebug (HB_ComClose( nPort )) 
Return
***************************************************************************

Show what are the COM ports on the system:
Bez tytułu.png
Bez tytułu.png (151.27 KiB) Viewed 2060 times
This function "INIT_PORT( cPort, nBaud, nData, nParity, nStop, nBufferSize )" is not very clear to me, it results from it, in order to initialize COM6 you have to initialize COM1-5 first?!? (look at the "nPort" variable) https://github.com/harbour/core/blob/ma ... m/comm.prg

Please check what the hb_comGetDevice( 6 ) function returns for you on Win10 and on another (working properly) version of Win.
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

Re: INIT_PORT problem in Win 10

Post by zolysoftsolutions »

msgdebug (hb_comOpen( nPort )) => return .T.
msgdebug (hb_comGetDevice ( nPort )) => return \\.\COM6
msgdebug (HB_ComInit( nPort, 9600, "N", 8, 1 )) => return .T.
msgdebug (HB_ComClose( nPort )) => return .T.
_______________________________
Open eyes for you!
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: INIT_PORT problem in Win 10

Post by edk »

There seems to be a reason: hb_comGetDevice ( 6 ) => \\.\COM6

Maybe try INIT_PORT ("\\.\COM6", 9600, 8, 0, 1, 64 )
User avatar
zolysoftsolutions
Posts: 139
Joined: Wed Feb 29, 2012 3:33 am
Location: Gyulakuta, Erdélyország
Contact:

Re: INIT_PORT problem in Win 10

Post by zolysoftsolutions »

Thank You very very much..
It's working now. :)
Zoli B.
_______________________________
Open eyes for you!
Post Reply