?? 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)
//下面實(shí)際是模擬一個三角波
*----------------------------------------------------------------------------*/
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
//模擬電壓步進(jìn)增加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
//模擬電壓步進(jìn)減少0.1
volts -= 0.1;
}
}
}
//模擬輸入電壓,最大值是3
Analog(3)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -