您当前的位置:五五电子网电子知识单片机-工控设备义隆单片机EM78P468 NTC lcd测温设计C语言源代码 正文
EM78P468 NTC lcd测温设计C语言源代码

EM78P468 NTC lcd测温设计C语言源代码

点击数:7709 次   录入时间:03-04 12:00:35   整理:http://www.55dianzi.com   义隆单片机
  }
  LCD_DB=tmp1; 
 
  tmp1=set_tmp&0x0f;
  LCD_ADDR=8;
  tmp1=lcd_ram[tmp1];
  LCD_DB=tmp1;
  LCD_ADDR=7;
  _asm
  {
   swap %tmp1
  }
  LCD_DB=tmp1;  
}

/*void lcd_on_off(void)

    uchar i;
 for(i=0;i<32;i++)
 {
  LCD_ADDR=i;
  LCD_DB=0xff;
 }
 
 for(dly=0x00ff;dly;dly--)
 {
  WDTC();
 }
  
 for(i=32;i;i--)
 {
  LCD_ADDR=i;
  LCD_DB=0;
 }
 
 for(dly=0x1fff;dly;dly--)
 {
  WDTC();
 }
 
}*/

/******************************按键扫描************************/
/*****************************按键处理************************/
void KeyDo(uchar key)

    uchar fan_temp;
    if (key == ON_OFF){
      if(mode_on_off==0)
        {
         key_flag=1;
         mode_on_off=1;
        }
      else
        {
         mode_on_off=0;
        }

    }
    else if (key == FAN)
    {
     timer1=0;
      key_flag=1;
        if(mode_on_off==1)
         {
         fan_temp=fan_st&0xe0;
         if(fan_temp==0x80)
          {
           fan_st|=0x40;
           fan_st&=0x7f;
          }
         else if(fan_temp==0x40)
          {
           fan_st|=0x20;
           fan_st&=0xbf;
          }
         else if(fan_temp==0x20)
          {
           fan_st|=0x80;
           fan_st&=0xdf;
          }
         }
    }
   else if (key == MODE)
   {
    timer1=0;
     key_flag=1;
     if(mode_on_off==1)
      {
        fan_temp=fan_st&0x03;
        if(fan_temp==0x01)
           fan_st++;
           else
           {
           fan_st|=0x01;
           fan_st&=0xfd;
           }    
      }
    }
    else if (key == DECREASE)
    {     
           timer1=0;
           key_flag=1;
            if (set_temper == 10)
            {
                set_temper = 10;
            }
            else
            {
                set_temper--;
            }
    }
    else if (key == INCREASE)
    {       timer1=0;
           key_flag=1;
            set_temper++;
            if (set_temper > 30)
            {
               set_temper = 30;
            }

    }

}
uchar KeyScan(void)
{
      uchar temp = 0;
      temp = PORT8;
      temp&=0x1f;
      if(temp!=0x1f)
      return temp;
    return 0x1f;
}

void _intcall counter1_l(void) @ 0x0C:low_int 3
{
 
}

void _intcall counter1(void) @ int 3
{
  //backup R4
  _asm
   {
     SWAPA 0x04
     MOV 0x1F,A
   }  
 
   //backup C system
  _asm
    {
    BS 0X4,6
    BS 0X4,7  
 MOV A,0X10 // USE 1 BYTE C TYPE,C SYSTEM BACKUP
 MOV 0X3C+1,A
 MOV A,0X14
 MOV 0X3B+1,A
 MOV A,0X18
 MOV 0X3A+1,A
 MOV A,0X1B
 MOV 0X39+1,A
 MOV A,0X1C
 MOV 0X38+1,A
    }
  
            ISR=0;
            timer_2ms_ok=1;
            if (key_state == 0)
           {
            new_key = KeyScan();
            if (new_key != 0x1f)
            {
                key_state++;
            }
           }
        else if (key_state < 5)
        {
            if (KeyScan() == new_key)
            {
                key_state++;
            }
            else

上一页  [1] [2] [3] [4] [5]  下一页


本文关键字:C语言  源代码  义隆单片机单片机-工控设备 - 义隆单片机