📄 sim.ini
字号:
/*----------------------------------------------------------------------------
* Name: Sim.ini
* Purpose: Functions used for simulating peripherals
* Version: V1.01
*----------------------------------------------------------------------------
* This file is part of the uVision/ARM development tools.
* This software may only be used under the terms of a valid, current,
* end user licence from KEIL for a compatible version of KEIL software
* development tools. Nothing else gives you the right to use this software.
*
* Copyright (c) 2005-2007 Keil Software. All rights reserved.
*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
Analog() simulates analog input values given to channel-1 (ADC1.0)
//下面实际是模拟一个三角波
*----------------------------------------------------------------------------*/
Signal void Analog (float limit) {
float volts;
printf ("Analog (%f) entered.\n", limit);
while (1)
{ // forever
volts = 0;
while (volts <= limit)
{
// analog input-1
//ADC1.0输入模拟电压
ADC1_IN0 = volts;
// wait 0.01 seconds
//延时0.01秒
swatch (0.01);
// increase voltage
//模拟电压步进增加0.1
volts += 0.1;
}
volts = limit;
while (volts >= 0.0)
{
// analog input-1
//ADC1.0输入模拟电压
ADC1_IN0 = volts;
// wait 0.01 seconds
//延时0.01秒
swatch (0.01);
// decrease voltage
//模拟电压步进减少0.1
volts -= 0.1;
}
}
}
//模拟输入电压,最大值是3
Analog(3)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -