69-老刘爱捣鼓示波器,使用OLED屏显示或者虚拟OLED接口显示,STC8H8K64U实验箱演示程
69-老刘爱捣鼓示波器,使用OLED屏显示或者虚拟OLED接口显示,STC8H8K64U实验箱演示程序, STC8H2K32U, STC8H2K12U, STC8H主程序main.C代码如下(汇编版本在附件中):
/*---------------------------------------------------------------------*/
/* --- Web: www.STCAI.com ---------------------------------------------*/
/* --- BBS: www.STCAIMCU.com-----------------------------------------*/
/* 如果要在程序中使用此代码,请在程序中注明使用了STC的资料及程序 */
/*---------------------------------------------------------------------*/
/*************功能说明 **************
/* 延时函数,由STC-ISP软件生成
Dealy Functions. Generated by STC-ISP Software*/
#include "delay.h"
void delay_ms(unsigned int ms)
{
unsigned int i;
do{
i = MAIN_Fosc / 10000;
while(--i); //10T per loop
}while(--ms);
}
//void Delay5ms() //@27.000MHz
//{
// unsigned char i, j;
// _nop_();
// i = 176;
// j = 80;
// do
// {
// while (--j)
// ;
// } while (--i);
//}
//void Delay50ms() //@27.000MHz
//{
// unsigned char i, j, k;
// _nop_();
// i = 7;
// j = 218;
// k = 55;
// do
// {
// do
// {
// while (--k)
// ;
// } while (--j);
// } while (--i);
//}
//void Delay1000ms() //@27.000MHz
//{
// unsigned char i, j, k;
// _nop_();
// i = 137;
// j = 249;
// k = 145;
// do
// {
// do
// {
// while (--k)
// ;
// } while (--j);
// } while (--i);
//}
void Delay3us() //@35.000MHz
{
unsigned char i;
i = 33;
while (--i);
}
//For scaleH 500ms with ADC_SPEED_512 20ms-26us-3us
void Delay19971us() //@35.000MHz
{
unsigned char i, j, k;
i = 4;
j = 139;
k = 196;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}
//For scaleH 200ms with ADC_SPEED_512 8ms-26us-3us
void Delay7971us() //@35.000MHz
{
unsigned char i, j, k;
i = 2;
j = 107;
k = 77;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}
//For scaleH 100ms with ADC_SPEED_512 4ms-26us-3us
void Delay3971us() //@35.000MHz
{
unsigned char i, j;
_nop_();
i = 181;
j = 125;
do
{
while (--j);
} while (--i);
}
//For scaleH 50ms with ADC_SPEED_512 2ms-26us-3us
void Delay1971us() //@35.000MHz
{
unsigned char i, j;
_nop_();
_nop_();
i = 90;
j = 148;
do
{
while (--j);
} while (--i);
}
//For scaleH 20ms with ADC_SPEED_512 800us-26us-3us
void Delay771us() //@35.000MHz
{
unsigned char i, j;
_nop_();
_nop_();
i = 36;
j = 8;
do
{
while (--j);
} while (--i);
}
//For scaleH 10ms with ADC_SPEED_512 400us-26us-3us
void Delay371us() //@35.000MHz
{
unsigned char i, j;
_nop_();
_nop_();
i = 17;
j = 218;
do
{
while (--j);
} while (--i);
}
//For scaleH 5ms with ADC_SPEED_512 200us-26us-3us
void Delay171us() //@35.000MHz
{
unsigned char i, j;
_nop_();
i = 8;
j = 195;
do
{
while (--j);
} while (--i);
}
//For scaleH 2ms with ADC_SPEED_512 80us-26us-3us
void Delay51us() //@35.000MHz
{
unsigned char i, j;
_nop_();
_nop_();
i = 3;
j = 78;
do
{
while (--j);
} while (--i);
}
//For scaleH 1ms with ADC_SPEED_352 40us-19us-3us
void Delay18us() //@35.000MHz
{
unsigned char i;
i = 208;
while (--i);
}
//For scaleH 500us with ADC_SPEED_192 20us-11us-3us
void Delay6us() //@35.000MHz
{
unsigned char i;
i = 68; //???~{!B~}/Fine tuning 52->44
while (--i);
}
页:
[1]