📄 红外遥控器.c
字号:
/*****************************************************
CodeWizardAVR V1.25.3 Professional
Project : 红外遥控器
Version : V 1.0.0
Date : 2007-08-10
Author : Aleyn.wu
Company : www.e-midas.cn
E-mail : aleyn@e-midas.cn
Chip type : ATmega8
Program type : Application
Clock frequency : 455K hz
Memory model : Small
External SRAM size : 0
Data Stack size : 256
*****************************************************/
#include <mega8.h>
#include "Config.h"
#include "IR38K.c"
#include "TV.c"
#include "DVD.c"
void Port_Init(void)
{
PORTB=0x00;
DDRB=0B00000011;
PORTC=0x00;
DDRC=0x00;
PORTD=0xE0;
DDRD=0xE0;
}
void main(void)
{
unsigned char LastKey;
unsigned char Key;
unsigned char State;
unsigned char i;
Port_Init();
//USART_Init(0x02);
LastKey=0;
while (1)
{
//PORTD.7=PINB.2;
State=(~PINC)&0x3F;
if (State)
{
Key=0;
for (i=0;i<6;i++)
{
if ((State>>i)&0x01)
{
Key=i+1;
break;
}
}
if ((Key>0)&&(Key<7))
{
GRE_LED_ON;
if (PINB.2)
{
if (Key!=LastKey)
{
SendTVIR(TVKey[Key-1]);
LastKey=Key;
}
else
{
SendTVIRRept();
}
}
else
{
if (Key!=LastKey)
{
SendDVDIR(DVDKey[Key-1]);
LastKey=Key;
}
else
{
SendDVDIRRept();
}
}
GRE_LED_OFF;
}
}
else
{
LastKey=0;
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -