VERSION 5.00
Object = "{D27CDB6B-AE6D-11CF-96B8-444553540000}#1.0#0"; "Flash9d.ocx"
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form frmMain 
   BackColor       =   &H00FFC0C0&
   Caption         =   "WIND CONDITION SYSTEM"
   ClientHeight    =   10695
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   13095
   Icon            =   "frmMain.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   10695
   ScaleWidth      =   13095
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox Text1 
      BackColor       =   &H00FFC0C0&
      DragMode        =   1  'Automatic
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   161
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   2
      Left            =   240
      TabIndex        =   61
      Top             =   3960
      Width           =   10935
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00FFC0C0&
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   161
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   1
      Left            =   240
      TabIndex        =   60
      Top             =   4440
      Width           =   12735
   End
   Begin VB.Timer Timer2 
      Enabled         =   0   'False
      Interval        =   500
      Left            =   240
      Top             =   600
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00FFC0C0&
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   161
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   0
      Left            =   240
      TabIndex        =   59
      Top             =   3480
      Width           =   3615
   End
   Begin VB.Frame Frame5 
      Caption         =   "Marine Weather Systems"
      DragMode        =   1  'Automatic
      Height          =   4935
      Left            =   8400
      TabIndex        =   23
      Top             =   5040
      Width           =   4335
      Begin VB.Label Label5 
         BackColor       =   &H000000FF&
         Height          =   4815
         Index           =   4
         Left            =   3840
         TabIndex        =   24
         Top             =   4680
         Width           =   255
      End
      Begin VB.Label Label5 
         BackColor       =   &H000000FF&
         Height          =   4815
         Index           =   3
         Left            =   2880
         TabIndex        =   25
         Top             =   4680
         Width           =   255
      End
      Begin VB.Label Label5 
         BackColor       =   &H000000FF&
         Height          =   4815
         Index           =   1
         Left            =   720
         TabIndex        =   27
         Top             =   4680
         Width           =   255
      End
      Begin VB.Label Label5 
         BackColor       =   &H000000FF&
         Height          =   4815
         Index           =   2
         Left            =   1800
         TabIndex        =   26
         Top             =   4680
         Width           =   255
      End
      Begin VB.Label Label4 
         BackColor       =   &H00000000&
         Caption         =   "  km/h           mph           knots         Bfr                "
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   161
            Weight          =   700
            Underline       =   -1  'True
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000E&
         Height          =   255
         Index           =   1
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   58
         Top             =   0
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00000000&
         Caption         =   "- - 213 - - - - - - - - -  134 - - - - - - - - - 116 - - - - - - - - -12 - - - - - - - -"
         ForeColor       =   &H8000000E&
         Height          =   255
         Index           =   3
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   57
         Top             =   240
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00000000&
         Caption         =   " - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - -"
         ForeColor       =   &H8000000E&
         Height          =   135
         Index           =   2
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   56
         Top             =   480
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00400000&
         Caption         =   " - 189.3 - - - - - - - -  117.6 - - - - - - - -102.2 - - - - - - - 12  - - - - - - - -"
         ForeColor       =   &H8000000E&
         Height          =   255
         Index           =   4
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   55
         Top             =   720
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00800000&
         Caption         =   " - 165.7 - - - - - - - -   103  - - - - - - - -  89.5   - - - - - - -12 - - - - - - - -"
         ForeColor       =   &H8000000E&
         Height          =   255
         Index           =   6
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   54
         Top             =   1200
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00400000&
         Caption         =   " "
         ForeColor       =   &H8000000E&
         Height          =   135
         Index           =   0
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   53
         Top             =   600
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00C00000&
         Caption         =   " - -142 - - - - - - - - -   88.2 - - - - - - - - -76.7 - - - - - - -  12 - - - - - - - - -"
         ForeColor       =   &H8000000E&
         Height          =   255
         Index           =   5
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   52
         Top             =   1680
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FF0000&
         Caption         =   " - -118..3 - - - - - - - - 73.5 - - - - - - - - -63.9 - - - - - - - -12 - - - - - - - -"
         ForeColor       =   &H8000000E&
         Height          =   255
         Index           =   7
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   51
         Top             =   2160
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FF8080&
         Caption         =   " - -94.7 - - - - - - - - - -58.8 - - - - - - - - -51.1 - - - - - - - 10.6 - - - - - - -"
         ForeColor       =   &H00000000&
         Height          =   255
         Index           =   8
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   50
         Top             =   2640
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFC0C0&
         Caption         =   " - - 71  - - - - - - - - -   44.1   - - - - - - -  38.3   - - - - - -  8.7  - - - - - - - -"
         ForeColor       =   &H00000000&
         Height          =   255
         Index           =   9
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   49
         Top             =   3120
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFFFC0&
         Caption         =   " - - 47.3  - - - - - - - -  29.4  - - - - - - -   25.5   - - - - - -  6.8  - - - - - - - -"
         ForeColor       =   &H00000000&
         Height          =   255
         Index           =   10
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   48
         Top             =   3600
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00C0FFFF&
         Caption         =   " - - 23.7  - - - - - - - -  14.7  - - - - - - -   12.8   - - - - - -  4.5  - - - - - - - -"
         ForeColor       =   &H00000000&
         Height          =   255
         Index           =   11
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   47
         Top             =   4080
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFFFFF&
         Caption         =   " - -   0  - - - - - - - - - -   0  - - - - - - - - - -   0  - - - - - - - -   0  - - - - - - - -"
         ForeColor       =   &H00000000&
         Height          =   255
         Index           =   12
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   46
         Top             =   4560
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00400000&
         Caption         =   " - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - -"
         ForeColor       =   &H8000000E&
         Height          =   135
         Index           =   13
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   45
         Top             =   960
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00800000&
         Caption         =   " - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - -"
         ForeColor       =   &H8000000E&
         Height          =   135
         Index           =   14
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   44
         Top             =   1440
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00C00000&
         Caption         =   " - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - -"
         ForeColor       =   &H8000000E&
         Height          =   135
         Index           =   15
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   43
         Top             =   1920
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FF0000&
         Caption         =   " - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - -"
         ForeColor       =   &H8000000E&
         Height          =   135
         Index           =   16
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   42
         Top             =   2400
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FF8080&
         Caption         =   " - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - -"
         ForeColor       =   &H00000000&
         Height          =   135
         Index           =   17
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   41
         Top             =   2880
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFC0C0&
         Caption         =   " - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - -"
         ForeColor       =   &H00000000&
         Height          =   135
         Index           =   18
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   40
         Top             =   3360
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFFFC0&
         Caption         =   " - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - -"
         ForeColor       =   &H00000000&
         Height          =   135
         Index           =   19
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   39
         Top             =   3840
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00C0FFFF&
         Caption         =   " - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - -"
         ForeColor       =   &H00000000&
         Height          =   135
         Index           =   20
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   38
         Top             =   4320
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFFFFF&
         ForeColor       =   &H00000000&
         Height          =   15
         Index           =   29
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   37
         Top             =   4800
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00400000&
         ForeColor       =   &H8000000E&
         Height          =   135
         Index           =   21
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   36
         Top             =   1080
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00800000&
         ForeColor       =   &H8000000E&
         Height          =   135
         Index           =   22
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   35
         Top             =   1560
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00C00000&
         ForeColor       =   &H8000000E&
         Height          =   135
         Index           =   23
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   34
         Top             =   2040
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00400000&
         ForeColor       =   &H8000000E&
         Height          =   135
         Index           =   24
         Left            =   360
         OLEDropMode     =   1  'Manual
         TabIndex        =   33
         Top             =   -480
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FF0000&
         ForeColor       =   &H8000000E&
         Height          =   135
         Index           =   25
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   32
         Top             =   2520
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FF8080&
         ForeColor       =   &H00000000&
         Height          =   135
         Index           =   26
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   31
         Top             =   3000
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFC0C0&
         ForeColor       =   &H00000000&
         Height          =   135
         Index           =   27
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   30
         Top             =   3480
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFFFC0&
         ForeColor       =   &H00000000&
         Height          =   135
         Index           =   28
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   29
         Top             =   3960
         Width           =   4455
      End
      Begin VB.Label Label4 
         BackColor       =   &H00FFFFFF&
         ForeColor       =   &H00000000&
         Height          =   135
         Index           =   30
         Left            =   0
         OLEDropMode     =   1  'Manual
         TabIndex        =   28
         Top             =   4440
         Width           =   4455
      End
   End
   Begin ShockwaveFlashObjectsCtl.ShockwaveFlash ShockwaveFlash2 
      Height          =   1455
      Left            =   3960
      TabIndex        =   22
      Top             =   1920
      Width           =   5055
      _cx             =   8916
      _cy             =   2566
      FlashVars       =   ""
      Movie           =   ""
      Src             =   ""
      WMode           =   "Window"
      Play            =   -1  'True
      Loop            =   -1  'True
      Quality         =   "High"
      SAlign          =   ""
      Menu            =   -1  'True
      Base            =   ""
      AllowScriptAccess=   ""
      Scale           =   "ShowAll"
      DeviceFont      =   0   'False
      EmbedMovie      =   0   'False
      BGColor         =   ""
      SWRemote        =   ""
      MovieData       =   ""
      SeamlessTabbing =   -1  'True
      Profile         =   0   'False
      ProfileAddress  =   ""
      ProfilePort     =   0
      AllowNetworking =   "all"
      AllowFullScreen =   "false"
   End
   Begin VB.Frame Frame4 
      BackColor       =   &H00FFC0C0&
      ForeColor       =   &H00000080&
      Height          =   855
      Left            =   5040
      TabIndex        =   19
      Top             =   8880
      Width           =   3255
      Begin VB.Label Label1 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFC0C0&
         Caption         =   "50"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Index           =   13
         Left            =   120
         TabIndex        =   21
         Top             =   120
         Width           =   1335
      End
      Begin VB.Label Label1 
         BackColor       =   &H00FFC0C0&
         Caption         =   "knots"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Index           =   12
         Left            =   1560
         TabIndex        =   20
         Top             =   120
         Width           =   1575
      End
   End
   Begin VB.Frame Frame3 
      BackColor       =   &H00FFC0C0&
      ForeColor       =   &H00000080&
      Height          =   855
      Left            =   5040
      TabIndex        =   16
      Top             =   6240
      Width           =   3255
      Begin VB.Label Label1 
         BackColor       =   &H00FFC0C0&
         Caption         =   "km/h"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Index           =   5
         Left            =   1680
         TabIndex        =   18
         Top             =   120
         Width           =   1455
      End
      Begin VB.Label Label1 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFC0C0&
         Caption         =   "50"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Index           =   10
         Left            =   120
         TabIndex        =   17
         Top             =   120
         Width           =   1455
      End
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00FFC0C0&
      ForeColor       =   &H00000080&
      Height          =   855
      Left            =   5040
      TabIndex        =   13
      Top             =   4920
      Width           =   3255
      Begin VB.Label Label1 
         BackColor       =   &H00FFC0C0&
         Caption         =   "mph"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Index           =   11
         Left            =   1800
         TabIndex        =   15
         Top             =   120
         Width           =   1215
      End
      Begin VB.Label Label1 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFC0C0&
         Caption         =   "50"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Index           =   8
         Left            =   120
         TabIndex        =   14
         Top             =   120
         Width           =   1455
      End
   End
   Begin VB.CommandButton Command4 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      Caption         =   "Select Serial Port"
      Height          =   315
      Left            =   4920
      MaskColor       =   &H00FFFFFF&
      Style           =   1  'Graphical
      TabIndex        =   12
      Top             =   10440
      Width           =   3135
   End
   Begin VB.CommandButton Command3 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      Caption         =   "Start Example Mode"
      Height          =   555
      Left            =   8040
      MaskColor       =   &H00FFFFFF&
      Style           =   1  'Graphical
      TabIndex        =   11
      Top             =   10200
      Width           =   3855
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Test Bytes"
      Height          =   615
      Left            =   11280
      TabIndex        =   10
      Top             =   1680
      Visible         =   0   'False
      Width           =   1575
   End
   Begin VB.Timer SerialPortTimer 
      Enabled         =   0   'False
      Interval        =   10500
      Left            =   12360
      Top             =   360
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Start Listening Serial Port..."
      Height          =   615
      Left            =   1200
      MaskColor       =   &H00FFFFFF&
      Style           =   1  'Graphical
      TabIndex        =   9
      Top             =   10200
      Width           =   3735
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFC0C0&
      ForeColor       =   &H00000080&
      Height          =   855
      Index           =   3
      Left            =   5040
      TabIndex        =   6
      Top             =   7560
      Width           =   3255
      Begin VB.Label Label1 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFC0C0&
         Caption         =   "50"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Index           =   15
         Left            =   240
         TabIndex        =   8
         Top             =   120
         Width           =   1215
      End
      Begin VB.Label Label1 
         BackColor       =   &H00FFC0C0&
         Caption         =   "Bfr"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Index           =   14
         Left            =   1920
         TabIndex        =   7
         Top             =   120
         Width           =   975
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFC0C0&
      ForeColor       =   &H00000080&
      Height          =   1455
      Index           =   2
      Left            =   600
      TabIndex        =   1
      Top             =   8400
      Width           =   3135
      Begin VB.Label Label1 
         BackColor       =   &H00FFC0C0&
         Caption         =   "NE"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Index           =   1
         Left            =   1920
         TabIndex        =   5
         Top             =   720
         Width           =   1095
      End
      Begin VB.Label Label1 
         BackColor       =   &H00FFC0C0&
         Caption         =   "0"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   9
         Left            =   1560
         TabIndex        =   4
         Top             =   720
         Width           =   255
      End
      Begin VB.Label Label1 
         Alignment       =   1  'Right Justify
         BackColor       =   &H00FFC0C0&
         Caption         =   "89"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Index           =   0
         Left            =   480
         TabIndex        =   3
         Top             =   720
         Width           =   975
      End
      Begin VB.Label Label2 
         BackColor       =   &H00FFC0C0&
         Caption         =   "Angle"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   21.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000C0&
         Height          =   495
         Index           =   3
         Left            =   1200
         TabIndex        =   2
         Top             =   240
         Width           =   1215
      End
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   250
      Left            =   11760
      Top             =   360
   End
   Begin ShockwaveFlashObjectsCtl.ShockwaveFlash ShockwaveFlash1 
      Height          =   3135
      Left            =   360
      TabIndex        =   0
      Top             =   5040
      Width           =   3735
      _cx             =   6588
      _cy             =   5530
      FlashVars       =   ""
      Movie           =   ""
      Src             =   ""
      WMode           =   "Window"
      Play            =   -1  'True
      Loop            =   -1  'True
      Quality         =   "High"
      SAlign          =   ""
      Menu            =   -1  'True
      Base            =   ""
      AllowScriptAccess=   ""
      Scale           =   "ShowAll"
      DeviceFont      =   0   'False
      EmbedMovie      =   0   'False
      BGColor         =   ""
      SWRemote        =   ""
      MovieData       =   ""
      SeamlessTabbing =   -1  'True
      Profile         =   0   'False
      ProfileAddress  =   ""
      ProfilePort     =   0
      AllowNetworking =   "all"
      AllowFullScreen =   "false"
   End
   Begin MSCommLib.MSComm comSerial1 
      Left            =   11640
      Top             =   960
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
   End
   Begin VB.Image Image2 
      Height          =   735
      Left            =   3960
      Picture         =   "frmMain.frx":27A2
      Stretch         =   -1  'True
      Top             =   9000
      Visible         =   0   'False
      Width           =   975
   End
   Begin VB.Image Image1 
      Height          =   1470
      Left            =   1800
      Picture         =   "frmMain.frx":58E0
      Top             =   240
      Width           =   9390
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim Angle As Double
Dim Wind As Double
Private ListeningMode As Boolean
Private ValuesChanged As Boolean
'Private GraphDateSelected As String
Private DummyMode As Boolean
Private bFormLoaded As Boolean

    

    


