中微CMS8S5880 LED灯点亮

中微CMS8S3680/69xx系列单片机 另外它的存储器资源也是很丰富的,16K字节ROM,256字节RAM以及512字节的XRAM,对于一般的程序是绰绰有余了。4、demo_adc.c:主要是ADC检测及NTC贴片电阻不同阻值下对应的AD值表,然后程序根据AD值表获取相应的温度信息。AD取样每两毫秒进行一次,12V输出电压共检测16次,温度值检测共8次,然后取平均值。12V /53V输出异常出高(电源风扇异常、输出过压、输出限流、输出短路、电源过温保护)输出>13V,4脚出高(打嗝保护)(3V保护,2.8V恢复正常) 阅读详情

废话不多直接上代码

main.c

#include "uart.h"
#include "pwm.h"
#include "led.h"
#include "stdio.h"
#include "sys_time.h"
#include "timer.h"
#include "my_iic.h"



void main()
{
	UART0_INIT();								//initinal UART
	PWM_init();
	LED_INIT();
	Timer2Init();
	set_pwm5_Duty_cycle(30);
	IIC_GPIO_Init();
	printf("code start\r\n");
	EA = 1;//使能总中断
	calc_value_pressure();
	LED4_ON;
	LED5_ON;
	while(1)
	{
		if(get_sys_time_ms() % 100 == 0)
		{
			Put_press_and_temp_value();
			printf("Pressure %f\r\n",pressure);
			printf("TEMP %f\r\n",temp); 
		}
		clrwdt();	
	}

}

lib.h

#ifndef __LIB_H__
#define __LIB_H__

#define BIT0 0x01
#define BIT1 0x02
#define BIT2 0x04
#define BIT3 0x08
#define BIT4 0x10
#define BIT5 0x20
#define BIT6 0x40
#define BIT7 0x80



#endif

led.c

#include "led.h"
#include <CMS/CMS8S5880.H>
#include "lib.h"

void LED_INIT(void)
{
	P04CFG = 0x00;//GPIO
	P05CFG = 0x00;
	
	P0TRIS	|=	(BIT4 | BIT5);						//输出设置
	P0UP	&=	~(BIT4 | BIT5);						//上拉电阻	
	P0RD	&=	~(BIT4 | BIT5);						//下拉电阻	
	P0OD	&=	~(BIT4 | BIT5);						//推挽输出

	LED4_OFF;
	LED5_OFF;
}

led.h 

#ifndef __LED_H__
#define __LED_H__

#define LED4_ON   P0_4 = 0
#define LED4_OFF  P0_4 = 1

#define LED5_ON   P0_5 = 0
#define LED5_OFF  P0_5 = 1

void LED_INIT(void);

#endif

 

 

 

中微8S6990使用过程的一些记录--GPIO初始化、定时器、PWM、ADC、休眠等外设的配置和使用 中微8S6990单片机的GPIO初始化、定时器、PWM、ADC、休眠等外设的配置和使用 阅读详情

相关推荐

CMS8S5880 demo代码包实战:外设驱动解析与避坑指南

在嵌入式开发中,8位MCU的外设驱动开发是基础且关键的环节。其原理是通过寄存器配置实现GPIO、定时器、UART等外设的初始化与控制,技术价值在于提供稳定可靠的底层驱动,降低开发门槛。典型应用场景包括工业控制、消费电子和物联网终端设备。针对CMS8S5880芯片,demo代码包V1.1版本提供了统一风格的外设驱动示例,涵盖启动流程、时钟配置、中断处理等核心内容,并总结了常见问题与排查方法,帮助开发者快速上手并避免常见错误。

weixin_29168393的博客 67

中微CMS8S5880 串口输出

废话不多直接上代码 main.c #include "uart.h" #include "pwm.h" #include "led.h" #include "stdio.h" #include "sys_time.h" #include "timer.h" #include "my_iic.h" void main() { UART0_INIT(); //initinal UART PWM_init(); LED_INIT(); Timer2Init(); set_pwm

dailin2012的博客 2148

中微单片机手持风扇项目解析:PWM调速与低功耗设计

在消费级小家电设计中,单片机作为控制核心,常需兼顾成本、功耗与功能完整性。以电池供电的手持风扇为例,其系统涉及PWM调速、锂电池充放电管理、ADC电量检测及低功耗唤醒等典型环节。PWM通过调节占空比实现电机转速控制,需合理选择频率以平衡噪声与开关损耗;锂电池管理则需关注充电电流、电压检测与低压保护,避免过放损伤电池。低功耗设计在关机状态下利用外部中断唤醒MCU,将待机电流降至微安级。这类方案融合了嵌入式开发中的硬件选型、电路设计与软件状态机实现,是理解小家电产品落地的良好范例。本文基于中微CMS8S系列8位

weixin_29185493的博客 34

中微SC2892B范例程序:掌握核心功能,助力高效开发

