基于PIC16F628的CM402型高速貼片機控制系統(tǒng)改造設(shè)計與實現(xiàn)
void X_Y_IN(void)
{ if((RB0==0)(RB1==0))
{ ms(2);
if((RB0==0)(RB1==0)((z++)==500))
{ temp1=1;
}
}
else
{ z=1;
temp1=0;
}
Key_Num1=temp1;
if((Key_Num1!=0x00)(Key_Num1 == Key_Backup1 ))
{ if(!Key_Dis_F1)
{ Key_Dis_F1 = 1;
asm("clrwdt");
if((RB0==0)(RB1==0))
{ OFF_ON=1;
}
}
}
else
{ Key_Backup1 = Key_Num1;
Key_Dis_F1 = 0;
}
}
void keyscan(void)
{ if((RB7==0)|(RB6==0))
{ ms(10);
if((RB7==0)|(RB6==0))
{ temp=1;
}
}
else
{ temp=0;
}
Key_Num=temp;
if((Key_Num!=0x00)(Key_Num == Key_Backup ))
{ if(!Key_Dis_F)
{ Key_Dis_F = 1;
asm("clrwdt");
if((RB6==0)(RB7==1))
{ ES--;
if(ES=1)
{ ES=1;
}
if(ES!=ES_BC_DATA)
{ ES_DATA=ES_BC_DATA=ES;
writeByte(0x00,ES_BC_DATA);
writeByte(0x01,out);
writeByte(0x02,RA4);
writeByte(0x03,RB1);
writeByte(0x04,RB0);
writeByte(0x05,z);
}
}
if((RB6==1)(RB7==0))
{ ES++;
if(ES>=6)
{ ES=6;
}
if(ES!=ES_BC_DATA)
{ ES_DATA=ES_BC_DATA=ES;
writeByte(0x00,ES_BC_DATA);
}
}
}
}
else
{ Key_Backup = Key_Num;
Key_Dis_F = 0;
}
}
char readByte(char addr)
{ char tmpEEPROM;
EEADR = addr;
SELECT_EEPROM();
START_READ_EEPROM();
tmpEEPROM = EEDATA;
return tmpEEPROM;
}
void writeByte(char addr, char data)
{ EEADR = addr;
EEDATA = data;
SELECT_EEPROM();
ENABLE_WRITE_EEPROM();
EECON2 = 0X55;
EECON2 = 0Xaa;
START_WRITE_EEPROM();
ENABLE_WRITE_EEPROM();
while(1 != EEIF);
EEIF = 0;
}
結(jié)束語
該PVS控制系統(tǒng)以PIC16F628單片機為核心,具有集成度高、性能穩(wěn)定、抗干擾能力強、性價比高等優(yōu)點。該PVS控制系統(tǒng)已制作成品銷售,由蘇州翔慶精密機械有限公司等單位經(jīng)過6個月的聯(lián)機生產(chǎn)驗證,證明該設(shè)計方案可靠、可行。利用該PVS控制系統(tǒng)改造CM402型貼片機,預(yù)期可提升生產(chǎn)力約4%,具有良好的實用價值。
評論