使用传统IDE对51单片机进行逻辑编写的基本小框架

向大家推荐一个好用的单片机IDE---EmBitz EmBitz STM32单片机程序开发 也许很多朋友常用的IDE 有keil,IAR,Eclipse等常见工具,keil,IAR各有优劣吧,我开始学单片机的时候也是从这两个IDE开始的。但是工作后也许有些公司可能也跟我们公司一样不给你买IDE同时你又不能用收费软件的时候,我相信很多朋友开始折腾GCC编译器的IDE。我接触过Eclipse,COIDE,都有很明显的缺点这里就不细说 阅读详情

使用传统IDE对51单片机进行逻辑编写的基本小框架:


#include <stdio.h>

void Init();        //对各类变量进行初始化
void runCore();     //对单片机定时器,串口模拟用变量进行实时变更
void runMain();     //运行主函数
void runTimer();    //运行定时器中断
void runExter();    //运行外部中断
void runSer();      //运行串口中断

int main(){
    Init();
    while (1){
        runCore();
        runMain();
        runTimer();
        runExter();
        runSer();
    }
    return 0;
}
普中51单片机:经典入门与应用开发 普中51单片机凭借其经典而稳定的架构,结合现代技术的进步,继续为工程师们提供了一个可靠的学习和开发平台。无论你是刚刚踏入嵌入式领域的新人,还是有一定经验的开发者,普中51单片机都能为你带来不少乐趣和挑战。希望这篇文章能够帮助你更好地了解这款单片机,并激发你动手尝试的兴趣。如果你有任何疑问或者想要分享你的项目经历,请随时留言交流! 阅读详情

相关推荐

51单片机实现的语音计算器项目实战

本文还有配套的精品资源,点击获取 简介:本项目是一个基于51单片机的语音计算器应用,涵盖了从硬件选择到软件开发的各个方面。它结合了语音合成技术与嵌入式系统设计,特别适合学生课程设计或毕业设计,以深入理解单片机应用。关键实现包括文本转语音(TTS)技术,按键输入处理,数值计算,存储器管理,串行通信,定时器/计数器应用,以及电源管理。源代码资源可在提供的压缩包中找到,为学习者提...

weixin_42146230的博客 1474

51单片机超声波测距项目设计详解

超声波测距技术是一种利用超声波作为媒介来测量物体距离的方法。该技术广泛应用于工业自动化、汽车泊车辅助系统以及机器人导航等领域,其核心在于测量声波从发射到接收的时间差,并将时间差转换为距离值。超声波测距系统通常包括发射器、接收器以及微处理器等关键部分,能够实现非接触式测量,具有成本低廉、适应性强和准确度高的特点。在具体应用中,超声波测距技术有效地解决了传统测量方法在恶劣环境下的应用限制,尤其在精确度要求不高的场合,表现出了卓越的性能和广泛的应用前景。

weixin_35751194的博客 861

基于51单片机的生产线自动化控制系统

51单片机是一种经典的微控制器,它以Intel 8051为内核,广泛应用于嵌入式系统的开发和学习。其编程语言多样,包括C语言和汇编语言,因其简单易学和资源丰富而被IT行业广泛使用。

weixin_42599908的博客 1020

51单片机仿真电路学习板ISIS实战教程

51单片机核心由CPU、RAM、ROM、定时器/计数器、中断系统及I/O端口构成,采用冯·诺依曼架构,运行频率通常为12MHz或11.0592MHz。其内部包含128B RAM(部分型号扩展至256B),4KB~64KB Flash ROM,支持3个或更多定时器,具备5个中断源(含2个外部中断)。// 示例:基础I/O操作代码(点亮P1.0连接的LED)P1_0 = 0;// 输出低电平驱动LED亮起while(1);// 循环等待。

weixin_26907223的博客 1474

51单片机在智能水产养殖系统中的应用与实践

随着科技的进步和人口的增加,全球对食品的需求不断上升,尤其是在水产品方面。传统的水产养殖方法已难以满足现代高效、绿色、可持续发展的要求。智能水产养殖系统就是在这样的背景下应运而生,它利用物联网、传感器技术、数据处理和自动化控制技术,实现对养殖环境的精确控制和管理,提高养殖产量和质量,降低生产成本,保护环境。

weixin_42612405的博客 1122

keil 51单片机IDE

keil 51单片机IDE

mcu8051ide_开源的8051单片机开发环境

优秀的开源的8051IDE,可以仿真,提供常规的外设部件,支持C和asm源文件,可以运行在windows和Linux平台下,windows下的版本为1.4.6,Linux下的版本为1.4.9,且Linux下的为源代码方式安装。

