ҡդӶ ʵŧ 纺촨շ٨絴͵ ᷹ФѺ

͵Դҷҧ Inbox Ѻ

˹ѡ
-
VB 6/VB.Net
ASP/ASP.Net
Ѻ¤
¹ҹ Flash Movie
ռͺش  
 RSS Feeds
 ǹŴ RSS Reader ...   Download  RSS Reader

Forum - www.g2gnet.com
Webmaster - www.g2gnet.com
Visitors - Session views
 5 6 1 6 1 3 8

7 ѹҤ ..2549
93 Users On-Line.
Visitors - Page views
 8 9 7 3 8 8 1
1 Ҿѹ ..2551

Google   
g2gnet.com
Ҵѡ:  

RFID õԴͰҹ VB6 Ҥ 2 (ҹ)

Category »  VB 6/VB.Net
: Webmaster 1/12/2552   : 14:47
(ҹ : 34826) 
ѹҧҹҧǴǨԧ¾ͤس س ... ෤շӹ˹ ҧ ֧§͹ѹ· Ҥҧ Ѻѧ١Դ ... 觡ʹյѺԺһշҹ ͡͹ǧҢ ѹ͹ТҧҡѹӺҡ è èн ǹҨҡ ֡ µͧ ѹ駹 ... ٨ҡɳ ... "¶ҵ㨷 ҵš" ... ҤԴɳҹ ͺὧǤԴ ... ͧǡ ¡ҵ͡ ͧ ͧѺ ԤѺ ... ҵ Ф㨹 ... ... ͧ ... ... Ѻ " Ϳ 仹͡ ()"

  • ػͧ RFID Ẻ (աͺ) ... ҵͧ Tag ( ѵùѡ֡) ҧѺա÷ӧҹͧҹ (Reader) ҧʹ俿 (;ѧҹѺ Tag) ͷ Reader öҹŷ Tag ͡ ҡ鹵 Reader ͧ觢Ẻ͹ءѺ ҹҧ Serial Port ( COM Port ͧ) ... ǹͧйӢŷ 任żŵ Ң DataBase ѹ ѹк ...
    º͡ҼѡԪԹ Ԫҡ ... 55555+ ...
  • Ƿҧ㹡¹ (ҡҤ 1)

        ͧ㹡¹ͷӡҹ Basic
      • ͧҡ Tag ID ѹҤҶ١ Ѵ红ѡɳТͧ 1 Ե ͧѹ ѹբش
      • ŷҹ <02>1C006082946A<0D><0A><03> ... ѧࡵդ 16 亵 ( 16 ѡ)
      • ŷҵͧèԧ 1C006082946A Ҵ 12 亵 ͧǨͺ١ͧ (CHECK SUM) ... öҹѡ 2 йѺ价ҧա 11 ( 12 )
      • ѧ㹡¹ Visual Basic 6 ֧Ըա¡ǹ DATA ͡Ҩҡ CR LF ԸաùѺǢͧ INPUT

        駹 駹 ͧ֡Ҩҡػóسҹѹ¹ФѺ С红 Tag ID ѹ͹ѹ

       
    ǹŴ
    ǹŴ Source Code Ѻ MS Visual Basic 6.0 - Service Pack 6
     ǹŴ Visual Basic 6.0 SP5: Run-Time Redistribution Pack
     ǹŴ Microsoft Data Access Object (MDAC) Jet 4.0 Update
     ǹŴ Microsoft Visual Basic Service Pack 6

    RFID õԴͰҹ VB6 Ҥ 1 (ɮ ٻẺ)
    ǤԴŧŢҹ 10 繰ҹ 2 ͧ ... ᷺͡ѹ
    ŧŢҹ 10 Ţҹ 16 Ţҹ 2 Ţҹ 16 (ǤԴͧҧ)

    Projects --> Components


    Tools - ͡ Component ҹ


    Design Time


    Run Time

    Visual Basic 6 Ѻҹ Tag
    ˵ءóӤѭ㹡Ѻ MSComm1_OnComm() ... ͧҡ¡Դ Interrupt (ѴѧС÷ӧҹͧ CPU) ѧö Minimized ͹ System Tray ... բ зӡҹ ӧҹѵѵ
    
    Option Explicit
    
    Private Sub Form_Load()
        
        Me.Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
        
        ' 駤ͷͺ ID ҴŤ 16 ѡ óշժش RFID ͺ
        '  ش Notepad ͹  Copy ҧ㹪ͧ TextBox Ѻ
        txtTagID.Text = "x1234567890ABxxx"
        ' ͧ͡ RFID ö¹÷ӧҹ ... 55555+
        
        ' óժشͺ ͧҧҹФѺ
        ' txtTagID.Text = ""
        
        ' 鹵駤Ҿ췡͹ ҡԴҴ͡仨ҡ
        If Not InitializePort Then End
        ' 
        ' Call InitializePort
        
        '  1000 millisecond = 1 second
        '  Timer е鹡÷ӧҹء 100 millisecond.
        ' 蹡 ء 100 ms. աáе鹡÷ӧҹǹѺ MSComm1_OnComm
        Timer1.Interval = 100
        
        ' ٻẺͧ ListView
        With lvwData
            .ListItems.Clear
            .View = lvwReport
            ' 駤 ListView 㹡ʴ 3 Columns
            .ColumnHeaders.Add 1, , "Item", 800
            .ColumnHeaders.Add 2, , "Tag ID", .Width \ 2 - 630
            .ColumnHeaders.Add 3, , "ѹ -  ҹ", .Width \ 2 - 500
        End With
        
    End Sub
    
    ' ========================================================
    ' 駤Ѻ Port ͹
    Function InitializePort() As Boolean
    ' 繿ѧ () кҧ駡͹ӧҹԧͧǨͺ ...
    ' ͧ췷ҹ ҡ Return ҡѺ False ͧش÷ӧҹ͹
    ' ========================================================
    On Error GoTo ErrHandler
        
        With MSComm1
            ' ͺ͹ Port Դҹ ҡԴԴ Port ͹
            If .PortOpen Then .PortOpen = False
            
            ' 駤 COM Port ͧ
            .CommPort = 1
            
            ' 駤 Baud Rate, Parity, Data Bits, Stop Bits
            .Settings = "9600, N, 8, 1"
            
            ' ʶҹ㹡 Hand Shaking ͧ DTR and RTS (õǨͺ١ͧѺ - )
            '.DTREnable = True
            '.RTSEnable = True
            ' ========================================
            '  Enabled ˵ءó㹡Ѻŷء Character
            .RThreshold = 1
            ' ========================================
            ' Disable  Characters
            '.SThreshold = 0
            
            ' Դ Port
            .PortOpen = True
            InitializePort = True
        
        End With
    
    ExitProc::
        Exit Function
        
    ErrHandler:
        'MsgBox Err.Number & " : " & Err.description
        InitializePort = False
        
    End Function
    
    ' ===========================================================
    ' ˵ءóԴѺҼҹҧ Serial Port - COM ѡɳТͧ Interrupt
    Private Sub MSComm1_OnComm()
    ' ===========================================================
        
        With MSComm1
            ' ͺԴ˵ءóҢͧ (Received)
            Select Case .CommEvent
                Case comEvReceive   '  դҡѺ 2
                    
                    ' ʴ աѺ
                    ' Ӿѧ¡ Interrupt ... оѭ Error ¤ ֧ Timer Ҫա
                    txtTagID.Text = txtTagID.Text & MSComm1.Input
        
            End Select
            
        End With
    
    End Sub
    
    ' =========================================================
    ' ù Timer ШѧТͧҹѹҤѺ
    Private Sub Timer1_Timer()
    ' =========================================================
        ' Ѻ Tag ID ҡ TextBox
        Dim TagID As String
        
        ' СȵѺ ListItem ͧҹ ListView
        Dim LV As ListItem
        
        ' ѡ Error óաҹԴҴ зҹú
        ' Ǣҡ 0  ͧҡѺ 16 ѡ ҹ
        If Len(txtTagID.Text) > 0 And Len(txtTagID.Text) = 16 Then
        
            ' ¡¤Ҩҡ TextBox 㹵á͹ дա
            TagID = txtTagID.Text
                        
            ' 鹹Ӣʴŧ ListView
            ' ԴӴѺ Ѻѡá (Index = 0)
            Set LV = lvwData.ListItems.Add(, , lvwData.ListItems.Count + 1)
            
            ' ٻẺҡ TextBox ===> [1C006082946A[ <===
            ' ԧ ŨٻẺ ASCII ѧ
            ' <02>1C006082946A<0D><0A><03>
            ' <02> 觺͡ش鹢ͧ (STX - Start of Text)
            ' <0D>  13 (ҹ 10)   Enter (Carriage Return)
            ' <0A>  10 (ҹ 10)  Line Feed (鹺÷Ѵ)
            ' <03> 觺͡ششͧ (ETX - End of Text)
            
            ' ԸաùѺҡѡ 2 йѺ仵Ǣͧ TagID (16 ) - 4
            LV.SubItems(1) = Mid$(TagID, 2, Len(TagID) - 4)
            
            ' 纤ѹ  
            LV.SubItems(2) = Now()
            
            ' §ѡ˹ҢŶ١ͧǹ ...
            With MMControl1
                .Command = "Stop"
                .Command = "Close"
                .FileName = App.Path & "\Sound\RightMP3.mp3"
                .PlayEnabled = True
                .Command = "Open"
                .Command = "Play"
            End With
            
            ' ======================== ˹觹 ==========================
            ' ============= öѹ֡ŧҹ  ػóӧҹ =============
            
        End If
        
        ' ҡѺ
        txtTagID.Text = ""
    
    End Sub
    
    ͹跴ͺ觼ҹ Serial Port ФѺ ѧͪشػó㹡ŧѭҳҡ RS-232 RJ-45 觼ҹ UTP к LAN ᷹ФѺ зҧ觢ŨŢ ѺͧҹŢͧ Server ... Ǩҹʹ㹤駵 ...

    Ҥ 3 ... кҹ


    Ҥ 3 ... кҹ


    ʶԵԡ͡ - Logging Stat

    Ҥ 4 ... äǺ-͡ Դ-Դе (Hardware)

    Conclusion:
    ѧФѺͧǢͧ RFID ѹͧҡʹ ҧ ... ͹ͧҧͧ ѹ͡ҨҡʺóѡӤѭ ֧ͧǵҧҡ ʹͼҹ䫵觹ФѺͧ ... ͧѺ ͧҹѹдѺ Assignment ѹö任صҹҡ ػóҤѹҷ (Ңͧ Ẻµź¹ ... 55555+) ... 价ӡúѹ֡šͧ͡ LAB ͢ѧѡ֡Ҵ 55555+ ... ԹôҪ ͡ Шӹǹͧ ... 55555+ ... ͺ˹ҾѺûءкҹŤѺ ... (ⴹ Hardware ... )

  • ͵ - g2gNet Dot Com
    Ţ¹ҳԪ硷͹ԡ 0407314800231
    CopyLeft © 2004 - 2099 g2gNet.Com All rights reserved.
    Email: [email protected] . 08-6862-6560