📄 copy-2.27.c
字号:
{
uchar i;
feedStartI2c ();
feedSend_byte (sla);
if( ack == 0 ) return (0);
feedSend_byte (suba / 256); // the high byte address
if (ack == 0 ) return (0);
feedSend_byte (suba % 256); // the low byte address
if (ack == 0 ) return (0);
feedStartI2c();
feedSend_byte(sla + 1);
if ( ack == 0) return ( 0 );
for(i =0;i< no -1; i++)
{
*s = feedRcv_byte();
feedAckI2c(0);
s++;
}
*s = feedRcv_byte();
feedAckI2c(1);
feedStopI2c();
return(1);
}
///////////////////////////////////////////
bit feed_SendStr16K( uchar sla, uchar suba, uchar *s, uchar no )
{
uchar i;
feedStartI2c ();
feedSend_byte (sla);
if( ack == 0 ) return (0);
feedSend_byte (suba);
if(ack == 0)return (0);
for( i = 0; i < no ;i ++)
{
feedSend_byte (*s);
if(ack == 0)return (0);
s++;
}
feedStopI2c();
return (1);
}
bit feedSendStr32K( uchar sla, uint suba, uchar *s, uchar no )
{
uchar i;
feedStartI2c ();
feedSend_byte (sla);
if(ack == 0)return (0);
feedSend_byte(suba / 256); // the high byte address
if(ack == 0)return (0);
feedSend_byte(suba % 256); // the low byte address
if(ack == 0)return (0);
for( i = 0; i < no ;i ++)
{
feedSend_byte(*s);
if(ack == 0)return (0);
s++;
}
feedStopI2c();
return (1);
}
////////////////////////////////////////////
/*bit JUBU_location_check()
{
uchar BitCnt;
uchar c = 0xa0;
jubuStartI2c();
for( BitCnt = 0; BitCnt < 8; BitCnt ++ )
{
if((c << BitCnt) & 0x80) SDA1 = 1;
else
SDA1 =0;
_Nop();
_Nop();
SCL = 1;
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
SCL = 0;
_Nop();
_Nop();
_Nop();
}
_Nop();
_Nop();
_Nop();
SDA1 =1;
_Nop();
_Nop();
_Nop();
_Nop();
SCL = 1;
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
if(SDA1==0) CONTR = SDA1;
else
ALM=1;
SCL = 0;
_Nop();
_Nop();
_Nop();
jubuStopI2c();
return (1);
}*/
//////////////////////////////////////
bit JUBU0_location_check(void)
{
uchar BitCnt;
uchar c = 0xa0;
jubuStartI2c();
for( BitCnt = 0; BitCnt < 8; BitCnt ++ )
{
if((c << BitCnt) & 0x80) SDA1 = 1;
else
SDA1 =0;
_Nop();
_Nop();
SCL = 1;
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
SCL = 0;
_Nop();
_Nop();
_Nop();
}
_Nop();
_Nop();
_Nop();
SDA1 =1;
_Nop();
_Nop();
_Nop();
_Nop();
SCL = 1;
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
if(SDA1==0) LED2 = SDA1;
else
ALM=1;
SCL = 0;
_Nop();
_Nop();
_Nop();
jubuStopI2c();
return (1);
}
////////////////////////////////////////
bit feed_jubu_location_check()
{
uchar BitCnt;
uchar c = 0xa0;
feedStartI2c();
for( BitCnt = 0; BitCnt < 8; BitCnt ++ )
{
if((c << BitCnt) & 0x80) SDA9 = 1;
else
SDA9 =0;
_Nop();
_Nop();
SCL = 1;
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
SCL = 0;
_Nop();
_Nop();
_Nop();
}
_Nop();
_Nop();
_Nop();
SDA9 =1;
_Nop();
_Nop();
_Nop();
_Nop();
SCL = 1;
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
if(SDA9==0) LED2 = SDA9;
else
{while(1){LED2=0;delay(500);LED2=1;delay(500);}}
SCL = 0;
_Nop();
_Nop();
_Nop();
feedStopI2c();
return (1);
}
///////////////////////////////////////////
bit feed_space_check()
{
uchar BitCnt; //+zcq 20040518
//-zcq 20040518 uchar BitCnt, test[6];
uchar c = 0xa2;
feedStartI2c();
for( BitCnt = 0; BitCnt < 8; BitCnt ++ )
{
if((c << BitCnt) & 0x80) SDA9 = 1;
else SDA9 = 0;
_Nop();
_Nop();
SCL = 1;
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
SCL = 0;
_Nop();
_Nop();
}
_Nop();
_Nop();
SDA9 = 1;
_Nop();
_Nop();
_Nop();
SCL = 1;
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
_Nop();
if( SDA9 == 0 )
{
feed_space = 'm';
SCL = 0;
_Nop();
_Nop();
_Nop();
feedStopI2c(); //
return (1);
}
else
{
SCL = 0;
_Nop();
_Nop();
_Nop();
feedStopI2c(); //
feed_space = 'o';
return (1);
}
}
///////////////////////////////
void TIMER0(void) interrupt 1 using 2
{
TH0=0x87;
TL0=0x58;
P0=SEG[MODE1];
P3=0xfe; //11111110
delay2(1);
P0=SEG[LENG_LO];
P3=0xfd; //11111101
delay2(1);
P0=SEG[LENG_HI];
P3=0xfb;//11111011
delay2(2);
P0=SEG[LOL];
P3=0XF7;//11110111
delay2(2);
P0=SEG[LOH];
P3=0xef; //11101111
delay2(1);
P0=SEG[HIL];
P3=0Xdf; //11011111
delay2(1);
P0=SEG[HIH];
P3=0xbf;//10111111
//delay2(1);
}
////////////////////////////////////////
void init(void)
{
P1=0XFF;
P3=0XFF;
IE=0X00;
ALM=0;
// ALM0=0;
ok=0;
TMOD=0X00;
CONTR1=1;
feed_jubu_location_check();
delay(1000);
CONTR=0;
delay(100);
ET0=1;
TR0=0;
EA=1;
}
uint count11,count22,count33;
//////////////////////////////////////////////////
/// 主程序
/////////////////////////////////////////
void pal_copy(uchar hi_add,uchar lo_add, uint pal_count11,uchar leng)
{ uchar i, j,sub_add;
uint count;
uchar pal_buffer;
uchar pal_buffer0;
if( feed_space == 'm')
{
for( count=(((uint)hi_add)*256+(uint)lo_add) ; count< (pal_count11+(uint)leng); count++)
{ j=count/256;
j=j<<1;
sub_add=count%256;
fed_RS16K(0xa0+j ,0x00+sub_add, &pal_buffer, 1 );
delay(12);
jubuSendStr16K(0xa0+j ,0x00+sub_add, &pal_buffer, 1 );
delay(12);
jubu_RS16K(0xa0+j ,0x00+sub_add, &pal_buffer0, 1 );
//delay(12);
if(pal_buffer==pal_buffer0){LED2=LED2^1;continue;}
for(i=5;i>0;i--)
{SPEAKE=0;LED2=0;delay(100);SPEAKE=1;LED2=1;delay(200);SPEAKE=0;LED2=0;delay(100);SPEAKE=1;LED2=1;ALM=0;}
return;
}
}
if(feed_space=='o')
{
for(count=(((uint)hi_add)*256+(uint)lo_add); count< (pal_count11+(uint)leng); count++)
{
fed_RS32K ( 0xa0, 0x0000+count, &pal_buffer, 1 );
delay(12);
jubuSendStr32K( 0xa0, 0x0000+count, &pal_buffer, 1 );
delay(12);
jubu_RS32K ( 0xa0, 0x0000+count, &pal_buffer0, 1 );
//delay(12);
if(pal_buffer==pal_buffer0){LED2=LED2^1;continue;}
for(i=5;i>0;i--)
{SPEAKE=0;LED2=0;delay(100);SPEAKE=1;LED2=1;delay(200);SPEAKE=0;LED2=0;delay(100);SPEAKE=1;LED2=1;ALM=0;}
return;
}
}
}
////////////////////////////////////
uchar dd;
void read(uchar m)
{ uchar u2,i2,l2,cc;uchar jiyi_buffer5[13];
cc=m;
u2=13*cc;
for(i2=i2+u2,l2=0;i2<13+u2;i2++,l2++)
{
JIYI_RS16K ( 0xa0, 0x00+i2, &jiyi_buffer5[l2], 1 );delay(10);
}
pal_hi_add=jiyi_buffer5[0];
pal_lo_add=jiyi_buffer5[1];
pal_leng=jiyi_buffer5[2];
ntsc_hi_add=jiyi_buffer5[3];
ntsc_lo_add=jiyi_buffer5[4];
ntsc_leng=jiyi_buffer5[5];
quxian_hi_add=jiyi_buffer5[6];
quxian_lo_add=jiyi_buffer5[7];
quxian_leng=jiyi_buffer5[8];
MODE1=jiyi_buffer5[12];
dd=jiyi_buffer5[12];
if(MODE1==0X01){ TR0=1;
HIH=(jiyi_buffer5[0]&0xf0)>>4;
HIL=(jiyi_buffer5[0]&0x0f);
LOH=(jiyi_buffer5[1]&0xf0)>>4;
LOL=(jiyi_buffer5[1]&0x0f);
LENG_HI=(jiyi_buffer5[2]&0xf0)>>4;
LENG_LO=(jiyi_buffer5[2]&0x0f);
MODE1=0x01;
}
if(MODE1==0X02){ TR0=1;
HIH=(jiyi_buffer5[3]&0xf0)>>4;
HIL=(jiyi_buffer5[3]&0x0f);
LOH=(jiyi_buffer5[4]&0xf0)>>4;
LOL=(jiyi_buffer5[4]&0x0f);
LENG_HI=(jiyi_buffer5[5]&0xf0)>>4;
LENG_LO=(jiyi_buffer5[5]&0x0f);
MODE1=0X02;
}
if(MODE1==0X03){ TR0=1;
HIH=(jiyi_buffer5[6]&0xf0)>>4;
HIL=(jiyi_buffer5[6]&0x0f);
LOH=(jiyi_buffer5[7]&0xf0)>>4;
LOL=(jiyi_buffer5[7]&0x0f);
LENG_HI=(jiyi_buffer5[8]&0xf0)>>4;
LENG_LO=(jiyi_buffer5[8]&0x0f);
MODE1=0X03;
}
}
///////////////////////////////////////////////
uchar data0,a1,b1,c1,d1,e1,f1,g1,keyword5;
////////////////////////////////////////
void main(void)
{
uchar u1,j;uchar n;
uchar keyword4;
// uchar over,over2;
uchar jiyi_buffer2,jiyi_buffer0,jiyi_buffer3;
init( );
JIYI_RS16K ( 0xa0, 0x00+0x90, &jiyi_buffer2, 1 );delay(10);
u1=jiyi_buffer2*13;
TR0=0;
JIYI_RS16K ( 0xa0, 0x00+u1+0x0c, &jiyi_buffer0, 1 );delay(10);
MODE1=jiyi_buffer0&0x0f;
LENG_LO=0X12;
LENG_HI=(uint)jiyi_buffer2%10;
LOL=(uint)jiyi_buffer2/10;
LOH=0x12;
HIL=0X0F;
HIH=0X11;
TR0=1;
// while(start!=1)
TP:WORK=1;
keyword4=scanf();
if(work_start0==1){keyword4=0; work_start0=0;goto PTT;}
if(keyword4!=0)
{ if(keyword4>=12)
{
for(j=0;j<5;j++)
{SPEAKE=0;delay(100);SPEAKE=1;delay(200);SPEAKE=0;delay(100);SPEAKE=1;goto TP;}
}
PTT:bb=keyword4;
JIYI_RS16K ( 0xa0, 0x00+bb*13+0x0c, &jiyi_buffer3, 1 );delay(10);
MODE1=jiyi_buffer3;
LENG_HI=(uint)keyword4%10;
LOL=(uint)keyword4/10;
}
if(WORK==0)
{delay(10);
while(WORK==0);
goto TTP;
}
if(P2==0XF0){keyword4=0;goto TP;}
goto TP;
TTP:switch (bb)
{
case 0: disp_select(0 );break;
case 1: disp_select(1 );break;
case 2: disp_select(2 );break;
case 3: disp_select(3 );break;
case 4: disp_select(4 );break;
case 5: disp_select(5);break;
case 6: disp_select(6);break;
case 7: disp_select(7 );break;
case 8: disp_select(8 );break;
case 9: disp_select(9 );break;
case 10: disp_select(10 );break;
case 11: disp_select(11 );break;
default:break;
}
read(bb );
//if(staus0=='k')goto TP;
// if(work_start==1) set_select( staus0);
//do{ mode_select();}while(ok!=1);
// while(WORK==1);
// if(WORK==0)
//delay(10);
//while(WORK==0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -