Announcement

Collapse
No announcement yet.

Simple Communications Program example

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

  • Simple Communications Program example

    I can't get the following to work.
    It is on page 211 of the Power Basic User's Guide.
    PB 3.5 for DOS. Doesn't work on either of two
    different DOS computers. The Terminal.BAS on
    the \example directory on the distribution disk
    works ok on both computers! The
    error message I get is error 24 - Device timeout.
    The error is on the OPEN "COM1: ... " line

    DEFINT a-z
    $COM 1024
    OPEN "COM1: 9600,N,8,1" AS #1 LEN = 1024
    echo = 1
    WHILE (1)
    WHILE NOT INSTAT
    IF LOC(1)>0 THEN
    stuf$ = INPUT$(LOC(1),#1)
    PRINT stuf$;
    END IF
    WEND
    WHILE INSTAT
    myinput$ = INKEY$
    PRINT #1,myinput$;
    IF echo THEN PRINT myinput$;
    WEND
    WEND


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

  • #2
    If your modem is external and the cable isn't setup for hardware
    flow control, you will have switch over to software flow control,
    i.e., Xon/Xoff

    Also, in your example, you have a space in "COM1: 9600..."
    that may have something to do with it or not.

    OPEN "COM1:9600,N,8,1,rs,cs,ds,cd" AS #1 LEN = 1024

    Another thought: COM1 is usually built into the system. If you
    have an internal modem, check to see that it is set to COM2 thru
    COM4.



    ------------------
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      I'm just using the software to talk
      with another device - no modem involved.

      I'll check out the space to see whether that
      makes any difference.

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

      Comment


      • #4
        The key difference between your code and the TERMINAL.BAS example is that the latter uses the ",DS,CS,CD" options... quite likely the the CD option is all you need to use to disable carrier detect. By default, CD will be set for a 1000mSec timeout.

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

        Comment


        • #5
          Yes, Lance, that's it! Using the ,DS,RS, etc
          fixed the sending ok. But, I still receive nothing
          using the modified sample program, altho the
          terminal.bas example receives data ok.

          Fortunately, for this application, I only need
          to send!

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

          Comment

          Working...
          X