Results 1 to 4 of 4

Thread: c232 Read Timeout [Revolved]

  1. #1

    Thread Starter
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Resolved c232 Read Timeout [Revolved]

    Hi guys!

    I'm using c232 class to read data from a keypad and I’m having Read TimeOut error, when run this command

    c232.Read(1)

    Do it can be due to a malfunctioning device?

    Do somebody know have any idea on way to solve it?
    Last edited by Zakary; Jun 30th, 2005 at 12:29 PM.
    Using VS 2010 on Fw4.0

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: c232 Read Timeout

    Have you set up your connection settings properly (baud, stop bits, parity etc...)?
    I don't live here any more.

  3. #3

    Thread Starter
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Re: c232 Read Timeout

    Here my code ...

    VB Code:
    1. Imports Microsoft.VisualBasic
    2.  
    3. Public Class Form1
    4.     Inherits System.Windows.Forms.Form
    5.  
    6. #Region " Windows Form Designer generated code "
    7.  
    8.     'Ba Bla bla
    9. #End Region
    10.  
    11.  
    12.     Friend Const PORTNUM As Integer = 1
    13.     Friend Const BAUDRATE As Integer = 9600
    14.     Friend Const DATABIT As Integer = 8
    15.     Friend Const PARITY As clsRs232.DataParity = clsRs232.DataParity.Parity_None
    16.     Friend Const STOPBIT As clsRs232.DataStopBit = clsRs232.DataStopBit.StopBit_1
    17.     Friend ReadOnly RESET_STRING As String = Chr(1) & "01" & Chr(11) & Chr(4) & Chr(13)
    18.  
    19.     Friend InitString As String = Chr(1) & "01" & Chr(11) & Chr(4) & Chr(13)
    20.     Private Const BufferSize As Integer = 12
    21.  
    22.     Private WithEvents c232 As clsRs232
    23.  
    24.  
    25.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    26.         c232 = New clsRs232
    27.        
    28.         txtOutPut.AppendText("Opening port ..." & Environment.NewLine)
    29.         c232.Open(PORTNUM, BAUDRATE, DATABIT, PARITY, STOPBIT, BufferSize)
    30.  
    31.         c232.EnableEvents()
    32.  
    33.         txtOutPut.AppendText("Send init string :" & InitString & Environment.NewLine)
    34.         c232.Write(InitString)
    35.  
    36.         txtOutPut.AppendText("Reseting " & RESET_STRING & Environment.NewLine)
    37.         c232.Write(RESET_STRING)
    38.  
    39.  
    40.     End Sub
    41.  
    42.     Private Sub c232_CommEvent(ByVal source As clsRs232, ByVal Mask As clsRs232.EventMasks) Handles c232.CommEvent
    43.  
    44.         Dim Buffer As String = ""
    45.    
    46.         txtOutPut.AppendText("CommEvent occur" & Environment.NewLine)
    47.  
    48.         If Not c232.IsOpen Then
    49.             txtOutPut.AppendText("c232 is not open" & Environment.NewLine)
    50.             Exit Sub
    51.         End If
    52.         txtOutPut.AppendText("c232 IS open" & Environment.NewLine)
    53.  
    54.         txtOutPut.AppendText("Read buffer ..." & Environment.NewLine)
    55.  
    56.         Try
    57.             'Throw a Time out error
    58.             txtOutPut.AppendText("Read -> '" & [COLOR=Red]c232.Read(BufferSize)[/COLOR].ToString & "'" & Environment.NewLine)   Catch ex As Exception
    59.             MessageBox.Show(ex.Message)
    60.         End Try
    61.  
    62.         txtOutPut.AppendText("Reading stream string ..." & Environment.NewLine)
    63.         Buffer = c232.InputStreamString
    64.  
    65.         txtOutPut.AppendText("Buffer -> '" & Buffer & "'" & Environment.NewLine)
    66.         c232.ClearInputBuffer()
    67.  
    68.  
    69.         txtOutPut.AppendText("End Comm Event" & Environment.NewLine)
    70.     End Sub
    71. End Class
    Using VS 2010 on Fw4.0

  4. #4

    Thread Starter
    Frenzied Member Zakary's Avatar
    Join Date
    Mar 2005
    Location
    Canada, Quebec, Montreal
    Posts
    1,654

    Re: c232 Read Timeout

    Ok .. forget it .. i've found what was the problem ...
    Using VS 2010 on Fw4.0

Posting Permissions

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



Click Here to Expand Forum to Full Width