中微SC2892B范例程序:掌握核心功能,助力高效开发 去发现同类优质开源项目:https://gitcode.com/ 项目介绍 在现代电子领域,智能芯片的应用日益广泛。中微SC2892B范例程序,正是为了满足开发者和工程师的需求而打造。该程序提供了一套详尽的操作指南,旨在帮助用户深入理解和灵活运用中微SC2892B系列产品的强大功能。 项目技术分析 中微SC2892B范例程序涵盖了该系列产品的...

gitblog_06755的博客 921

iWriterPro 中微爱芯烧录器程序

iWriterPro 中微爱芯烧录器程序,iWriterPro 烧录器支持多款 MCU 烧录而无需转接板,采用免驱 USB 接口与 PC 进 行通讯,能够根据所选芯片型号自动调节烧录电压。

CMS8S5880_democode_V1.1.zip

中微CMS8S5880示例代码

cms8s6990移植代码后编译无报错烧录不能正常运行的原因

在keil中添加代码文件进行编译后,即使在原来的代码中并未对新添加的代码进行调用,编译时也会为新添加的代码及其定义的变量分配内存空间。需要使用code const进行定义,可以看到使用code const进行定义后,数组被定义在了const区。优化代码,减小xdata的大小。

whIIe的博客 675

CMS8S6990单片机例程

针对使用CMS8S6990单片机芯片使用的应用场景,该案例提供了各个模块使用的详细例程,包括ADC,IIC,GPIO,中断,定时器等的案例使用。

中微CMS8S5880:8051家族的强力新星

中微半导体推出的CMS8S5880,作为其8位8051系列的新成员,在传承经典的同时,更以卓越的性能和丰富的功能,为开发者带来更多可能。中微CMS8S5880作为一款高性能、低功耗、功能丰富的8位8051单片机,凭借其优异的性能和便捷的开发体验,必将成为嵌入式系统开发者的理想选择,为各类应用场景带来更智能、更高效的解决方案。CMS8S5880采用先进的低功耗设计,支持多种低功耗模式,在满足性能需求的同时,有效降低系统功耗,延长电池寿命,适用于对功耗敏感的应用场景。智能照明、智能门锁、智能家电等。

szghwy的博客 895

TCGA之GDC-client工具下载安装与使用

文章主要是对GDC-client工具下载TCGA数据库数据整个过程的一个记录 1.下载GDC-client工具 GDC-client工具网址:GDC Data Transfer Tool | NCI Genomic Data Commons (cancer.gov) 我这里下的是上图中红圈中的版本, 2.解压安装 从网上了解的是不能解压到带中文的路径里,解压后是一个.exe文件,为了能直接在cmd命令行下使用,将其加入系统环境: 点击新建之后,输入将文件解压到的路径,然后...

better_strong的博客 1万+

N32G003学习——第九章 第三节1 串口 发送

经过第九章前2节的学习,基础打下之后,开始敲代码。

qq_34525008的博客 1034

CMS8S5880的烧录端口复用

5880的烧录端口作为IO使用时,必须在keil工程的配置选项里面disable 调试模块。否则,复用失败。 另外低功耗模式也要disable调试模块才能做到低功耗。

只要路是对的,就不害怕遥远 2004

桂电 数电实验 期末考试 试卷+解析(74LS192 + 74LS153 + 74LS139 + 74LS00 / 74LS20)

桂电 数电实验 期末考试 试卷+解析(74LS192 + 74LS153 + 74LS139 + 74LS00 / 74LS20)

Molly 的博客 1万+

中微CMS8S5880 PWM输出 占空比可调

废话不多直接上代码 main.c #include "uart.h" #include "pwm.h" #include "led.h" #include "stdio.h" #include "sys_time.h" #include "timer.h" #include "my_iic.h" void main() { UART0_INIT(); //initinal UART PWM_init(); LED_INIT(); Timer2Init(); set_pwm

dailin2012的博客 1929

OpenClaw(原Clawdbot/Moltbot)本地部署快速指南

支持Telegram、Slack、Discord、iMessage等多平台接入,通过配置文件或环境变量填写对应平台的Token,配置后执行。支持对接OpenAI、Anthropic、阿里云百炼等云端模型,也可搭配Ollama使用本地模型。默认仅允许已配对用户交互,群聊场景建议开启Docker沙箱模式,在配置文件设置。执行后跟随指引确认安全说明,进入QuickStart模式,默认网关端口为。可查看已加载模型,通过绑定的通讯通道发送测试指令,响应正常即部署完成。,限制非主会话操作权限,提升安全性。

wukangjupingbb的博客 8478

光学遥感显著目标检测初探笔记总结

一张图片里最吸引注意力的部分就是显著性物体,其实是模拟人的一个注意力机制。目标是希望通过计算机的方法让我们自动定位和模拟人的这种感知能力,从而去定位场景中的一个让人感兴趣的目标。

醋酸洋红的博客 2077

记录使用中微芯片CMS8S6990的经验

