Home All Groups Group Topic Archive Search About
Author
1 Jun 2005 4:38 AM
weetat
Hi all ,

   I am using VB 6 in window 2000 .
   I am developing a VB6 exe to talk with the 2 RFID reader which
connected in different COM PORT in my same Computer. The other end of
RFID reader is connected to Antenna. The main purpose is to detect the
any rfid items in the antenna.

   From my debug test , the RFID reader hardware is OK .
   However , in test program ,it can  retrieved data from one RFID
reader only . I suspected that some problem in the WithEvent code ,
however i cannot how to solve it.

   Anyone have any ideas or suggestion to solve this problem is much
appreciated ?

Thanks

- weetat

Author
1 Jun 2005 11:19 AM
Steven Burn
Dim iTemp
For iTemp = 1 To 5
    MsgBox "NEVER post binary files unless EXPLICITLY asked to do so"
Next

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Show quoteHide quote
"weetat" <t***@wavex-tech.com> wrote in message news:#L#MXLmZFHA.720@TK2MSFTNGP15.phx.gbl...
> Hi all ,
>
>    I am using VB 6 in window 2000 .
>    I am developing a VB6 exe to talk with the 2 RFID reader which
> connected in different COM PORT in my same Computer. The other end of
> RFID reader is connected to Antenna. The main purpose is to detect the
> any rfid items in the antenna.
>
>    From my debug test , the RFID reader hardware is OK .
>    However , in test program ,it can  retrieved data from one RFID
> reader only . I suspected that some problem in the WithEvent code ,
> however i cannot how to solve it.
>
>    Anyone have any ideas or suggestion to solve this problem is much
> appreciated ?
>
> Thanks
>
> - weetat
>
>


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


Show quoteHide quote
> VERSION 1.0 CLASS
> BEGIN
>   MultiUse = -1  'True
>   Persistable = 0  'NotPersistable
>   DataBindingBehavior = 0  'vbNone
>   DataSourceBehavior  = 0  'vbNone
>   MTSTransactionMode  = 0  'NotAnMTSObject
> END
> Attribute VB_Name = "clsHelper"
> Attribute VB_GlobalNameSpace = False
> Attribute VB_Creatable = True
> Attribute VB_PredeclaredId = False
> Attribute VB_Exposed = False
> Option Explicit
> Private MyTagReader As NLBReader
> Private bWaiting As Boolean
> Private DataRecv(1023) As Byte
>
> Public Event IncomingData(Data() As Byte, DataLen As Byte)
>
> Public Sub InitClass(TagReader1 As NLBReader)
>     Set MyTagReader = TagReader1
> End Sub
>
> Public Sub StartWaitForData()
>     Dim DataLen As Byte
>     Dim tempArray(1023) As Byte
>   
>     bWaiting = True
>     While bWaiting
>     
>         DoEvents
>         'clear array in memory
>         Erase DataRecv
>         'CopyArray tempArray, DataRecv
>         DataLen = MyTagReader.RecvLoopReply(MyTagReader.VBBytePtr(DataRecv(0)))
>         If DataLen > 0 Then
>            RaiseEvent IncomingData(DataRecv(), DataLen)
>         End If
>        
>      Wend
> End Sub
>
>
> Public Sub StopWaitForData()
>     bWaiting = False
> End Sub
>
> Public Function GetWaitState() As Boolean
>     GetWaitState = bWaiting
> End Function
>
>


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


