}
_nop_(); _nop_(); CLK=0; _nop_(); }
for(i=8;i>0;i--)//得到一个反序排列的8位数据 {
data_c<<=1; data_c|=Do; _nop_(); CLK=1; _nop_(); _nop_(); CLK=0; _nop_(); } CLK=0; _nop_(); _nop_(); CLK=1; _nop_(); _nop_(); CLK=0; _nop_(); _nop_(); CLK=1; _nop_(); CS=1; _nop_(); _nop_();
data_f=data_f*100/256; return data_f;
void delay(uint z) { uint x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); }
void write_com(uchar com) { lcdrs=0; P0=com; delay(5); lcden=1; delay(5); lcden=0; }
void write_data(uchar date) { lcdrs=1; P0=date; delay(5); lcden=1; delay(5); lcden=0; } void init() { lcdrw=0; lcden=0; set_temp=20; write_com(0x38);
write_com(0x0c); write_com(0x06); write_com(0x01); write_com(0x80); }
void dispay()
void dispay1()
{ }
write_data((tabel[(set_temp0)])); delay(20); write_data('%');
write_data(tabel[(set_temp0/10)]); delay(20);
write_com(0x80+0x0d+0x40);
write_data((tabel[(temp0)])); delay(20); write_data('%'); }
write_data(tabel[(temp0/10)]); delay(20); {
if(flag%2==0) {
write_com(0x80+0x0c); if(temp/100>0)
write_data(tabel[(temp/100)]); delay(20);
uchar i;
write_com(0x80); }
for(i=0;i<12;i++) write_data(tabel1[i]); write_com(0x80+0x40); for(i=0;i<13;i++) write_data(tabel2[i]);
void keyscan() {
if(flag%2==1)
{
write_com(0x80+0x0f+0x40); write_com(0x0e); if(k2==0)
{
delay(10); if(k2==0) {
while(!k2); set_temp++; if(set_temp>=99) set_temp=99;
if(k1==0)
{ }
delay(10); if(k1==0) { }
while(!k1); flag++;
}
}
}
}
if(k3==0) { }
delay(10); if(k3==0) { }
while(!k3); set_temp--; if(set_temp<=0) set_temp=0;
else
write_com(0x0c);
void set_alarm() { }
beep=0; delay(20); beep=1; delay(10);
void main() {
init(); dispay1(); while(1) {
temp=A_D();
dispay(); keyscan(); if(temp>set_temp) set_alarm();
} }