/* 遺憾的是不能產(chǎn)生標(biāo)準(zhǔn)38kHz頻率的方波,有點(diǎn)誤差*/
#include
#define uchar unsigned char
#define uint unsigned int
sbit Waveout=P1^0; //P1.0口輸出方波
uchar
void main()
{
TMOD=0x01; //定時(shí)器0方式1
TH0=0xFF; ///由于晶振是11.0592MHz,每個(gè)機(jī)器周期約是1.09us,38kHz是26.3us產(chǎn)生一個(gè)方波,26.3/1.09需要計(jì)數(shù)24次,因而TH0=(65536-24)/256=255,即0xff
TL0=0xE8; //TL0=(65536-24)%256=232,即E8
EA=1;
ET0=1;
TR0=1;
while(1);
}
void T0_time() interrupt 1
{
TH0=0xFF;
TL0=0xE8;
Waveout=!Waveout;
}
- Keil MDK破解過(guò)程詳解[2019-03-20 10:47:17]
- STM32F407之模擬I2C(二)之24C128[2019-03-20 10:47:17]
- STM32F1使用I/0模擬I2C接口[2019-03-20 10:47:17]
- STM32模擬I2C程序[2019-03-20 10:47:17]
- STM8S 模擬I2C程序[2019-03-20 10:47:17]
- 普通IO口模擬實(shí)現(xiàn)I2C通信及應(yīng)用解析[2019-03-20 10:47:17]