单片机版LCD液晶显示(汇编程序)

适合单片机初学者,弄懂它液晶显示就没问题

FPGA数据采集避坑指南:3PA1030 ADC的时钟相位、量程标志OVR与输出使能OE到底怎么用?

本文深入解析FPGA与3PA1030 ADC协同设计中的关键问题,包括时钟相位优化、OVR超量程监控和OE输出使能配置。通过实战案例和代码示例,详细探讨如何避免常见设计陷阱,提升数据采集系统的信噪比和稳定性,特别适合AD和FPGA开发者参考。

weixin_42620340的博客 1915

基于Docker的D435i相机与IMU联合标定实战指南

本文详细介绍了基于Docker的D435i相机与IMU联合标定实战指南,涵盖kalibr镜像构建、IMU标定全流程、双目相机标定技巧及联合标定结果验证。通过Docker容器化部署,简化了复杂依赖环境,提升标定效率与精度,适用于机器人视觉与SLAM应用。

weixin_30872337的博客 248

TensorRT-LLM.V1.1.0rc0:在无 GitHub 访问权限的服务器上编译 TensorRT-LLM 的完整实践

1.NGC上的预构建发布容器进行部署,见《2.通过pip进行部署。3.从源头构建再部署。在实际开发中,我们常常面临这样的场景:本地笔记本为 Windows 系统,虽然可以访问 GitHub,但受限于硬件性能,编译大型项目(如 TensorRT-LLM)耗时过长;而公司或实验室提供的 Linux 服务器性能强劲,适合编译任务,但却因网络策略限制无法连接外网,尤其是无法访问 GitHub。。

xinvictory的专栏 1209

回答网友提问:Word 里如何调用 DeepSeek API?

上面的 Visual Basic 定义了名叫 DeepSeekV3 的 subroutine,同理我们可以让 Trae 再写一个调用开启了 DeepThink(R1) 模式的 DeepSeek API,步骤类似,这里不再赘述。在 Word 的 File->Options 选项里,选择 Customize Ribbon,将 Developer 标签从左侧移到右侧,然后在 Developer 标签下新建一个 Group,随便起个名称。API 调用的 response,自动填充到了 Word 里。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 285

【漏洞复现】CVE-2024-44902 Thinkphp反序列化漏洞

Thinkphp v6.1.3至v8.0.4版本中存在反序列化漏洞,攻击者可利用此漏洞执行任意代码。

渗透之路,攻防之间皆学问 6738

使用自制的NTC测量模块测试Plecs的热仿真效果

可以测试:您完全可以用这个模型来测试热仿真。NTC 模型是连接电气域和热域的关键桥梁。实现闭环:通过这种方式,您创建了一个高度真实的正反馈闭环系统:负载增加 -> 损耗增加 -> 温度升高 -> NTC 阻值变化 -> 控制电路可能因此调整(如降低频率或电流)-> 损耗变化 -> 温度变化。应用场景:这对于设计过温保护 (OTP) 电路风扇控制系统以及分析热失控条件非常有用。单位:确保热域中使用的单位( Kelvin 或 Celsius )与您的 C-Script 模型输入期望的单位一致。

315

Open3D(C++) 统计滤波【2025最新版】

 统计滤波器用于去除明显离群点,离群点往往由测量噪声引入,其特征是在空间中分布稀疏,可以理解为:每个点都表达一定信息量,某个区域点越密集则可能信息量越大。噪声信息属于无用信息,信息量较小。所以离群点表达的信息可以忽略不计。...

点云侠的博客 1126

VAY 是 SAP 自动科目确定(OBYC-GBB)中的科目修改码,专用于带科目分配对象的销售订单发货场景,核心是触发 “Dr 成本要素科目(如销售费用 / 特定成本对象) Cr 库存商品” 的分录,

摘要:VAY是SAP中用于带科目分配对象(如成本中心、WBS)的销售订单发货的科目修改码,与标准VAX场景不同,它生成"借成本要素科目/贷库存商品"的分录。配置路径为OBYC-GBB-VAY,需确保借方科目为成本要素。典型业务场景包括免费样品、项目专用发货等。常见问题包括VAY未触发或科目记账错误,需检查销售订单科目分配、移动类型设置及OBYC配置。特殊场景建议单独配置科目以便费用分析。

金牌架构师 1265

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

下一篇: 嵌入式面试问题(1)——HelloWorld
t24kun
博客等级 码龄9年 0粉丝 7原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址