knrt.net
当前位置:首页 >> C51单片机编程怎么取平均值 >>

C51单片机编程怎么取平均值

多取几次 用冒泡法排列 从小到到大 取中间的值#define n 10 u8 a[n]={12,43,15,23,67,54,37,48,76,30}; void mp_() //冒泡法排序,从小到大 { char i,j; int m; for (i=1; i

你问的大概是while循环的控制。 检验标准:i>1时继续循环,否则循环结束,开始运行后面的语句。 控制:i=i-1,循环每执行一次,i-1一次,即使i初始值足够大,也总有i

如果只输出+,-12V的话你不如用个7812,7912这种12V稳压芯片 调整电压的话则需要DAC芯片即数字转模拟芯片,而且你的需要输出正负电压,DAC0800就是,不过是8位的,这个是他的资料 http://wenku.baidu.com/view/563bd5f9aef8941ea76e0538.html

方法类似,补写程序如下: #include #define uint unsigned int #define uchar unsigned char sbit LED=P0^0; sbit LED1=P0^1; void delay1ms (uint z) { uint x,y; for (x=z;x>0;x--) for (y=110;y>0;y--); } void exter() interrupt 2 { delay...

EX0=1;//开外部中断0 EA=0;//开总中断 lT0=1;//下降沿触发 然后写中断函数即可 void extern0( ) interrupt 0 { 执行动作语句 }

PJCJ: MOV R0,#30H MOV R2,#25 MOV 20H,#0 MOV 21H,#0 LP: MOV A,@R0 MOV B,#25 DIV AB ADD A,20H MOV 20H,A XCH A,B ADD A,21H MOV 21H,A XCH A,20H ADDC A,#0 MOV 20H,A INC R0 DJNZ R2,LP RET

#include#defineuintunsignedint#defineucharunsignedcharsbitdula=P2^6;sbitwela=P2^7;uchari,wei,ge,shi;uinttemp=23;ucharcodetable[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};//voidTimer0IRQ(...

#include "reg51.h" sbit key=P1^1;//按键IO,按下低电平 void main() { while(key);//等待按键按下 P2=0;//8个LED接在P2口的8个IO上,低电平点亮 }

#include#include "intrins.h"#include "absacc.h"#define uchar unsigned charuchar code ledtab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40,0xff};//0-9unsigned char disdat[4]="2018";sbit key=P3^0;void ext0() interrupt...

方法类似,补写程序如下: #include #define uint unsigned int #define uchar unsigned char sbit LED=P0^0; sbit LED1=P0^1; void delay1ms (uint z) { uint x,y; for (x=z;x>0;x--) for (y=110;y>0;y--); } void exter() interrupt 2 { delay...

网站首页 | 网站地图
All rights reserved Powered by www.knrt.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com