1T意思是一个机器周期对应一个时钟周期,机器周期就是TMD算定时器计数器+1的时间,单位一般是us,一个机器周期计数+1。经典的8051机器周期是12T,一个机器周期对应12时钟周期。,时钟源分为外部晶振高速(HSE)低速(LSE)和内部振荡器高速(HSI)低速(LSI),使用时选择合适的时钟源,单片机执行一条指令的周期(没用过),一般来说执行一个指令需要一个机器周期,复杂指令需要1~2个时钟周期。前辈告诉我用好什么芯片必看手册,网上别人是借鉴,还有前辈告诉我工作之后养成写博客的习惯。

qq_51797019的博客 2155

51单片机入门指南-基于STC89C52(持续更新)

一、环境介绍 编程IDE: keil5 单片机型号: STC89C51/52 开发板: 普中科技的开发板 完整PDF资源下载地址:https://download.youkuaiyun.com/download/xiaolong1126626497/19785856 二、51单片机开发手册介绍 2.1 前言 51单片机是对所有兼容Intel 8031指令系统的单片机的统称。 该系列单片机的始祖是Intel的8004单片机,后来随着Flash rom技术的发展,8004单片机取得了长足的进展,成为应用最.

8797

中微8S6990 EEPROM踩坑记录

原先是我个人的误解,原先我理解为了擦除CODE区的最小操作单位是扇区,而DATA区的最小单位是字节。所以也是一个乌龙事件。‍。

Pd的博客 1696

【雕爷学编程】Arduino FOC 之 AS5600 磁编码器的模拟电压与IIC通信

在Arduino平台上实现FOC可以提供平滑的运行和高度的扭矩、速度和位置控制,它通过精确控制电机的电流和电压来实现高效率、高精度和低噪声的操作。案例三在使用I2C通信读取角度值的基础上,添加了设置角度范围的功能。5、创新:Arduino可以让你用电子的方式来表达你的创意和想象,你可以用Arduino来制作各种有趣和有用的项目,如机器人、智能家居、艺术装置等。1、高性能电机控制:FOC是一种高级的电机控制算法,可以精准控制PMSM(永磁同步电机)和BLDC(无刷直流)电机,实现平滑的转速和扭矩输出。

雕爷学编程 1499

第14.8章 高翔博士最新开源框架Lightning-LM源码解读(八):位姿平滑器PoseSmoother深度剖析,从原理到代码实现

本文深度解析了高翔博士开源框架Lightning-LM中的位姿平滑器PoseSmoother模块。该模块通过设置平滑因子,在保证位姿准确性的同时减少突变,使位姿变化更平稳。文章详细讲解了模块功能、数据流程和核心代码实现,包括构造函数、拷贝构造函数以及关键的PushDRPose和PushPose函数。重点分析了位姿平滑算法原理,涉及运动有效性校验、位姿队列维护和平滑因子调节等核心机制。此外还介绍了相关C++语法(如显式构造函数、默认拷贝构造)和优化方向。本解析为SLAM学习者提供了位姿平滑处理的实用实现范例。

行知SLAM 601

CMS8S6990中微芯片_TxRxKeyLed

main.C /******************************************************************************* * Copyright (C) 2019 China Micro Semiconductor Limited Company. All Rights Reserved. * * This software is owned and published by: * CMS LLC, No 2609-10, Taurus Plaza, T

a14796210416的博客 2398

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

中微单片机IO口复用方式控制LED数码管

中微单片机IO口复用方式控制LED数码管。

fpd_led的博客 1253

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

CMS8S6990TS20 keil 程序 问题总结

YovaVan的博客 566

深度学习工具包 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")

中微CMS8S5898:8051系列高性价比MCU,赋能多样化应用

中微半导体推出的CMS8S5898,作为一款高性价比8位8051系列MCU,凭借其稳定的性能、丰富的外设资源和低功耗设计,成为通用产品线中的热门选择,为各种嵌入式应用提供经济高效的解决方案。中微CMS8S5898是一款高性价比、稳定可靠的8位8051系列MCU,其丰富的资源、低功耗设计和便捷的开发环境,使其成为通用产品线中的热门选择,能够满足各种嵌入式应用的需求,为开发者提供经济高效的解决方案,助力产品快速上市。此外,中微半导体还提供丰富的技术文档和参考设计,帮助开发者快速上手,加速产品上市。

szghwy的博客 908

中微 CMS8S5880 timer2

废话不多直接上代码 main.c #include "uart.h" #include "pwm.h" #include "led.h" #include "stdio.h" #include "sys_time.h" #include "timer.h" #include "my_iic.h" void main() { UART0_INIT(); //initinal UART PWM_init(); LED_INIT(); Timer2Init(); set_pwm

dailin2012的博客 1322
上一篇: STM32G031 HAL库TIM2 PWM使用 占空比可调
下一篇: 中微CMS8S5880 串口输出
dailin 2012
博客等级 码龄10年 173粉丝 135原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值