Show quoteHide quote
> VERSION 1.0 CLASS
> BEGIN
>   MultiUse = -1  'True
>   Persistable = 0  'NotPersistable
>   DataBindingBehavior = 0  'vbNone
>   DataSourceBehavior  = 0  'vbNone
>   MTSTransactionMode  = 0  'NotAnMTSObject
> END
> Attribute VB_Name = "clsHelper2"
> Attribute VB_GlobalNameSpace = False
> Attribute VB_Creatable = True
> Attribute VB_PredeclaredId = False
> Attribute VB_Exposed = False
> Option Explicit
> Private MyTagReader As NLBReader
> Private bWaiting As Boolean
> Private DataRecv(1023) As Byte
>
> Public Event IncomingData(Data() As Byte, DataLen As Byte)
>
> Public Sub InitClass(TagReader1 As NLBReader)
>     Set MyTagReader = TagReader1
> End Sub
>
> Public Sub StartWaitForData()
>     Dim DataLen As Byte
>     Dim tempArray(1023) As Byte
>   
>     bWaiting = True
>     While bWaiting
>     
>         DoEvents
>         'clear array in memory
>         Erase DataRecv
>         'CopyArray tempArray, DataRecv
>         DataLen = MyTagReader.RecvLoopReply(MyTagReader.VBBytePtr(DataRecv(0)))
>         If DataLen > 0 Then
>            RaiseEvent IncomingData(DataRecv(), DataLen)
>         End If
>        
>      Wend
> End Sub
>
>
> Public Sub StopWaitForData()
>     bWaiting = False
> End Sub
>
> Public Function GetWaitState() As Boolean
>     GetWaitState = bWaiting
> End Function
>
>
>


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


Show quoteHide quote
> Type=Exe
> Form=NNLBTest.frm
> Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\WINNT\system32\stdole2.tlb#OLE Automation
> Object={4626AAFA-3CB3-4AE0-BD33-59AF56D73CF8}#1.1#0; KINLBReader.ocx
> Class=clsHelper; clsHelper.cls
> Class=clsHelper2; clsHelper2.cls
> IconForm="frmReader"
> Startup="frmReader"
> ExeName32="NLBTest.exe"
> Command32=""
> Name="Project1"
> HelpContextID="0"
> CompatibleMode="0"
> MajorVer=1
> MinorVer=0
> RevisionVer=0
> AutoIncrementVer=0
> ServerSupportFiles=0
> VersionCompanyName="Wavex Technologies"
> CompilationType=0
> OptimizationType=0
> FavorPentiumPro(tm)=0
> CodeViewDebugInfo=0
> NoAliasing=0
> BoundsCheck=0
> OverflowCheck=0
> FlPointCheck=0
> FDIVCheck=0
> UnroundedFP=0
> StartMode=0
> Unattended=0
> Retained=0
> ThreadPerObject=0
> MaxNumberOfThreads=1
>
> [MS Transaction Server]
> AutoRefresh=1
>


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


Show quoteHide quote
> VERSION 5.00
> Object = "{4626AAFA-3CB3-4AE0-BD33-59AF56D73CF8}#1.1#0"; "KINLBReader.ocx"
> Begin VB.Form frmReader
>    Caption         =   "Form1"
>    ClientHeight    =   3195
>    ClientLeft      =   60
>    ClientTop       =   345
>    ClientWidth     =   4680
>    LinkTopic       =   "Form1"
>    ScaleHeight     =   3195
>    ScaleWidth      =   4680
>    StartUpPosition =   3  'Windows Default
>    Begin VB.CommandButton Command2
>       Caption         =   "Open Port 2"
>       Height          =   495
>       Left            =   2520
>       TabIndex        =   1
>       Top             =   1800
>       Width           =   1215
>    End
>    Begin VB.CommandButton Command1
>       Caption         =   "Open Port 1"
>       Height          =   495
>       Left            =   600
>       TabIndex        =   0
>       Top             =   1800
>       Width           =   1215
>    End
>    Begin KINLBReader.NLBReader NLBReader2
>       Left            =   840
>       Top             =   120
>       _ExtentX        =   2646
>       _ExtentY        =   2646
>    End
>    Begin KINLBReader.NLBReader NLBReader1
>       Left            =   840
>       Top             =   120
>       _ExtentX        =   2646
>       _ExtentY        =   2646
>    End
> End
> Attribute VB_Name = "frmReader"
> Attribute VB_GlobalNameSpace = False
> Attribute VB_Creatable = False
> Attribute VB_PredeclaredId = True
> Attribute VB_Exposed = False
>
> Option Explicit
> Private m_gateReader_1 As NLBReader
> Private m_gateReader_2 As NLBReader
> Private Const START_PAGE As Byte = 5
> Private Const PAGE_COUNT As Byte = 2
>
> Private Const NORMAL_MODE As Byte = 0
> Private Const GATE_MODE As Byte = 2
> Private DataRecv(1023) As Byte
> Private DataRecv2(1023) As Byte
> Private WithEvents m_clsHelper1 As clsHelper
> Attribute m_clsHelper1.VB_VarHelpID = -1
> Private WithEvents m_clsHelper2 As clsHelper2
> Attribute m_clsHelper2.VB_VarHelpID = -1
>
>
>
>
> Private Sub Command1_Click()
>
>   Dim l_reader As frmReader
>   Dim l_datalen As Byte
>   Set l_reader = New frmReader
>  
>   Debug.Print "1st Reader"
>   Set m_gateReader_1 = l_reader.NLBReader1
>   Call m_gateReader_1.OpenPort("COM1", "115200")
>   Call m_gateReader_1.CMD_MF_Buzzer(m_gateReader_1.VBBytePtr(DataRecv(0)), 100, 8)
>   Call m_gateReader_1.CMD_CUS_SetOpMode(m_gateReader_1.VBBytePtr(DataRecv(0)), GATE_MODE, START_PAGE, PAGE_COUNT)
>   Set m_clsHelper1 = New clsHelper

