using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Runtime.InteropServices; namespace Win_017 { public class fcls017a : System.Windows.Forms.Form { [DllImport("AID.dll")] static extern uint FT_ListDevices(); [DllImport("AID.dll")] static extern uint FT_Open(); [DllImport("AID.dll")] static extern uint FT_Close(); [DllImport("AID.dll")] static extern uint FT_GetStatus(ref ulong rxsize, ref ulong txsize); [DllImport("AID.dll")] static extern uint FT_Read([MarshalAs(UnmanagedType.LPArray)] byte[] p_data,ulong size); ulong rxsize=0,txsize=0; bool bCelsius=true; bool bAutoRefresh=true; private System.Windows.Forms.Button btnListDevice; private System.Windows.Forms.TextBox txtListDevice; private System.Windows.Forms.Button btnOpen; private System.Windows.Forms.Button btnClose; private System.Windows.Forms.TextBox txtStatus; private System.Windows.Forms.GroupBox grStatusAndControl; private System.Windows.Forms.MainMenu mnuMenu1; private System.Windows.Forms.StatusBar sbaStatus1; private System.Windows.Forms.Label lblTime; private System.Windows.Forms.Label lblDate; private System.Windows.Forms.Timer tmrTimer1; private System.Windows.Forms.Button btnBufferState; private System.Windows.Forms.TextBox txtRXBuffer; private System.Windows.Forms.TextBox txtTXBuffer; private System.Windows.Forms.Label lblRX; private System.Windows.Forms.Label lblTX; private System.Windows.Forms.Button btnRefresh; private System.Windows.Forms.GroupBox gboGroupBox2; private System.Windows.Forms.Button btnRead; private System.Windows.Forms.TextBox txtRead; private System.Windows.Forms.Label lblMSB; private System.Windows.Forms.Label lblLSB; private System.Windows.Forms.TextBox txtAddress; private System.Windows.Forms.TextBox txtData; private System.Windows.Forms.Label lblAddress; private System.Windows.Forms.Label lblData; internal System.Windows.Forms.GroupBox gboConverted; private System.Windows.Forms.TextBox txtTemperature; private System.Windows.Forms.MenuItem mnuAbout; private System.Windows.Forms.MenuItem mnuManualRefresh; private System.Windows.Forms.MenuItem mnuRefresh10mS; private System.Windows.Forms.MenuItem mnuRefresh100mS; private System.Windows.Forms.MenuItem mnuRefresh1000mS; private System.Windows.Forms.Splitter splitter1; private System.Windows.Forms.MenuItem mnuAutoRefresh; private System.Windows.Forms.MenuItem mnuCelsius; private System.Windows.Forms.MenuItem mnuFahrenheit; private System.Windows.Forms.MenuItem mnuFile; private System.Windows.Forms.MenuItem mnuClose; private System.Windows.Forms.MenuItem mnuEdit; private System.Windows.Forms.MenuItem mnuAutoRefreshInterval; private System.Windows.Forms.MenuItem mnuHelp; private System.Windows.Forms.MenuItem mnuSeperator1; private System.Windows.Forms.MenuItem mnuSeparator2; private System.ComponentModel.IContainer components; public fcls017a() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(fcls017a)); this.btnListDevice = new System.Windows.Forms.Button(); this.txtListDevice = new System.Windows.Forms.TextBox(); this.btnOpen = new System.Windows.Forms.Button(); this.btnClose = new System.Windows.Forms.Button(); this.txtStatus = new System.Windows.Forms.TextBox(); this.grStatusAndControl = new System.Windows.Forms.GroupBox(); this.lblTX = new System.Windows.Forms.Label(); this.lblRX = new System.Windows.Forms.Label(); this.txtTXBuffer = new System.Windows.Forms.TextBox(); this.txtRXBuffer = new System.Windows.Forms.TextBox(); this.btnBufferState = new System.Windows.Forms.Button(); this.btnRefresh = new System.Windows.Forms.Button(); this.mnuMenu1 = new System.Windows.Forms.MainMenu(); this.mnuFile = new System.Windows.Forms.MenuItem(); this.mnuClose = new System.Windows.Forms.MenuItem(); this.mnuEdit = new System.Windows.Forms.MenuItem(); this.mnuAutoRefresh = new System.Windows.Forms.MenuItem(); this.mnuManualRefresh = new System.Windows.Forms.MenuItem(); this.mnuSeperator1 = new System.Windows.Forms.MenuItem(); this.mnuAutoRefreshInterval = new System.Windows.Forms.MenuItem(); this.mnuRefresh10mS = new System.Windows.Forms.MenuItem(); this.mnuRefresh100mS = new System.Windows.Forms.MenuItem(); this.mnuRefresh1000mS = new System.Windows.Forms.MenuItem(); this.mnuSeparator2 = new System.Windows.Forms.MenuItem(); this.mnuCelsius = new System.Windows.Forms.MenuItem(); this.mnuFahrenheit = new System.Windows.Forms.MenuItem(); this.mnuHelp = new System.Windows.Forms.MenuItem(); this.mnuAbout = new System.Windows.Forms.MenuItem(); this.sbaStatus1 = new System.Windows.Forms.StatusBar(); this.lblTime = new System.Windows.Forms.Label(); this.lblDate = new System.Windows.Forms.Label(); this.tmrTimer1 = new System.Windows.Forms.Timer(this.components); this.gboGroupBox2 = new System.Windows.Forms.GroupBox(); this.lblData = new System.Windows.Forms.Label(); this.lblAddress = new System.Windows.Forms.Label(); this.txtData = new System.Windows.Forms.TextBox(); this.lblLSB = new System.Windows.Forms.Label(); this.txtRead = new System.Windows.Forms.TextBox(); this.btnRead = new System.Windows.Forms.Button(); this.lblMSB = new System.Windows.Forms.Label(); this.txtAddress = new System.Windows.Forms.TextBox(); this.gboConverted = new System.Windows.Forms.GroupBox(); this.txtTemperature = new System.Windows.Forms.TextBox(); this.splitter1 = new System.Windows.Forms.Splitter(); this.grStatusAndControl.SuspendLayout(); this.gboGroupBox2.SuspendLayout(); this.gboConverted.SuspendLayout(); this.SuspendLayout(); // // btnListDevice // this.btnListDevice.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(0))); this.btnListDevice.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnListDevice.ForeColor = System.Drawing.Color.Black; this.btnListDevice.Location = new System.Drawing.Point(16, 32); this.btnListDevice.Name = "btnListDevice"; this.btnListDevice.Size = new System.Drawing.Size(88, 23); this.btnListDevice.TabIndex = 0; this.btnListDevice.Text = "List Device(s)"; this.btnListDevice.Click += new System.EventHandler(this.btnListDevice_Click); // // txtListDevice // this.txtListDevice.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.txtListDevice.ForeColor = System.Drawing.Color.Red; this.txtListDevice.Location = new System.Drawing.Point(120, 32); this.txtListDevice.Name = "txtListDevice"; this.txtListDevice.Size = new System.Drawing.Size(72, 24); this.txtListDevice.TabIndex = 1; this.txtListDevice.Text = "idle"; this.txtListDevice.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.txtListDevice.TextChanged += new System.EventHandler(this.txtListDevice_TextChanged); // // btnOpen // this.btnOpen.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(128))); this.btnOpen.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnOpen.ForeColor = System.Drawing.Color.Black; this.btnOpen.Location = new System.Drawing.Point(32, 72); this.btnOpen.Name = "btnOpen"; this.btnOpen.Size = new System.Drawing.Size(64, 23); this.btnOpen.TabIndex = 2; this.btnOpen.Text = "Open"; this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click); // // btnClose // this.btnClose.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(128))); this.btnClose.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnClose.ForeColor = System.Drawing.Color.Black; this.btnClose.Location = new System.Drawing.Point(208, 72); this.btnClose.Name = "btnClose"; this.btnClose.Size = new System.Drawing.Size(64, 23); this.btnClose.TabIndex = 3; this.btnClose.Text = "Close"; this.btnClose.Click += new System.EventHandler(this.btnClose_Click); // // txtStatus // this.txtStatus.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.txtStatus.ForeColor = System.Drawing.Color.Black; this.txtStatus.Location = new System.Drawing.Point(120, 72); this.txtStatus.Name = "txtStatus"; this.txtStatus.Size = new System.Drawing.Size(72, 24); this.txtStatus.TabIndex = 4; this.txtStatus.Text = "Status"; this.txtStatus.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.txtStatus.TextChanged += new System.EventHandler(this.txtStatus_TextChanged); // // grStatusAndControl // this.grStatusAndControl.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255))); this.grStatusAndControl.Controls.Add(this.lblTX); this.grStatusAndControl.Controls.Add(this.lblRX); this.grStatusAndControl.Controls.Add(this.txtTXBuffer); this.grStatusAndControl.Controls.Add(this.txtRXBuffer); this.grStatusAndControl.Controls.Add(this.txtStatus); this.grStatusAndControl.Controls.Add(this.btnClose); this.grStatusAndControl.Controls.Add(this.btnOpen); this.grStatusAndControl.Controls.Add(this.btnListDevice); this.grStatusAndControl.Controls.Add(this.txtListDevice); this.grStatusAndControl.Controls.Add(this.btnBufferState); this.grStatusAndControl.Controls.Add(this.btnRefresh); this.grStatusAndControl.Font = new System.Drawing.Font("Lucida Sans Unicode", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.grStatusAndControl.ForeColor = System.Drawing.Color.White; this.grStatusAndControl.Location = new System.Drawing.Point(16, 40); this.grStatusAndControl.Name = "grStatusAndControl"; this.grStatusAndControl.Size = new System.Drawing.Size(304, 160); this.grStatusAndControl.TabIndex = 5; this.grStatusAndControl.TabStop = false; this.grStatusAndControl.Text = "Status from and Control of FT245BM"; this.grStatusAndControl.Enter += new System.EventHandler(this.grStatusAndControl_Enter); // // lblTX // this.lblTX.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblTX.ForeColor = System.Drawing.Color.White; this.lblTX.Location = new System.Drawing.Point(264, 112); this.lblTX.Name = "lblTX"; this.lblTX.Size = new System.Drawing.Size(16, 32); this.lblTX.TabIndex = 13; this.lblTX.Text = "TX"; this.lblTX.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // lblRX // this.lblRX.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblRX.ForeColor = System.Drawing.Color.White; this.lblRX.Location = new System.Drawing.Point(120, 112); this.lblRX.Name = "lblRX"; this.lblRX.Size = new System.Drawing.Size(16, 32); this.lblRX.TabIndex = 12; this.lblRX.Text = "RX"; this.lblRX.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // txtTXBuffer // this.txtTXBuffer.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.txtTXBuffer.ForeColor = System.Drawing.Color.Black; this.txtTXBuffer.Location = new System.Drawing.Point(208, 112); this.txtTXBuffer.Name = "txtTXBuffer"; this.txtTXBuffer.Size = new System.Drawing.Size(56, 24); this.txtTXBuffer.TabIndex = 11; this.txtTXBuffer.Text = ""; this.txtTXBuffer.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.txtTXBuffer.TextChanged += new System.EventHandler(this.txtTXBuffer_TextChanged); // // txtRXBuffer // this.txtRXBuffer.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.txtRXBuffer.ForeColor = System.Drawing.Color.Black; this.txtRXBuffer.Location = new System.Drawing.Point(136, 112); this.txtRXBuffer.Name = "txtRXBuffer"; this.txtRXBuffer.Size = new System.Drawing.Size(56, 24); this.txtRXBuffer.TabIndex = 10; this.txtRXBuffer.Text = ""; this.txtRXBuffer.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.txtRXBuffer.TextChanged += new System.EventHandler(this.txtRXBuffer_TextChanged); // // btnBufferState // this.btnBufferState.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255))); this.btnBufferState.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnBufferState.ForeColor = System.Drawing.Color.Black; this.btnBufferState.Location = new System.Drawing.Point(16, 112); this.btnBufferState.Name = "btnBufferState"; this.btnBufferState.Size = new System.Drawing.Size(88, 23); this.btnBufferState.TabIndex = 9; this.btnBufferState.Text = "Buffer State"; this.btnBufferState.Click += new System.EventHandler(this.btnBufferState_Click); // // btnRefresh // this.btnRefresh.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192))); this.btnRefresh.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnRefresh.ForeColor = System.Drawing.Color.Black; this.btnRefresh.Location = new System.Drawing.Point(240, 32); this.btnRefresh.Name = "btnRefresh"; this.btnRefresh.Size = new System.Drawing.Size(56, 23); this.btnRefresh.TabIndex = 9; this.btnRefresh.Text = "Refresh"; this.btnRefresh.Visible = false; this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); // // mnuMenu1 // this.mnuMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuFile, this.mnuEdit, this.mnuHelp}); // // mnuFile // this.mnuFile.Index = 0; this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuClose}); this.mnuFile.Text = "File"; // // mnuClose // this.mnuClose.Index = 0; this.mnuClose.Text = "Close"; this.mnuClose.Click += new System.EventHandler(this.menuItem5_Click); // // mnuEdit // this.mnuEdit.Index = 1; this.mnuEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuAutoRefresh, this.mnuManualRefresh, this.mnuSeperator1, this.mnuAutoRefreshInterval, this.mnuSeparator2, this.mnuCelsius, this.mnuFahrenheit}); this.mnuEdit.Text = "Edit"; // // mnuAutoRefresh // this.mnuAutoRefresh.Checked = true; this.mnuAutoRefresh.Index = 0; this.mnuAutoRefresh.Text = "Auto Refresh"; this.mnuAutoRefresh.Click += new System.EventHandler(this.mnuAutoRefresh_Click); // // mnuManualRefresh // this.mnuManualRefresh.Index = 1; this.mnuManualRefresh.Text = "Manual Refresh"; this.mnuManualRefresh.Click += new System.EventHandler(this.mnuManualRefresh_Click); // // mnuSeperator1 // this.mnuSeperator1.Index = 2; this.mnuSeperator1.Text = "-"; // // mnuAutoRefreshInterval // this.mnuAutoRefreshInterval.Index = 3; this.mnuAutoRefreshInterval.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuRefresh10mS, this.mnuRefresh100mS, this.mnuRefresh1000mS}); this.mnuAutoRefreshInterval.Text = "Auto Refresh Interval"; // // mnuRefresh10mS // this.mnuRefresh10mS.Index = 0; this.mnuRefresh10mS.Text = "10 mS"; this.mnuRefresh10mS.Click += new System.EventHandler(this.mnuRefresh10mS_Click); // // mnuRefresh100mS // this.mnuRefresh100mS.Checked = true; this.mnuRefresh100mS.Index = 1; this.mnuRefresh100mS.Text = "100 mS"; this.mnuRefresh100mS.Click += new System.EventHandler(this.mnuRefresh100mS_Click); // // mnuRefresh1000mS // this.mnuRefresh1000mS.Index = 2; this.mnuRefresh1000mS.Text = "1000 mS"; this.mnuRefresh1000mS.Click += new System.EventHandler(this.mnuRefresh1000mS_Click); // // mnuSeparator2 // this.mnuSeparator2.Index = 4; this.mnuSeparator2.Text = "-"; // // mnuCelsius // this.mnuCelsius.Checked = true; this.mnuCelsius.Index = 5; this.mnuCelsius.Text = "Celsius"; this.mnuCelsius.Click += new System.EventHandler(this.mnuCelsius_Click); // // mnuFahrenheit // this.mnuFahrenheit.Index = 6; this.mnuFahrenheit.Text = "Fahrenheit"; this.mnuFahrenheit.Click += new System.EventHandler(this.mnuFahrenheit_Click); // // mnuHelp // this.mnuHelp.Index = 2; this.mnuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuAbout}); this.mnuHelp.Text = "Help"; // // mnuAbout // this.mnuAbout.Index = 0; this.mnuAbout.Text = "About"; this.mnuAbout.Click += new System.EventHandler(this.menuItem6_Click); // // sbaStatus1 // this.sbaStatus1.Location = new System.Drawing.Point(0, 425); this.sbaStatus1.Name = "sbaStatus1"; this.sbaStatus1.Size = new System.Drawing.Size(336, 16); this.sbaStatus1.TabIndex = 6; this.sbaStatus1.Text = "Status"; // // lblTime // this.lblTime.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192))); this.lblTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.lblTime.Font = new System.Drawing.Font("Comic Sans MS", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblTime.Location = new System.Drawing.Point(232, 8); this.lblTime.Name = "lblTime"; this.lblTime.Size = new System.Drawing.Size(88, 23); this.lblTime.TabIndex = 7; this.lblTime.Text = "Time"; this.lblTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // lblDate // this.lblDate.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192))); this.lblDate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.lblDate.Font = new System.Drawing.Font("Comic Sans MS", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblDate.Location = new System.Drawing.Point(16, 8); this.lblDate.Name = "lblDate"; this.lblDate.Size = new System.Drawing.Size(208, 23); this.lblDate.TabIndex = 8; this.lblDate.Text = "Date"; this.lblDate.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblDate.Click += new System.EventHandler(this.lblDate_Click); // // tmrTimer1 // this.tmrTimer1.Enabled = true; this.tmrTimer1.Tick += new System.EventHandler(this.btnRefresh_Click); // // gboGroupBox2 // this.gboGroupBox2.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255))); this.gboGroupBox2.Controls.Add(this.lblData); this.gboGroupBox2.Controls.Add(this.lblAddress); this.gboGroupBox2.Controls.Add(this.txtData); this.gboGroupBox2.Controls.Add(this.lblLSB); this.gboGroupBox2.Controls.Add(this.txtRead); this.gboGroupBox2.Controls.Add(this.btnRead); this.gboGroupBox2.Controls.Add(this.lblMSB); this.gboGroupBox2.Controls.Add(this.txtAddress); this.gboGroupBox2.Font = new System.Drawing.Font("Lucida Sans Unicode", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.gboGroupBox2.ForeColor = System.Drawing.Color.White; this.gboGroupBox2.Location = new System.Drawing.Point(16, 208); this.gboGroupBox2.Name = "gboGroupBox2"; this.gboGroupBox2.Size = new System.Drawing.Size(304, 112); this.gboGroupBox2.TabIndex = 14; this.gboGroupBox2.TabStop = false; this.gboGroupBox2.Text = "Read 8 bytes from FT245BM"; // // lblData // this.lblData.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblData.Location = new System.Drawing.Point(264, 72); this.lblData.Name = "lblData"; this.lblData.Size = new System.Drawing.Size(32, 23); this.lblData.TabIndex = 19; this.lblData.Text = "Data"; this.lblData.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // lblAddress // this.lblAddress.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblAddress.Location = new System.Drawing.Point(8, 72); this.lblAddress.Name = "lblAddress"; this.lblAddress.Size = new System.Drawing.Size(56, 23); this.lblAddress.TabIndex = 18; this.lblAddress.Text = "Address"; this.lblAddress.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.lblAddress.Click += new System.EventHandler(this.lblAddress_Click); // // txtData // this.txtData.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.txtData.Location = new System.Drawing.Point(168, 72); this.txtData.Name = "txtData"; this.txtData.Size = new System.Drawing.Size(96, 24); this.txtData.TabIndex = 17; this.txtData.Text = ""; this.txtData.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // lblLSB // this.lblLSB.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblLSB.Location = new System.Drawing.Point(272, 32); this.lblLSB.Name = "lblLSB"; this.lblLSB.Size = new System.Drawing.Size(24, 23); this.lblLSB.TabIndex = 16; this.lblLSB.Text = "LSB"; this.lblLSB.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // txtRead // this.txtRead.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.txtRead.Location = new System.Drawing.Point(128, 32); this.txtRead.Name = "txtRead"; this.txtRead.Size = new System.Drawing.Size(144, 24); this.txtRead.TabIndex = 1; this.txtRead.Text = ""; this.txtRead.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // btnRead // this.btnRead.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(0))); this.btnRead.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnRead.ForeColor = System.Drawing.Color.Black; this.btnRead.Location = new System.Drawing.Point(32, 32); this.btnRead.Name = "btnRead"; this.btnRead.Size = new System.Drawing.Size(64, 23); this.btnRead.TabIndex = 0; this.btnRead.Text = "Read"; this.btnRead.Click += new System.EventHandler(this.btnRead_Click); // // lblMSB // this.lblMSB.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblMSB.Location = new System.Drawing.Point(96, 32); this.lblMSB.Name = "lblMSB"; this.lblMSB.Size = new System.Drawing.Size(32, 23); this.lblMSB.TabIndex = 15; this.lblMSB.Text = "MSB"; this.lblMSB.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // txtAddress // this.txtAddress.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.txtAddress.Location = new System.Drawing.Point(64, 72); this.txtAddress.Name = "txtAddress"; this.txtAddress.Size = new System.Drawing.Size(96, 24); this.txtAddress.TabIndex = 14; this.txtAddress.Text = ""; this.txtAddress.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // // gboConverted // this.gboConverted.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255))); this.gboConverted.Controls.Add(this.txtTemperature); this.gboConverted.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.gboConverted.ForeColor = System.Drawing.Color.White; this.gboConverted.Location = new System.Drawing.Point(16, 328); this.gboConverted.Name = "gboConverted"; this.gboConverted.Size = new System.Drawing.Size(304, 88); this.gboConverted.TabIndex = 14; this.gboConverted.TabStop = false; this.gboConverted.Text = "Converted data from FT245BM"; this.gboConverted.Enter += new System.EventHandler(this.gboConverted_Enter); // // txtTemperature // this.txtTemperature.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.txtTemperature.Location = new System.Drawing.Point(32, 32); this.txtTemperature.Name = "txtTemperature"; this.txtTemperature.Size = new System.Drawing.Size(240, 38); this.txtTemperature.TabIndex = 0; this.txtTemperature.Text = ""; this.txtTemperature.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.txtTemperature.TextChanged += new System.EventHandler(this.txtTemperature_TextChanged); // // splitter1 // this.splitter1.Location = new System.Drawing.Point(0, 0); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(3, 425); this.splitter1.TabIndex = 15; this.splitter1.TabStop = false; // // fcls017a // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255))); this.ClientSize = new System.Drawing.Size(336, 441); this.Controls.Add(this.splitter1); this.Controls.Add(this.lblDate); this.Controls.Add(this.lblTime); this.Controls.Add(this.sbaStatus1); this.Controls.Add(this.grStatusAndControl); this.Controls.Add(this.gboGroupBox2); this.Controls.Add(this.gboConverted); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Menu = this.mnuMenu1; this.Name = "fcls017a"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = " 017 - FT245BM interface >> TechDesign"; this.Load += new System.EventHandler(this.fcls017a_Load); this.grStatusAndControl.ResumeLayout(false); this.gboGroupBox2.ResumeLayout(false); this.gboConverted.ResumeLayout(false); this.ResumeLayout(false); } #endregion [STAThread] static void Main() { Application.Run(new fcls017a()); } private void fcls017a_Load(object sender, System.EventArgs e) { // System.Threading.Thread.Sleep(500); // pause 0,5 secs. tmrTimer1.Interval=100; btnListDevice_Click(this,System.EventArgs.Empty); btnOpen_Click(this,System.EventArgs.Empty); } private void btnListDevice_Click(object sender, System.EventArgs e) { if (FT_ListDevices() == 0){ txtListDevice.Text = "No Device!"; btnOpen.Enabled=false; btnClose.Enabled=false; btnBufferState.Enabled=false; btnRead.Enabled=false; txtRXBuffer.Text =""; txtTXBuffer.Text =""; txtStatus.Text =""; txtRead.Text =""; txtAddress.Text =""; txtData.Text =""; txtTemperature.Text = ""; } else {txtListDevice.Text = Convert.ToString(FT_ListDevices())+ " Device"; btnOpen.Enabled=true; btnClose.Enabled=true; btnBufferState.Enabled=true; btnRead.Enabled=true; btnRead.IsAccessible=true; } } private void btnOpen_Click(object sender, System.EventArgs e) { if (!(btnOpen.Enabled))return; FT_Open(); if (FT_Open() == 0){txtStatus.Text = "Closed";} else txtStatus.Text = "Open"; } private void btnClose_Click(object sender, System.EventArgs e) { if (!(btnClose.Enabled))return; FT_Close(); txtStatus.Text = "Closed"; } private void lblDate_Click(object sender, System.EventArgs e) { DateTime dtCurrentTime = DateTime.Now; lblTime.Text = dtCurrentTime.ToLongTimeString(); lblDate.Text = dtCurrentTime.ToLongDateString(); } public void btnBufferState_Click(object sender, System.EventArgs e) { if (!(btnBufferState.Enabled))return; FT_GetStatus(ref rxsize, ref txsize); txtRXBuffer.Text = Convert.ToString(rxsize); txtTXBuffer.Text = Convert.ToString(txsize); } private void txtRXBuffer_TextChanged(object sender, System.EventArgs e) { } private void txtStatus_TextChanged(object sender, System.EventArgs e) { } private void txtListDevice_TextChanged(object sender, System.EventArgs e) { } private void txtTXBuffer_TextChanged(object sender, System.EventArgs e) { } private void grStatusAndControl_Enter(object sender, System.EventArgs e) { } private void btnRefresh_Click(object sender, System.EventArgs e) { btnListDevice_Click(this,System.EventArgs.Empty); btnOpen_Click(this,System.EventArgs.Empty); lblDate_Click(this,System.EventArgs.Empty); btnBufferState_Click(this,System.EventArgs.Empty); if (!bAutoRefresh)return; btnRead_Click(this,System.EventArgs.Empty); } public void btnRead_Click(object sender, System.EventArgs e) { if (!(btnRead.Enabled))return; if ((rxsize==0)&&(txsize==0))return; byte[] data=new Byte[8]; uint i,length; uint USB_address; int USB_data; double dTemperature=0f; USB_address=0; USB_data=0; string strTemperature= ""; string strAdjTemperature= ""; int intLocation; txtRead.Text=""; length=FT_Read(data, 08); // if (length==0)return; for(i=0;i