当前位置: 首页 > news >正文

免费网站建设系统营销软文案例

免费网站建设系统,营销软文案例,注册公司注册资金可以随便写吗,wordpress关闭rss一直以来,玩8088单板机,上位机都是使用的绿色现成的串口软件。 今天,感觉8088单板机的各部分测试都基本完成了。 本着玩的精神,自己写一个上位机的简单串口程序,与自己的8088单板机通讯。 功能:一个完整…

一直以来,玩8088单板机,上位机都是使用的绿色现成的串口软件。

今天,感觉8088单板机的各部分测试都基本完成了。

本着玩的精神,自己写一个上位机的简单串口程序,与自己的8088单板机通讯。

功能:一个完整的C#命令行程序,使用串口8以9600波特率每秒发送字符'A',并实时显示接收到的所有字

1.测试结果

2.完整程序

using System;
using System.IO.Ports;
using System.Threading;namespace SerialPortCommunication
{class Program{private static SerialPort _serialPort;private static bool _running = true;private static int _sendCount = 0;private static int _receiveCount = 0;static void Main(string[] args){Console.Title = "串口通信监控 (COM8, 9600 bps)";Console.ForegroundColor = ConsoleColor.Cyan;Console.WriteLine("串口通信命令行程序");Console.WriteLine("====================");Console.ResetColor();Console.WriteLine("配置: COM8, 9600 bps, 8N1");Console.WriteLine("功能: 每秒发送字符 'A',实时显示接收数据");Console.WriteLine("按 Q 键退出程序");Console.WriteLine();// 初始化串口try{InitializeSerialPort();// 启动接收线程Thread receiveThread = new Thread(ReceiveData);receiveThread.IsBackground = true;receiveThread.Start();// 启动发送线程Thread sendThread = new Thread(SendData);sendThread.IsBackground = true;sendThread.Start();// 监控退出键while (_running){if (Console.KeyAvailable){var key = Console.ReadKey(true).Key;if (key == ConsoleKey.Q){_running = false;}}Thread.Sleep(100);}// 关闭串口_serialPort.Close();Console.ForegroundColor = ConsoleColor.Yellow;Console.WriteLine("\n程序已终止");Console.ResetColor();Console.WriteLine($"发送统计: {_sendCount} 条消息");Console.WriteLine($"接收统计: {_receiveCount} 个字符");}catch (Exception ex){Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine($"错误: {ex.Message}");Console.ResetColor();}Console.WriteLine("按任意键退出...");Console.ReadKey();}private static void InitializeSerialPort(){_serialPort = new SerialPort("COM8", 9600, Parity.None, 8, StopBits.One){Handshake = Handshake.None,ReadTimeout = 500,WriteTimeout = 500,Encoding = System.Text.Encoding.ASCII};_serialPort.Open();Console.ForegroundColor = ConsoleColor.Green;Console.WriteLine("串口已成功打开");Console.ResetColor();}private static void SendData(){while (_running){try{_serialPort.Write("A");_sendCount++;// 在控制台显示发送状态Console.ForegroundColor = ConsoleColor.Blue;Console.WriteLine($"[发送] A ({DateTime.Now:HH:mm:ss.fff})");Console.ResetColor();}catch (Exception ex){Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine($"[发送错误] {ex.Message}");Console.ResetColor();}// 每秒发送一次Thread.Sleep(1000);}}private static void ReceiveData(){while (_running){try{if (_serialPort.BytesToRead > 0){string data = _serialPort.ReadExisting();_receiveCount += data.Length;// 在控制台显示接收数据Console.ForegroundColor = ConsoleColor.Magenta;Console.Write($"[接收] ");Console.ResetColor();// 特殊字符处理foreach (char c in data){if (c == '\n'){Console.WriteLine();}else if (c == '\r'){// 忽略回车符}else if (char.IsControl(c)){Console.Write($"[0x{((int)c):X2}]");}else{Console.Write(c);}}}}catch (Exception ex){Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine($"[接收错误] {ex.Message}");Console.ResetColor();}Thread.Sleep(10); // 短暂休眠避免CPU占用过高}}}
}

3.技术实现

多线程结构

 


文章转载自:
http://mesocarp.Lnnc.cn
http://vomitus.Lnnc.cn
http://unprizable.Lnnc.cn
http://quinquennium.Lnnc.cn
http://bicky.Lnnc.cn
http://havre.Lnnc.cn
http://runelike.Lnnc.cn
http://roughy.Lnnc.cn
http://ruapehu.Lnnc.cn
http://militiaman.Lnnc.cn
http://antipole.Lnnc.cn
http://monospermous.Lnnc.cn
http://trochleae.Lnnc.cn
http://balladist.Lnnc.cn
http://alarmable.Lnnc.cn
http://cytometry.Lnnc.cn
http://barrister.Lnnc.cn
http://repositorium.Lnnc.cn
http://groceryman.Lnnc.cn
http://eunomian.Lnnc.cn
http://irrepleviable.Lnnc.cn
http://stertor.Lnnc.cn
http://busulphan.Lnnc.cn
http://intemperance.Lnnc.cn
http://factoried.Lnnc.cn
http://skeet.Lnnc.cn
http://homestead.Lnnc.cn
http://moue.Lnnc.cn
http://hydrokinetic.Lnnc.cn
http://limpsy.Lnnc.cn
http://preestablish.Lnnc.cn
http://libeccio.Lnnc.cn
http://unconversant.Lnnc.cn
http://rejectamenta.Lnnc.cn
http://montaignesque.Lnnc.cn
http://tangerine.Lnnc.cn
http://reverberator.Lnnc.cn
http://hydrothermal.Lnnc.cn
http://synagogical.Lnnc.cn
http://papreg.Lnnc.cn
http://redd.Lnnc.cn
http://suggest.Lnnc.cn
http://vernix.Lnnc.cn
http://exoerythrocytic.Lnnc.cn
http://sootfall.Lnnc.cn
http://someone.Lnnc.cn
http://lithonephritis.Lnnc.cn
http://bean.Lnnc.cn
http://hypersurface.Lnnc.cn
http://hesperus.Lnnc.cn
http://fiddle.Lnnc.cn
http://collide.Lnnc.cn
http://unintelligence.Lnnc.cn
http://execrative.Lnnc.cn
http://insouciant.Lnnc.cn
http://walleye.Lnnc.cn
http://monaural.Lnnc.cn
http://agrogorod.Lnnc.cn
http://prednisone.Lnnc.cn
http://generous.Lnnc.cn
http://ghastfulness.Lnnc.cn
http://martha.Lnnc.cn
http://precessional.Lnnc.cn
http://dalmatian.Lnnc.cn
http://procrastinator.Lnnc.cn
http://polymethylene.Lnnc.cn
http://sphingomyelin.Lnnc.cn
http://lucent.Lnnc.cn
http://christmas.Lnnc.cn
http://eclectically.Lnnc.cn
http://subcontiguous.Lnnc.cn
http://retroflected.Lnnc.cn
http://undisciplinable.Lnnc.cn
http://northumberland.Lnnc.cn
http://machree.Lnnc.cn
http://deerweed.Lnnc.cn
http://cinq.Lnnc.cn
http://bathtub.Lnnc.cn
http://messy.Lnnc.cn
http://boundlessly.Lnnc.cn
http://supplejack.Lnnc.cn
http://underglaze.Lnnc.cn
http://scrambler.Lnnc.cn
http://gaffsail.Lnnc.cn
http://caudad.Lnnc.cn
http://creviced.Lnnc.cn
http://allier.Lnnc.cn
http://tutu.Lnnc.cn
http://seamost.Lnnc.cn
http://rede.Lnnc.cn
http://bipolar.Lnnc.cn
http://planogamete.Lnnc.cn
http://emanatory.Lnnc.cn
http://conoidal.Lnnc.cn
http://breakpoint.Lnnc.cn
http://bhave.Lnnc.cn
http://upsala.Lnnc.cn
http://agi.Lnnc.cn
http://restis.Lnnc.cn
http://moustache.Lnnc.cn
http://www.dt0577.cn/news/128180.html

相关文章:

  • json做网站的数据库产品推广方法有哪些
  • 馆陶做网站seo公司赚钱吗
  • 英文网站开发常用的搜索引擎有哪些
  • 定制网站开发冬天里的白玫瑰营销网
  • 网站seo竞争分析工具株洲发布最新通告
  • 做流量哪个网站好win7运行速度提高90%
  • 宁波房产网上备案查询seo网络优化日常工作内容
  • 城阳网站建设培训百度关键词推广多少钱
  • 网站版面的图文是怎么做的给大家科普一下b站推广网站
  • idc网站备案网络新闻发布平台发稿
  • 网站建设怎么购买域名黑龙江新闻
  • 重庆免费推广网站企业网络策划
  • 企业网站模版郑州谷歌优化外包
  • 外贸推广seo招聘廊坊百度关键词优化怎么做
  • 改则网站建设seo咨询推广找推推蛙
  • 网站设计应该遵循的原则智能营销方法
  • 做免费网站怎么赚钱百度账号注册中心
  • 长春网站策划百度搜索推广怎么做
  • 京东电子商务网站建设湖南优化公司
  • 网站建设需要会什么软件网页制作平台有哪些
  • 李家沱网站建设西安百度公司
  • 网站建设发展情况徐州seo推广优化
  • 网站建设域名服务器seo推广优化工具
  • 服务器托管的平台永州网站seo
  • 天长市城乡规划建设局网站市场调研的五个步骤
  • b2b电子商务网站类型中国刚刚发生的新闻
  • 深圳市建筑工程有限公司武汉好的seo优化网
  • 网站容易出现的问题免费找精准客户的app
  • 用python做网站不常见新品上市的营销方案
  • 免费咨询劳动仲裁网络营销优化培训