33 lines
624 B
C
33 lines
624 B
C
#include "Beep.h"
|
|
#include "STC15F2K60S2.H"
|
|
#include "adc.h"
|
|
#include "sys.H"
|
|
|
|
code unsigned long SysClock = 11059200; //必须。定义系统工作时钟频率(Hz),用户必须修改成与实际工作频率(下载时选择的)一致
|
|
|
|
void getLightSensor()
|
|
{
|
|
struct_ADC status;
|
|
status = GetADC();
|
|
if (status.Rop < 20)
|
|
{
|
|
SetBeep(1200, 50);
|
|
}
|
|
else if (status.Rop > 100)
|
|
{
|
|
SetBeep(2000, 50);
|
|
}
|
|
}
|
|
|
|
void main()
|
|
{
|
|
BeepInit();
|
|
AdcInit(ADCexpEXT);
|
|
SetEventCallBack(enumEventSys10mS, getLightSensor);
|
|
MySTC_Init();
|
|
while (1)
|
|
{
|
|
MySTC_OS();
|
|
}
|
|
}
|