It is quite hard to understand without looking at the source code of your program.
Have you tried adding something like
just after your COMM opening command and see what is MyErrorCode value?... DIM MyErrorCode AS LONG MyErrorCode = ERR ...
Dear,
I can not openingg the comm port every time after startup the pc.
So I only running the other program like VB or hyperterminal with related comm opening, after that the thin basic program with communication can running normal. I already tried with 3 computers.
What is the problem with my program?
thank you verymuch
regard
hendryawan
It is quite hard to understand without looking at the source code of your program.
Have you tried adding something like
just after your COMM opening command and see what is MyErrorCode value?... DIM MyErrorCode AS LONG MyErrorCode = ERR ...
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Dear,
I has been add the error number, but the return number is always 0.
I attatch the program and print screen of my program result.
The screen no_respon is first time I running the program.
And the screen with_respon is after I open the other program with using comm1.
thankyou verymuch
regard
hendryawan
I think you need to first open COM port and just after that set communication parameters.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Thank Eros,
I already try, but the result is same with my previous program
regard
hendryawan
hendryawan,
the problem with such situation is that I cannot replicate your local device situation, so please be patient if I ask more and more or I try to suggest different path that does not bring into an immediate solution.
So here my next try:
are you sure you don't need to first send some kind of command to your device in order it to reply? Usually with serial devices you need first to send a command, than wait for response. For example some nextwork device that have a serial console (switch or routers) you usually neext to send an enter key in order to wake them up.
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Dear Eros,
I just made the device microcontroller only sending "count = xxx" to PC.
My thin basic program is only read from my device, no cammand request to my device.
Maybe you can try with two PC to made communication, one pc use hyperterminal and the other one is use thin basic program.
thank
hendryawan
Hello Hendry,
try this
Regards'---Open the port COMM_Open( "COM1", hcomm ) If Err <> 0 Then PrintL "error: " + Err Else Do If COMM_Get( hcomm, %COMM_RXQUE ) <> 0 Then ' Get size of incoming data sBuffer = COMM_Line(hComm) 'waiting rx data with CRLF to continue Console_WriteLine(sBuffer) End If Loop While Console_WaitKey = "" ' Anykey to quit End If 'closing comm
Mike
Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370
Dear Mike and Eros,
I still can not solve my problem, please any idea?
regard
hendryawan
hendryawan
some questions for you, sorry
Just after COMM_FreeFile, what is the value of hComm file channel?
Can you please also print Err value after COMM_FreeFile?
You said that if you first run another application to open com port and than use thinBasic script, all is ok. This can be a symptom of missing parameter or a wring parameter. Can you please double check all COMM_Set options are what they need to be?
Is "COM1" the correct port on which your card is on?
Is there another application using "COM1" running at the same time?
When you use Hyperterm to test, does your card immediately send out text buffer after connection or you need to press some keys like <enter> to wake it up? If yes, try to add a COMM_Send(hComm, $CRLF) after COMM_Open and a sleep 200 to give some the time to the device.
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Bookmarks