>  
>     If Not m_gateReader_1 Is Nothing Then
>        Call m_clsHelper1.InitClass(m_gateReader_1)
>     End If
>
>     If m_clsHelper1.GetWaitState And GATE_MODE > 0 Then
>         Exit Sub
>     ElseIf Not m_clsHelper1.GetWaitState And GATE_MODE = 0 Then
>         Exit Sub
>     End If
>
>     If GATE_MODE > 0 Then
>         m_clsHelper1.StartWaitForData
>     Else
>         m_clsHelper1.StopWaitForData
>
>     End If
>  
> End Sub
>
> Private Sub Command2_Click()
>
>   Dim l_reader As frmReader
>   Dim l_datalen As Byte
>   Set l_reader = New frmReader
>   
>   Debug.Print "2nd Reader"
>   Set m_gateReader_2 = l_reader.NLBReader2
>   Call m_gateReader_2.OpenPort("COM3", "115200")
>   Call m_gateReader_2.CMD_MF_Buzzer(m_gateReader_2.VBBytePtr(DataRecv2(0)), 100, 8)
>   Call m_gateReader_2.CMD_CUS_SetOpMode(m_gateReader_2.VBBytePtr(DataRecv2(0)), GATE_MODE, START_PAGE, PAGE_COUNT)
>   Set m_clsHelper2 = New clsHelper2
>  

>     If Not m_gateReader_2 Is Nothing Then
>        Call m_clsHelper2.InitClass(m_gateReader_2)
>     End If
>
>     If m_clsHelper2.GetWaitState And GATE_MODE > 0 Then
>         Exit Sub
>     ElseIf Not m_clsHelper2.GetWaitState And GATE_MODE = 0 Then
>         Exit Sub
>     End If
>
>     If GATE_MODE > 0 Then
>         m_clsHelper2.StartWaitForData
>     Else
>         m_clsHelper2.StopWaitForData
>
>     End If
>
> End Sub
>
> Private Sub Form_Unload(Cancel As Integer)
>     
>   If Not m_gateReader_1 Is Nothing Then
>      m_gateReader_1.ClosePort
>   End If
>  
>   If Not m_gateReader_2 Is Nothing Then
>      m_gateReader_2.ClosePort
>   End If
>     
>   If Not m_gateReader_1 Is Nothing Then
>     Call m_gateReader_1.CMD_CUS_SetOpMode(m_gateReader_1.VBBytePtr(DataRecv(0)), NORMAL_MODE, START_PAGE, PAGE_COUNT)
>   End If
>  
>   If Not m_gateReader_2 Is Nothing Then
>     Call m_gateReader_2.CMD_CUS_SetOpMode(m_gateReader_2.VBBytePtr(DataRecv(0)), NORMAL_MODE, START_PAGE, PAGE_COUNT)
>   End If
>     
> End Sub
>
>
> Private Sub m_clsHelper1_IncomingData(Data() As Byte, DataLen As Byte)
>  Debug.Print "here 1"
> End Sub
>
> Private Sub m_clsHelper2_IncomingData(Data() As Byte, DataLen As Byte)
>   Debug.Print "here 2"
> End Sub
>