Announcement

Collapse
No announcement yet.

Why in VDM a COM program do not work?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why in VDM a COM program do not work?

    Hi friends of BP,

    this is the mine first post to this forum.
    I'm writing from Italy, near Roma.

    I have monitored this list from few days ago.

    I have been discovered the Power Basic for the first time
    a couple of months ago. As an old entusiast programmer of
    the use of Turbo Basic ten years ago, After that positive
    experience, the world goes to VB...

    Now I have buied the full line of product of Power Basic
    and I have in plan to use it frequently!

    But at my first approach to the serial port, a strange problem
    put me in trouble.

    A simple comm program, that work fine under pure DOS, in a
    VDM (DOS)windows of WIN98SE do not work.
    The program is:

    DEFINT a-z
    CLS
    $COM 1024
    OPEN "COM2:9600,n,8,1,DS,RS,CS,CD" as #2 LEN = 1024
    PRINT "premi un tasto per terminare"
    WHILE NOT INSTAT
    DO UNTIL LOC(2) = 0 or EOF(1)
    a$ = INPUT$(1,#2)
    PRINT a$;
    LOOP
    WEND

    What I have mistaked?

    Thanks for your answer.

    Ciao

    Leonardo

    ------------------

  • #2
    EOF(1) looks wrong since you have not opened file #1...

    This little app seems to be just listening to a serial port. Other than the EOF(1) problem, what happens? Is there actually a data stream to be read?


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      You have reason, the statement is caming from an older file...

      The working programa is:

      defint a-z ' integer variables are smaller and fast
      CLS
      $COM 1024
      OPEN "COM2:9600,n,8,1,DS,RS,CS,CD" as #2 LEN = 1024
      PRINT "premi un tasto per terminare"
      WHILE NOT INSTAT
      DO UNTIL LOC(2) = 0 or EOF(2)
      a$ = INPUT$(1,#2)
      PRINT a$;
      LOOP
      WEND
      CLOSE
      END

      and this program show incoming serial data only if is
      made running in COMMAND PROMT mode.

      Starting the same program under a windows DOS, the
      windows remain black. Do not appear the
      "premi un tasto per terminare"

      regards

      Comment


      • #4
        If you step through the code with the debugger using the F7 key, does the OPEN statement appear to work, or does it hang? Try adding $ERROR ALL ON to the code and see if any errors are detected when the code is run.

        Is COM2 configured correctly in CONTROL PANEL (port address, IRQ, etc)? Have you set the Properties of COM2 in CONTROL PANEL|SYSTEM|COM/LPT PORTS to use RTS/CTS handshaking, etc?

        Is there a conflict with COM2 and some other device you have installed (like an internal modem or other device)? In some cases, Plug & Play hardware can cause a port or IRQ conflict with "legacy" devices like COM ports - since DOS does not "enable" these devices, the conflict may not show up until Windows is running. Check the "Resources" tab on the Properties sheet for COM2

        If you use "Hyperterm" (which comes with Windows), does that show the data stream arriving on COM2?



        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          Hi Edmonds,

          stepping through the code with the debugger using the F7 key,
          stay highlihted on yhe does the OPEN statement
          OPEN "COM2:9600,n,8,1,DS,RS,CS,CD" as #2 LEN = 1024
          forever.
          I have found an older mu TB program that use the serial port
          with tree wire, GND, TX and RX and have the following OPEN:

          OPEN "COM2:9600,N,8,1,CS,DS" AS #2

          and with this new open the program continue to not run.
          I will try to adding $ERROR ALL ON to the code and see if
          any valid errors are detected.

          Using Hyperterm, I can see the correct data incoming trought
          the COM2.



          ------------------

          Comment


          • #6
            Hi

            In CONTROL PANEL, COM2 have port address,02F8 - 02FF,
            IRQ 3, flux control ia at none.

            Regards


            Leonardo


            ------------------

            Comment


            • #7
              Well, since the OPEN statement is "failing", you must have a serial port problem. Try to listen to the port with Hyperterm and see if that works.

              Also, try opening the port with the default settings...
              Code:
              OPEN "COM2:9600,n,8,1" as #2 LEN = 1024

              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected].com[email protected]</A>
              Lance
              mailto:[email protected]

              Comment


              • #8
                Hi,

                I believe that I have a problem.


                Using Hyperterminal I receive the data correctly.


                Now I will try to another PC to see if the problem change..,


                Ciao


                Leonardo

                ------------------

                Comment

                Working...
                X