Announcement

Collapse
No announcement yet.

Runtime Error 24 & 52

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

  • Runtime Error 24 & 52

    I have a large four segment program (60k,56k,57k,12k) that
    uses serial ports COM1-COM4. Recently I changed COM3 to use
    RTS/CTS hardware handshaking.

    If the device connected to COM3 is either unplugged or
    disconnected, I should get a runtime error 24. I never get this
    error in my program. When I try to PRINT #3, I get error 52
    and the program crashes. I am unable to trap this error.
    Even if I use ON ERROR RESUME NEXT, the program still crashes
    at the PRINT #3 statement.

    I am using PB DOS 3.2 in a DOS 6.22 environment.

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

  • #2
    How did you change the port to use RTS/CTS? A cable change? Does the new cable work ok? Did COM3 work OK before the cable change, and did you make any code-changes to your code in the intervening go/nogo period?

    Beyond that, we'd probably need to see the code to make any suggestions. However, that code is obviously very large, so I would suggest that you try to write a small test app or strip down your code to the bare essentials just to verify the actual com port code operation.

    With such unusual error conditions is it conceivable that there is a problem elsewhere in your program (for example, causing a memory corruption that is affecting seemingly unrelated code). For test purposes, be sure to add $ERROR ALL ON to your code...

    I hope this helps!


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

    Comment


    • #3
      RTS/CTS enabled on COM3 by the following statement and through
      the use of a null modem cable:

      OPEN "COM3:9600,N,8,1,DS,CD,IR4" AS #3

      Yes, communication works fine. I'm trying to detect runtime
      errors caused by the CTS signal not being present (unplugged
      cable), which cause a timeout (ERROR 24)
      during the initial open statement and subsquent (ERROR 52)
      PRINT #3 statements.

      I have written a small program to simulate what is happening in
      the larger one and it all error traps work fine.

      I am using $ERROR ALL ON.

      I will prepare an email and send you the code.

      Thanks.

      William Baker

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

      Comment

      Working...
      X