Location:
Search - delay_ms
Search list
Description: #include <reg51.h>
void delay_ms(unsigned short ms)
{
unsigned short i
unsigned char j
for(i=0 i<ms i++)
{
for(j=0 j<200 j++)
for(j=0 j<102 j++)
}
}
Platform: |
Size: 981 |
Author: 刘东 |
Hits:
Description: #include <reg51.h>
void delay_ms(unsigned short ms)
{
unsigned short i
unsigned char j
for(i=0 i<ms i++)
{
for(j=0 j<200 j++)
for(j=0 j<102 j++)
}
} -# Include <reg51.h> void delay_ms (unsigned short ms) (unsigned short i unsigned char j for (i = 0 i <ms i++) (For (j = 0 j <200 j++) For (j = 0 j <102 j++)))
Platform: |
Size: 1024 |
Author: 刘东 |
Hits:
Description: u_reg.h"
void Delay_MS(unsigned int ms)
void main()
{
asm(" STM #0000h,CLKMD ")
while(*CLKMD & 0x01 )
asm(" STM #40C7h,CLKMD ") //设置CPU运行频率=100M
/* 40C7h:5*clkin =100M
30c7h:4*clkin =80M
20c7h:3*clkin =60M
10C7h:2*clkin =40M
*/
asm(" stm #4240h, SWWSR ")
//2 wait except for on-chip program 1
asm(" stm #00a0h, PMST ") //MP/MC = 0, IPTR = 001,ovly=0
asm(" stm #0802h, BSCR ")
asm(" STM #0h,IMR ")
while(1)
{
Delay_MS(500)
asm(" RSBX XF ")
Delay_MS(500)
asm(" SSBX XF ")
}
-sdqwd
Platform: |
Size: 621568 |
Author: zhang |
Hits:
Description: 跑马灯程序,所用单片机为Atmega32,闪亮时间没有设定,可通过调节delay_ms()函数进行调节-Marquee program for the microcontroller of this procedure, the use of microcontroller Atmega32, lights flashing interval is not set.
Platform: |
Size: 1024 |
Author: 王凯 |
Hits:
Description: P1口做输入口,接八个拨码开关,以P0口做输出口,接八只发光二极管,(1)编写程序使发光二极管循环点亮。(2)读取开关状态,在二极管上显示出来。
1、根据要求设计接口电路的接线。
2、编写程序使发光二极管循环点亮,时间变化间隔0.5秒
3、编写程序读取开关状态,在二极管上显示出来。
- #include <reg51.h>
#define LED P1 //宏定义,使用LED代替P1口(相当于LED=P1)
#define uchar unsigned char //用uchar代替unsigned char方便操作
#define uint unsigned int
/*------------------time ms延时函数-----------------*/
void delay_ms(uint time)
{
uchar tres
for( time>0 time--)
{
tres=150
while(tres--)
}
}
void main()
{
uchar t
LED=0X01 //P1=00000001B
while(1)//死循环,不停的点亮和熄灭LED
{
for(t=0 t<8 t++)
{
LED=~LED //按位取反,点亮一个LED
delay_ms(100) //延时0.1s
LED=~LED //按位取反
LED<<=1 //左移一位,点亮不同的LED
}
LED=0X80 //P1=10000000B
for(t=0 t<8 t++)
{
LED=~LED //按位取反,点亮一个LED
delay_ms(100) //延时0.1s
LED=~LED //按位取反
LED>>=1 //右移一位,点亮不同的LED
}
LED=0X01 //P1=00000001B
}
}
Platform: |
Size: 1024 |
Author: mayue |
Hits:
Description: 采用DS18B20和STM32F103RBT6编写的测温程序,每秒从USART1输出温度数据。采用3.5版固件库,自编DS18B20库文件,需要注意的是使用本库前需要写delay_us和delay_ms函数。电路上采用8M晶振,PA8为数据口,如有变化请修改stm32f10x_conf.h文件。-The temperature program DS18B20 and STM32F103RBT6-written per second from USART1 output temperature data. The version 3.5 firmware library, composing the the DS18B20 libraries should be noted that before using the library need to to write delay_us and delay_ms function. 8M crystal oscillator circuit, PA8 data port, if the changes please modify the stm32f10x_conf.h file.
Platform: |
Size: 9216 |
Author: |
Hits:
Description: STM32延迟库函数,采用SysTick计时,包含delay_us、delay_ms功能,实测误差0.6us。-Delay functions of STM32 library, Using ysTick timer for timing. It includes delay_us and delay_ms function. The measured error is 0.6us according to the oscilloscope.
Platform: |
Size: 2048 |
Author: |
Hits:
Description: stm32驱动4X4键盘扫描,用于键盘扫描-/*******************************************************************************
* File Name : KeyScan
* Description : Serial print out the corresponding key value
*******************************************************************************/
#include"stm32f10x.h"
#include"KeyScan.h"
#include"SysTick.h"
#include"USART.h"
/*******************************************************************************
* Function Name : main
* Description : Main program.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
int main(void)
{
SysTick_Init() //延时初始化
USART_GPIO_Config() //串口初始化
USART_Config()
Keyboard_Interrupt_Init() //矩阵键盘初始化
while(1)
{
printf("\nBelieve yourself\n")
delay_ms(1500)
if(Keyboard_Val)
{
switch(Keyboard_Val)
{
case 1:printf("\n1\n") Keyboard_Val=0 break
case 2:printf("\n2\n") Keyboar
Platform: |
Size: 1024 |
Author: henry |
Hits:
Description: 这是一个通用的STM32启动及控制代码集.它没有使用ST的库,完全是基于寄存器的操作.它包括三部分:
1,sys
sys部分包含了STM32的系统级别的代码,包括:时钟配置,IO口输入输出管理,中断管理,待机模式设置,BKP操作,软复位,JTAG配置等.
2,usart
usart部分包含了对串口1的初始化,用于串口调试,或者串口打印信息.
3,delay
delay部分包含了2个基本的延时数,delay_us和delay_ms,这两个函数采用STM32的SYSTICK作为延时定时器,所以在使用delay的时候,需要占用SYSTICK.-kei4 stm32 gprs
Platform: |
Size: 851968 |
Author: July |
Hits:
Description: 本程序只供学习使用,未经作者许可,不得用于其它任何用途-int main(void)
{
Key_Init()
LED_Init()
LCD_Init()
Touch_Init()
COM1Init(115200)
LCD_Clear(BLUE)
LCD_String(20,20, Vido play! ,RED)
delay_ms(500)
AVI_play()
while(1)
{
delay_ms(500)
LEDTog(LED1)
}
}
Platform: |
Size: 9680896 |
Author: lianghao |
Hits:
Description: 相比labview中的Vi控件要好,可以精确延时到毫秒。(Can be accurately delayed to milliseconds.)
Platform: |
Size: 20480 |
Author: 小宝哥。, |
Hits:
Description: stm32F103 adc采样程序,包括初始化和配置等(u16 ADC_Get_aveg(u8 ch,u8 n)
{
u32 ad_sum = 0;
u8 i;
for(i=0;i<n;i++)
{
ad_sum += Get_val(ch);
delay_ms(5);
}
return (ad_sum / n))
Platform: |
Size: 351232 |
Author: stevenli |
Hits: