Page 1 of 1

INIT_PORT problem in Win 10

Posted: Tue Apr 14, 2020 12:13 pm
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.

Re: INIT_PORT problem in Win 10

Posted: Tue Apr 14, 2020 1:43 pm
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

Re: INIT_PORT problem in Win 10

Posted: Tue Apr 14, 2020 2:44 pm
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 2069 times
:(

Zoli B.

Re: INIT_PORT problem in Win 10

Posted: Tue Apr 14, 2020 3:09 pm
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 2057 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.

Re: INIT_PORT problem in Win 10

Posted: Tue Apr 14, 2020 4:41 pm
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.

Re: INIT_PORT problem in Win 10

Posted: Tue Apr 14, 2020 4:54 pm
by edk
There seems to be a reason: hb_comGetDevice ( 6 ) => \\.\COM6

Maybe try INIT_PORT ("\\.\COM6", 9600, 8, 0, 1, 64 )

Re: INIT_PORT problem in Win 10

Posted: Tue Apr 14, 2020 5:30 pm
by zolysoftsolutions
Thank You very very much..
It's working now. :)
Zoli B.