怎么在淘宝上买游戏脚本
展开全部
#include "stdio.h"
#define U8 unsigned char
#define U16 unsigned int
#define INT int
#define CHAR char
#define ON 1
#define OFF 0
#define INFRARED_SWITCH P2
#define NOBODY 0X00
#define TIME1 1
#define TIME0 0
#define TOTAL_I EA
#define I_T0 ET0
#define I_T1 ET1
#define SUCCESS 0
#define FALURE -1
#define DEBOUNCE_TIME
#define DEBOUNCE_NUM
#define DEBOUNCE_SET TIME0
#define OVERTIME_TIME
#define OVERTIME_NUM
#define OVERTIME_SET TIME1
CHAR t0_Num, t1_Num;
U8 *t0_Data;
U8 *t1_Data;
U8 t0_H, t0_L, t1_H, t1_L;
U8 frist_Trigger, secred_Trigger;
U8 studet_Num;
U16 cp_Line;
INT Time_open(U16 time, CHAR num, U8 set, U8 *data)
{
if(TIME0 == set){
t0_Num = num;
t0_H = (U8)(time >> 8);
t0_L = (U8)(time & 0x00ff);
TH0 = t0_H;
TL0 = t0_L;
I_T0 = ON;
t0_Data = data;
return SUCCESS;
}
if(TIME1 == set){
t1_Num = num;
t1_H = (U8)(time >> 8);
t1_L = (U8)(time & 0x00ff);
TH1 = t1_H;
TL1 = t1_L;
I_T1 = ON;
t1_Data = data;
return SUCCESS;
}
return FALURE;
}
INT Debounce(U8 sw_data)
{
U8 debounce_flag = 0;
if(SUCCESS != Time_open(DEBOUNCE_TIME, DEBOUNCE_NUM, DEBOUNCE_SET, &debounce_flag)){
cp_Line = __LINE__;
return FALURE;
}
for(;;){
if(1 == debounce_flag){
if(sw_data == INFRARED_SWITCH){
while(INFRARED_SWITCH);
return SUCCESS;
}
return FALURE;
}
}
}
INT State_switch(U8 *state)
{
U8 data;
if(NOBODY == INFRARED_SWITCH){
*state = 0;
return NOBODY;
}
data = INFRARED_SWITCH;
if(SUCCESS == Debounce(data)){
*state = data;
return SUCCESS;
}
return NOBODY;
}
INT main (U16 argc, U8 **argv)
{
}
void T0_SR(void) interrupt 1
{
t0_Num--;
if(0 > t0_Num){
*t0_Data = 1;
I_T0 = OFF;
}
TH0 = t0_H;
TL0 = t0_L;
}
void T1_SR(void) interrupt 3
{
t1_Num--;
if(0 > t1_Num){
*t1_Data = 1;
I_T1 = OFF;
}
TH1 = t1_H;
TL1 = t1_L;
}
#define U8 unsigned char
#define U16 unsigned int
#define INT int
#define CHAR char
#define ON 1
#define OFF 0
#define INFRARED_SWITCH P2
#define NOBODY 0X00
#define TIME1 1
#define TIME0 0
#define TOTAL_I EA
#define I_T0 ET0
#define I_T1 ET1
#define SUCCESS 0
#define FALURE -1
#define DEBOUNCE_TIME
#define DEBOUNCE_NUM
#define DEBOUNCE_SET TIME0
#define OVERTIME_TIME
#define OVERTIME_NUM
#define OVERTIME_SET TIME1
CHAR t0_Num, t1_Num;
U8 *t0_Data;
U8 *t1_Data;
U8 t0_H, t0_L, t1_H, t1_L;
U8 frist_Trigger, secred_Trigger;
U8 studet_Num;
U16 cp_Line;
INT Time_open(U16 time, CHAR num, U8 set, U8 *data)
{
if(TIME0 == set){
t0_Num = num;
t0_H = (U8)(time >> 8);
t0_L = (U8)(time & 0x00ff);
TH0 = t0_H;
TL0 = t0_L;
I_T0 = ON;
t0_Data = data;
return SUCCESS;
}
if(TIME1 == set){
t1_Num = num;
t1_H = (U8)(time >> 8);
t1_L = (U8)(time & 0x00ff);
TH1 = t1_H;
TL1 = t1_L;
I_T1 = ON;
t1_Data = data;
return SUCCESS;
}
return FALURE;
}
INT Debounce(U8 sw_data)
{
U8 debounce_flag = 0;
if(SUCCESS != Time_open(DEBOUNCE_TIME, DEBOUNCE_NUM, DEBOUNCE_SET, &debounce_flag)){
cp_Line = __LINE__;
return FALURE;
}
for(;;){
if(1 == debounce_flag){
if(sw_data == INFRARED_SWITCH){
while(INFRARED_SWITCH);
return SUCCESS;
}
return FALURE;
}
}
}
INT State_switch(U8 *state)
{
U8 data;
if(NOBODY == INFRARED_SWITCH){
*state = 0;
return NOBODY;
}
data = INFRARED_SWITCH;
if(SUCCESS == Debounce(data)){
*state = data;
return SUCCESS;
}
return NOBODY;
}
INT main (U16 argc, U8 **argv)
{
}
void T0_SR(void) interrupt 1
{
t0_Num--;
if(0 > t0_Num){
*t0_Data = 1;
I_T0 = OFF;
}
TH0 = t0_H;
TL0 = t0_L;
}
void T1_SR(void) interrupt 3
{
t1_Num--;
if(0 > t1_Num){
*t1_Data = 1;
I_T1 = OFF;
}
TH1 = t1_H;
TL1 = t1_L;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |