Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: can't opening comm

  1. #1

    can't opening comm

    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

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    It is quite hard to understand without looking at the source code of your program.
    Have you tried adding something like
    ...
    DIM MyErrorCode AS LONG
    MyErrorCode = ERR
    ...
    
    just after your COMM opening command and see what is MyErrorCode value?
    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

  3. #3
    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
    Attached Images Attached Images
    Attached Files Attached Files

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    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

  5. #5
    Thank Eros,
    I already try, but the result is same with my previous program
    regard

    hendryawan

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    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

  7. #7
    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

  8. #8
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    159
    Hello Hendry,

    try this

    '---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
    
    Regards

    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

  9. #9
    Dear Mike and Eros,
    I still can not solve my problem, please any idea?
    regard

    hendryawan

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    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

Page 1 of 2 12 LastLast

Similar Threads

  1. opening 2 forms
    By hendryawan in forum UI (User Interface)
    Replies: 6
    Last Post: 15-02-2011, 11:19
  2. Cannot get COMM to receive
    By fgasoi in forum COMM (Serial communication)
    Replies: 7
    Last Post: 18-02-2010, 08:51
  3. COMM Module?
    By Lee Allen in forum COMM (Serial communication)
    Replies: 5
    Last Post: 24-03-2007, 19:21

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •