• 大小: 212KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-17
  • 语言: 其他
  • 标签: gps  

资源简介

gps授时校时系统,需要gps模块支持。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.Runtime.InteropServices;
using System.Threading;

namespace gps授时
{
    public partial class 时钟芯片授时校验系统 : Form
    {
        static SerialPort sp = new SerialPort();
        static SerialPort sp1 = new SerialPort();
        string indata = “2001-01-01  00:00:00“;
        string indata1 = “无GPS信号,请检查!“;
        string indata2 = “2001-01-01  00:00:00.000“;
        string indata3 = “2001-01-01  00:00:00.000“;
        string indata4 = “2001-01-01  00:00:00“;
        TimeSpan wucha;
        TimeSpan shicha;
        bool z = false;
        bool s = false;
        //调用Kernel32.DLL
        [DllImport(“Kernel32.dll“)]
        public static extern void GetLocalTime(SystemTime st);
        [DllImport(“Kernel32.dll“)]
        public static extern void SetLocalTime(SystemTime st);
        [StructLayout(LayoutKind.Sequential)]
        public class SystemTime
        {
            public ushort wYear;
            public ushort wMonth;
            public ushort wDayOfWeek;
            public ushort wDay;
            public ushort Whour;
            public ushort wMinute;
            public ushort wSecond;
            public ushort wMilliseconds;
        }        
        public 时钟芯片授时校验系统()
        {
            InitializeComponent();
            this.FormClosing += new FormClosingEventHandler(Form1_FormClosing);
            comboBox1.Enabled = false;
            comboBox2.Enabled = false;
            dateTimePicker1.Enabled = false;
            button2.Enabled = false;
            button3.Enabled = false;
            button4.Enabled = false;
            button5.Enabled = false;
            button7.Enabled = false;
            button8.Enabled = false;
        }
        private void button1_Click(object sender EventArgs e)
        {
            string[] ports = SerialPort.GetPortNames();
            comboBox1.Items.Clear();
            comboBox2.Items.Clear();
            foreach (string port in ports)
            {
                comboBox1.Items.Add(port);
                comboBox2.Items.Add(port);
            }
            comboBox1.Enabled = true;
            comboBox2.Enabled = true;
            dateTimePicker1.Enabled = false;
            button2.Enabled = false;
            button3.Enabled = false;
            button4.Enabled = false;
            button5.Enabled = false;
        }
        private void comboBox1_SelectedIndexChanged(object sender EventArgs e)
        {
            // Allow the user to set the appropriate properties.
            sp.Close();
            sp.PortName = comboBox1.Text;
            sp.BaudRate = 115200;
            sp.Parity = Parity.None;
            sp.DataBits = 8;
            sp.StopBits = StopBits.One;
            sp.Handsh

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     225280  2012-11-01 23:15  gps授时\gps授时\bin\Debug\gps授时.exe

     文件      32256  2012-11-01 23:15  gps授时\gps授时\bin\Debug\gps授时.pdb

     文件      11600  2012-11-01 23:14  gps授时\gps授时\bin\Debug\gps授时.vshost.exe

     文件       2423  2012-11-01 20:45  gps授时\gps授时\bin\Debug\gps授时.vshost.exe.manifest

     文件          1  2012-10-31 20:58  gps授时\gps授时\ClassDiagram1.cd

     文件      99678  2012-11-01 20:42  gps授时\gps授时\Clock.ico

     文件      14114  2012-11-01 23:10  gps授时\gps授时\Form1.cs

     文件      30123  2012-11-01 23:06  gps授时\gps授时\Form1.Designer.cs

     文件     156426  2012-11-01 22:35  gps授时\gps授时\Form1.resx

     文件       5930  2012-11-01 20:45  gps授时\gps授时\gps授时.csproj

     文件        523  2012-10-31 21:06  gps授时\gps授时\gps授时.csproj.user

     文件       5420  2012-11-01 12:03  gps授时\gps授时\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6494  2012-11-01 23:17  gps授时\gps授时\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        565  2012-11-01 23:17  gps授时\gps授时\obj\x86\Debug\gps授时.csproj.FileListAbsolute.txt

     文件        975  2012-11-01 23:15  gps授时\gps授时\obj\x86\Debug\gps授时.csproj.GenerateResource.Cache

     文件     225280  2012-11-01 23:15  gps授时\gps授时\obj\x86\Debug\gps授时.exe

     文件      32256  2012-11-01 23:15  gps授时\gps授时\obj\x86\Debug\gps授时.pdb

     文件        180  2012-11-01 23:15  gps授时\gps授时\obj\x86\Debug\gps授时.Properties.Resources.resources

     文件     100244  2012-11-01 23:15  gps授时\gps授时\obj\x86\Debug\gps授时.时钟芯片授时校验系统.resources

     文件        515  2012-10-31 22:04  gps授时\gps授时\Program.cs

     文件       2423  2012-11-01 20:45  gps授时\gps授时\Properties\app.manifest

     文件       1350  2012-10-31 20:53  gps授时\gps授时\Properties\AssemblyInfo.cs

     文件       2870  2012-10-31 20:53  gps授时\gps授时\Properties\Resources.Designer.cs

     文件       5612  2012-10-31 20:53  gps授时\gps授时\Properties\Resources.resx

     文件       1096  2012-10-31 20:53  gps授时\gps授时\Properties\Settings.Designer.cs

     文件        249  2012-10-31 20:53  gps授时\gps授时\Properties\Settings.settings

     文件        869  2012-10-31 20:53  gps授时\gps授时.sln

    ..A..H.     24064  2012-11-01 23:18  gps授时\gps授时.suo

    ..A..H.     44032  2012-11-01 17:10  gps授时\gps授时.v11.suo

     目录          0  2012-10-31 20:53  gps授时\gps授时\obj\x86\Debug\TempPE

............此处省略11个文件信息

评论

共有 条评论