📄 sci_io.c
字号:
#include <general.h>
/* ----------------
char getchar ()
{
char c;
/* 中断触发
while (!RI)
{
_nop_();
WDT_cls();
_nop_();
}
c = SBUF;
RI = 0;
return (c);
}
void putchar (char c)
{
if (!TI)
{
SBUF = c;
}
else
{
TI = 0;
SBUF = c;
while (!TI)
continue;
TI = 0;
}
}
void keyboard485_disable()
{
P1_0=1;
P1_1=0;
}
void camera485_enable()
{
P1_2=0;
P1_3=1;
}
------------
void keyboard485_enable()
{
P1_0=0;
P1_1=1;
}
void camera485_disable()
{
P1_2=1;
P1_3=0;
}*/
/* while(1) //试验步进电机用程序
{
// P0=P1=P3=0;
// P2=0xff;
//P4_0=P4_1=P4_2=P4_3=0;
// for(x=0;x<60000;x++)
WDT_CONTR=0xff;
// SBUF=0x41;
}
while(1)
{
P0_0=0;
P0_1=0;
P0_2=0;
for(x=0;x<60000;x++)
WDT_CONTR=0xff;
P0_2=1;
}
while(1)
{
for(x=0;x<60000;x++)
WDT_CONTR=0xff;
P0_0=P0_3=0;
P0_1=P0_4=P0_5=P0_2=0;
for(x=0;x<60000;x++)
WDT_CONTR=0xff;
}
while(1)
{
P0_0=P0_1=0; //out1ab
P0_2=1;
P0_3= 0;
P0_4=0;
P0_5=1;
for(x=0;x<300;x++)
WDT_CONTR=0xff;
// LeftRight_out(3);
P2_0=1;
P2_1=1;
P2_2=0;
P2_3=0;
P2_7= 1;
P2_6= 1;
P2_5= 0;
P2_4= 0;
for(x=0;x<300;x++)
WDT_CONTR=0xff;
//LeftRight_out(6);
P2_0=0;
P2_1=1;
P2_2=1;
P2_3=0;
P2_7= 0;
P2_6= 1;
P2_5= 1;
P2_4= 0;
for(x=0;x<300;x++)
WDT_CONTR=0xff;
//LeftRight_out(0xc);
P2_0=0;
P2_1=0;
P2_2=1;
P2_3=1;
P2_7= 0;
P2_6= 0;
P2_5= 1;
P2_4= 1;
for(x=0;x<300;x++)
WDT_CONTR=0xff;
// LeftRight_out(9);
P2_0=1;
P2_1=0;
P2_2=0;
P2_3=1;
P2_7= 1;
P2_6= 0;
P2_5= 0;
P2_4= 1;
//P0_2=!P0_2;
} */
/* switch(keycode_num)
{
case 0: break;
case 1:
for( charvar=0;charvar<=6;charvar++)
keycode_temp[charvar]=keycode[charvar];
keycode_num=0;
if(keycode_temp[1]==ID)
{
intvar=(((unsigned int )keycode_temp[2])<<8)+(unsigned char )keycode_temp[3];
switch(intvar)
{
case 0x55 : //选择球机/解码器地址,什么也不用处理,键盘组合用
break;
case 0x3 : //设置预置点
break;
case 0x7 : //调用预置点
break;
case 0x5 : //清除预置点
break;
case 0x4f : //运行轨迹
break;
case 0x40 : //控制摄像机WIDE
Zoom_wide();
while(!keycode_num)
WDT_cls();
for( charvar=0;charvar<=6;charvar++)
keycode_temp[charvar]=keycode[charvar];
keycode_num=0;
Zoom_stop();
break;
case 0x20: //TELE
Zoom_tele();
while(!keycode_num)
WDT_cls();
for( charvar=0;charvar<=6;charvar++)
keycode_temp[charvar]=keycode[charvar];
keycode_num=0;
Zoom_stop();
break;
case 0x80 : //FAR
Focus_far();
while(!keycode_num)
WDT_cls();
for( charvar=0;charvar<=6;charvar++)
keycode_temp[charvar]=keycode[charvar];
keycode_num=0;
Focus_stop();
break;
case 0x100 : //NEAR
Focus_near();
while(!keycode_num)
WDT_cls();
for( charvar=0;charvar<=6;charvar++)
keycode_temp[charvar]=keycode[charvar];
keycode_num=0;
Focus_stop();
break;
case 0x200 : //OPEN 无控制
while(!keycode_num)
WDT_cls();
for( charvar=0;charvar<=6;charvar++)
keycode_temp[charvar]=keycode[charvar];
keycode_num=0;
break;
case 0x400 : //CLOSE 无控制
while(!keycode_num)
WDT_cls();
for( charvar=0;charvar<=6;charvar++)
keycode_temp[charvar]=keycode[charvar];
keycode_num=0;
break;
case 0x8 : //摇杆向上
dir_vertical=1;
T1_start();
do
{
while(!keycode_num)
WDT_cls();
for( charvar=0;charvar<=6;charvar++)
keycode_temp[charvar]=keycode[charvar];
keycode_num=0;
intvar=(((unsigned int )keycode_temp[2])<<8)+(unsigned char )keycode_temp[3];
}while(intvar!=0);
T1_stop();
break;
case 0x10 : //摇杆向下
dir_vertical=0;
T1_start();
do
{
while(!keycode_num)
WDT_cls();
for( charvar=0;charvar<=6;charvar++)
keycode_temp[charvar]=keycode[charvar];
keycode_num=0;
intvar=(((unsigned int )keycode_temp[2])<<8)+(unsigned char )keycode_temp[3];
}while(intvar!=0);
T1_stop();
break;
case 0x4 : //摇杆向左
dir_horizon=1;
T0_start();
do
{
while(!keycode_num)
WDT_cls();
for( charvar=0;charvar<=6;charvar++)
keycode_temp[charvar]=keycode[charvar];
keycode_num=0;
intvar=(((unsigned int )keycode_temp[2])<<8)+(unsigned char )keycode_temp[3];
}while(intvar!=0);
T0_stop();
break;
case 0x2 : //摇杆向右
dir_horizon=0;
T0_start();
do
{
while(!keycode_num)
WDT_cls();
for( charvar=0;charvar<=6;charvar++)
keycode_temp[charvar]=keycode[charvar];
keycode_num=0;
intvar=(((unsigned int )keycode_temp[2])<<8)+(unsigned char )keycode_temp[3];
}while(intvar!=0);
T0_stop();
break;
case 0x53 : //相机串口的一系列操作 无控制
break;
default:
break;
} //switch结束
} //if结束
else
{
_nop_(); //相机处理码程序
}
break;
} //switch结束
} //while结束
}//main结束
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -