📄 tech.c
字号:
// LCDdat[14] = LCDdat[14] | LED[dkeyvol&0x0f];
// LCDdat[13] = LCDdat[13] | LED[(dkeyvol>>4)&0x0f];
//ucState=0xcd;
// LCDdat[12] = LCDdat[12] | LED[ucState&0x0f];
// LCDdat[11] = LCDdat[11] | LED[(ucState>>4)&0x0f];
//LCDdat[11] = LCDdat[11] | LED[(wTime>>12)&0x000f];
//LCDdat[12] = LCDdat[12] | LED[(wTime>>8)&0x000f];
//LCDdat[13] = LCDdat[13] | LED[(wTime>>4)&0x000f];
//LCDdat[14] = LCDdat[14] | LED[wTime&0x000f];
//LCDdat[8] = LCDdat[8] | LED[ucState&0x0f];
// LCDdat[7] = LCDdat[7] | LED[(ucState>>4)&0x0f];
}
*/
WriteLCD();
if(playend)
{
LCDdat[10] = 0x00;
LCDdat[9] = 0x00;
LCDdat[8] = 0x00;
WriteLCD();
delay(200);
LCDdat[10] = LED[ wTime % 10];
LCDdat[9] = LED[(wTime % 100)/10];
LCDdat[8] = LED[(wTime % 1000)/100];
//LCDdat[6]=LCDdat[6]|0x028;
WriteLCD();
delay(150);
}
if(followend){
LCDdat[10] = LED[0];
LCDdat[9] = LED[0];
LCDdat[8] = LED[0];
WriteLCD();
delay(200);
LCDdat[10] = LED[ wTime % 10];
LCDdat[9] = LED[(wTime % 100)/10];
LCDdat[8] = LED[(wTime % 1000)/100];
WriteLCD();
delay(150);
}
}
void IniLCD()
{
uchar i;
CommandLCD(0x2); /* Open JZ */
CommandLCD(0x6); /* Open LCD */
CommandLCD(0x52); /* set 1/2 V && Open 4 comm */
for(i=0;i<12;i++)
LCDdat[i] = 0x00;
WriteLCD();
}
void Comm(void) interrupt 4 using 2{
RI = 0;
ES = 0;
RevDat = SBUF;
RevOK=1;
switch(RevDat)
{
case 0: RemoteFUN = NULL; break;
case 0x01: RemoteFUN = PLAY;break;
//case 0x21: RemoteFUN = PLAY; IsA=0;IsB=1;break;
case 0x02: RemoteFUN = STOP;break;
//case 0x22: RemoteFUN = STOP; IsA=0;IsB=1;break;
case 0x03: RemoteFUN = REW;break;
//case 0x23: RemoteFUN = REW; IsA=0;IsB=1;break;
case 0x04: RemoteFUN = REC; break;
//case 0x24: RemoteFUN = REC; IsA=0;IsB=1;break;
case 0x05: RemoteFUN = RET; break;
//case 0x25: RemoteFUN = RET; IsA=0;IsB=1;break;
case 0x06: RemoteFUN = PAUSE;break;
// case 0x26: RemoteFUN = PAUSE; IsA=0;IsB=1;break;
case 0x07: RemoteFUN = FFW; break;
//case 0x27: RemoteFUN = FFW; IsA=0;IsB=1;break;
case 0x08: RemoteFUN = EJECT; break;
//case 0x28: RemoteFUN = EJECT; IsA=0;IsB=1;break;
case 0x09: RemoteFUN = MEM; break;
//case 0x29: RemoteFUN = MEM; IsA=0;IsB=1;break;
case 0x0a: RemoteFUN = Reset;break;
//case 0x2a: RemoteFUN = Reset; IsA=0;IsB=1;break;
case 0x11: RemoteFUN = PLAY; IsA=1;IsB=0;break;
case 0x21: RemoteFUN = PLAY; IsA=0;IsB=1;break;
case 0x12: RemoteFUN = STOP; IsA=1;IsB=0;break;
case 0x22: RemoteFUN = STOP; IsA=0;IsB=1;break;
case 0x13: RemoteFUN = REW; IsA=1;IsB=0;break;
case 0x23: RemoteFUN = REW; IsA=0;IsB=1;break;
case 0x14: RemoteFUN = REC; IsA=1;IsB=0;break;
case 0x24: RemoteFUN = REC; IsA=0;IsB=1;break;
case 0x15: RemoteFUN = RET; IsA=1;IsB=0;break;
case 0x25: RemoteFUN = RET; IsA=0;IsB=1;break;
case 0x16: RemoteFUN = PAUSE; IsA=1;IsB=0;break;
case 0x26: RemoteFUN = PAUSE; IsA=0;IsB=1;break;
case 0x17: RemoteFUN = FFW; IsA=1;IsB=0;break;
case 0x27: RemoteFUN = FFW; IsA=0;IsB=1;break;
case 0x18: RemoteFUN = EJECT; IsA=1;IsB=0;break;
case 0x28: RemoteFUN = EJECT; IsA=0;IsB=1;break;
case 0x19: RemoteFUN = MEM; IsA=1;IsB=0;break;
case 0x29: RemoteFUN = MEM; IsA=0;IsB=1;break;
case 0x1a: RemoteFUN = Reset; IsA=1;IsB=0;break;
case 0x2a: RemoteFUN = Reset; IsA=0;IsB=1;break;
case 0x70: RemoteFUN = SetVol;CurrentVol = 0xe7; break;
case 0x71: RemoteFUN = SetVol;CurrentVol = 0xe6; break;
case 0x72: RemoteFUN = SetVol;CurrentVol = 0xe5; break;
case 0x73: RemoteFUN = SetVol;CurrentVol = 0xe4; break;
case 0x74: RemoteFUN = SetVol;CurrentVol = 0xe3; break;
case 0x75: RemoteFUN = SetVol;CurrentVol = 0xe2; break;
case 0x76: RemoteFUN = SetVol;CurrentVol = 0xe1; break;
case 0x77: RemoteFUN = SetVol;CurrentVol = 0xe0; break;
// default: RemoteFUN = MTEST; MDat = RevDat; break;
}
ES = 1;
}
void Count(void) interrupt 0 using 1{
/*uchar i;*/
if (RF){
if (CountNub<9999)
CountNub++;
else
CountNub = 0;
}else{
if (CountNub>0)
CountNub--;
else
CountNub = 9999;
}
RUN = 1;
}
void Pause()
{
if ((CurrentFUN==PLAY) || (CurrentFUN==REC))
{
SOLEA=1;SOLEB=1;
LastFUN=CurrentFUN;
CurrentFUN=PAUSE;
// PT2259_Set(0xe7,data_1db);
ES=0;
SBUF=IsAorB[CF&0x03]|0x86;
while(!TI);TI=0;ES=1;
}else{
if(CurrentFUN==PAUSE){
SOLEA=0;SOLEB=1;
// PT2259_Set(CurrentVol,data_1db);
CurrentFUN=LastFUN;
if(CurrentFUN==PLAY)
{
ES=0;
SBUF=IsAorB[CF&0x03]|0x82; while(!TI);TI=0;
ES=1;
}
if(CurrentFUN==REC)
{
ES=0;
SBUF=IsAorB[CF&0x03]|0x83; while(!TI);TI=0;
ES=1;
}
}
}
}
void Timer(void) interrupt 1 using 3{
TL0=-(6000 % 256 ); TH0=-(6000 / 256);
if ((CurrentFUN!=STOP) && (CurrentFUN!=PAUSE))
AutoStop++;
}
void Stop()
{
if (CurrentFUN!=STOP){
if ((CurrentFUN == PAUSE)||(CurrentFUN == PLAY)||(CurrentFUN == REC)||(CurrentFUN == FFW))
{
SOLEA=1;SOLEB=0;
delay(100*BASE);
SOLEA=1;SOLEB=1;
speed=0;
}
if (CurrentFUN == REW)
{
delay(40*BASE);
SOLEA=1;SOLEB=0;
delay(4*BASE);//2
SOLEA=0;SOLEB=1;
delay(15*BASE);
SOLEA=1;SOLEB=1;
speed=0;
}
//PT2259_OpenVolume(0x77);
CurrentFUN=STOP;
RecX=0; RecX1=0;
copy1=copy2=1;
}
PT2259_Set(0xe7,data_1db);
ES=0;
SBUF=IsAorB[CF&0x03]|0x81; while(!TI);TI=0;
ES=1;
// VOL_C=1;
}
void Play()
{
if (CurrentFUN!=PAUSE){
if (CurrentFUN==STOP){
delay(35*BASE);
SOLEA=1;SOLEB=0;
delay(4*BASE);//
SOLEA=0;SOLEB=1;
speed=0;
}
if (CurrentFUN==REW){
SOLEA=1;SOLEB=0;
delay(4*BASE);//
SOLEA=0;SOLEB=1;
delay(40*BASE);
SOLEA=1;SOLEB=0;
delay(4*BASE);//
SOLEA=0;SOLEB=1;
speed=0;
}
if (CurrentFUN==FFW){
Stop();
delay(35*BASE);
SOLEA=1;SOLEB=0;
delay(4*BASE);//
SOLEA=0;SOLEB=1;
speed=0;
}
//LastVol=CurrentVol;
CD5508_SendCommand( 0x0082 );
PT2259_Set(0xe2,data_1db);
//delay(100);
RecX=0;RecX1=0;
// VOL_C=1;
CurrentFUN=PLAY;
}
}
void Rec()
{
if (CurrentFUN!=PAUSE){
Play();
if (Ccopy){CurrentFUN=REC;
RecX=1;RecX1=1;
copy1=0;copy2=1;
}
else{
CurrentFUN=REC;
RecX=1;RecX1=1;
// VOL_C=1;
copy1=copy2=0;
}
}
PT2259_OpenVolume(0x77);
}
void Ffw()
{
if (CurrentFUN==STOP)
{
SOLEA=0;SOLEB=1;
delay(200*BASE);
SOLEA=1;SOLEB=0;
delay(40*BASE);
SOLEA=0;SOLEB=1; //
speed=1;
}
if (CurrentFUN==REW)
{
SOLEA=1;SOLEB=0; delay(2*BASE); SOLEA=0;SOLEB=1;
delay(40*BASE);
SOLEA=1;SOLEB=0; delay(2*BASE); SOLEA=0;SOLEB=1;
delay(27*BASE);
SOLEA=0;SOLEB=1; delay(2*BASE); SOLEA=1;SOLEB=0;
delay(27*BASE);
SOLEA=1;SOLEB=0; delay(2*BASE); SOLEA=0;SOLEB=1;
speed=1;
}
if (CurrentFUN==PLAY)
{
Stop();
SOLEA=0;SOLEB=1;
delay(100*BASE); //80
SOLEA=1;SOLEB=0;
delay(35*BASE);
SOLEA=0;SOLEB=1; //
speed=1;
}
RecX=0;RecX1=0;
CurrentFUN=FFW;
}
void Rew()
{
if(CurrentFUN==STOP)
{
delay(15*BASE);
SOLEA=0;SOLEB=1; delay(4*BASE); SOLEA=1;SOLEB=0;//
delay(65*BASE);
SOLEA=0;SOLEB=1; delay(4*BASE); SOLEA=1;SOLEB=0;//
speed=1;
}
if ((CurrentFUN==PLAY) || (CurrentFUN==FFW))
{
SOLEA=0;SOLEB=1; delay(2*BASE); SOLEA=1;SOLEB=0;
delay(40*BASE);
SOLEA=0;SOLEB=1; delay(4*BASE); SOLEA=1;SOLEB=0;//
delay(65*BASE);
SOLEA=0;SOLEB=1; delay(4*BASE); SOLEA=1;SOLEB=0; //
speed=1;
}
RecX=0;RecX1=0;
CurrentFUN=REW;
}
uchar GetKey()
{
uchar i,key;
key=0;
P1=0xf;
if ((P1 & 0xf) != 0xf ){
delay(2);
for(i=0;i<4;i++){
P1 = ~(0x10 << i);
key = P1;
if ((key & 0xf ) != 0xf ){
key = ((~key & 0xf)<<4) + (1 << i);
return(key); }
}
}
return(0);
}
void Init()
{
SOLEA=1;SOLEB=1;
delay(20*BASE);
/* Init Tape */
IniLCD();
TMOD=0x21;
TL0=-(60000 % 256); TH0=-(60000 / 256);
TL1=0xfd;TH1=0xfd;
TCON=0x45; //41(old)
SCON=0x50;
CF=0;
IE=0x93; /* open comm && int0 && timer0 */
TR0=1;
CurrentFUN=STOP;
SOLEA=1;SOLEB=1;
copy1=copy2 =1;
CurrentPL =0;
CountNub=0;
AutoStop=0;
RUN=1;
// VOL_C=0;
CurrentVol=LastVol=0xe2;
speed=0;
AutoRew=0;
data_1db=0xd4;
}
void main()
{
uchar KeyVol;
uint xx;
//BYTE ucState; //当前状态
// WORD wTime; //当前时间
Init();
CurrentFUN=STOP;
RecX=0;
RecX1=0;
DOpen=1;
IsA=0;
IsB=0;
CountNub=0;
PIN_CD5508_RESET = 0; //复位5508
ShowLCD();
PIN_CD5508_RESET = 1;
////////////////////////////////////////////////////////
delay(500);
delay(800);
CD5508_SendCommand( 0x01ff ); //设置A0口为输出口
CD5508_SendCommand( 0x0200 ); //设置A口为不接下拉电阻
CD5508_SendCommand( 0x0300 ); //设置A0口为高
delay(10);
CD5508_SendCommand( 0x0430 ); //设置5508 自动放音门槛
delay(10);
CD5508_SendCommand( 0x05e0 ); //设置5508自动跟读门槛
//////////////////////////////////////////////////////////
CD5508_SendCommand( 0x0088 );
high=1;
setAuto = 0;
setFollow = 0;
followend = 0;
setRepeat1 = 0;
setRepeat2 = 0;
playend=0;
duibi=0;
ST5508 = 0;
setSpeed = 0;
Fspeed = 0;
//PT2259_Init();
PT2259_Clear();
PT2259_OpenVolume(0x77);
// PT2259_Set(0xe7,data_1db);
Setvol_C=1;
for(;;){
if((setAuto)&&(setFollow))
{if(ucState==0x33)
CD5508_SendCommand( 0x0082 );
duibi=0;
}
if((setAuto)&&(duibi))
{if(ucState==0x35)
CD5508_SendCommand( 0x0082 );
if(ucState==0x32)
duibi=1;
}
if (CountNub != OldNub)
{
ShowLCD();
OldNub = CountNub;
}
if ((CurrentFUN == REW) && (SetMem))
if (((MemNub+10) > CountNub) && (MemNub < CountNub))
{ Play(); RF=1;
ES=0;
SBUF=IsAorB[CF&0x03]|0x82; while(!TI);TI=0;
ES=1;
ShowLCD();
};
if ((CurrentFUN!=STOP) && (CurrentFUN!=PAUSE) && (AutoStop>=300)){
if (!RUN){
CurrentVol=0xe0;
CD5508_SendCommand( 0x0088);
Stop();
//if(!AutoRew){
// Rew();
// } //////////////////autorew
//AutoRew=~AutoRew;
MODI = 1; }
AutoStop = 0;
RUN = 0;
}
if(CurrentFUN!=STOP)
{
CD5508_ReadState();
}
//delay(10);
//CD5508_ReadState();
switch(ucState>>4)
{
case 0x00: setAuto=0; high=0; MODI = 1;break; //受动/低音质
case 0x01: setAuto=1; high=0; MODI = 1;break; //自动/低音质
case 0x02: setAuto=0; high=1; MODI = 1;break; //手动/高音质
case 0x03: setAuto=1; high=1; MODI = 1;break; //自动/高音质
default: MODI = 1;break;
}
switch(ucState&0x0f)
{
case 0x00: if ((CurrentFUN==PAUSE)&&(setAuto))
{Pause();} MODI = 1;break;//自动放音-》-录音
case 0x01: Fspeed = 2; setSpeed = 1; MODI = 1;break; //快速2
case 0x02: if (CurrentFUN==PLAY){Pause();} MODI = 1;break; //跟读
case 0x03: duibi=1; MODI = 1;break; //对比
case 0x04: followend=1; MODI = 1;break; //跟读时间到闪
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -