This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/MCU/MCU_5 _Wave_Generate/main.h
2022-04-28 10:00:04 +08:00

38 lines
No EOL
517 B
C

#ifndef _MAIN_H_
#define _MAIN_H_
#define MODE_3
//1三角2锯齿3正弦
#ifdef MODE_3
#define RELOAD (65535-217)
//#define RELOAD (65535-217)
#else
#define RELOAD (5000)
#endif
unsigned int TH, TL;
unsigned long int count = 0;
unsigned int ge,ui,bd,qm,wj,num;
void setConfig()
{
TH = RELOAD / 256;
TL = RELOAD - (RELOAD / 256) * 256;
TMOD = 0x01; //T0 16位定时 T1 16位计数
TH0 = TH;
TL0 = TL;
EA = 1; //打开中断总开关
ET0 = 1; //打开定时器0中断开关
TR0 = 1; //启动定时器0
P1 = 0X00;
}
#endif