Private Sub Command2_Click()
'''Manipulate Data..
''Dim tmpString  As String, tmpSerial1 As String, tmpSerial2 As String
''Dim i As Integer
''Dim DataReceived As Boolean
''Dim tmpDate As String
''Dim tmpStart As Integer
''Dim tmpEnd As Integer
''Dim tmpVal As String
''Dim tmpValues
''Dim tmpPos As Integer
''
''
''    tmpSerial2 = Chr(2) & "Q,229,002.74,M,00," & Chr(3) & "Remaining Data"
''
''    'Get Real Data..
''    tmpStart = InStr(1, tmpSerial2, Chr(2))
''    tmpEnd = InStr(1, tmpSerial2, Chr(3))
''    tmpString = Mid(tmpSerial2, tmpStart + 1, tmpEnd - tmpStart - 1)
''    tmpSerial2 = Right(tmpSerial2, Len(tmpSerial2) - tmpEnd)
''
''    'Manipulate Data..
''
''    tmpValues = Split(tmpString, ",")
''
''    tmpVal = tmpValues(1)
''    If IsNumeric(tmpVal) Then
''        Angle = CDbl(tmpVal)
''    End If
''
''    tmpVal = tmpValues(2)
''
''    If IsNumeric(tmpVal) Then
''        Wind = CDbl(Replace(tmpVal, ".", ","))
''    End If
''
''    Call SetValues
    
End Sub

Private Sub Command4_Click()
    Form1.Show 1
End Sub
Private Sub Form_Initialize()
    Call InitializeINIFile
    
    DummyMode = CBool(ReadINI("PARAMETRES", "DummyMode"))

'    If DummyMode Then
    'Set Initial Values
    Angle = CDbl(ReadINI("VALUES", "Angle"))
    Wind = CDbl(ReadINI("VALUES", "Wind"))
        
    comSerial1.CommPort = CInt(ReadINI("PARAMETRES", "SerialPort1-COM"))
    
    'Set Dummy mode

'    End If

End Sub

Private Sub InitializeINIFile()
    Call CreateINIFile("Application.ini")
    Call CreateINIApp("PARAMETRES")
    Call CreateINIKey("PARAMETRES", "SerialPort1-COM", "1")
    Call CreateINIKey("PARAMETRES", "DummyMode", "True")
    
    Call CreateINIApp("VALUES")
    Call CreateINIKey("VALUES", "Angle", "1")
    Call CreateINIKey("VALUES", "Wind", "1")
    
End Sub

Private Sub Form_Load()
    bFormLoaded = True
    Call ShockwaveFlash1.LoadMovie(0, CurDir + "\compass2.swf")
    Call ShockwaveFlash2.LoadMovie(0, CurDir + "\clock\clock106.swf")
    
            ' clock47 , clock104 , clock106 , clock150
    
    If DummyMode Then
        Timer1.Enabled = True
        Command3.Caption = "Stop Example Mode"
    End If
    Call SetValues
End Sub


Private Sub Form_Unload(Cancel As Integer)

Call WriteINI("PARAMETRES", "SerialPort1-COM", comSerial1.CommPort)
Call WriteINI("PARAMETRES", "DummyMode", CStr(DummyMode))

Call WriteINI("VALUES", "Angle", CStr(Angle))
Call WriteINI("VALUES", "Wind", CStr(Wind))

bFormLoaded = False

Unload Me
Set Form1 = Nothing

End Sub



Private Sub Picture1_Click()

End Sub

Private Sub Timer1_Timer()
    If Not (DummyMode) Then
        Timer1.Enabled = False
        Exit Sub
    End If
    Call ProduceDummyValues
    Call SetValues
End Sub

Private Sub SetValues()
    Call SetAngle
    Call SetWind
    
    End Sub

Private Sub ProduceDummyValues()
    Angle = RandomChange(Angle, 20, 0.5)
    Wind = RandomChange(Wind, 2, 0.55)
        If Wind > 60 Then
            Wind = 60
        End If
    
    End Sub


Private Function RandomChange(value As Double, Change As Double, Frequency As Single) As Double
    If Rnd() > Frequency Then
        If Rnd() > 0.5 Then
            value = value + Change * Rnd()
        Else
            value = value - Change * Rnd()
        End If
    End If
    
    RandomChange = value
End Function
Private Sub Command3_Click()
    DummyMode = Not (DummyMode)
    If DummyMode Then
        Timer1.Enabled = True
        Command3.Caption = "Stop Example Mode"
            If ListeningMode = "True" Then
                Call EndListeningMode
            End If
        Else
        Command3.Caption = "Start Example Mode"
        
    End If
End Sub


Private Sub SetAngle()
Dim Direction As String
    If Angle < 0 Then Angle = Angle + 360
    If Angle > 359 Then Angle = Angle - 360
    
    Call ShockwaveFlash1.SetVariable("Angle", Format(Angle, "0") + 180)
    Label1(0).Caption = Format(Angle, "0")
    
    If Angle > 0 And Angle < 23 Then Direction = "N"
    If Angle > 24 And Angle < 68 Then Direction = "NE"
    If Angle > 69 And Angle < 113 Then Direction = "E"
    If Angle > 114 And Angle < 158 Then Direction = "SE"
    If Angle > 159 And Angle < 203 Then Direction = "S"
    If Angle > 204 And Angle < 248 Then Direction = "SW"
    If Angle > 249 And Angle < 293 Then Direction = "W"
    If Angle > 294 And Angle < 338 Then Direction = "NW"
    If Angle > 339 And Angle < 360 Then Direction = "N"
    
    Label1(1).Caption = Direction
End Sub

Private Sub SetWind()
Dim tempDbl As Double
    
    If Wind < 0 Then Wind = 0
    
    'Km/h
    tempDbl = CDbl(Wind * 3.6)
    Label1(10).Caption = Format(tempDbl, "0.0")
    
    tempDbl = 4680 - CDbl(tempDbl) * 20.28169
    Label5(1).Top = tempDbl
    Label5(2).Top = tempDbl
    Label5(3).Top = tempDbl
    Label5(4).Top = tempDbl
    
    
    'mph
    tempDbl = CDbl(Label1(10).Caption) * 0.621371
    Label1(8).Caption = Format(tempDbl, "##0.0")
    
    
    'Knots
    tempDbl = CDbl(Label1(10).Caption) * 0.539957
    Label1(13).Caption = Format(tempDbl, "##0.0")
    
    
    'Beaufort
    tempDbl = ConvertMph2Beaufort(Label1(10).Caption)
    Label1(15).Caption = tempDbl
    
    
    
    
    
    
    
        If tempDbl >= 0 And tempDbl <= 0.7 Then Text1(0).Text = "DESCRIPTION: Calm"
        If tempDbl >= 0.7 And tempDbl <= 1.9 Then Text1(0).Text = "DESCRIPTION: Light air"
        If tempDbl >= 1.9 And tempDbl <= 3 Then Text1(0).Text = "DESCRIPTION: Light breeze"
        If tempDbl >= 3 And tempDbl <= 4 Then Text1(0).Text = "DESCRIPTION: Gentle breeze"
        If tempDbl >= 4 And tempDbl <= 5 Then Text1(0).Text = "DESCRIPTION: Moderate breeze"
        If tempDbl >= 5 And tempDbl <= 6 Then Text1(0).Text = "DESCRIPTION: Fresh breeze"
        If tempDbl >= 6 And tempDbl <= 7 Then Text1(0).Text = "DESCRIPTION: Strong breeze"
        If tempDbl >= 7 And tempDbl <= 8 Then Text1(0).Text = "DESCRIPTION: Near gale"
        If tempDbl >= 8 And tempDbl <= 9 Then Text1(0).Text = "DESCRIPTION: Gale"
        If tempDbl >= 9 And tempDbl <= 10 Then Text1(0).Text = "DESCRIPTION: Strong gale"
        If tempDbl >= 10 And tempDbl <= 11 Then Text1(0).Text = "DESCRIPTION: Storm"
        If tempDbl >= 11 And tempDbl <= 11.9 Then Text1(0).Text = "DESCRIPTION: Violent storm"
        If tempDbl >= 11.9 And tempDbl <= 12 Then Text1(0).Text = "DESCRIPTION: Hurricane"
    
    
    
    
    
        If tempDbl >= 0 And tempDbl <= 0.7 Then Text1(1).Text = "SEA CONDITION: Flat"
        If tempDbl >= 0.7 And tempDbl <= 1.9 Then Text1(1).Text = "SEA CONDITION: Ripples without crests"
        If tempDbl >= 1.9 And tempDbl <= 3 Then Text1(1).Text = "SEA CONDITION: Small wavelets. Crests of glassy appearance, not breaking"
        If tempDbl >= 3 And tempDbl <= 4 Then Text1(1).Text = "SEA CONDITION: Large wavelets. Crests begin to break; scattered whitecaps"
        If tempDbl >= 4 And tempDbl <= 5 Then Text1(1).Text = "SEA CONDITION: Small waves"
        If tempDbl >= 5 And tempDbl <= 6 Then Text1(1).Text = "SEA CONDITION: Moderate (1.2 m) longer waves. Some foam and spray"
        If tempDbl >= 6 And tempDbl <= 7 Then Text1(1).Text = "SEA CONDITION: Large waves with foam crests and some spray"
        If tempDbl >= 7 And tempDbl <= 8 Then Text1(1).Text = "SEA CONDITION: Sea heaps up and foam begins to streak"
        If tempDbl >= 8 And tempDbl <= 9 Then Text1(1).Text = "SEA CONDITION: Moderately high waves with breaking crests forming spindrift. Streaks of foam"
        If tempDbl >= 9 And tempDbl <= 10 Then Text1(1).Text = "SEA CONDITION: High waves (2.75 m) with dense foam. Wave crests start to roll over. Considerable spray"
        If tempDbl >= 10 And tempDbl <= 11 Then Text1(1).Text = "SEA CONDITION: Very high waves. The sea surface is white and there is considerable tumbling. Visibility is reduced"
        If tempDbl >= 11 And tempDbl <= 11.9 Then Text1(1).Text = "SEA CONDITION: Exceptionally high waves"
        If tempDbl >= 11.9 And tempDbl <= 12 Then Text1(1).Text = "SEA CONDITION: Huge waves. Air filled with foam and spray. Sea completely white with driving spray. Visibility very greatly reduced"
   
    
    
        
        If tempDbl >= 0 And tempDbl <= 0.7 Then Text1(2).Text = "LAND CONDITION: Calm. Smoke rises vertically"
        If tempDbl > 0.7 And tempDbl <= 1.9 Then Text1(2).Text = "LAND CONDITION: Wind motion visible in smoke"
        If tempDbl >= 1.9 And tempDbl <= 3 Then Text1(2).Text = "LAND CONDITION: Wind felt on exposed skin. Leaves rustle"
        If tempDbl >= 3 And tempDbl <= 4 Then Text1(2).Text = "LAND CONDITION: Leaves and smaller twigs in constant motion"
        If tempDbl >= 4 And tempDbl <= 5 Then Text1(2).Text = "LAND CONDITION: Dust and loose paper raised. Small branches begin to move"
        If tempDbl >= 5 And tempDbl <= 6 Then Text1(2).Text = "LAND CONDITION: Smaller trees sway"
        If tempDbl >= 6 And tempDbl <= 7 Then Text1(2).Text = "LAND CONDITION: Large branches in motion. Whistling heard in overhead wires. Umbrella use becomes difficult"
        If tempDbl >= 7 And tempDbl <= 8 Then Text1(2).Text = "LAND CONDITION: Whole trees in motion. Effort needed to walk against the wind"
        If tempDbl >= 8 And tempDbl <= 9 Then Text1(2).Text = "LAND CONDITION: Twigs broken from trees. Cars veer on road"
        If tempDbl >= 9 And tempDbl <= 10 Then Text1(2).Text = "LAND CONDITION: Light structure damage"
        If tempDbl >= 10 And tempDbl <= 11 Then Text1(2).Text = "LAND CONDITION: Trees uprooted. Considerable structural damage"
        If tempDbl >= 11 And tempDbl <= 11.9 Then Text1(2).Text = "LAND CONDITION: Widespread structural damage"
        If tempDbl >= 11.9 And tempDbl <= 12 Then Text1(2).Text = "LAND CONDITION: Massive and widespread damage to structures"
   
    
    
        
        
        
        
End Sub

Private Function ConvertMph2Beaufort(value As Double)
Dim tmpDbl As Double
    
    
    If value >= 0 And value <= 0.1 Then tmpDbl = 0.1
    If value >= 0.1 And value <= 0.2 Then tmpDbl = 0.2
    If value >= 0.2 And value <= 0.3 Then tmpDbl = 0.3
    If value >= 0.3 And value <= 0.4 Then tmpDbl = 0.4
    If value >= 0.4 And value <= 0.5 Then tmpDbl = 0.5
    If value >= 0.5 And value <= 0.6 Then tmpDbl = 0.6
    If value >= 0.6 And value <= 0.7 Then tmpDbl = 0.7
    If value >= 0.7 And value <= 0.8 Then tmpDbl = 0.8
    If value >= 0.8 And value <= 0.9 Then tmpDbl = 0.9
    If value >= 0.9 And value <= 1 Then tmpDbl = 1
    If value >= 1 And value <= 1.5 Then tmpDbl = 1.1
    If value >= 1.5 And value <= 2 Then tmpDbl = 1.2
    If value >= 2 And value <= 2.5 Then tmpDbl = 1.3
    If value >= 2.5 And value <= 3 Then tmpDbl = 1.4
    If value >= 3 And value <= 3.5 Then tmpDbl = 1.5
    If value >= 3.5 And value <= 4 Then tmpDbl = 1.6
    If value >= 4 And value <= 4.5 Then tmpDbl = 1.7
    If value >= 4.5 And value <= 5 Then tmpDbl = 1.8
    If value >= 5 And value <= 5.5 Then tmpDbl = 1.9
    If value >= 5.5 And value <= 6 Then tmpDbl = 2
    If value >= 6 And value <= 6.5 Then tmpDbl = 2.1
    If value >= 6.5 And value <= 7 Then tmpDbl = 2.2
    If value >= 7 And value <= 7.5 Then tmpDbl = 2.3
    If value >= 7.5 And value <= 8 Then tmpDbl = 2.4
    If value >= 8 And value <= 8.5 Then tmpDbl = 2.5
    If value >= 8.5 And value <= 9 Then tmpDbl = 2.6
    If value >= 9 And value <= 9.5 Then tmpDbl = 2.7
    If value >= 9.5 And value <= 10 Then tmpDbl = 2.8
    If value >= 10 And value <= 10.5 Then tmpDbl = 2.9
    If value >= 10.5 And value <= 11 Then tmpDbl = 3
    If value >= 11 And value <= 11.8 Then tmpDbl = 3.1
    If value >= 11.8 And value <= 12.6 Then tmpDbl = 3.2
    If value >= 12.6 And value <= 13.4 Then tmpDbl = 3.3
    If value >= 13.4 And value <= 14.2 Then tmpDbl = 3.4
    If value >= 14.2 And value <= 15 Then tmpDbl = 3.5
    If value >= 15 And value <= 15.8 Then tmpDbl = 3.6
    If value >= 15.8 And value <= 16.6 Then tmpDbl = 3.7
    If value >= 16.6 And value <= 17.4 Then tmpDbl = 3.8
    If value >= 17.4 And value <= 18.2 Then tmpDbl = 3.9
    If value >= 18.2 And value <= 19 Then tmpDbl = 4
    If value >= 19 And value <= 20 Then tmpDbl = 4.1
    If value >= 20 And value <= 21 Then tmpDbl = 4.2
    If value >= 21 And value <= 22 Then tmpDbl = 4.3
    If value >= 22 And value <= 23 Then tmpDbl = 4.4
    If value >= 23 And value <= 24 Then tmpDbl = 4.5
    If value >= 24 And value <= 25 Then tmpDbl = 4.6
    If value >= 25 And value <= 26 Then tmpDbl = 4.7
    If value >= 26 And value <= 27 Then tmpDbl = 4.8
    If value >= 27 And value <= 28 Then tmpDbl = 4.9
    If value >= 28 And value <= 29 Then tmpDbl = 5
    If value >= 29 And value <= 30 Then tmpDbl = 5.1
    If value >= 30 And value <= 31 Then tmpDbl = 5.2
    If value >= 31 And value <= 32 Then tmpDbl = 5.3
    If value >= 32 And value <= 33 Then tmpDbl = 5.4
    If value >= 33 And value <= 34 Then tmpDbl = 5.5
    If value >= 34 And value <= 35 Then tmpDbl = 5.6
    If value >= 35 And value <= 36 Then tmpDbl = 5.7
    If value >= 37 And value <= 37 Then tmpDbl = 5.8
    If value >= 37 And value <= 38 Then tmpDbl = 5.9
    If value >= 38 And value <= 39 Then tmpDbl = 6
    If value >= 39 And value <= 40.1 Then tmpDbl = 6.1
    If value >= 40.1 And value <= 41.2 Then tmpDbl = 6.2
    If value >= 41.2 And value <= 42.3 Then tmpDbl = 6.3
    If value >= 42.3 And value <= 43.4 Then tmpDbl = 6.4
    If value >= 43.4 And value <= 44.5 Then tmpDbl = 6.5
    If value >= 44.5 And value <= 45.6 Then tmpDbl = 6.6
    If value >= 45.6 And value <= 46.7 Then tmpDbl = 6.7
    If value >= 46.7 And value <= 47.8 Then tmpDbl = 6.8
    If value >= 47.8 And value <= 48.9 Then tmpDbl = 6.9
    If value >= 48.9 And value <= 50 Then tmpDbl = 7
    If value >= 50 And value <= 51.2 Then tmpDbl = 7.1
    If value >= 51.2 And value <= 52.4 Then tmpDbl = 7.2
    If value >= 52.4 And value <= 53.6 Then tmpDbl = 7.3
    If value >= 53.6 And value <= 54.8 Then tmpDbl = 7.4
    If value >= 54.8 And value <= 56 Then tmpDbl = 7.5
    If value >= 56 And value <= 57.2 Then tmpDbl = 7.6
    If value >= 57.2 And value <= 58.4 Then tmpDbl = 7.7
    If value >= 58.4 And value <= 59.6 Then tmpDbl = 7.8
    If value >= 59.6 And value <= 60.8 Then tmpDbl = 7.9
    If value >= 60.8 And value <= 62 Then tmpDbl = 8
    If value >= 62 And value <= 63.3 Then tmpDbl = 8.1
    If value >= 63.3 And value <= 64.6 Then tmpDbl = 8.2
    If value >= 64.6 And value <= 65.9 Then tmpDbl = 8.3
    If value >= 65.9 And value <= 67.2 Then tmpDbl = 8.4
    If value >= 67.2 And value <= 68.5 Then tmpDbl = 8.5
    If value >= 68.5 And value <= 69.8 Then tmpDbl = 8.6
    If value >= 69.8 And value <= 71.1 Then tmpDbl = 8.7
    If value >= 71.1 And value <= 72.4 Then tmpDbl = 8.8
    If value >= 72.4 And value <= 73.7 Then tmpDbl = 8.9
    If value >= 73.7 And value <= 75 Then tmpDbl = 9
    If value >= 75 And value <= 76.2 Then tmpDbl = 9.1
    If value >= 76.2 And value <= 77.4 Then tmpDbl = 9.2
    If value >= 77.4 And value <= 78.6 Then tmpDbl = 9.3
    If value >= 78.6 And value <= 79.8 Then tmpDbl = 9.4
    If value >= 79.8 And value <= 81 Then tmpDbl = 9.5
    If value >= 81 And value <= 82.2 Then tmpDbl = 9.6
    If value >= 82.2 And value <= 83.4 Then tmpDbl = 9.7
    If value >= 83.4 And value <= 84.6 Then tmpDbl = 9.8
    If value >= 84.6 And value <= 85.8 Then tmpDbl = 9.9
    If value >= 85.8 And value <= 87 Then tmpDbl = 10
    If value >= 87 And value <= 88.5 Then tmpDbl = 10.1
    If value >= 88.5 And value <= 90 Then tmpDbl = 10.2
    If value >= 90 And value <= 91.5 Then tmpDbl = 10.3
    If value >= 91.5 And value <= 93 Then tmpDbl = 10.4
    If value >= 93 And value <= 94.5 Then tmpDbl = 10.5
    If value >= 94.5 And value <= 96 Then tmpDbl = 10.6
    If value >= 96 And value <= 97.5 Then tmpDbl = 10.7
    If value >= 97.5 And value <= 99 Then tmpDbl = 10.8
    If value >= 99 And value <= 100.5 Then tmpDbl = 10.9
    If value >= 100.5 And value <= 102 Then tmpDbl = 11
    If value >= 102 And value <= 103.5 Then tmpDbl = 11.1
    If value >= 103.5 And value <= 105 Then tmpDbl = 11.2
    If value >= 105 And value <= 106.5 Then tmpDbl = 11.3
    If value >= 106.5 And value <= 108 Then tmpDbl = 11.4
    If value >= 108 And value <= 109.5 Then tmpDbl = 11.5
    If value >= 109.5 And value <= 111 Then tmpDbl = 11.6
    If value >= 111 And value <= 112.5 Then tmpDbl = 11.7
    If value >= 112.5 And value <= 114 Then tmpDbl = 11.8
    If value >= 114 And value <= 115.5 Then tmpDbl = 11.9
    If value >= 115.5 And value <= 117 Then tmpDbl = 12
    If value >= 117 Then tmpDbl = 12
    
    ConvertMph2Beaufort = tmpDbl
End Function


Private Sub Command1_Click()
    If DummyMode = True Then
        DummyMode = False
        Command3.Caption = "Start Example Mode"
    End If
    Call ListenSerialPort
End Sub



Private Sub EndListeningMode()
    
    ListeningMode = False
'   WaitingCON = False
    Command1.Caption = "Start Listening Serial Port"
    Command4.Enabled = True

'    If comSerial1.PortOpen Then comSerial1.Output = "STP" & Chr(13) & Chr(10)     'Send "STP" to STOP communication
    'Form2.txtRead.Text = Form2.txtRead.Text & "SND: " & "STP" & Chr(13) & Chr(10)
'    Call Log("STP", "SND")
    
    If comSerial1.PortOpen Then comSerial1.PortOpen = False
        
    SerialPortTimer.Enabled = False
    
End Sub

Private Sub ListenSerialPort()
'Start Listening Serial Port

Dim tmpString  As String, tmpSerial1 As String
Dim i As Integer
Dim DataReceived As Boolean
Dim tmpDate As String
Dim tmpStart As Integer
Dim tmpEnd As Integer
Dim tmpVal As String
Dim tmpValues
Dim tmpPos As Integer
    'Checksum Variables
Dim tmpCheckSum As String
Dim n As Integer
Dim b As Integer
Dim tmpxor As Double



    If Not (ListeningMode) Then
        ListeningMode = True
    '    WaitingCON = True
        Command1.Caption = "Stop listening Serial Port"
        Command4.Enabled = False
        
    Else
        Call EndListeningMode
        Exit Sub
    End If
    
    comSerial1.InputLen = 0
    tmpSerial1 = ""
    ValuesChanged = False
    
        
    While ListeningMode
     
        On Error GoTo Error1
        
        If Not (comSerial1.PortOpen) Then comSerial1.PortOpen = True
                   
                    
                '~~~~~~~~~~~~~~~~~~~~~~~~~~~
                'Data received in comSerial1
                '~~~~~~~~~~~~~~~~~~~~~~~~~~~
                
                If comSerial1.InBufferCount Then 'Data Received in Serial Port 1
                    Debug.Print "comSerial1.InBufferCount = " & comSerial1.InBufferCount
                                        
                    tmpSerial1 = tmpSerial1 & CStr(comSerial1.Input)
                    
                    'tmpString = Left(tmpSerial1, 1)
                    'Debug.Print Asc(tmpString)
                    If InStr(1, tmpSerial1, Chr(3)) > 0 And InStr(1, tmpSerial1, Chr(2)) > 0 Then
                        'Full data string arrived in Serial Port 1
                        
                        tmpSerial1 = tmpSerial1 & CStr(comSerial1.Input)
                        
                        ValuesChanged = True
                                        
''                            WaitingData = False
                        
                        'Data format
                        'Chr(2) & "Q,229,002.74,M,00," & Chr(3) 16
                        ' 229 -> Angle
                        ' 002.74 -> Wind
                        
                        'Get Real Data..
                        tmpStart = InStr(1, tmpSerial1, Chr(2))
                        tmpEnd = InStr(1, tmpSerial1, Chr(3))
                        tmpString = Mid(tmpSerial1, tmpStart + 1, tmpEnd - tmpStart - 1)
                        tmpSerial1 = Right(tmpSerial1, Len(tmpSerial1) - tmpEnd)
                            
                            'check data start
                        
                        n = Len(tmpString)
                        
                        tmpxor = Asc("Mid(tmpString, 1, 1")
                            For b = 2 To n
                                tmpxor = tmpxor Xor Asc(Mid(tmpString, b, 1))
                            
                            Next
                        tmpxor = Hex(tmpxor)
                        
                        
                        tmpCheckSum = tmpSerial1
                            If InStr(1, tmpSerial1, Chr(2)) > 0 Then
                                tmpCheckSum = Left(tmpSerial1, Chr(2))
                            End If
                            
                            If tmpxor = tmpCheckSum Then
                                Timer2 = False
                            Else
                                Timer2 = True
                                   Call cleardata
                                   
                            End If
                                               
                        'Manipulate Data..
                                
                        '''CHECKSUM
                                
                                
                        tmpValues = Split(tmpString, ",")
                                
                        tmpVal = tmpValues(1)
                        If IsNumeric(tmpVal) Then
                            Angle = CDbl(Replace(tmpVal, ".", ","))
                        End If
                        
                        tmpVal = tmpValues(2)
                        
                        If IsNumeric(tmpVal) Then
                            Wind = CDbl(Replace(tmpVal, ".", ","))
                        End If
                        
                        SerialPortTimer.Enabled = False
                        SerialPortTimer.Enabled = True  'Start / ReStart Counter to check for connection Time-Out
                    
                    End If
                End If
            
            
                'Redraw Values
                If ValuesChanged Then
                    Call SetValues
                    ValuesChanged = False
                End If
                
                DoEvents    'To check whether another button is pressed
            
                If Not (bFormLoaded) Then
                    Unload Form1
                    Set Form1 = Nothing
                    Exit Sub
                End If
                
                If Not (ListeningMode) Then
                    Call EndListeningMode
                    Exit Sub
                End If
        ''            Wend
            '    End If
    
    Wend
    
    'End Listening Mode - Close Ports
    If comSerial1.PortOpen Then comSerial1.PortOpen = False
        
    
    
    Exit Sub

Error1:
    MsgBox "Error " & Err.Description, vbCritical
End Sub


Private Sub cleardata()
    Label1(8).Caption = ""
    Label1(10).Caption = ""
    Label1(15).Caption = ""
    Label1(13).Caption = ""
    ValuesChanged = False
    
End Sub


