找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3124|回复: 1
打印 上一主题 下一主题
收起左侧

桑拿浴房控制器电路与单片机程序设计

[复制链接]
跳转到指定楼层
楼主
桑拿浴房控制器


单片机源程序如下:
  1. /***************************************************************
  2. *    High grade personal sana control system v3.0                                        *
  3. *                                                                   *
  4. * function: 1.control tempreture and time.                          *
  5. *           2.control push water header.                            *
  6. *                                3.control keyboard and lcd screen.                      *
  7. *                                4.control radio,music,or languge audio output.          *
  8. *                                5.control outside device(for example: fans,phone..)*
  9. ****************************************************************/


  10. #include <at89x52.h>
  11. #include <string.h>
  12. #define uint unsigned int
  13. #define uchar unsigned char
  14. //-------const define--------
  15. #define ENTER_W P1_3                        //=0 THEN ENTER WATER
  16. #define GO_W P1_4
  17. #define HEAT P1_5
  18. #define ISD_SCLK P1_6
  19. #define ISD_MOSI P2_5
  20. #define ASK P1_7                                        //=1 LCD IS BUSY
  21. #define WP_SW P1_0                                //=0 WATER IS FULL
  22. #define EEPROM_SDA P1_2                //cat24c021'data pin(24c02+watchdog)
  23. #define EEPROM_SCL P1_1                //cat24c021'clock pin(24c02+watchdog)
  24. #define RM_IN INT0
  25. #define ANSWER INT1
  26. #define LATCH T0
  27. #define TMP_IN T1
  28. #define BEEP P2_7
  29. #define M62429_CL P2_6
  30. #define M62429_DA P2_0
  31. #define RDKEY2 P2_4
  32. #define RDKEY1 P3_6
  33. #define RADIO_DO P2_3
  34. #define RADIO_CL P2_2
  35. #define RADIO_CE P2_1
  36. #define RADIO_DI P2_0
  37. #define ISD_INT P3_7
  38. #define KEYPORT P0
  39. #define LCDPORT P0
  40. #define setb(bitunit) {bitunit=1;out_port();}
  41. #define clrb(bitunit) {bitunit=0;out_port();}
  42. #define NONE_KEY 0
  43. #define UP_KEY 1
  44. #define DOWN_KEY 2
  45. #define LEFT_KEY 3
  46. #define RIGHT_KEY 4
  47. #define OSD_KEY 5
  48. #define SMOKER_KEY 6
  49. #define LAMP_KEY 7
  50. #define AMB_KEY 8
  51. #define POWER_KEY 9
  52. #define MUSIC_KEY 10
  53. #define FAN_KEY 11
  54. #define LP_KEY 12
  55. #define MAXITEMS 4
  56. //---------eeprom unit define
  57. #define ID_ADDR 8        //this address data must is 0x28
  58. #define STATUS_BYTE 18 //this byte save status1 data
  59. #define FM_FRE_ADDR 28 //4 byte fm fre value(low to high) from this address start
  60. #define STMP_ADDR 38        //1 byte save the set tempreture
  61. //---------bit unit define-------
  62. bdata uchar port0,port1,port2,status,status1;
  63. sbit power_sta=status^0;                //=1 then power is on
  64. sbit disp_sta_flag=status^1;         //=1 then display status line
  65. sbit smoker_flag=status^2;                //=1 then in smoker status
  66. sbit waterfull_flag=status^3;        //=1 then water is full
  67. sbit menu_flag=status^5;                //=1 then menu status
  68. sbit lockf=status^6;                                //=1 then lock self
  69. sbit lppw_flag=status^7;                //=1 then loop push water
  70. sbit keyvoice_flag=status1^0;        //=1 then press key BEEP
  71. sbit voice_flag=status1^1;                //=1 then voice output
  72. sbit first_chk_flag=status1^2; //=1 then chkself finish
  73. sbit english_chinese=status1^3;//=1 then chinese menu else english menu
  74. sbit mutef=status1^4;                        //=1 then mute
  75. sbit shift_flag=status1^5;        //=1 then send the output bit data
  76. sbit danger_flag=status1^6;        //=1 then water is already empty,indicate water don't long time full
  77. sbit first_smoker_flag=status1^7;        //=1 then first open the smoker in power on status
  78. //sbit first_speechf=status1^5;        //=1 then first speech play complete
  79. sbit AMBDRV=port0^3;                                //=1 then an mp beng open
  80. sbit O_INC=port0^4;                                //=1 then o++
  81. sbit KILLV=port0^5;                                //=1 then kill virus
  82. sbit FCOOL=port0^6;                                //=1 then cool fan
  83. sbit FWARM=port0^7;                                //=1 then hot fan
  84. sbit CYY=port1^0;                                        //=1 then chou yang yu open
  85. sbit FAN=port1^1;                                        //=1 fan open
  86. sbit LAMP2=port1^2;                                //=1 lamp2 on
  87. sbit LAMP1=port1^3;                                //=1 lamp1 on
  88. sbit W3=port1^4;                                        //=1 4 line push water header
  89. sbit W2=port1^5;
  90. sbit W1=port1^6;
  91. sbit W0=port1^7;
  92. sbit CD_RADIO=port2^0;                        //=0 cd on else =1 radio on
  93. sbit SOUND_CDRADIO=port2^1;        //=0 sound on else cd or radio       
  94. sbit ISD_SS=port2^4;
  95. //sbit ISD_SCLK=port2^3;
  96. //sbit ISD_MOSI=port2^5;
  97. sbit LCD_LIT=port2^3;
  98. //sbit RDKEY2=port2^6;
  99. //sbit RDKEY1=port2^7;
  100. //----------function define----------
  101. void out_port();
  102. void initial();
  103. void delay(uint);
  104. void clr_lcd();
  105. void disp_hz_str(uchar col,uchar row,uchar len,uchar *hzstr);
  106. void disp_ch_str(uchar col,uchar row,uchar len,uchar *chstr);
  107. void disp_hz(uchar col,uchar row,uint qwcode);
  108. void disp_ch(uchar col,uchar row,uchar chcode);
  109. void disp_icon(uchar col,uchar row,uchar *icon_ptr);
  110. unsigned char read_key();
  111. void wait_key_off();
  112. void ls_lcd();
  113. void disp_tmp();
  114. unsigned char get_tmp(uint cntval);
  115. void osd();
  116. void fanctrl();
  117. void amb();
  118. void music();
  119. void uk();
  120. void lk();
  121. void rk();
  122. void dk();
  123. void smoker();
  124. void lamp();
  125. void display();//display the menu or the other function
  126. void disp_status();//display the funciotn icon status line
  127. void chkself();//check self whole machine
  128. bit timewait_key_off(uchar wk_time);//timing wait key off
  129. void lp();
  130. void setvol(uchar volv);//set 62429 vol
  131. bit wrt_24cxx(uchar ic_type,uchar byte_addr,wdata);//radom wrt 24cxx,return 0 is ok
  132. bit rd_24cxx(uchar ic_type,uchar byte_addr,uchar *rd_ptr);//radom read 24cxx,return 0 is ok
  133. void reset_dog();
  134. void dly_us(uchar us_v);//delay i us
  135. void sstart();//send start bit
  136. void sstop();//send stop bit
  137. void send_ack();
  138. void send_noack();
  139. bit sdata(uchar tdata);//send data to eeprom, return 0 is ok else return 1
  140. uchar rdata();        //read 1 byte data from at24cxx
  141. bit set_radio_fre(unsigned long int fre);//set FM radio fre(88000khz--108000khz)
  142. unsigned long int rece_pll_data();
  143. void send_pll_data(unsigned long int ccb_data_block);
  144. void mute();//mute
  145. void wpchk();//water position test;if water full then waterfull_flag=1
  146. void play_voice(uchar seg_no);
  147. void send_isd_byte(uchar isd_data);
  148. void delay(uint ms);
  149. void stop_isd();
  150. void up_isd();
  151. void cyc();
  152. void save_par();
  153. void read_par();
  154. void demo(uchar i);
  155. void disp_second_dot();
  156. //-----------unit define------------
  157. uchar seccnt=20,mincnt=60,keycode=0,rmcode,wfcnt=0,wecnt=0,cyc_cnt=0;
  158. uchar stmp,stime,ctmp,vol=50,/*(0--80)*/items=0;
  159. uchar staline_disp_cnt,menu_disp_cnt,icon_cnt=0,speech_num=255;
  160. uchar lppw_cnt=80,music_cnt=0;/*=0:cd,radio all off;=1:radio on;=2:cd on;*/
  161. uint lcd_disp_cnt=3000;
  162. uint enterw_time_cnt,waterfull_hottime_cnt;
  163. unsigned long int fm_fre=94600;//khz
  164. //-----------string define----------
  165. code uchar str1[]="温度:";
  166. code uchar str2[]="+ ";
  167. code uchar fan_on_str[]="  风扇开启  ";
  168. code uchar fan_off_str[]="  风扇关闭  ";
  169. code uchar lit1_on_str[]="  灯一开启  ";
  170. code uchar lit2_on_str[]="  灯二开启  ";
  171. code uchar lit_off_str[]="  灯光关闭  ";
  172. code uchar radio_on_str[]="  收音开启  ";
  173. code uchar sound_off_str[]="  音乐关闭  ";
  174. code uchar sound_on_str[]="  音乐开启  ";
  175. code uchar cd_on_str[]="  唱碟开启  ";
  176. code uchar amb_on_str[]=" 按摩泵开启  ";
  177. code uchar amb_off_str[]=" 按摩泵关闭  ";
  178. code uchar smoke_on_str[]="  蒸汽开启  ";
  179. code uchar smoke_off_str[]="  蒸汽关闭  ";
  180. code uchar tp_on_str[]="  顶喷开启  ";
  181. code uchar tp_off_str[]="  顶喷关闭  ";
  182. code uchar bp_on_str[]="  下喷开启  ";
  183. code uchar bp_off_str[]="  下喷关闭  ";
  184. code uchar mp_on_str[]="  中喷开启  ";
  185. code uchar mp_off_str[]="  中喷关闭  ";
  186. code uchar hp_on_str[]="  上喷开启  ";
  187. code uchar hp_off_str[]="  上喷关闭  ";
  188. code uchar lp_on_str[]=" 循环喷水开启 ";
  189. code uchar lp_off_str[]=" 循环喷水关闭 ";
  190. code uchar zy_on_str[]="  增氧开启  ";
  191. code uchar zy_off_str[]="  增氧关闭  ";
  192. code uchar sj_on_str[]="  杀菌开启  ";
  193. code uchar sj_off_str[]="  杀菌关闭  ";
  194. code uchar nf_on_str[]="  暖风开启  ";
  195. code uchar nf_off_str[]="  暖风关闭  ";
  196. code uchar lf_on_str[]="  冷风开启  ";
  197. code uchar lf_off_str[]="  冷风关闭  ";
  198. code uchar yy_on_str[]="  语音开启  ";
  199. code uchar yy_off_str[]="  语音关闭  ";
  200. code uchar jy_on_str[]="  键音开启  ";
  201. code uchar jy_off_str[]="  键音关闭  ";
  202. code uchar nopstr[]="";
  203. code uchar chkself_str0[]=" 请 稍 等  ";
  204. code uchar chkself_str1[]="蒸汽机进入自动清";
  205. code uchar chkself_str2[]="洗自动检测状态 ";
  206. code uchar chkself_str5[]="一切功能暂停使用";
  207. code uchar chkself_str3[]="  自检成功  ";
  208. code uchar chkself_str4[]=" 电脑安全上锁 ";
  209. code uchar chkself_str6[]=" 蒸汽暂停使用 ";
  210. code uchar chkself_str7[]=" 请参考说明书 ";
  211. code uchar power_off_str[6][16]={"您好 谢谢使用 ","Hello,thank you ","for your use    ","蒸汽机已安全关闭","The steamer is  ","already shutdown"};
  212. code uchar title_str1[3][16]={"您好 欢迎使用","维特斯巡航智能型","电脑蒸汽房产品 "};
  213. code uchar title_str2[11][16]={"Hello,thank you ","for selecting   ","Watxfy series  ",
  214.                                                                                 "products.Our cru","ising intellectu","al computer ste",
  215.                                                                                 "am room introduc","ed from Finland ","is specially de",
  216.                                                                                 "signed for the  ","Chinese market. "};
  217. code uchar help_str[158][16]={"        ",
  218.                                                                         "        ",
  219.                                                                         "        ",
  220.                                                                         "        ",
  221.                                                                         "维特斯巡航智能型",
  222.                                                                         "        ",
  223.                                                     "电脑蒸汽房来自芬",
  224.                                                                         "        ",
  225.                                                     "兰休闲色彩 本型",
  226.                                                                         "        ",
  227.                                                            "号为中国市场特别",
  228.                                                                         "        ",
  229.                                                            "设计      ",
  230.                                                                         "        ",
  231.                                                                         "Watxfy crusing  ",
  232.                                                                         "                ",
  233.                                                                         "intellectual com",
  234.                                                                         "                ",
  235.                                                                         "puter steam is  ",
  236.                                                                         "                ",
  237.                                                                         "introduced from ",
  238.                                                                         "                ",
  239.                                                                         "Finland,and its ",
  240.                                                                         "                ",
  241.                                                                         "W-2000 is specia",
  242.                                                                         "                ",
  243.                                                                         "lly designed for",
  244.                                                                         "                ",
  245.                                                                         "the Chinese mark",
  246.                                                                         "                ",
  247.                                                                         "et.             ",
  248.                                                                         "                ",
  249.                                                                         "        ",
  250.                                                                         "        ",
  251.                                                                         "  功能简介  ",
  252.                                                                         "    Briefs of   ",
  253.                                                                         "    functions   ",
  254.                                                                         "        ",
  255.                                                                         " 含选配功能  ",
  256.                                                                         "        ",
  257.                                                                         "        ",
  258.                                                                         "        ",
  259.                                                                         " 双色幻彩灯  ",
  260.                                                                         "Safe dual-color ",
  261.                                                                         "     lights     ",
  262.                                                                         "        ",
  263.                                                                         "  电子排气  ",
  264.                                                                         "Electric exhaust",
  265.                                                                         "                ",
  266.                                                                         " 音响唱碟转换 ",
  267.                                                                         " Stereo radio,  ",
  268.                                                                         " CD conversion  ",
  269.                                                                         "        ",
  270.                                                                         " 水力针刺按摩 ",
  271.                                                                         "Hydraulic acupun",
  272.                                                                         "cture massage   ",
  273.                                                                         "        ",
  274.                                                                         "  增  氧  ",
  275.                                                                         "  Oxygenation   ",
  276.                                                                         "                ",
  277.                                                                         "  杀  菌  ",
  278.                                                                         " Sterilization  ",
  279.                                                                         "                ",
  280.                                                                         "  电  话  ",
  281.                                                                         "   Telephone    ",
  282.                                                                         "                ",
  283.                                                                         "  冷  风  ",
  284.                                                                         "    Cool air    ",
  285.                                                                         "                ",
  286.                                                                         "  热风干蒸  ",
  287.                                                                         "  Dry steam by  ",
  288.                                                                         "  hot air       ",
  289.                                                                         "        ",
  290.                                                                         " 电子控制冲浪 ",
  291.                                                                         " Electric wave  ",
  292.                                                                         "                ",
  293.                                                                         " 按键提示音  ",
  294.                                                                         "   Key tone     ",
  295.                                                                         "                ",
  296.                                                                         " 中英文显示  ",
  297.                                                                         "Chinese and Eng-",
  298.                                                                         "lish display    ",
  299.                                                                         "        ",
  300.                                                                         "  语音提示  ",
  301.                                                                         "    Speech      ",
  302.                                                                         "                ",
  303.                                                                         "  脚底按摩  ",
  304.                                                                         "  Sole massage  ",
  305.                                                                         "                ",
  306.                                                                         "  药浴蒸汽  ",
  307.                                                                         "  Herbal steam  ",
  308.                                                                         "                ",
  309.                                                                         "  自动恒温  ",
  310.                                                                         "Automatic thermo",
  311.                                                                         "stat            ",
  312.                                                                         "  自动定时  ",
  313.                                                                         "Automatic timing",
  314.                                                                         "                ",
  315.                                                                         " 蒸汽机自动清洗",
  316.                                                                         "Automatic clean-",
  317.                                                                         "ing of steamer  ",
  318.                                                                         "        ",
  319.                                                                         "电脑自动巡航监控",
  320.                                                                         "Computer auto cr",
  321.                                                                         "uising monitor  ",
  322.                                                                         "        ",
  323.                                                                         "自动检测故障提示",
  324.                                                                         "Auto detection, ",
  325.                                                                         "trouble indicati",
  326.                                                                         "        ",
  327.                                                                         "及安全上锁   ",
  328.                                                                         "on and safe lock",
  329.                                                                         "                ",
  330.                                                                         "  报警装置  ",
  331.                                                                         "  Alarm device  ",
  332.                                                                         "                ",
  333.                                                                         "        ",
  334.                                                                         "        ",
  335.                                                                         "        ",
  336.                                                                         " 全球机型简介 ",
  337.                                                                         "Briefs of global",
  338.                                                                         "models:         ",
  339.                                                                         "        ",
  340.                                                                         "  英语机型  ",
  341.                                                                         "English-langrage",
  342.                                                                         "models: W-E2000 ",
  343.                                                                         "        ",
  344.                                                                         "  俄语机型  ",
  345.                                                                         "Russian-langrage",
  346.                                                                         "models: W-R2000 ",
  347.                                                                         "        ",
  348.                                                                         "  汉语机型  ",
  349.                                                                         "Chinese-langrage",
  350.                                                                         "models: W-C2000 ",
  351.                                                                         "        ",
  352.                                                                         "  日语机型  ",
  353.                                                                         "Japaneselangrage",
  354.                                                                         "models: W-J2000 ",
  355.                                                                         "        ",
  356.                                                                         "  法语机型  ",
  357.                                                                         "French-langrage ",
  358.                                                                         "models: W-F2000 ",
  359.                                                                         "        ",
  360.                                                                         "  德语机型  ",
  361.                                                                         "German-langrage ",
  362.                                                                         "models: W-G2000 ",
  363.                                                                         "        ",
  364.                                                                         "  韩语机型  ",
  365.                                                                         "Korean-langrage ",
  366.                                                                         "models: W-K2000 ",
  367.                                                                         "        ",
  368.                                                                         " 西班牙语机型 ",
  369.                                                                         "Spanish-langrage",
  370.                                                                         "models: W-S2000 ",
  371.                                                                         "        ",
  372.                                                                         "        ",
  373.                                                                         "        ",
  374.                                                                         "        "};

  375. code uint tmp_tab[]={612,630,660,700,740,770,807,836,880,920,//0-9 C
  376.                                                         958,1013,1068,1107,1178,1221,1275,1331,1391,1451,//10-19 C
  377.                                                         1528,1606,1675,1744,1769,1901,1916,2023,2101,2180,//20-29 C
  378.                                                         2357,2412,2521,2631,2704,2804,2904,3014,3134,3249,//30-39 C
  379.                                                         3375,3495,3645,3825,4004,4125,4305,4479,4634,4790,//40-49 C
  380.                                                         4891,5063,5263,5477,5691,5841,6087,6287,6513,6739,//50-59 C
  381.                                                         6949,7160,7346,7644,7942,8181,8374,8654,8959,9264,//60-69 C
  382.                                                         9523,9876,10099,10432,10765,10978,11317,11617,11939,//70-79 C
  383.                                                         12642,12950,13250,13550,13900,14250,14600,15000,15400,15800,//80-89 C
  384.                                                         16200,16600,17000,17450,17900,18350,18800,19250,19700,20200//90-99 C
  385.                                                         };
  386. code uint rm_tab[]={0xA05F,0x8877,0x08F7,0x906F,0xB847,0xF807,0xB04F,0x9867,
  387.                          0xD827,0xC03F,0x40BF,0x00FF,0x807F,0x609F,0x20DF,0xF00F,
  388.                          0x58A7,0x28D7,0x6897,0x708F,0x30CF,0x0000,0x0000,0x0000,
  389.                          0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000};
  390. code uchar fan_icon[]={0x00,0x00,0x00,0x00,0x07,0x80,0x02,0x40,
  391.                                                                 0x01,0x20,0x01,0x20,0x01,0x40,0x3b,0x80,
  392.                                                                 0x46,0x80,0x47,0xc0,0x48,0xbe,0x50,0x84,
  393.                                                                 0x60,0x48,0x40,0x30,0x00,0x00,0x00,0x00};
  394. code uchar fan1_icon[]={0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x48,
  395.                                                                 0x00,0x24,0x38,0x24,0x44,0x48,0x87,0xf0,
  396.                                                                 0x9a,0x80,0x63,0x80,0x00,0xc0,0x00,0xb0,
  397.                                                                 0x00,0x8c,0x00,0x44,0x00,0xf0,0x00,0x00};
  398. code uchar fan2_icon[]={0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x06,
  399.                                                                 0x48,0x09,0x44,0x11,0x22,0x21,0x23,0xfe,
  400.                                                                 0x1f,0xc0,0x01,0x80,0x01,0x80,0x02,0x80,
  401.                                                                 0x02,0x40,0x02,0x20,0x01,0x20,0x00,0xc0};
  402. code uchar light_icon[]={        0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,
  403.                                                                           0x40,0x04,0x23,0x88,0x07,0xc0,0x0f,0xe0,
  404.                                                                         0x0f,0xe0,0x07,0xc0,0x03,0x80,0x13,0x90,
  405.                                                                         0x23,0x88,0x03,0x80,0x00,0x00,0x00,0x00};       
  406. code uchar music_icon[]={ 0x00,0x00,0x00,0x00,0x07,0x80,0x07,0x80,
  407.                                                                         0x04,0xe0,0x04,0x3c,0x04,0x04,0x04,0x04,
  408.                                                                         0x04,0x04,0x3c,0x04,0x3c,0x04,0x38,0x3c,
  409.                                                                         0x00,0x3c,0x00,0x38,0x00,0x00,0x00,0x00};
  410. code uchar smoker_icon[]={0x0f,0xf0,0x10,0x08,0x21,0xe4,0x42,0x12,
  411.                                                                   0x82,0x09,0x84,0x01,0x98,0x81,0xa3,0x31,
  412.                                                                   0xa2,0x71,0xa4,0xf1,0xa1,0xf1,0x83,0xf1,
  413.                                                                   0x43,0xfa,0x20,0x1c,0x10,0x08,0x0f,0xf0};
  414. code uchar amb_icon[]={0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,
  415.                                                                 0x23,0xc0,0x24,0x20,0x2a,0x50,0x29,0x90,
  416.                                                                 0x29,0x90,0x2a,0x50,0x24,0x20,0x23,0xc0,
  417.                                                                 0x20,0x00,0x3f,0xf8,0x00,0x00,0x00,0x00};
  418. code uchar menu_icon[]={0x0f,0xf0,0x10,0x08,0x20,0x04,0x40,0x02,
  419.                                                            0xbb,0xb9,0xaa,0x29,0xaa,0x25,0xaa,0x25,
  420.                                                            0xab,0xa5,0xa8,0xa5,0xa8,0xa5,0xa8,0xa9,
  421.                                                            0x7b,0xba,0x20,0x04,0x10,0x08,0x0f,0xf0};
  422. code uchar left_icon[]={        0x00,0x00,0x00,0x00,0x00,0x60,0x00,0xe0,
  423.                                                                         0x01,0xe0,0x03,0xe0,0x07,0xe0,0x0f,0xe0,
  424.                                                                         0x0f,0xe0,0x07,0xe0,0x03,0xe0,0x01,0xe0,
  425.                                                                         0x00,0xe0,0x00,0x60,0x00,0x00,0x00,0x00};
  426. code uchar right_icon[]={        0x00,0x00,0x00,0x00,0x0c,0x00,0x0e,0x00,
  427.                                                                         0x0f,0x00,0x0f,0x80,0x0f,0xc0,0x0f,0xe0,
  428.                                                                         0x0f,0xe0,0x0f,0xc0,0x0f,0x80,0x0f,0x00,
  429.                                                                         0x0e,0x00,0x0c,0x00,0x00,0x00,0x00,0x00};
  430. code uchar up_icon[]={        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  431.                                                                 0x00,0x00,0x01,0x80,0x03,0xc0,0x07,0xe0,
  432.                                                                 0x0f,0xf0,0x1f,0xf8,0x3f,0xfc,0x3f,0xfc,
  433.                                                                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
  434. code uchar down_icon[]={        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  435.                                                                         0x00,0x00,0x3f,0xfc,0x3f,0xfc,0x1f,0xf8,
  436.                                                                         0x0f,0xf0,0x07,0xe0,0x03,0xc0,0x01,0x80,
  437.                                                                         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
  438. code uchar cw_fan_icon[]={0x00,0x00,0x00,0x00,0x3f,0xe0,0x20,0x20,
  439.                                                                         0x20,0x00,0x20,0x70,0x23,0x8e,0x20,0x00,
  440.                                                                         0x20,0x70,0x23,0x8e,0x20,0x00,0x20,0x70,
  441.                                                                         0x23,0x87,0x20,0x20,0x3f,0xe0,0x00,0x00};
  442. code uchar o2_icon[]={ 0x00,0x00,0x00,0x00,0x0c,0x00,0x12,0x00,
  443.                                                                 0x21,0x00,0x21,0x00,0x21,0x00,0x21,0x00,
  444.                                                                 0x21,0x30,0x21,0x48,0x21,0x08,0x21,0x70,
  445.                                                                 0x12,0x40,0x0c,0x78,0x00,0x00,0x00,0x00};
  446. code uchar o3_icon[]={ 0x00,0x00,0x00,0x00,0x0c,0x00,0x12,0x00,
  447.                                                                 0x21,0x00,0x21,0x00,0x21,0x00,0x21,0x30,
  448.                                                                 0x21,0x48,0x21,0x08,0x21,0x30,0x21,0x08,
  449.                                                                 0x12,0x48,0x0c,0x30,0x00,0x00,0x00,0x00};
  450. code uchar pushw_icon[]={ 0x00,0x00,0x00,0x00,0x20,0x84,0xf1,0xcf,
  451.                                                                         0x21,0xc4,0x03,0x80,0x07,0xc0,0x27,0xe4,
  452.                                                                         0xf5,0xcf,0x25,0xc4,0x0d,0xe0,0x1f,0xf0,
  453.                                                                         0x03,0xb0,0x01,0xb0,0x01,0xb0,0x00,0x90};
  454. code uchar lock_icon[]={        0x00,0x00,0x00,0x00,0x03,0xc0,0x04,0x20,
  455.                                                                         0x04,0x20,0x04,0x20,0x1f,0xf8,0x10,0x08,
  456.                                                                         0x1f,0xf8,0x10,0x08,0x1f,0xf8,0x10,0x08,
  457.                                                                         0x1f,0xf8,0x1f,0xf8,0x00,0x00,0x00,0x00};
  458. //
  459. uint        code isd_addr[]={ 0x0000,0x0034,0x0077,0x0080,
  460.                                                                 0x0089,0x0091,0x009b,0x00a5,
  461.                                                                 0x00af,0x00bb,0x00c8,0x00d2,
  462.                                                                 0x00db,0x00e6,0x00ef,0x00f7,
  463.                                                                 0x0100,0x0108,0x0111,0x0119,
  464.                                                                 0x0122,0x012d,0x013a,0x0142,
  465.                                                                 0x014c,0x0156,0x0161,0x016e,
  466.                                                                 0x017c,0x0185,0x018e,0x0198,
  467.                                                                 0x01a3,0x01aa,0x01b4,0x01d6,
  468.                                                                 0x01f0,0x020b,0x0216,0x021d};
  469. //
  470. main(void)
  471. {
  472.         uint cnt0,i;
  473.         uchar j;
  474. //        uint waterfull_hottime_cnt;
  475.         reset_dog();
  476.         delay(200);
  477.         read_par();
  478.   initial();
  479.         first_chk_flag=0;
  480.         cnt0=1300;
  481.         clr_lcd();
  482. //        delay(300);
  483.         disp_ch_str(0,2,16,"    Watxfy      ");
  484.         while(1)//main loop
  485.         {
  486.                 j=0;
  487.                 while(keycode!=POWER_KEY&&rmcode!=1)
  488.                 {
  489.                         reset_dog();
  490.                         delay(100);
  491.                         if(--cnt0==0)
  492.                         {
  493.                                 cnt0=1300;
  494.                                 GO_W=1;                        //close water switch
  495.                                 ENTER_W=1;
  496.                         }
  497.                         if(cnt0%15==0)
  498.                         {
  499.                                 demo(j);
  500.                                 if(help_str[j][0]>=0xa0)
  501.                                         j=j+1;
  502.                                 else
  503.                                         j=j+2;
  504.                                 if(j>153)
  505.                                         j=0;
  506.                         }
  507.                         keycode=read_key();
  508.                 }
  509.                 wait_key_off();
  510.                 power_sta=1;
  511.                 rmcode=0;
  512. //                if(english_chinese==0)
  513. //                {
  514.                         clr_lcd();                                //power key press ,open the machine
  515.                         disp_hz_str(0,0,8,title_str1[0]);
  516.                         disp_hz_str(0,1,8,title_str1[1]);
  517.                         disp_hz_str(0,2,8,title_str1[2]);
  518.                         disp_hz_str(0,3,8,title_str1[3]);
  519.                         play_voice(0);
  520.                         if(voice_flag)
  521.                         {
  522.                                 while(ISD_INT)
  523.                                         if(keycode=read_key()>0||rmcode>0)
  524.                                                 goto power_on;
  525.                         }
  526.                         else
  527.                         {
  528.                                 i=100;
  529.                                 while(i--)
  530.                                 {
  531.                                         delay(100);
  532.                                         if(keycode=read_key()>0||rmcode>0)
  533.                                                 goto power_on;
  534.                                 };
  535.                         }
  536. //                }
  537. //                else
  538. //                {
  539.                         clr_lcd();
  540.                         disp_ch_str(0,0,16,title_str2[0]);
  541.                         disp_ch_str(0,1,16,title_str2[1]);
  542.                         disp_ch_str(0,2,16,title_str2[2]);
  543.                         disp_ch_str(0,3,16,title_str2[3]);
  544.                         disp_ch_str(0,4,16,title_str2[4]);
  545.                         disp_ch_str(0,5,16,title_str2[5]);
  546.                         disp_ch_str(0,6,16,title_str2[6]);
  547.                         disp_ch_str(0,7,16,title_str2[7]);
  548.                         play_voice(1);
  549.                         i=100;
  550.                         while(i--)
  551.                         {
  552.                                 delay(100);
  553.                                 if(keycode=read_key()>0||rmcode>0)
  554.                                         goto power_on;
  555.                         };
  556.                         clr_lcd();
  557.                         disp_ch_str(0,0,16,title_str2[8]);
  558.                         disp_ch_str(0,1,16,title_str2[9]);
  559.                         disp_ch_str(0,2,16,title_str2[10]);
  560.                         if(voice_flag)
  561.                         {
  562.                                 while(ISD_INT)
  563.                                         if(keycode=read_key()>0||rmcode>0)
  564.                                                 goto power_on;
  565.                         }
  566.                         else
  567.                         {
  568.                                 i=100;
  569.                                 while(i--)
  570.                                 {
  571.                                         delay(100);
  572.                                         if(keycode=read_key()>0||rmcode>0)
  573.                                                 goto power_on;
  574.                                 };
  575.                         }
  576. //                }
  577. power_on:
  578.                 keycode=read_key();
  579.                 menu_flag=0;
  580.                 speech_num=255;
  581.                 first_smoker_flag=1;
  582. //                first_speechf=0;
  583.                 GO_W=1;                                        //close water switch
  584.                 ENTER_W=1;
  585. //                stmp=60;
  586.                 stime=90;
  587. //                enterw_time_cnt=23622;        //set enter time is 30s=1.27ms*23622
  588.                 enterw_time_cnt=300;        //set enter time is 30s
  589. //                waterfull_hottime_cnt=355719;//set 8 minute hot time in water full state 1.35ms*355719=480s
  590.                 waterfull_hottime_cnt=4800;//set 8 minute hot time in water full state
  591.                 music_cnt=0;
  592.                 mute();
  593.                 setb(SOUND_CDRADIO);//open cd or radio
  594. //                setvol(vol);
  595.                 if(keycode!=POWER_KEY)
  596.                 {
  597.                         display();
  598.                         disp_status();
  599.                 }
  600. /*      if(waterfull_flag==0&&lockf==0)
  601.                 {
  602.                         waterfull_flag=0;        //if water is not full then enter water
  603.                         smoker_flag=0;
  604.                         ENTER_W=0;
  605.                 }*/
  606.                 while(power_sta)
  607.                 {
  608.                         delay(1);
  609.                         disp_second_dot();
  610.                         disp_tmp();
  611.                         if(shift_flag)
  612.                         {
  613.                                 out_port();
  614.                                 display();
  615.                                 shift_flag=0;
  616.                         }
  617.                         if(!lockf&&smoker_flag)
  618.                         {
  619.                                 if(waterfull_flag)
  620.                                 {
  621.                                         ENTER_W=1;
  622.                                         GO_W=1;
  623.                                         enterw_time_cnt=300;        //set enter time is 30s=1.27ms*23622
  624.                                 }
  625.                                 else
  626.                                 {
  627.                                         ENTER_W=0;
  628.                                         GO_W=1;
  629.                                 }
  630.                         }
  631.                         if(keycode==0)
  632.                                 keycode=read_key();
  633.                         if(keycode)
  634.                         {
  635.                                   switch(keycode)
  636.                                   {
  637.                                         case LP_KEY:
  638.                                                 lp();
  639.                                                 wait_key_off();
  640.                                                   break;
  641.                                         case UP_KEY:
  642.                                                 uk();
  643.                                                   if(timewait_key_off(70))
  644.                                                 {
  645.                                                         while(timewait_key_off(10))
  646.                                                                 uk();
  647.                                                 }
  648.                                                   break;
  649.                                           case DOWN_KEY:
  650.                                                 dk();
  651.                                                   if(timewait_key_off(70))
  652.                                                 {
  653.                                                         while(timewait_key_off(10))
  654.                                                                 dk();
  655.                                                 }
  656.                                                 break;
  657.                                           case LEFT_KEY:
  658.                                                 lk();
  659.                                                   if(timewait_key_off(70))
  660.                                                 {
  661.                                                         while(timewait_key_off(3))
  662.                                                                 lk();
  663.                                                 setvol(vol);
  664.                                                 }
  665.                                                   break;
  666.                                           case RIGHT_KEY:
  667.                                                 rk();
  668.                                                   if(timewait_key_off(70))
  669.                                                 {
  670.                                                         while(timewait_key_off(3))
  671.                                                                 rk();
  672.                                                         setvol(vol);
  673.                                                 }
  674.                                                   break;
  675.                                           case OSD_KEY:
  676.                                                 osd();
  677.                                                 display();
  678.                                                   wait_key_off();
  679.                                                   break;
  680.                                           case SMOKER_KEY:
  681.                                                 enterw_time_cnt=300;        //set enter time is 30s=1.27ms*23622
  682.                                                 waterfull_hottime_cnt=4800;//set 8 minute hot time in water full state 1.35ms*355719=480s
  683.                                                 smoker();
  684.                                                   wait_key_off();
  685.                                                   break;
  686.                                           case LAMP_KEY:
  687.                   lamp();
  688.                                                   wait_key_off();
  689.                                                   break;
  690.                                           case AMB_KEY:
  691.                                                 amb();
  692.                                                   wait_key_off();
  693.                                                   break;
  694.                                           case POWER_KEY:
  695.                                                 initial();
  696.                                                 power_sta=0;
  697.                                                 mute();
  698.                                                 GO_W=0;
  699.                                                 ENTER_W=1;
  700.                                                 cnt0=1300;
  701.                                                 clr_lcd();
  702.                                                 disp_hz_str(0,0,8,power_off_str[0]);
  703.                                                 disp_ch_str(0,3,16,power_off_str[1]);
  704.                                                 disp_ch_str(0,4,16,power_off_str[2]);
  705.                                                 disp_hz_str(0,3,8,power_off_str[3]);
  706.                                                 play_voice(37);
  707.                                                 wait_key_off();
  708.                                                 i=0;
  709.                                                 do
  710.                                                 {
  711.                                                         delay(1);
  712.                                                         ++i;
  713.                                                 }while(i<30000&&(keycode=read_key())!=POWER_KEY&&rmcode!=1);
  714.                   if(i==30000)
  715.                                                 {
  716.                                                         GO_W=ENTER_W=1;
  717.                                                         delay(800);
  718.                                                    ENTER_W=0;
  719.                                                         i=0;
  720.                                                         do
  721.                                                         {
  722.                                                                 delay(1);
  723.                                                                 ++i;
  724.                                                         }while(i<25000&&(keycode=read_key())!=POWER_KEY&&rmcode!=1);
  725.                                                 }
  726.                                                 GO_W=0;
  727.                                                 ENTER_W=1;
  728.                                                   break;
  729.                                           case MUSIC_KEY:
  730.                                                 music();
  731.                                                   wait_key_off();
  732.                                                     break;
  733.                                           case FAN_KEY:
  734.                                                 fanctrl();
  735.                                                   wait_key_off();
  736.                                                   break;
  737.                                   }
  738.                                 save_par();
  739.                         }
  740.                         if(rmcode)
  741.                         {
  742.                                 if(keyvoice_flag&&power_sta)
  743.                                 {
  744.                                         BEEP=0;
  745.                                           delay(20);
  746.                                           BEEP=1;
  747.                                 }
  748.                                 switch(rmcode)
  749.                                 {
  750.                                         case 1://power
  751.                                                 rmcode=0;
  752.                                                 initial();
  753.                                                 power_sta=0;
  754.                                                 mute();
  755.                                                 GO_W=0;
  756.                                                 ENTER_W=1;
  757.                                                 cnt0=1300;
  758.                                                 clr_lcd();
  759.                                                 disp_hz_str(0,0,8,power_off_str[0]);
  760.                                                 disp_ch_str(0,3,16,power_off_str[1]);
  761.                                                 disp_ch_str(0,4,16,power_off_str[2]);
  762.                                                 disp_hz_str(0,3,8,power_off_str[3]);
  763.                                            play_voice(37);
  764.                                                 i=0;
  765.                                                 do
  766.                                                 {
  767.                                                         delay(1);
  768.                                                         ++i;
  769.                                                 }while(i<30000&&(keycode=read_key())!=POWER_KEY&&rmcode!=1);
  770.                                       if(i==30000)
  771.                                                 {
  772.                                                         GO_W=ENTER_W=1;
  773.                                                         delay(800);
  774.                                                    ENTER_W=0;
  775.                                                         i=0;
  776.                                                         do
  777.                                                         {
  778.                                                                 delay(1);
  779.                                                                 ++i;
  780.                                                         }while(i<25000&&(keycode=read_key())!=POWER_KEY&&rmcode!=1);
  781.                                                 }
  782.                                                 GO_W=0;
  783.                                                 ENTER_W=1;
  784.                                                 break;
  785.                                         case 2://lamp
  786.                                                 lamp();
  787.                                                 break;
  788.                                         case 3://smoker
  789.                                                 enterw_time_cnt=300;        //set enter time is 30s=1.27ms*23622
  790.                                                 waterfull_hottime_cnt=4800;//set 8 minute hot time in water full state 1.35ms*355719=480s
  791.                                                 smoker();
  792.                                                 break;
  793.                                         case 4://fan
  794.                                                 fanctrl();
  795.                                                 break;
  796.                                         case 5://pump
  797.                                                 amb();
  798.                                                 break;
  799.                                         case 6://hot fan
  800.                                                 AMBDRV=0;
  801.                                                 smoker_flag=0;
  802.                                                 HEAT=1;
  803.                                                 FWARM=~FWARM;
  804.                                                 if(FWARM)
  805.                                                         FCOOL=1;
  806.                                                 else
  807.                                                         FCOOL=0;
  808.                                                 out_port();
  809.                                                 if(english_chinese==0)
  810.                                                         FWARM==1?disp_hz_str(0,3,8,nf_on_str):disp_hz_str(0,3,8,nf_off_str);
  811.                                                 else
  812.                                                 {
  813.                                                         disp_hz_str(0,3,8,nopstr);
  814.                                                         if(FWARM)
  815.                                                         {
  816.                                                                 disp_ch_str(0,6,16,"  Dry steam by  ");
  817.                                                                 disp_ch_str(0,7,16,"  hot air on    ");
  818.                                                         }
  819.                                                         else
  820.                                                         {
  821.                                                                 disp_ch_str(0,6,16,"  Dry steam by  ");
  822.                                                                 disp_ch_str(0,7,16,"  hot air off   ");
  823.                                                         }
  824.                                                 }
  825.                                                 FWARM==1?play_voice(20):play_voice(21);
  826.                                                 break;
  827.                                         case 7://kill virus
  828.                                                 KILLV=~KILLV;
  829.                                                 out_port();
  830.                                                 if(english_chinese==0)
  831.                                                         KILLV==1?disp_hz_str(0,3,8,sj_on_str):disp_hz_str(0,3,8,sj_off_str);
  832.                                                 else
  833.                                                 {
  834.                                                         disp_hz_str(0,3,8,nopstr);
  835.                                                         if(KILLV)
  836.                                                         {
  837.                                                                 disp_ch_str(0,6,16," Sterilization  ");
  838.                                                                 disp_ch_str(0,7,16,"       on       ");
  839.                                                         }
  840.                                                         else
  841.                                                         {
  842.                                                                 disp_ch_str(0,6,16," Sterilization  ");
  843.                                                                 disp_ch_str(0,7,16,"       off      ");
  844.                                                         }
  845.                                                 }
  846.                                                 KILLV==1?play_voice(16):play_voice(17);
  847.                                                 break;
  848.                                         case 8://o++
  849.                                                 O_INC=~O_INC;
  850.                                                 out_port();
  851.                                                 if(english_chinese==0)
  852.                                                         O_INC==1?disp_hz_str(0,3,8,zy_on_str):disp_hz_str(0,3,8,zy_off_str);
  853.                                                 else
  854.                                                 {
  855.                                                         disp_hz_str(0,3,8,nopstr);
  856.                                                         if(O_INC)
  857.                                                         {
  858.                                                                 disp_ch_str(0,7,16," Oxygenation on ");
  859.                                                         }
  860.                                                         else
  861.                                                         {
  862.                                                                 disp_ch_str(0,7,16," Oxygenation off");
  863.                                                         }
  864.                                                 }
  865.                                                 O_INC==1?play_voice(14):play_voice(15);
  866.                                                 break;
  867.                                         case 9://cool fan
  868.                                                 if(FWARM)
  869.                                                 {
  870.                                                         FWARM=0;
  871.                                                         FCOOL=1;
  872.                                                 }
  873.                                                 else
  874.                                                 {
  875.                                                         FCOOL=~FCOOL;
  876.                                                         FWARM=0;
  877.                                                 }
  878.                                                 out_port();
  879.                                                 if(english_chinese==0)
  880.                                                         FCOOL==1?disp_hz_str(0,3,8,lf_on_str):disp_hz_str(0,3,8,lf_off_str);
  881.                                                 else
  882.                                                 {
  883.                                                         disp_hz_str(0,3,8,nopstr);
  884.                                                         if(FCOOL)
  885.                                                         {
  886.                                                                 disp_ch_str(0,7,16,"  Cool air on   ");
  887.                                                         }
  888.                                                         else
  889.                                                         {
  890.                                                                 disp_ch_str(0,7,16,"  Cool air off  ");
  891.                                                         }
  892.                                                 }
  893.                                                 FCOOL==1?play_voice(18):play_voice(19);
  894.                                                                 break;
  895.                                         case 10://lp
  896.                                                 lp();
  897.                                                 break;
  898.                                         case 11://temp inc
  899.                                                 menu_flag=1;
  900.                                                 items=0;
  901.                                                 display();
  902.                                                 if(smoker_flag==0)
  903.                                                         break;
  904.                                                 if(stmp==60)
  905.                                                         stmp=35;
  906.                                                 else
  907.                                                         stmp++;
  908.                                                 disp_hz_str(0,0,8,nopstr);
  909.                                                 if(english_chinese==0)
  910.                                                         disp_hz_str(0,0,8,"温度   时间 ");
  911.                                                 else
  912.                                                         disp_ch_str(0,1,16,"TEMP     TIME   ");
  913.                                                 disp_ch(14,1,stime/10+'0');
  914.                                                 disp_ch(15,1,stime%10+'0');
  915.                                                 disp_ch(4,1,stmp/10+'0');
  916.                                                 disp_ch(5,1,stmp%10+'0');
  917.                                                 play_voice(33);
  918.                                                 break;
  919.                                         case 12://time inc
  920.                                                 menu_flag=1;
  921.                                                 items=0;
  922.                                                 display();
  923.                                                 if(smoker_flag==0)
  924.                                                         break;
  925.                                                 if(stime>=90)
  926.                                                         stime=5;
  927.                                                 else
  928.                                                         stime++;
  929.                                                 disp_hz_str(0,0,8,nopstr);
  930.                                                 if(english_chinese==0)
  931.                                                         disp_hz_str(0,0,8,"温度   时间 ");
  932.                                                 else
  933.                                                         disp_ch_str(0,1,16,"TEMP     TIME   ");
  934.                                                 disp_ch(14,1,stime/10+'0');
  935.                                                 disp_ch(15,1,stime%10+'0');
  936.                                                 disp_ch(4,1,stmp/10+'0');
  937.                                                 disp_ch(5,1,stmp%10+'0');
  938.                                                 play_voice(32);
  939.                                                 break;
  940.                                         case 13://mute
  941.                                                 mutef=~mutef;
  942.                                                 if(mutef)
  943.                                                 {
  944.                                                         mute();
  945.                                                         play_voice(12);
  946.                                                         disp_hz_str(0,3,8,nopstr);
  947.                                                         if(english_chinese==0)
  948.                                                                 disp_hz_str(0,3,8,sound_off_str);
  949.                                                         else
  950.                                                                 disp_ch_str(0,7,16,"   Music off    ");
  951.                                                 }
  952.                                                 else
  953.                                                 {
  954.                                                         setvol(vol);
  955.                                                         play_voice(36);
  956.                                                         disp_hz_str(0,3,8,nopstr);
  957.                                                         if(english_chinese==0)
  958.                                                                 disp_hz_str(0,3,8,sound_on_str);
  959.                                                         else
  960.                                                                 disp_ch_str(0,7,16,"   Music on     ");
  961.                                                 }
  962.                                                 break;
  963.                                         case 14://temp dec
  964.                                                 menu_flag=1;
  965.                                                 items=0;
  966.                                                 display();
  967.                                                 if(smoker_flag==0)
  968.                                                         break;
  969.                                                 if(stmp==35)
  970.                                                         stmp=60;
  971.                                                 else
  972.                                                         stmp--;
  973.                                                 disp_hz_str(0,0,8,nopstr);
  974.                                                 if(english_chinese==0)
  975.                                                         disp_hz_str(0,0,8,"温度   时间 ");
  976.                                                 else
  977.                                                         disp_ch_str(0,1,16,"TEMP     TIME   ");
  978.                                                 disp_ch(14,1,stime/10+'0');
  979.                                                 disp_ch(15,1,stime%10+'0');
  980.                                                 disp_ch(4,1,stmp/10+'0');
  981.                                                 disp_ch(5,1,stmp%10+'0');
  982.                                                 play_voice(33);
  983.                                                 break;
  984.                                         case 15://time dec
  985.                                                 menu_flag=1;
  986.                                                 items=0;
  987.                                                 display();
  988.                                                 if(smoker_flag==0)
  989.                                                         break;
  990.                                                 if(stime<=1)
  991.                                                         stime=90;
  992.                                                 else
  993.                                                         stime--;
  994.                                                 disp_hz_str(0,0,8,nopstr);
  995.                                                 if(english_chinese==0)
  996.                                                         disp_hz_str(0,0,8,"温度   时间 ");
  997.                                                 else
  998.                                                         disp_ch_str(0,1,16,"TEMP     TIME   ");
  999.                                                 disp_ch(14,1,stime/10+'0');
  1000.                                                 disp_ch(15,1,stime%10+'0');
  1001.                                                 disp_ch(4,1,stmp/10+'0');
  1002.                                                 disp_ch(5,1,stmp%10+'0');
  1003.                                                 play_voice(32);
  1004.                                                 break;
  1005.                                         case 16://radio
  1006.                                                 music_cnt=1;
  1007.                                                 mutef=0;
  1008.                                                 setb(SOUND_CDRADIO);//open cd or radio
  1009.                                                 setb(CD_RADIO);//radio on
  1010.                                                 setvol(vol);
  1011.                                                 set_radio_fre(fm_fre);
  1012.                                                 send_pll_data(0x0200a029);//open the radio
  1013.                                                 display();
  1014.                                                 disp_hz_str(0,3,8,nopstr);
  1015.                                                 play_voice(10);
  1016.                                                 break;
  1017.                                         case 17://vol inc
  1018.                                                 if(mutef==0&&music_cnt!=0)
  1019.                                                 {
  1020.                                                         menu_flag=1;
  1021.                                                         items=1;
  1022.                                                         display();
  1023.                                                         if(vol<80)
  1024.                                                         {
  1025.                                                                 vol++;
  1026.                                                                 disp_hz(7,0,0x375a);
  1027.                                                                 disp_ch(14,1,vol/10+'0');
  1028.                                                                 disp_ch(15,1,vol%10+'0');
  1029.                                                                 setvol(vol);
  1030.                                                                 play_voice(31);
  1031.                                                         }
  1032.                                                 }
  1033.                                                 break;
  1034.                                         case 18://tuning inc
  1035.                                                 menu_flag=1;
  1036.                                                 items=1;
  1037.                                                 display();
  1038.                                                 if(CD_RADIO)
  1039.                                                 {
  1040.                                                    play_voice(30);
  1041.                                                         rmcode=0;
  1042.                                                         mute();
  1043.                                                         do
  1044.                                                         {
  1045.                                                                 if(fm_fre<108000)
  1046.                                                                         fm_fre=fm_fre+100;
  1047.                                                                 else
  1048.                                                                         fm_fre=88000;
  1049.                                                                 disp_hz(2,0,0x375a);
  1050.                                                                 disp_hz(3,0,0x375a);
  1051.                                                                 disp_hz(4,0,0x375a);
  1052.                                                                 disp_ch_str(6,0,2,"FM");
  1053.                                                                 disp_ch(4,1,fm_fre/100000?'1':' ');
  1054.                                                                 disp_ch(5,1,fm_fre/10000%10+'0');
  1055.                                                                 disp_ch(6,1,fm_fre/1000%10+'0');
  1056.                                                                 disp_ch(7,1,'.');
  1057.                                                                 disp_ch(8,1,fm_fre/100%10+'0');
  1058.                                                         }while(set_radio_fre(fm_fre)&&read_key()==0&&rmcode==0);//&&timewait_key_off(1));
  1059.                                                         rmcode=18;
  1060.                                                         setvol(vol);
  1061.                                                         send_pll_data(0x0200a029);//open the radio
  1062.                                                         wait_key_off();
  1063.                                                 }
  1064.                                                 break;
  1065.                                         case 19://cd
  1066.                                                 music_cnt=2;
  1067.                                                 mutef=0;
  1068.                                                 setb(SOUND_CDRADIO);
  1069.                                                 clrb(CD_RADIO);//cd on
  1070.                                                 setvol(vol);
  1071.                                                 display();
  1072.                                                 disp_hz_str(0,3,8,nopstr);
  1073.                                                 play_voice(11);
  1074.                                                 break;
  1075.                                         case 20://vol dec
  1076.                                                 if(mutef==0&&music_cnt!=0)
  1077.                                                 {
  1078.                                                         menu_flag=1;
  1079.                                                         items=1;
  1080.                                                         display();
  1081.                                                         if(vol>0)
  1082.                                                         {
  1083.                                                                 vol--;
  1084.                                                                 disp_hz(7,0,0x375a);
  1085.                                                                 disp_ch(14,1,vol/10+'0');
  1086.                                                                 disp_ch(15,1,vol%10+'0');
  1087.                                                                 setvol(vol);
  1088.                                                                 play_voice(31);
  1089.                                                         }
  1090.                                                 }
  1091.                                                 break;
  1092.                                         case 21://tuning dec
  1093.                                                 menu_flag=1;
  1094.                                                 items=1;
  1095.                                                 display();
  1096.                                                 if(CD_RADIO)
  1097.                                                 {
  1098.                                                         play_voice(30);
  1099.                                                         rmcode=0;
  1100.                                                         mute();
  1101.                                                         do{
  1102.                                                                 if(fm_fre>88000)
  1103.                                                                         fm_fre=fm_fre-100;
  1104.                                                                 else
  1105.                                                                         fm_fre=108000;
  1106.                                                                 disp_hz(2,0,0x375a);
  1107.                                                                 disp_hz(3,0,0x375a);
  1108.                                                                 disp_hz(4,0,0x375a);
  1109.                                                                 disp_ch_str(6,0,2,"FM");
  1110.                                                                 disp_ch(4,1,fm_fre/100000?'1':' ');
  1111.                                                                 disp_ch(5,1,fm_fre/10000%10+'0');
  1112.                                                                 disp_ch(6,1,fm_fre/1000%10+'0');
  1113.                                                                 disp_ch(7,1,'.');
  1114.                                                                 disp_ch(8,1,fm_fre/100%10+'0');
  1115.                                                         }while(set_radio_fre(fm_fre)&&read_key()==0&&rmcode==0);//&&timewait_key_off(1));
  1116.                                                         rmcode=21;
  1117.                                                         setvol(vol);
  1118.                                                         send_pll_data(0x0200a029);//open the radio
  1119.                                                         wait_key_off();
  1120.                                                 }
  1121.                                                 break;
  1122.                                         default:
  1123.                                                 break;
  1124.                                 }
  1125.                                 menu_disp_cnt=100;                          //10s delay
  1126.                                 staline_disp_cnt=30;                //3 second delay
  1127.                                 disp_sta_flag=1;
  1128.                                 if(rmcode!=1)
  1129.                                 {
  1130.                                           rmcode=0;
  1131.                                         save_par();
  1132.                                 }
  1133.                   }
  1134.                         if(staline_disp_cnt==0&&disp_sta_flag==1)
  1135.                         {
  1136. //                                disp_sta_flag=0;
  1137.                                 staline_disp_cnt=3;
  1138.                                 disp_status();
  1139.                         }
  1140.                         if(menu_disp_cnt==0&&menu_flag==1)
  1141.                         {
  1142.                                 menu_flag=0;
  1143.                                 speech_num=255;
  1144. //                                first_speechf=0;
  1145.                                 display();
  1146.                         }
  1147.                         if(smoker_flag&&!lockf)
  1148.                         {
  1149.                         //control temp & time
  1150.                                 if(stime!=0&&smoker_flag)
  1151.                                 {
  1152.                                         if(ctmp<stmp)
  1153.                                                 HEAT=0;
  1154.                                         else
  1155.                                                 HEAT=1;
  1156.                                 }
  1157.                                 else
  1158.                                 {
  1159.                                         smoker_flag=0;
  1160.                                         HEAT=1;
  1161.                                         ENTER_W=GO_W=1;
  1162.                                         display();
  1163.                                 }
  1164.                                 if(smoker_flag)
  1165.                                 {
  1166.                                         if(waterfull_flag)
  1167.                                         {
  1168.                                                 ENTER_W=GO_W=1;
  1169.                                                 enterw_time_cnt=300;        //set enter time is 30s=1.27ms*23622
  1170. //                                        if(ctmp<stmp)
  1171. //                                                HEAT=0;
  1172. //                                        else
  1173. //                                                HEAT=1;
  1174.                                                  if(danger_flag)
  1175.                                                         if(waterfull_hottime_cnt<3)
  1176.                                                         {
  1177.                                                                 waterfull_hottime_cnt=4800;
  1178.                                                                 lockf=1;
  1179.                                                                 HEAT=1;
  1180.                                                                 smoker_flag=0;
  1181.                                                                 ENTER_W=GO_W=1;
  1182.                                                                 display();
  1183.                                                                 if(english_chinese==0)
  1184.                                                                 {
  1185.                                                                         disp_hz_str(0,1,8,chkself_str4);
  1186.                                                                         disp_hz_str(0,2,8,chkself_str6);
  1187.                                                                         disp_hz_str(0,3,8,chkself_str7);
  1188.                                                                 }
  1189.                                                                 else
  1190.                                                                 {
  1191.                                                                         disp_hz_str(0,3,8,nopstr);
  1192.                                                                         disp_ch_str(0,7,16,"Lock the steamer");
  1193.                                                                 }
  1194.                                                                 menu_disp_cnt=100;                          //10s delay
  1195.                                                                 staline_disp_cnt=30;                //3 second delay
  1196.                                                                 disp_sta_flag=1;
  1197.                                                         }
  1198.                                         }
  1199.                                         else
  1200.                                         {
  1201.                                                 ENTER_W=0;
  1202.                                                 GO_W=1;
  1203.                                                 danger_flag=1;
  1204.                                                 waterfull_hottime_cnt=4800;//set 8 minute hot time in water full state 1.35ms*355719=480s
  1205. //                                        if(ctmp<stmp)
  1206. //                                                HEAT=0;
  1207. //                                        else
  1208. //                                                HEAT=1;
  1209.                                                 if(enterw_time_cnt<3)
  1210.                                                 {
  1211.                                                         enterw_time_cnt=300;
  1212.                                                         lockf=1;
  1213.                                                         HEAT=1;
  1214.                                                         smoker_flag=0;
  1215.                                                         ENTER_W=GO_W=1;
  1216.                                                         display();
  1217.                                                         if(english_chinese==0)
  1218.                                                         {
  1219.                                                                 disp_hz_str(0,1,8,chkself_str4);
  1220.                                                                 disp_hz_str(0,2,8,chkself_str6);
  1221.                                                                 disp_hz_str(0,3,8,chkself_str7);
  1222.                                                         }
  1223.                                                         else
  1224.                                                         {
  1225.                                                                 disp_hz_str(0,3,8,nopstr);
  1226.                                                                 disp_ch_str(0,7,16,"Lock the steamer");
  1227.                                                         }
  1228.                                                         menu_disp_cnt=100;                          //10s delay
  1229.                                                         staline_disp_cnt=30;                //3 second delay
  1230.                                                         disp_sta_flag=1;
  1231.                                                 }
  1232.                                         }
  1233.                                 }
  1234.                         }
  1235.                 }
  1236.         }
  1237. }
  1238. /*void cyc()
  1239. {
  1240.         if(++cyc_cnt==4)
  1241.                 cyc_cnt=0;
  1242.         switch(cyc_cnt)
  1243.         {
  1244.                  case 0:
  1245.                         W0=1;
  1246.                         W1=W2=W3=0;
  1247.                         out_port();
  1248.                         if(english_chinese==0)
  1249.                                 disp_hz_str(0,3,8,tp_on_str);
  1250.                         else
  1251.                         {
  1252.                                 disp_hz_str(0,3,8,nopstr);
  1253.                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  1254.                                 disp_ch_str(0,7,16,"cture massage on");
  1255.                         }
  1256.                         play_voice(8);
  1257.                         break;
  1258.                 case 1:
  1259.                         W1=1;
  1260.                         W0=W2=W3=0;
  1261.                         out_port();
  1262.                         if(english_chinese==0)
  1263.                                 disp_hz_str(0,3,8,hp_on_str);
  1264.                         else
  1265.                         {
  1266.                                 disp_hz_str(0,3,8,nopstr);
  1267.                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  1268.                                 disp_ch_str(0,7,16,"cture massage on");
  1269.                         }
  1270.                         play_voice(8);
  1271.                         break;
  1272.                 case 2:
  1273.                         W2=1;
  1274.                         W1=W0=W3=0;
  1275.                         out_port();
  1276.                         if(english_chinese==0)
  1277.                                 disp_hz_str(0,3,8,mp_on_str);
  1278.                         else
  1279.                         {
  1280.                                 disp_hz_str(0,3,8,nopstr);
  1281.                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  1282.                                 disp_ch_str(0,7,16,"cture massage on");
  1283.                         }
  1284.                         play_voice(8);
  1285.                         break;
  1286.                 case 3:
  1287.                         W3=1;
  1288.                         W1=W2=W0=0;
  1289.                         out_port();
  1290.                         if(english_chinese==0)
  1291.                                 disp_hz_str(0,3,8,bp_on_str);
  1292.                         else
  1293.                         {
  1294.                                 disp_hz_str(0,3,8,nopstr);
  1295.                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  1296.                                 disp_ch_str(0,7,16,"cture massage on");
  1297.                         }
  1298.                         play_voice(8);
  1299.                         break;
  1300.         }
  1301. }*/
  1302. void initial()
  1303. {
  1304.         SCON=0x00;
  1305.         TMOD=0x51;                //time 0 is 16 bit timing;time1 is 16 bit counter
  1306.         TH1=0;
  1307.         TL1=0;
  1308.         TH0=0x3c;                //100 ms 6mhz osc
  1309.         TL0=0xb0;
  1310.         T2CON=0x00;
  1311.         RCAP2H=0x00;
  1312.         RCAP2L=0x00;
  1313.         TR2=0;
  1314.         ES=0;
  1315.         ET1=0;
  1316.         ET2=0;
  1317.         IT0=1;                        //down tridge
  1318.   EX0=1;
  1319.         EX1=0;
  1320.         TR0=1;
  1321.         TF1=0;
  1322.         TR1=1;
  1323.         PX0=1;
  1324.         PT0=1;
  1325.         ET0=1;
  1326.         TF2=0;
  1327.         EA=1;
  1328.         mute();
  1329. //port ini
  1330.         P0=0xff;
  1331.         P1=0xff;
  1332.         P2=0xff;
  1333.         P3=0xff;
  1334.         port0=0x00;
  1335.         port1=0x00;
  1336.         port2=0x00;
  1337.         CY=lockf;
  1338.         status=0x00;
  1339.         lockf=CY;
  1340.         RDKEY1=1;
  1341.         RDKEY2=1;
  1342. //        setb(RDKEY1);
  1343. //        setb(RDKEY2);
  1344.         setb(SOUND_CDRADIO);
  1345.         up_isd();//voice chip power up
  1346.         stop_isd();
  1347. //        keyvoice_flag=1;                //key voice is on
  1348. //        voice_flag=1;//
  1349. //unit ini
  1350. //        stmp=60;
  1351.         stime=90;
  1352.         music_cnt=0;
  1353. //        wrt_24cxx(0,0,rd_24cxx(0,0));
  1354. }
  1355. void save_par()
  1356. {
  1357.         wrt_24cxx(1,STATUS_BYTE,status1);
  1358.         wrt_24cxx(1,FM_FRE_ADDR,fm_fre%256);
  1359.         wrt_24cxx(1,FM_FRE_ADDR+1,(fm_fre>>8)%256);
  1360.         wrt_24cxx(1,FM_FRE_ADDR+2,(fm_fre>>16)%256);
  1361.         wrt_24cxx(1,FM_FRE_ADDR+3,(fm_fre>>24)%256);
  1362.         wrt_24cxx(1,STMP_ADDR,stmp);
  1363. }
  1364. void read_par()
  1365. {
  1366.         uchar warm,r0,r1,r2,r3;
  1367.         if(rd_24cxx(1,ID_ADDR,&warm))
  1368.                 while(1);
  1369.         else
  1370.                 if(warm!=0x28)
  1371.                         while(1);
  1372.         if(rd_24cxx(1,STATUS_BYTE,&status1))
  1373.                 while(1);
  1374.         rd_24cxx(1,FM_FRE_ADDR,&r0);
  1375.         rd_24cxx(1,FM_FRE_ADDR+1,&r1);
  1376.         rd_24cxx(1,FM_FRE_ADDR+2,&r2);
  1377.         rd_24cxx(1,FM_FRE_ADDR+3,&r3);
  1378.         fm_fre=r3*0x1000000+r2*0x10000+r1*0x100+r0;
  1379.         if(rd_24cxx(1,STMP_ADDR,&stmp))
  1380.                 while(1);
  1381. }
  1382. remote() interrupt 0
  1383. {
  1384.         unsigned long int c;
  1385.         uchar i;
  1386.         uint j;
  1387.         for(i=0;i<32;i++)
  1388.         {
  1389.                 j=300;
  1390.                 while(--j&&!RM_IN);
  1391.                 if(j==0)
  1392.                         return;
  1393.                 TR2=0;
  1394.                 TL2=0;
  1395.                 TH2=0;
  1396.                 TR2=1;
  1397.                 j=500;
  1398.                 while(--j&&RM_IN);
  1399.                 if(j==0)
  1400.                 {
  1401.                         //repeat press control
  1402.                         return;
  1403.                 }
  1404.                 TR2=0;
  1405.                 if(TH2>=4)
  1406.                         return;
  1407.                 else
  1408.                         if(TH2>=2)
  1409.                                 c=c<<1|1;
  1410.                         else
  1411.                                 c=c<<1;
  1412.         }
  1413.         if(c>>16==0x08f7)                //remotor code
  1414.         {
  1415.                 j=c%65536;
  1416.                 for(i=0;i<32;i++)
  1417.                 {
  1418.                         if(j==rm_tab[i])
  1419.                         {
  1420.                                 rmcode=i+1;
  1421.                                 clrb(LCD_LIT);
  1422.                                 lcd_disp_cnt=3000;
  1423. //                        if(keyvoice_flag)
  1424. //                                        BEEP=0;
  1425.                                 return;
  1426.                         }
  1427.                 }
  1428.                 return;
  1429.         }
  1430.         else
  1431.                 return;
  1432. }
  1433. timer0() interrupt 1                //100ms timing mode
  1434. {
  1435.         uchar i;
  1436.         TH0=0x3c;
  1437.         TL0=0xb0;
  1438.         reset_dog();
  1439.         if(SOUND_CDRADIO==0)
  1440.         {
  1441.                 for(i=0;i<100;i++)
  1442.                 {
  1443.                         if(ISD_INT)
  1444.                                 break;
  1445.                 }
  1446.                 if(i==100)
  1447.                 {
  1448.                         SOUND_CDRADIO=1;
  1449.                         shift_flag=1;
  1450.                 }
  1451.         }
  1452.         wpchk();
  1453.         --staline_disp_cnt;
  1454.         --menu_disp_cnt;
  1455.         --enterw_time_cnt;
  1456.         --waterfull_hottime_cnt;
  1457.         if(--lcd_disp_cnt==0)
  1458.                 setb(LCD_LIT);
  1459.         if(--seccnt==0)
  1460.                 seccnt=20;
  1461.         if(seccnt%10==0)
  1462.         {
  1463.                 TR1=0;
  1464.                 ctmp=get_tmp(TH1*256+TL1);
  1465.                 TH1=0x00;
  1466.                 TL1=0x00;
  1467.                 TF1=0;
  1468.                 TR1=1;
  1469.                 if(--mincnt==0)
  1470.                 {
  1471.                         mincnt=60;
  1472.                         if(stime!=0&&smoker_flag==1)
  1473.                         {
  1474.                                 stime--;
  1475.                                 shift_flag=1;
  1476.                         }
  1477.                 }
  1478.                 if(lppw_flag)
  1479.                 {
  1480.                         --lppw_cnt;
  1481.                         switch(lppw_cnt)
  1482.                         {
  1483.                                 case 60:
  1484.                                         W0=W2=W3=0;
  1485.                                         W1=1;
  1486.                                         shift_flag=1;
  1487.                                         break;
  1488.                                 case 40:
  1489.                                         W0=W1=W3=0;
  1490.                                         W2=1;
  1491.                                         shift_flag=1;
  1492.                                         break;
  1493.                                 case 20:
  1494.                                         W0=W1=W2=0;
  1495.                                         W3=1;
  1496.                                         shift_flag=1;
  1497.                                         break;
  1498.                                 case 0:
  1499.                                         lppw_cnt=80;
  1500.                                         W1=W2=W3=0;
  1501.                                         W0=1;
  1502.                                         shift_flag=1;
  1503.                                         break;
  1504.                                 default:
  1505.                                         break;
  1506.                         }
  1507.                 }
  1508.         }
  1509. }
  1510. uchar read_key()
  1511. {
  1512.         uchar keytemp,i,j;
  1513.         KEYPORT=0xff;
  1514.         RDKEY1=0;
  1515. //        clrb(RDKEY1);
  1516.         keytemp=~KEYPORT;
  1517.         RDKEY1=1;
  1518. //        setb(RDKEY1);
  1519.         if(keytemp)
  1520.         {
  1521.                 clrb(LCD_LIT);                //lcd on
  1522.                 lcd_disp_cnt=3000;
  1523.                 if(keyvoice_flag&&power_sta)
  1524.                 {
  1525.                         BEEP=0;
  1526.                         delay(50);
  1527.                         BEEP=1;
  1528.                 }
  1529.                 for(i=1,j=1;i<=8;i++,j=j*2)
  1530.                         if(keytemp&j)
  1531.                                 return i;
  1532.                 return 0;
  1533.         }
  1534. //        clrb(RDKEY2);
  1535.         RDKEY2=0;
  1536.         keytemp=(~KEYPORT)&0x0f;
  1537. //        setb(RDKEY2);
  1538.         RDKEY2=1;
  1539.         if(keytemp)
  1540.         {
  1541.                 clrb(LCD_LIT);                //lcd on
  1542.                 lcd_disp_cnt=3000;
  1543.                 if(keyvoice_flag&&power_sta)
  1544.                 {
  1545.                      BEEP=0;
  1546.                         delay(50);
  1547.                         BEEP=1;
  1548.                 }
  1549.                 for(i=9,j=1;i<=12;i++,j=j*2)
  1550.                         if(keytemp&j)
  1551.                                 return i;
  1552.                 return 0;
  1553.         }
  1554.         BEEP=1;
  1555.         return 0;
  1556. }
  1557. void wait_key_off()
  1558. {
  1559.         KEYPORT=0xff;
  1560.         RDKEY1=0;
  1561. //        clrb(RDKEY1);
  1562.         while(KEYPORT!=0xff);
  1563.         RDKEY1=1;
  1564. //        setb(RDKEY1);
  1565.         RDKEY2=0;
  1566. //        clrb(RDKEY2);
  1567.         while((KEYPORT&0x0f)!=0x0f);
  1568.         RDKEY2=1;
  1569. //        setb(RDKEY2);
  1570.         BEEP=1;
  1571.         keycode=0;
  1572. }
  1573. bit timewait_key_off(uchar wk_time)
  1574. {
  1575.         uchar i;
  1576.         i=wk_time;
  1577.         for(;i>0;i--)
  1578.         {
  1579.                 KEYPORT=0xff;
  1580.                 RDKEY1=0;
  1581. //                clrb(RDKEY1);
  1582.                 if(KEYPORT==0xff)
  1583.                 {
  1584.                         RDKEY1=1;
  1585. //                        setb(RDKEY1);
  1586.                         RDKEY2=0;
  1587. //                        clrb(RDKEY2);
  1588.                         if((KEYPORT&0x0f)==0x0f)
  1589.                         {
  1590. //                                setb(RDKEY2);
  1591.                                 RDKEY2=1;
  1592.                                 keycode=0;
  1593.                                 return 0;//key off exit
  1594.                         }
  1595. //                        setb(RDKEY2);
  1596.                         RDKEY2=1;
  1597.                 }
  1598. //                setb(RDKEY1);
  1599.                 RDKEY1=1;
  1600.                 delay(10);
  1601.         }
  1602.         return 1;//key no break exit,time over exit
  1603. }

  1604. void disp_tmp(void)
  1605. {
  1606.         if(smoker_flag==0&&menu_flag==0&&seccnt==20)
  1607.         {
  1608.                 disp_hz(2,0,0x375a);
  1609.                 disp_hz(3,0,0x375a);
  1610.                 disp_ch(5,1,ctmp/10+48);
  1611.                 disp_ch(6,1,ctmp%10+48);
  1612.         }
  1613. }
  1614. uchar get_tmp(uint cntval)
  1615. {
  1616.         uchar i=0;
  1617.         while(cntval>=tmp_tab[i]&&i<99)
  1618.                 i++;
  1619.         return i;
  1620. }
  1621. void wait_til_busy(void)
  1622. {
  1623.         int i=2000;
  1624.         while(!ASK&&i--);
  1625. }
  1626. void wait_til_nop(void)
  1627. {
  1628.         int i=2000;
  1629.         while(ASK&&i--);
  1630. }
  1631. void disp_hz_str(uchar col,uchar row,uchar len,uchar *hzstr)
  1632. //COL=HZ COLS IN SCREEN(00--07);
  1633. //ROW=HZ ROWS IN SCREEN\(00--03);
  1634. //LEN=HZ NUMBER;
  1635. //HZSTR=HANZI NEIMA STRING POINTER;
  1636. {
  1637.         while(len-->0&&*hzstr>=0xa0)
  1638.         {
  1639.                 ANSWER=0;
  1640.                 ASK=1;
  1641.                 wait_til_nop();
  1642.                 LCDPORT=0xf0;
  1643.                 ANSWER=1;
  1644.                 wait_til_busy();
  1645.                 ANSWER=0;
  1646.                 wait_til_nop();
  1647.                 LCDPORT=col+2;                                //col from 2 start for hz
  1648.                 ANSWER=1;
  1649.                 wait_til_busy();
  1650.                 ANSWER=0;
  1651.                 wait_til_nop();
  1652.                 LCDPORT=row;
  1653.                 ANSWER=1;
  1654.                 wait_til_busy();
  1655.                 ANSWER=0;
  1656.                 wait_til_nop();
  1657.                 LCDPORT=*hzstr==0xa1&&*(hzstr+1)==0xa1?0x37:*hzstr-0xa0;
  1658.                 hzstr++;
  1659.                 ANSWER=1;
  1660.                 wait_til_busy();
  1661.                 ANSWER=0;
  1662.                 wait_til_nop();
  1663.                 LCDPORT=*hzstr==0xa1&&*(hzstr-1)==0xa1?0x5a:*hzstr-0xa0;
  1664.                 hzstr++;
  1665.                 ANSWER=1;
  1666.                 wait_til_busy();
  1667.                 ANSWER=0;
  1668.                 col++;
  1669.         }
  1670.         LCDPORT=0xff;
  1671. }
  1672. void disp_ch_str(uchar col,uchar row,uchar len,uchar *chstr)
  1673. {
  1674. //COL=CHAR COLS IN SCREEN(0--15);
  1675. //ROW=CHAR LINES IN SCREEN(0--7);
  1676. //LEN=CHAR NUMBER;
  1677. //CHSTR=CHAR STRING POINTER;
  1678.         while(len-->0&&*chstr)
  1679.         {
  1680.                 ANSWER=0;
  1681.                   ASK=1;
  1682.                   wait_til_nop();
  1683.                   LCDPORT=0xf1;
  1684.                   ANSWER=1;
  1685.                   wait_til_busy();
  1686.                   ANSWER=0;
  1687.                   wait_til_nop();
  1688.                   LCDPORT=col+4;                        //col from 4 start for char
  1689.                   ANSWER=1;
  1690.                   wait_til_busy();
  1691.                   ANSWER=0;
  1692.                   wait_til_nop();
  1693.                   LCDPORT=row*8;
  1694.                   ANSWER=1;
  1695.                   wait_til_busy();
  1696.                   ANSWER=0;
  1697.                   wait_til_nop();
  1698.                   LCDPORT=*chstr++;
  1699.                   ANSWER=1;
  1700.                   wait_til_busy();
  1701.                   ANSWER=0;
  1702.                 col++;
  1703.         }
  1704.         LCDPORT=0xff;
  1705. }
  1706. void disp_hz(uchar col,uchar row,uint qwcode)
  1707. //COL=HZ COLS IN SCREEN(00--07);
  1708. //ROW=HZ ROWS IN SCREEN(00--03);
  1709. //QWCODE=HANZI QU WEI CODE;
  1710. {
  1711.                 ANSWER=0;
  1712.                 ASK=1;
  1713.                 wait_til_nop();
  1714.                 LCDPORT=0xf0;
  1715.                 ANSWER=1;
  1716.                 wait_til_busy();
  1717.                 ANSWER=0;
  1718.                 wait_til_nop();
  1719.                 LCDPORT=col+2;                                //col from 2 start for hz
  1720.                 ANSWER=1;
  1721.                 wait_til_busy();
  1722.                 ANSWER=0;
  1723.                 wait_til_nop();
  1724.                 LCDPORT=row;
  1725.                 ANSWER=1;
  1726.                 wait_til_busy();
  1727.                 ANSWER=0;
  1728.                 wait_til_nop();
  1729.                 LCDPORT=qwcode/256;
  1730.                 ANSWER=1;
  1731.                 wait_til_busy();
  1732.                 ANSWER=0;
  1733.                 wait_til_nop();
  1734.                 LCDPORT=qwcode%256;
  1735.                 ANSWER=1;
  1736.                 wait_til_busy();
  1737.                 ANSWER=0;
  1738.                 LCDPORT=0xff;
  1739. }
  1740. void disp_ch(uchar col,uchar row,uchar chcode)
  1741. {
  1742. //COL=CHAR COLS IN SCREEN(0--15);
  1743. //ROW=CHAR LINES IN SCREEN(0--7);
  1744. //CHCODE=CHAR ASIC CODE;
  1745.                 ANSWER=0;
  1746.                   ASK=1;
  1747.                   wait_til_nop();
  1748.                   LCDPORT=0xf1;
  1749.                   ANSWER=1;
  1750.                   wait_til_busy();
  1751.                   ANSWER=0;
  1752.                   wait_til_nop();
  1753.                   LCDPORT=col+4;                        //col from 4 start for char
  1754.                   ANSWER=1;
  1755.                   wait_til_busy();
  1756.                   ANSWER=0;
  1757.                   wait_til_nop();
  1758.                   LCDPORT=row*8;
  1759.                   ANSWER=1;
  1760.                   wait_til_busy();
  1761.                   ANSWER=0;
  1762.                   wait_til_nop();
  1763.                   LCDPORT=chcode;
  1764.                   ANSWER=1;
  1765.                   wait_til_busy();
  1766.                   ANSWER=0;
  1767.                 LCDPORT=0xff;
  1768. }
  1769. void disp_icon(uchar col,uchar row,uchar *icon_ptr)
  1770. {
  1771. //display 16*16 dot icon
  1772. //COL=CHAR COLS IN SCREEN(0--7);
  1773. //ROW=CHAR LINES IN SCREEN(0--3);
  1774. //ICON_PTR=POINT TO DOT BYTE ARRAY;
  1775.                 uchar coltmp,rowtmp,i;
  1776.                 disp_hz(col,row,0x375a);
  1777.                 for(coltmp=col*2+4,rowtmp=row*16,i=0;i<16;i++)
  1778.                 {
  1779.                         ANSWER=0;
  1780.                           ASK=1;
  1781.                           wait_til_nop();
  1782.                           LCDPORT=0xf3;                        //dot display
  1783.                           ANSWER=1;
  1784.                           wait_til_busy();
  1785.                           ANSWER=0;
  1786.                           wait_til_nop();
  1787.                           LCDPORT=coltmp;           //col from 4 start for char
  1788.                           ANSWER=1;
  1789.                           wait_til_busy();
  1790.                           ANSWER=0;
  1791.                           wait_til_nop();
  1792.                           LCDPORT=rowtmp++;
  1793.                           ANSWER=1;
  1794.                           wait_til_busy();
  1795.                           ANSWER=0;
  1796.                           wait_til_nop();
  1797.                           LCDPORT=icon_ptr[i*2];
  1798.                           ANSWER=1;
  1799.                           wait_til_busy();
  1800.                           ANSWER=0;
  1801.                           LCDPORT=0xff;
  1802.                 }
  1803.                 for(coltmp=col*2+5,rowtmp=row*16,i=0;i<16;i++)
  1804.                 {
  1805.                         ANSWER=0;
  1806.                           ASK=1;
  1807.                           wait_til_nop();
  1808.                           LCDPORT=0xf3;                        //dot display
  1809.                           ANSWER=1;
  1810.                           wait_til_busy();
  1811.                           ANSWER=0;
  1812.                           wait_til_nop();
  1813.                           LCDPORT=coltmp;           //col from 4 start for char
  1814.                           ANSWER=1;
  1815.                           wait_til_busy();
  1816.                           ANSWER=0;
  1817.                           wait_til_nop();
  1818.                           LCDPORT=rowtmp++;
  1819.                           ANSWER=1;
  1820.                           wait_til_busy();
  1821.                           ANSWER=0;
  1822.                           wait_til_nop();
  1823.                           LCDPORT=icon_ptr[i*2+1];
  1824.                           ANSWER=1;
  1825.                           wait_til_busy();
  1826.                           ANSWER=0;
  1827.                           LCDPORT=0xff;
  1828.                 }
  1829. }

  1830. void clr_lcd(void)
  1831. {
  1832.         ANSWER=0;
  1833.         ASK=1;
  1834.         wait_til_nop();
  1835.         LCDPORT=0xf4;
  1836.         ANSWER=1;
  1837.         wait_til_busy();
  1838.         ANSWER=0;
  1839.         LCDPORT=0xff;
  1840. }
  1841. /*void ls_lcd(void)
  1842. {
  1843.         ANSWER=0;
  1844.         ASK=1;
  1845.         wait_til_nop();
  1846.         LCDPORT=0xf7;
  1847.         ANSWER=1;
  1848.         wait_til_busy();
  1849.         ANSWER=0;
  1850.         LCDPORT=0xff;
  1851. }*/
  1852. void out_port()
  1853. {
  1854.         mute();
  1855.         TI=0;
  1856.         SBUF=port0;
  1857.         while(!TI);
  1858.         TI=0;
  1859.         SBUF=port1;
  1860.         while(!TI);
  1861.         TI=0;
  1862.         SBUF=port2;
  1863.         while(!TI);
  1864.         LATCH=0;
  1865.         TI=0;
  1866.         LATCH=1;
  1867.         if(mutef==0)
  1868.         setvol(vol);
  1869. }
  1870. void delay(uint ms)
  1871. {
  1872.         uchar i;
  1873.         uint j;
  1874.         for(j=0;j<ms;j++)
  1875.                 for(i=250;i>0;i--); //6mhz osc is 1ms
  1876. }
  1877. void osd()
  1878. {
  1879.         if(!menu_flag)
  1880.         {
  1881.                 menu_flag=1;
  1882.                 items=0;
  1883.                 menu_disp_cnt=100;          //10s delay
  1884.                 play_voice(13);
  1885.                 return;
  1886.         }
  1887.         if(items<MAXITEMS)
  1888.         {
  1889.                 items++;
  1890.                 menu_disp_cnt=100;          //10s delay
  1891.                 play_voice(13);
  1892.         }
  1893.         else
  1894.         {
  1895.                 menu_flag=0;
  1896.                 speech_num=255;
  1897. //                first_speechf=0;
  1898.         }
  1899. }
  1900. void fanctrl()
  1901. {
  1902.         FAN=~FAN;
  1903.         FAN?play_voice(4):play_voice(5);
  1904.         out_port();
  1905.         if(english_chinese==0)
  1906.                 FAN==1?disp_hz_str(0,3,8,fan_on_str):disp_hz_str(0,3,8,fan_off_str);
  1907.         else
  1908.         {
  1909.                 if(FAN)
  1910.                 {
  1911.                         disp_hz_str(0,3,8,nopstr);
  1912.                         disp_ch_str(0,7,16,"    Fan on      ");
  1913.                 }
  1914.                 else
  1915.                 {
  1916.                         disp_hz_str(0,3,8,nopstr);
  1917.                         disp_ch_str(0,7,16,"    Fan off     ");
  1918.                 }
  1919.         }
  1920.         menu_disp_cnt=100;                          //10s delay
  1921.         staline_disp_cnt=30;                //3 second delay
  1922.         disp_sta_flag=1;
  1923. }
  1924. void amb()
  1925. {
  1926.         HEAT=1;
  1927.         AMBDRV=~AMBDRV;
  1928.         AMBDRV?play_voice(6):play_voice(7);
  1929.         out_port();
  1930.         if(english_chinese==0)
  1931.                 AMBDRV==1?disp_hz_str(0,3,8,amb_on_str):disp_hz_str(0,3,8,amb_off_str);
  1932.         else
  1933.         {
  1934.                 if(AMBDRV)
  1935.                 {
  1936.                         disp_hz_str(0,3,8,nopstr);
  1937.                         disp_ch_str(0,7,16,"    Wave on     ");
  1938.                 }
  1939.                 else
  1940.                 {
  1941.                         disp_hz_str(0,3,8,nopstr);
  1942.                         disp_ch_str(0,7,16,"    Wave off    ");
  1943.                 }
  1944.         }
  1945.         if(AMBDRV)
  1946.         {
  1947.                 if(FWARM)
  1948.                 {
  1949.                         FWARM=0;
  1950.                         FCOOL=0;
  1951.                 }
  1952.                 smoker_flag=0;
  1953.                 HEAT=1;
  1954.                 out_port();
  1955.         }
  1956.         menu_disp_cnt=100;                          //10s delay
  1957.         staline_disp_cnt=30;                //3 second delay
  1958.         disp_sta_flag=1;
  1959. }
  1960. void music()
  1961. {
  1962.         menu_disp_cnt=100;                          //10s delay
  1963.         staline_disp_cnt=50;                //5 second delay
  1964.         mutef=0;
  1965.         disp_sta_flag=1;
  1966.         if(++music_cnt>2)
  1967.                 music_cnt=0;
  1968.         switch(music_cnt)
  1969.         {
  1970.                 case 0:
  1971.                         mute();
  1972.                         play_voice(12);
  1973.                         display();
  1974.                         if(english_chinese==0)
  1975.                                 disp_hz_str(0,3,8,sound_off_str);
  1976.                         else
  1977.                         {
  1978.                                 disp_hz_str(0,3,8,nopstr);
  1979.                                 disp_ch_str(0,7,16,"   Music off    ");
  1980.                         }
  1981.                         break;
  1982.                 case 1:
  1983.                         setb(SOUND_CDRADIO);
  1984.                         setb(CD_RADIO);//radio on
  1985.                         setvol(vol);
  1986.                         set_radio_fre(fm_fre);
  1987.                         send_pll_data(0x0200a029);//open the radio
  1988.                         display();
  1989.                         disp_hz_str(0,3,8,nopstr);
  1990.                         if(english_chinese==0)
  1991.                                 disp_hz_str(0,3,8,"  收音开启  ");
  1992.                         else
  1993.                                 disp_ch_str(0,8,16,"   RADIO ON     ");
  1994.                         play_voice(10);
  1995.                         break;
  1996.                 case 2:
  1997.                         setb(SOUND_CDRADIO);
  1998.                         clrb(CD_RADIO);//cd on
  1999.                         setvol(vol);
  2000.                         display();
  2001.                         disp_hz_str(0,3,8,nopstr);
  2002.                         if(english_chinese==0)
  2003.                                 disp_hz_str(0,3,8,"  唱碟输入  ");
  2004.                         else
  2005.                                 disp_ch_str(0,8,16,"    CD INPUT    ");
  2006.                         play_voice(11);
  2007.                         break;
  2008.         }
  2009. //        display();
  2010. }
  2011. void smoker()
  2012. {
  2013.         uchar i;
  2014.         if(first_chk_flag==0)
  2015.         {
  2016.                 first_chk_flag=1;
  2017.                 chkself();
  2018.                 if(lockf==0)
  2019.                 {
  2020.                         stime=90;
  2021. //                        stmp=60;
  2022.                         smoker_flag=1;
  2023.                         display();
  2024.                 }
  2025.                 else
  2026.                 {
  2027.                         smoker_flag=0;
  2028.                         HEAT=1;
  2029.                         display();
  2030.                         if(english_chinese==0)
  2031.                                 disp_hz_str(0,3,8,chkself_str4);
  2032.                         else
  2033.                         {
  2034.                                 disp_hz_str(0,3,8,nopstr);
  2035.                                 disp_ch_str(0,7,16,"Lock the steamer");
  2036.                                
  2037.                         }
  2038. //                play_voice(36);
  2039.                 }
  2040. //                display();
  2041.                 menu_disp_cnt=100;                           //10s delay
  2042.                 staline_disp_cnt=50;                        //3 second delay
  2043.                 disp_sta_flag=1;
  2044.         }
  2045.         else
  2046.         {
  2047.                 if(smoker_flag)
  2048.                 {
  2049.                         play_voice(29);
  2050.                         smoker_flag=0;
  2051.                         HEAT=1;
  2052.                         display();
  2053.                         disp_hz_str(0,3,8,nopstr);
  2054.                         if(english_chinese==0)
  2055.                                 disp_hz_str(0,3,8,smoke_off_str);
  2056.                         else
  2057.                                 disp_ch_str(0,7,16,"   STEAM OFF    ");
  2058.                 }
  2059.                 else
  2060.                 {
  2061.                         if(lockf==0)
  2062.                         {
  2063.                                 if(first_smoker_flag)
  2064.                                 {
  2065.                                         first_smoker_flag=0;
  2066.                                         if(waterfull_flag==1)                        //if water is full
  2067.                                         {
  2068.                                                 GO_W=0;
  2069.                                                 ENTER_W=1;
  2070.                                                 i=88;
  2071.                                                 do
  2072.                                                 {
  2073.                                                         delay(1000);
  2074.                                                         i--;
  2075.                                                 }while(waterfull_flag&&i>0);
  2076.                                                 if(i==0)
  2077.                                                 {
  2078.                                                         lockf=1;
  2079.                                                         GO_W=1;
  2080.                                                         ENTER_W=1;
  2081.                                                         clr_lcd();
  2082.                                                         if(english_chinese==0)
  2083.                                                         {
  2084.                                                                 disp_hz_str(0,1,8,chkself_str4);
  2085.                                                                 disp_hz_str(0,2,8,chkself_str6);
  2086.                                                                 disp_hz_str(0,3,8,chkself_str7);
  2087.                                                         }
  2088.                                                         else
  2089.                                                         {
  2090.                                                                 disp_ch_str(0,3,16,"Lock the steamer");
  2091.                                                         }
  2092.                                                         play_voice(36);
  2093.                                                         delay(2000);
  2094.                                                         return;
  2095.                                                 }
  2096.                                                 GO_W=1;                                //check success
  2097.                                                 lockf=0;
  2098.                                                 ENTER_W=1;
  2099.                                         }
  2100.                                         else                //if water is empty
  2101.                                         {
  2102.                                                 ENTER_W=0;
  2103.                                                 GO_W=1;
  2104.                                                 i=30;
  2105.                                                 do
  2106.                                                 {
  2107.                                                         delay(1000);
  2108.                                                         i--;
  2109.                                                 }while(waterfull_flag==0&&i>0);
  2110.                                                 if(i==0)
  2111.                                                 {
  2112.                                                         lockf=1;
  2113.                                                         GO_W=1;
  2114.                                                         ENTER_W=1;
  2115.                                                         clr_lcd();
  2116.                                                         if(english_chinese==0)
  2117.                                                         {
  2118.                                                                 disp_hz_str(0,1,8,chkself_str4);
  2119.                                                                 disp_hz_str(0,2,8,chkself_str6);
  2120.                                                                 disp_hz_str(0,3,8,chkself_str7);
  2121.                                                         }
  2122.                                                         else
  2123.                                                         {
  2124.                                                                 disp_ch_str(0,3,16,"Lock the steamer");
  2125.                                                         }
  2126.                                                         play_voice(36);
  2127.                                                         delay(2000);
  2128.                                                         return;
  2129.                                                 }
  2130.                                                 ENTER_W=1;
  2131.                                                 lockf=0;
  2132.                                         }
  2133.                                 }
  2134.                                 stime=90;
  2135.                                  smoker_flag=1;
  2136.                                 display();
  2137.                                 disp_hz_str(0,3,8,nopstr);
  2138.                                 if(english_chinese==0)
  2139.                                         disp_hz_str(0,3,8,smoke_on_str);
  2140.                                 else
  2141.                                         disp_ch_str(0,7,16,"   STEAM ON     ");
  2142.                                 play_voice(28);
  2143.                         }
  2144.                         else
  2145.                         {
  2146.                                 smoker_flag=0;
  2147.                                 HEAT=1;
  2148.                                 display();
  2149.                                 if(english_chinese==0)
  2150.                                         disp_hz_str(0,3,8,chkself_str4);
  2151.                                 else
  2152.                                 {
  2153.                                         disp_hz_str(0,3,8,nopstr);
  2154.                                         disp_ch_str(0,7,16,"Lock the steamer");
  2155.                                 }
  2156. //                        delay(5000);
  2157.                                 play_voice(36);
  2158.                         }
  2159.                 }
  2160.         }
  2161. //        display();
  2162.         if(smoker_flag)
  2163.         {
  2164.                 if(FWARM)
  2165.                 {
  2166.                         FWARM=0;
  2167.                         FCOOL=0;
  2168.                 }
  2169.                 AMBDRV=0;
  2170.                 out_port();
  2171.         }
  2172.         menu_disp_cnt=100;                           //10s delay
  2173.         staline_disp_cnt=50;                        //3 second delay
  2174.         disp_sta_flag=1;
  2175. }
  2176. void lamp()
  2177. {
  2178.         if(LAMP1==0&&LAMP2==0)
  2179.         {
  2180.                 setb(LAMP1);
  2181.                 clrb(LAMP2);
  2182.                 if(english_chinese==0)
  2183.                         disp_hz_str(0,3,8,lit1_on_str);
  2184.                 else
  2185.                 {
  2186.                         disp_hz_str(0,3,8,nopstr);
  2187.                         disp_ch_str(0,7,16,"  Light on      ");
  2188.                 }
  2189.                 play_voice(2);
  2190.                 menu_disp_cnt=100;                          //10s delay
  2191.                 staline_disp_cnt=30;                //3 second delay
  2192.                 disp_sta_flag=1;
  2193.                 return;
  2194.         }
  2195.         if(LAMP1==1&&LAMP2==0)
  2196.         {
  2197.                 setb(LAMP2);
  2198.                 clrb(LAMP1);
  2199.                 play_voice(2);
  2200.                 if(english_chinese==0)
  2201.                         disp_hz_str(0,3,8,lit2_on_str);
  2202.                 else
  2203.                 {
  2204.                         disp_hz_str(0,3,8,nopstr);
  2205.                         disp_ch_str(0,7,16,"  Light on      ");
  2206.                 }
  2207.                 menu_disp_cnt=100;                          //10s delay
  2208.                 staline_disp_cnt=30;                //3 second delay
  2209.                 disp_sta_flag=1;
  2210.                 return;
  2211.         }
  2212.         if(LAMP1==0&&LAMP2==1)
  2213.         {
  2214.                 clrb(LAMP1);
  2215.                 clrb(LAMP2);
  2216.                 play_voice(3);
  2217.                 if(english_chinese==0)
  2218.                         disp_hz_str(0,3,8,lit_off_str);
  2219.                 else
  2220.                 {
  2221.                         disp_hz_str(0,3,8,nopstr);
  2222.                         disp_ch_str(0,7,16,"  Light off     ");
  2223.                 }
  2224.                 menu_disp_cnt=100;                          //10s delay
  2225.                 staline_disp_cnt=30;                //3 second delay
  2226.                 disp_sta_flag=1;
  2227.                 return;
  2228.         }
  2229. }
  2230. void lp()//loop push water
  2231. {
  2232.         lppw_flag=~lppw_flag;
  2233.         if(english_chinese==0)
  2234.                 lppw_flag==1?disp_hz_str(0,3,8,lp_on_str):disp_hz_str(0,3,8,lp_off_str);
  2235.         else
  2236.         {
  2237.                 if(lppw_flag)
  2238.                 {
  2239.                         disp_hz_str(0,3,8,nopstr);
  2240.                         disp_ch_str(0,6,16,"Hydraulic acupun");
  2241.                         disp_ch_str(0,7,16,"cture massage on");
  2242.                 }
  2243.                 else
  2244.                 {
  2245.                         disp_hz_str(0,3,8,nopstr);
  2246.                         disp_ch_str(0,6,16,"Hydraulic acupun");
  2247.                         disp_ch_str(0,7,16,"cture massageoff");
  2248.                 }
  2249.         }
  2250.         lppw_flag==1?play_voice(8):play_voice(9);
  2251.         if(lppw_flag)
  2252.         {
  2253.                 W1=W2=W3=0;
  2254.                 W0=1;
  2255.                 out_port();
  2256.         }
  2257.         else
  2258.         {
  2259.                 W0=W1=W2=W3=0;
  2260.                 out_port();
  2261.         }
  2262.         lppw_cnt=80;
  2263.         menu_disp_cnt=100;                          //10s delay
  2264.         staline_disp_cnt=30;                //3 second delay
  2265.         disp_sta_flag=1;
  2266. }
  2267. void lk()
  2268. {
  2269.         uchar keyf=0;
  2270.         if(menu_flag)
  2271.         {
  2272.                 menu_disp_cnt=100;                          //10s delay
  2273.                 staline_disp_cnt=30;                //3 second delay
  2274.                 disp_sta_flag=1;
  2275.                 switch(items)
  2276.                 {
  2277.                         case 0:
  2278.                                 //set tempreture --
  2279.                                 if(smoker_flag==0)
  2280.                                         break;
  2281.                                 if(stmp==35)
  2282.                                         stmp=60;
  2283.                                 else
  2284.                                         stmp--;
  2285.                                 disp_hz_str(0,0,8,nopstr);
  2286.                                 if(english_chinese==0)
  2287.                                         disp_hz_str(0,0,8,"温度   时间 ");
  2288.                                 else
  2289.                                         disp_ch_str(0,1,16,"TEMP     TIME   ");
  2290.                                 disp_ch(14,1,stime/10+'0');
  2291.                                 disp_ch(15,1,stime%10+'0');
  2292.                                 disp_ch(4,1,stmp/10+'0');
  2293.                                 disp_ch(5,1,stmp%10+'0');
  2294.                                 play_voice(33);
  2295.                                 break;
  2296.                         case 1:
  2297.                                 //radio fm fre dec
  2298.                                 if(CD_RADIO)
  2299.                                 {
  2300.                                         play_voice(30);
  2301. //                                        wait_key_off();
  2302.                                         rmcode=0;
  2303.                                         mute();
  2304.                                         if(timewait_key_off(800)==0)
  2305.                                         {
  2306.                                                 if(fm_fre>88000)
  2307.                                                         fm_fre=fm_fre-100;
  2308.                                                 else
  2309.                                                         fm_fre=108000;
  2310.                                                 disp_hz(2,0,0x375a);
  2311.                                                 disp_hz(3,0,0x375a);
  2312.                                                 disp_hz(4,0,0x375a);
  2313.                                                 if(english_chinese==0)
  2314.                                                         disp_ch_str(6,0,2,"FM");
  2315.                                                 else
  2316.                                                         disp_ch_str(0,1,3,"RAD");
  2317.                                                 disp_ch(4,1,fm_fre/100000?'1':' ');
  2318.                                                 disp_ch(5,1,fm_fre/10000%10+'0');
  2319.                                                 disp_ch(6,1,fm_fre/1000%10+'0');
  2320.                                                 disp_ch(7,1,'.');
  2321.                                                 disp_ch(8,1,fm_fre/100%10+'0');
  2322.                                                 set_radio_fre(fm_fre);
  2323.                                         }
  2324.                                         else
  2325.                                         {
  2326.                                                 do{
  2327.                                                         if(read_key()==0)
  2328.                                                                 keyf=1;
  2329.                                                         if(fm_fre>88000)
  2330.                                                                 fm_fre=fm_fre-100;
  2331.                                                         else
  2332.                                                                 fm_fre=108000;
  2333.                                                         disp_hz(2,0,0x375a);
  2334.                                                         disp_hz(3,0,0x375a);
  2335.                                                         disp_hz(4,0,0x375a);
  2336.                                                         if(english_chinese==0)
  2337.                                                                 disp_ch_str(6,0,2,"FM");
  2338.                                                         else
  2339.                                                                 disp_ch_str(0,1,3,"RAD");
  2340.                                                         disp_ch(4,1,fm_fre/100000?'1':' ');
  2341.                                                         disp_ch(5,1,fm_fre/10000%10+'0');
  2342.                                                         disp_ch(6,1,fm_fre/1000%10+'0');
  2343.                                                         disp_ch(7,1,'.');
  2344.                                                         disp_ch(8,1,fm_fre/100%10+'0');
  2345.                                                         if(keyf==1&&read_key()!=0)
  2346.                                                                 break;
  2347.                                                 }while(set_radio_fre(fm_fre)&&rmcode==0);
  2348.                                         }
  2349.                                         setvol(vol);
  2350.                                         send_pll_data(0x0200a029);//open the radio
  2351.                                         wait_key_off();
  2352.                                 }
  2353.                                 break;
  2354.                         case 2:
  2355.                                 //top push water
  2356.                                 W0=~W0;
  2357.                                 W1=W2=W3=0;
  2358.                                 out_port();
  2359.                                 if(english_chinese==0)
  2360.                                         W0==1?disp_hz_str(0,3,8,tp_on_str):disp_hz_str(0,3,8,tp_off_str);
  2361.                                 else
  2362.                                 {
  2363.                                         disp_hz_str(0,3,8,nopstr);
  2364.                                         if(W0)
  2365.                                         {
  2366.                                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  2367.                                                 disp_ch_str(0,7,16,"cture massage on");
  2368.                                         }
  2369.                                         else
  2370.                                         {
  2371.                                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  2372.                                                 disp_ch_str(0,7,16,"cture massageoff");
  2373.                                         }
  2374.                                 }
  2375.                                 W0==1?play_voice(8):play_voice(9);
  2376.                                 break;
  2377.                         case 3:
  2378.                                 //O inc
  2379.                                 O_INC=~O_INC;
  2380.                                 out_port();
  2381.                                 if(english_chinese==0)
  2382.                                         O_INC==1?disp_hz_str(0,3,8,zy_on_str):disp_hz_str(0,3,8,zy_off_str);
  2383.                                 else
  2384.                                 {
  2385.                                         disp_hz_str(0,3,8,nopstr);
  2386.                                         if(O_INC)
  2387.                                         {
  2388.                                                 disp_ch_str(0,7,16," Oxygenation on ");
  2389.                                         }
  2390.                                         else
  2391.                                         {
  2392.                                                 disp_ch_str(0,7,16," Oxygenation off");
  2393.                                         }
  2394.                                 }
  2395.                                 O_INC==1?play_voice(14):play_voice(15);
  2396.                                 break;
  2397.                         case 4:
  2398.                                 //voice
  2399.                                 voice_flag=~voice_flag;
  2400.                                 if(english_chinese==0)
  2401.                                         voice_flag==1?disp_hz_str(0,3,8,yy_on_str):disp_hz_str(0,3,8,yy_off_str);
  2402.                                 else
  2403.                                 {
  2404.                                         disp_hz_str(0,3,8,nopstr);
  2405.                                         if(voice_flag)
  2406.                                         {
  2407.                                                 disp_ch_str(0,7,16,"   Speech on    ");
  2408.                                         }
  2409.                                         else
  2410.                                         {
  2411.                                                 disp_ch_str(0,7,16,"   Speech off   ");
  2412.                                         }
  2413.                                 }
  2414.                                 if(voice_flag)
  2415.                                         play_voice(22);
  2416.                                 else
  2417.                                 {
  2418.                                         voice_flag=1;
  2419.                                         play_voice(23);
  2420.                                         voice_flag=0;
  2421.                                 }
  2422.                                 break;
  2423.                 }
  2424.         }
  2425. }
  2426. void rk()
  2427. {
  2428.         uchar keyf=0;
  2429.         if(menu_flag)
  2430.         {
  2431.                 menu_disp_cnt=100;                          //10s delay
  2432.                 staline_disp_cnt=30;                //3 second delay
  2433.                 disp_sta_flag=1;
  2434.                 switch(items)
  2435.                 {
  2436.                         case 0:
  2437.                                 //set tempreture ++
  2438.                                 if(smoker_flag==0)
  2439.                                         break;
  2440.                                 if(stmp==60)
  2441.                                         stmp=35;
  2442.                                 else
  2443.                                         stmp++;
  2444.                                 disp_hz_str(0,0,8,nopstr);
  2445.                                 if(english_chinese==0)
  2446.                                         disp_hz_str(0,0,8,"温度   时间 ");
  2447.                                 else
  2448.                                         disp_ch_str(0,1,16,"TEMP     TIME   ");
  2449.                                 disp_ch(14,1,stime/10+'0');
  2450.                                 disp_ch(15,1,stime%10+'0');
  2451.                                 disp_ch(4,1,stmp/10+'0');
  2452.                                 disp_ch(5,1,stmp%10+'0');
  2453.                                 play_voice(33);
  2454.                                 break;
  2455.                         case 1:
  2456.                                 //radio fm fre inc
  2457.                                 if(CD_RADIO)
  2458.                                 {
  2459.                                         play_voice(30);
  2460. //                                        wait_key_off();
  2461.                                         rmcode=0;
  2462.                                         mute();
  2463.                                         if(timewait_key_off(800)==0)
  2464.                                         {
  2465.                                                 if(fm_fre<108000)
  2466.                                                         fm_fre=fm_fre+100;
  2467.                                                 else
  2468.                                                         fm_fre=88000;
  2469.                                                 disp_hz(2,0,0x375a);
  2470.                                                 disp_hz(3,0,0x375a);
  2471.                                                 disp_hz(4,0,0x375a);
  2472.                                                 if(english_chinese==0)
  2473.                                                         disp_ch_str(6,0,2,"FM");
  2474.                                                 else
  2475.                                                         disp_ch_str(0,1,3,"RAD");
  2476.                                                 disp_ch(4,1,fm_fre/100000?'1':' ');
  2477.                                                 disp_ch(5,1,fm_fre/10000%10+'0');
  2478.                                                 disp_ch(6,1,fm_fre/1000%10+'0');
  2479.                                                 disp_ch(7,1,'.');
  2480.                                                 disp_ch(8,1,fm_fre/100%10+'0');
  2481.                                                 set_radio_fre(fm_fre);
  2482.                                         }
  2483.                                         else
  2484.                                         {
  2485.                                                 do{
  2486.                                                         if(read_key()==0)
  2487.                                                                 keyf=1;
  2488.                                                         if(fm_fre<108000)
  2489.                                                                 fm_fre=fm_fre+100;
  2490.                                                         else
  2491.                                                                 fm_fre=88000;
  2492.                                                         disp_hz(2,0,0x375a);
  2493.                                                         disp_hz(3,0,0x375a);
  2494.                                                         disp_hz(4,0,0x375a);
  2495.                                                         if(english_chinese==0)
  2496.                                                                 disp_ch_str(6,0,2,"FM");
  2497.                                                         else
  2498.                                                                 disp_ch_str(0,1,3,"RAD");
  2499.                                                         disp_ch(4,1,fm_fre/100000?'1':' ');
  2500.                                                         disp_ch(5,1,fm_fre/10000%10+'0');
  2501.                                                         disp_ch(6,1,fm_fre/1000%10+'0');
  2502.                                                         disp_ch(7,1,'.');
  2503.                                                         disp_ch(8,1,fm_fre/100%10+'0');
  2504.                                                         if(keyf==1&&read_key()!=0)
  2505.                                                                 break;
  2506.                                                 }while(set_radio_fre(fm_fre)&&rmcode==0);
  2507.                                         }
  2508.                                         setvol(vol);
  2509.                                         send_pll_data(0x0200a029);//open the radio
  2510.                                         wait_key_off();
  2511.                                 }
  2512.                                 break;
  2513.                         case 2:
  2514.                                 //high push water
  2515.                                 W1=~W1;
  2516.                                 W0=W3=W2=0;
  2517.                                 out_port();
  2518.                                 if(english_chinese==0)
  2519.                                         W1==1?disp_hz_str(0,3,8,hp_on_str):disp_hz_str(0,3,8,hp_off_str);
  2520.                                 else
  2521.                                 {
  2522.                                         disp_hz_str(0,3,8,nopstr);
  2523.                                         if(W1)
  2524.                                         {
  2525.                                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  2526.                                                 disp_ch_str(0,7,16,"cture massage on");
  2527.                                         }
  2528.                                         else
  2529.                                         {
  2530.                                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  2531.                                                 disp_ch_str(0,7,16,"cture massageoff");
  2532.                                         }
  2533.                                 }
  2534.                                 W1==1?play_voice(8):play_voice(9);
  2535.                                 break;
  2536.                         case 3:
  2537.                                 //kill virus
  2538.                                 KILLV=~KILLV;
  2539.                                 out_port();
  2540.                                 if(english_chinese==0)
  2541.                                         KILLV==1?disp_hz_str(0,3,8,sj_on_str):disp_hz_str(0,3,8,sj_off_str);
  2542.                                 else
  2543.                                 {
  2544.                                         disp_hz_str(0,3,8,nopstr);
  2545.                                         if(KILLV)
  2546.                                         {
  2547.                                                 disp_ch_str(0,6,16," Sterilization  ");
  2548.                                                 disp_ch_str(0,7,16,"       on       ");
  2549.                                         }
  2550.                                         else
  2551.                                         {
  2552.                                                 disp_ch_str(0,6,16," Sterilization  ");
  2553.                                                 disp_ch_str(0,7,16,"       off      ");
  2554.                                         }
  2555.                                 }
  2556.                                 KILLV==1?play_voice(16):play_voice(17);
  2557.                                 break;
  2558.                         case 4:
  2559.                                 //key voice
  2560.                                 keyvoice_flag=~keyvoice_flag;
  2561.                                 if(english_chinese==0)
  2562.                                         keyvoice_flag==1?disp_hz_str(0,3,8,jy_on_str):disp_hz_str(0,3,8,jy_off_str);
  2563.                                 else
  2564.                                 {
  2565.                                         disp_hz_str(0,3,8,nopstr);
  2566.                                         if(keyvoice_flag)
  2567.                                         {
  2568.                                                 disp_ch_str(0,7,16,"  Key tone on   ");
  2569.                                         }
  2570.                                         else
  2571.                                         {
  2572.                                                 disp_ch_str(0,7,16,"  Key tone off  ");
  2573.                                         }
  2574.                                 }
  2575.                                 keyvoice_flag==1?play_voice(24):play_voice(25);
  2576.                                 break;
  2577.                 }
  2578.         }
  2579. }
  2580. void dk()
  2581. {
  2582.         if(menu_flag)
  2583.         {
  2584.                 menu_disp_cnt=100;                          //10s delay
  2585.                 staline_disp_cnt=30;                //1 second delay
  2586.                 disp_sta_flag=1;
  2587.                 switch(items)
  2588.                 {
  2589.                         case 0:
  2590.                                 //set time --
  2591.                                 if(smoker_flag==0)
  2592.                                         break;
  2593.                                 if(stime<=1)
  2594.                                         stime=90;
  2595.                                 else
  2596.                                         stime--;
  2597.                                 disp_hz_str(0,0,8,nopstr);
  2598.                                 if(english_chinese==0)
  2599.                                         disp_hz_str(0,0,8,"温度   时间 ");
  2600.                                 else
  2601.                                         disp_ch_str(0,1,16,"TEMP     TIME   ");
  2602.                                 disp_ch(14,1,stime/10+'0');
  2603.                                 disp_ch(15,1,stime%10+'0');
  2604.                                 disp_ch(4,1,stmp/10+'0');
  2605.                                 disp_ch(5,1,stmp%10+'0');
  2606.                                 play_voice(32);
  2607.                                 break;
  2608.                         case 1:
  2609.                                 //vol--
  2610.                                 if(music_cnt>0&&mutef==0)
  2611.                                 {
  2612.                                         if(vol>0)
  2613.                                         {
  2614.                                                 vol--;
  2615.                                                 disp_hz(7,0,0x375a);
  2616.                                                 disp_ch(14,1,vol/10+'0');
  2617.                                                 disp_ch(15,1,vol%10+'0');
  2618.                                                 setvol(vol);
  2619.                                                 play_voice(31);
  2620.                                         }
  2621.                                 }
  2622.                                 break;
  2623.                         case 2:
  2624.                                 //middle push water
  2625.                                 W2=~W2;
  2626.                                 W0=W1=W3=0;
  2627.                                 out_port();
  2628.                                 if(english_chinese==0)
  2629.                                         W2==1?disp_hz_str(0,3,8,mp_on_str):disp_hz_str(0,3,8,mp_off_str);
  2630.                                 else
  2631.                                 {
  2632.                                         disp_hz_str(0,3,8,nopstr);
  2633.                                         if(W2)
  2634.                                         {
  2635.                                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  2636.                                                 disp_ch_str(0,7,16,"cture massage on");
  2637.                                         }
  2638.                                         else
  2639.                                         {
  2640.                                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  2641.                                                 disp_ch_str(0,7,16,"cture massageoff");
  2642.                                         }
  2643.                                 }
  2644.                                 W2==1?play_voice(8):play_voice(9);
  2645.                                 break;
  2646.                         case 3:
  2647.                                 //warm fan
  2648.                                 AMBDRV=0;
  2649.                                 smoker_flag=0;
  2650.                                 HEAT=1;
  2651.                                 FWARM=~FWARM;
  2652.                                 if(FWARM)
  2653.                                         FCOOL=1;
  2654.                                 else
  2655.                                         FCOOL=0;
  2656.                                 out_port();
  2657.                                 if(english_chinese==0)
  2658.                                         FWARM==1?disp_hz_str(0,3,8,nf_on_str):disp_hz_str(0,3,8,nf_off_str);
  2659.                                 else
  2660.                                 {
  2661.                                         disp_hz_str(0,3,8,nopstr);
  2662.                                         if(FWARM)
  2663.                                         {
  2664.                                                 disp_ch_str(0,6,16,"  Dry steam by  ");
  2665.                                                 disp_ch_str(0,7,16,"  hot air on    ");
  2666.                                         }
  2667.                                         else
  2668.                                         {
  2669.                                                 disp_ch_str(0,6,16,"  Dry steam by  ");
  2670.                                                 disp_ch_str(0,7,16,"  hot air off   ");
  2671.                                         }
  2672.                                 }
  2673.                                 FWARM==1?play_voice(20):play_voice(21);
  2674.                                 break;
  2675.                         case 4:
  2676.                                 english_chinese=0;
  2677.                                 play_voice(26);
  2678.                                 display();
  2679.                                 //chinese on
  2680.                                 break;
  2681.                 }
  2682.         }
  2683. }
  2684. void uk()
  2685. {
  2686.         if(menu_flag)
  2687.         {
  2688.                 menu_disp_cnt=100;                          //10s delay
  2689.                 staline_disp_cnt=30;                //3 second delay
  2690.                 disp_sta_flag=1;
  2691.                 switch(items)
  2692.                 {
  2693.                         case 0:
  2694.                                 //set time++
  2695.                                 if(smoker_flag==0)
  2696.                                         break;
  2697.                                 if(stime>=90)
  2698.                                         stime=5;
  2699.                                 else
  2700.                                         stime++;
  2701.                                 disp_hz_str(0,0,8,nopstr);
  2702.                                 if(english_chinese==0)
  2703.                                         disp_hz_str(0,0,8,"温度   时间 ");
  2704.                                 else
  2705.                                         disp_ch_str(0,1,16,"TEMP     TIME   ");
  2706.                                 disp_ch(14,1,stime/10+'0');
  2707.                                 disp_ch(15,1,stime%10+'0');
  2708.                                 disp_ch(4,1,stmp/10+'0');
  2709.                                 disp_ch(5,1,stmp%10+'0');
  2710.                                 play_voice(32);
  2711.                                 break;
  2712.                         case 1:
  2713.                                 //vol++
  2714.                                 if(music_cnt>0&&mutef==0)
  2715.                                 {
  2716.                                         if(vol<80)
  2717.                                         {
  2718.                                                 vol++;
  2719.                                                 disp_hz(7,0,0x375a);
  2720.                                                 disp_ch(14,1,vol/10+'0');
  2721.                                                 disp_ch(15,1,vol%10+'0');
  2722.                                                 setvol(vol);
  2723.                                                 play_voice(31);
  2724.                                         }
  2725.                                 }
  2726.                                 break;
  2727.                         case 2:
  2728.                                 //xia push water
  2729.                                 W3=~W3;
  2730.                                 W2=W0=W1=0;
  2731.                                 out_port();
  2732.                                 if(english_chinese==0)
  2733.                                         W3==1?disp_hz_str(0,3,8,bp_on_str):disp_hz_str(0,3,8,bp_off_str);
  2734.                                 else
  2735.                                 {
  2736.                                         disp_hz_str(0,3,8,nopstr);
  2737.                                         if(W3)
  2738.                                         {
  2739.                                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  2740.                                                 disp_ch_str(0,7,16,"cture massage on");
  2741.                                         }
  2742.                                         else
  2743.                                         {
  2744.                                                 disp_ch_str(0,6,16,"Hydraulic acupun");
  2745.                                                 disp_ch_str(0,7,16,"cture massageoff");
  2746.                                         }
  2747.                                 }
  2748.                                 W3==1?play_voice(8):play_voice(9);
  2749.                                 break;
  2750.                         case 3:
  2751.                                 //cool fan
  2752.                                 if(FWARM)
  2753.                                 {
  2754.                                         FWARM=0;
  2755.                                         FCOOL=1;
  2756.                                 }
  2757.                                 else
  2758.                                 {
  2759.                                         FCOOL=~FCOOL;
  2760.                                         FWARM=0;
  2761.                                 }
  2762.                                 out_port();
  2763.                                 if(english_chinese==0)
  2764.                                         FCOOL==1?disp_hz_str(0,3,8,lf_on_str):disp_hz_str(0,3,8,lf_off_str);
  2765.                                 else
  2766.                                 {
  2767.                                         disp_hz_str(0,3,8,nopstr);
  2768.                                         if(FCOOL)
  2769.                                         {
  2770.                                                 disp_ch_str(0,7,16,"  Cool air on   ");
  2771.                                         }
  2772.                                         else
  2773.                                         {
  2774.                                                 disp_ch_str(0,7,16,"  Cool air off  ");
  2775.                                         }
  2776.                                 }
  2777.                                 FCOOL==1?play_voice(18):play_voice(19);
  2778.                                 break;
  2779.                         case 4:
  2780.                                 english_chinese=1;
  2781.                                 play_voice(27);
  2782.                                 display();
  2783.                                 //english on
  2784.                                 break;
  2785.                 }
  2786.         }
  2787. }
  2788. void disp_second_dot()
  2789. {
  2790.         if(smoker_flag&&menu_flag==0)
  2791.         {
  2792.                 if(seccnt==10)
  2793.                 {
  2794.                         disp_hz(6,0,0x375a);
  2795.                         disp_ch(13,1,':');
  2796.                 }
  2797.                 else if(seccnt==20)
  2798.                 {
  2799.                         disp_hz(6,0,0x375a);
  2800.                 }
  2801.                 return;
  2802.         }
  2803.         if(lockf==1&&menu_flag==0)
  2804.         {
  2805.                 if(seccnt==10)
  2806.                 {
  2807.                         disp_hz(6,0,0x375a);
  2808.                 }
  2809.                 else if(seccnt==20)
  2810.                 {
  2811.                         disp_icon(6,0,lock_icon);
  2812.                 }
  2813.                 return;
  2814.         }
  2815. }
  2816. void display()
  2817. {
  2818.         if(power_sta==0)
  2819.         {
  2820.                 clr_lcd();
  2821.                 disp_hz_str(0,0,8,title_str1[0]);
  2822.                 disp_hz_str(0,1,8,title_str1[1]);
  2823.                 return;
  2824.         }
  2825.         if(menu_flag)
  2826.         {
  2827.                 switch(items)
  2828.                 {
  2829.                         case 0:        if(english_chinese==0)
  2830.                                                 {
  2831.                                                         disp_hz_str(0,0,8,"温度   时间 ");
  2832.                                                         if(smoker_flag)
  2833.                                                         {
  2834.                                                                 disp_ch(4,1,stmp/10+'0');
  2835.                                                                 disp_ch(5,1,stmp%10+'0');
  2836.                                                                 disp_ch(14,1,stime/10+'0');
  2837.                                                                 disp_ch(15,1,stime%10+'0');
  2838.                                                         }
  2839.                                                         else
  2840.                                                         {
  2841.                                                                 disp_ch(4,1,'-');
  2842.                                                                 disp_ch(5,1,'-');
  2843.                                                                 disp_ch(14,1,'-');
  2844.                                                                 disp_ch(15,1,'-');
  2845.                                                         }
  2846.                                                         disp_hz_str(0,1,8,nopstr);
  2847.                                                         disp_icon(0,1,left_icon);
  2848.                                                         disp_icon(2,1,right_icon);
  2849.                                                         disp_icon(5,1,down_icon);
  2850.                                                         disp_icon(7,1,up_icon);
  2851.                                                         disp_hz_str(0,2,8,"减 加  减 加");
  2852.                                                 }
  2853.                                                 else
  2854.                                                 {
  2855.                                                         disp_hz_str(0,0,8,nopstr);
  2856.                                                         disp_hz_str(0,1,8,nopstr);
  2857.                                                         disp_hz_str(0,2,8,nopstr);
  2858.                                                         disp_ch_str(0,1,16,"TEMP    TIME    ");
  2859.                                                         if(smoker_flag)
  2860.                                                         {
  2861.                                                                 disp_ch(4,1,stmp/10+'0');
  2862.                                                                 disp_ch(5,1,stmp%10+'0');
  2863.                                                                 disp_ch(14,1,stime/10+'0');
  2864.                                                                 disp_ch(15,1,stime%10+'0');
  2865.                                                         }
  2866.                                                         else
  2867.                                                         {
  2868.                                                                 disp_ch(4,1,'-');
  2869.                                                                 disp_ch(5,1,'-');
  2870.                                                                 disp_ch(14,1,'-');
  2871.                                                                 disp_ch(15,1,'-');
  2872.                                                         }
  2873.                                                         disp_icon(0,1,left_icon);
  2874.                                                         disp_icon(2,1,right_icon);
  2875.                                                         disp_icon(5,1,down_icon);
  2876.                                                         disp_icon(7,1,up_icon);
  2877.                                                         disp_ch_str(0,5,16," -   +    -   + ");
  2878.                                                 }
  2879.                                                 break;
  2880.                         case 1:        if(english_chinese==0)
  2881.                                                 {
  2882.                                                         disp_hz_str(0,0,8,"收音   音量 ");
  2883.                                                         disp_ch_str(6,0,2,"FM");
  2884.                                                         if(CD_RADIO==0)
  2885.                                                         {
  2886.                                                                 disp_ch_str(4,1,5,"---.-");
  2887.                                                         }
  2888.                                                         else
  2889.                                                         {
  2890.                                                                 disp_ch(4,1,fm_fre/100000?'1':' ');
  2891.                                                                 disp_ch(5,1,fm_fre/10000%10+'0');
  2892.                                                                 disp_ch(6,1,fm_fre/1000%10+'0');
  2893.                                                                 disp_ch(7,1,'.');
  2894.                                                                 disp_ch(8,1,fm_fre/100%10+'0');
  2895.                                                         }
  2896.                                                         if(mutef==0&&music_cnt>0)
  2897.                                                         {
  2898.                                                                 disp_ch(14,1,vol/10+'0');
  2899.                                                                 disp_ch(15,1,vol%10+'0');
  2900.                                                         }
  2901.                                                         else
  2902.                                                         {
  2903.                                                                 disp_ch(14,1,'-');
  2904.                                                                 disp_ch(15,1,'-');
  2905.                                                         }
  2906.                                                         disp_hz_str(0,1,8,nopstr);
  2907.                                                         disp_icon(0,1,left_icon);
  2908.                                                         disp_icon(2,1,right_icon);
  2909.                                                         disp_icon(5,1,down_icon);
  2910.                                                         disp_icon(7,1,up_icon);
  2911.                                                         disp_hz_str(0,2,8,"减 加  减 加");
  2912.                                                 }
  2913.                                                 else
  2914.                                                 {
  2915.                                                         disp_hz_str(0,0,8,nopstr);
  2916.                                                         disp_hz_str(0,1,8,nopstr);
  2917.                                                         disp_hz_str(0,2,8,nopstr);
  2918.                                                         disp_ch_str(0,1,16,"RAD        VOL  ");
  2919.                                                         disp_ch_str(6,0,2,"FM");
  2920.                                                         if(CD_RADIO==0)
  2921.                                                         {
  2922.                                                                 disp_ch_str(4,1,5,"---.-");
  2923.                                                         }
  2924.                                                         else
  2925.                                                         {
  2926.                                                                 disp_ch(4,1,fm_fre/100000?'1':' ');
  2927.                                                                 disp_ch(5,1,fm_fre/10000%10+'0');
  2928.                                                                 disp_ch(6,1,fm_fre/1000%10+'0');
  2929.                                                                 disp_ch(7,1,'.');
  2930.                                                                 disp_ch(8,1,fm_fre/100%10+'0');
  2931.                                                         }
  2932.                                                         if(mutef==0&&music_cnt>0)
  2933.                                                         {
  2934.                                                                 disp_ch(14,1,vol/10+'0');
  2935.                                                                 disp_ch(15,1,vol%10+'0');
  2936.                                                         }
  2937.                                                         else
  2938.                                                         {
  2939.                                                                 disp_ch(14,1,'-');
  2940.                                                                 disp_ch(15,1,'-');
  2941.                                                         }
  2942.                                                         disp_icon(0,1,left_icon);
  2943.                                                         disp_icon(2,1,right_icon);
  2944.                                                         disp_icon(5,1,down_icon);
  2945.                                                         disp_icon(7,1,up_icon);
  2946.                                                         disp_ch_str(0,5,16," -   +    -   + ");
  2947.                                                 }
  2948.                                                 break;
  2949.                         case 2:        if(english_chinese==0)
  2950.                                                 {
  2951.                                                         disp_hz_str(0,0,8,"顶 上  中 下");
  2952.                                                         disp_hz_str(0,1,8,"喷 喷  喷 喷");
  2953.                                                         disp_hz_str(0,2,8,nopstr);
  2954.                                                         disp_icon(0,2,left_icon);
  2955.                                                         disp_icon(2,2,right_icon);
  2956.                                                         disp_icon(5,2,down_icon);
  2957.                                                         disp_icon(7,2,up_icon);
  2958.                                                 }
  2959.                                                 else
  2960.                                                 {
  2961.                                                         disp_hz_str(0,0,8,nopstr);
  2962.                                                         disp_hz_str(0,1,8,nopstr);
  2963.                                                         disp_hz_str(0,2,8,nopstr);
  2964.                                                         disp_icon(0,0,left_icon);
  2965.                                                         disp_icon(4,0,right_icon);
  2966.                                                         disp_icon(0,2,down_icon);
  2967.                                                         disp_icon(4,2,up_icon);
  2968.                                                         disp_ch_str(2,0,6," TOP  ");
  2969.                                                         disp_ch_str(2,1,6," JET  ");
  2970.                                                         disp_ch_str(10,0,6,"  UP  ");
  2971.                                                         disp_ch_str(10,1,6," JET  ");
  2972.                                                         disp_ch_str(2,4,6,"CENTER");
  2973.                                                         disp_ch_str(2,5,6," JET  ");
  2974.                                                         disp_ch_str(10,4,6," DOWN ");
  2975.                                                         disp_ch_str(10,5,6," JET  ");
  2976.                                                 }
  2977.                                                 break;
  2978.                         case 3:        if(english_chinese==0)
  2979.                                                 {
  2980.                                                         disp_hz_str(0,0,8,"增 杀  暖 冷");
  2981.                                                         disp_hz_str(0,1,8,"氧 菌  风 风");
  2982.                                                         disp_hz_str(0,2,8,nopstr);
  2983.                                                         disp_icon(0,2,left_icon);
  2984.                                                         disp_icon(2,2,right_icon);
  2985.                                                         disp_icon(5,2,down_icon);
  2986.                                                         disp_icon(7,2,up_icon);
  2987.                                                 }
  2988.                                                 else
  2989.                                                 {
  2990.                                                         disp_hz_str(0,0,8,nopstr);
  2991.                                                         disp_hz_str(0,1,8,nopstr);
  2992.                                                         disp_hz_str(0,2,8,nopstr);
  2993.                                                         disp_icon(0,0,left_icon);
  2994.                                                         disp_icon(4,0,right_icon);
  2995.                                                         disp_icon(0,2,down_icon);
  2996.                                                         disp_icon(4,2,up_icon);
  2997.                                                         disp_ch_str(2,0,6,"OXYGE-");
  2998.                                                         disp_ch_str(2,1,6,"NATION");
  2999.                                                         disp_ch_str(10,0,6,"STERI-");
  3000.                                                         disp_ch_str(10,1,6,"LIZE  ");
  3001.                                                         disp_ch_str(2,4,6," DRY  ");
  3002.                                                         disp_ch_str(2,5,6," STEAM");
  3003.                                                         disp_ch_str(10,4,6," COOL ");
  3004.                                                         disp_ch_str(10,5,6," AIR  ");
  3005.                                                 }
  3006.                                                 break;
  3007.                         case 4:        if(english_chinese==0)
  3008.                                                 {
  3009.                                                         disp_hz_str(0,0,8,"语 键  中  ");
  3010.                                                         disp_hz_str(0,1,8,"音 音  文  ");
  3011.                                                         disp_ch_str(14,0,2,"EN");
  3012.                                                         disp_ch_str(14,1,2,"GL");
  3013.                                                         disp_ch_str(14,2,2,"IS");
  3014.                                                         disp_ch_str(14,3,2,"H ");
  3015.                                                         disp_hz_str(0,2,8,nopstr);
  3016.                                                         disp_icon(0,2,left_icon);
  3017.                                                         disp_icon(2,2,right_icon);
  3018.                                                         disp_icon(5,2,down_icon);
  3019.                                                         disp_icon(7,2,up_icon);
  3020.                                                 }
  3021.                                                 else
  3022.                                                 {
  3023.                                                         disp_hz_str(0,0,8,nopstr);
  3024.                                                         disp_hz_str(0,1,8,nopstr);
  3025.                                                         disp_hz_str(0,2,8,nopstr);
  3026.                                                         disp_icon(0,0,left_icon);
  3027.                                                         disp_icon(4,0,right_icon);
  3028.                                                         disp_icon(0,2,down_icon);
  3029.                                                         disp_icon(4,2,up_icon);
  3030.                                                         disp_ch_str(2,0,6,"      ");
  3031.                                                         disp_ch_str(2,1,6,"SPEECH");
  3032.                                                         disp_ch_str(10,0,6," KEY  ");
  3033.                                                         disp_ch_str(10,1,6," TONE ");
  3034.                                                         disp_hz_str(1,2,2,"中文");
  3035. //                                                        disp_ch_str(2,4,6," CHIN-");
  3036. //                                                        disp_ch_str(2,5,6," ESE  ");
  3037.                                                         disp_ch_str(10,4,6," ENG- ");
  3038.                                                         disp_ch_str(10,5,6," LISH ");
  3039.                                                 }
  3040.                                                 break;
  3041.                   }
  3042.         }
  3043.         else
  3044.         {
  3045.                 if(smoker_flag)
  3046.                 {
  3047.                         disp_hz_str(0,0,8,nopstr);
  3048.                         if(english_chinese==0)
  3049.                                 disp_hz_str(0,0,8,"温度  时间  ");
  3050.                         else
  3051.                                 disp_ch_str(0,1,16,"TEMP    TIME   ");
  3052.                         disp_hz_str(0,1,8,nopstr);
  3053.                         disp_ch(5,1,stmp/10+48);
  3054.                         disp_ch(6,1,stmp%10+48);
  3055.                         disp_ch(14,1,stime/10+48);
  3056.                         disp_ch(15,1,stime%10+48);
  3057.                 }
  3058.                 else
  3059.                 {
  3060.                         disp_hz_str(0,0,8,nopstr);
  3061.                         if(english_chinese==0)
  3062.                                 disp_hz_str(0,0,8,"温度  时间  ");
  3063.                         else
  3064.                                 disp_ch_str(0,1,16,"TEMP    TIME   ");
  3065.                         disp_hz_str(0,1,8,nopstr);
  3066.                         disp_ch(5,1,ctmp/10+48);
  3067.                         disp_ch(6,1,ctmp%10+48);
  3068. //                        disp_ch_str(5,1,2,"--");
  3069.                         disp_ch_str(14,1,2,"--");
  3070.                 }
  3071.                 if(music_cnt==0)
  3072.                 {
  3073.                          disp_hz_str(0,2,8,nopstr);
  3074. //                         disp_ch_str(3,4,8,"        ");
  3075.                 }
  3076.                 else
  3077.                         if(CD_RADIO)
  3078.                         {
  3079.                                 disp_hz_str(0,2,8,nopstr);
  3080.                                 disp_ch_str(3,4,8,"FM");
  3081.                                 disp_ch(6,4,fm_fre/100000?'1':' ');
  3082.                                 disp_ch(7,4,fm_fre/10000%10+'0');
  3083.                                 disp_ch(8,4,fm_fre/1000%10+'0');
  3084.                                 disp_ch(9,4,'.');
  3085.                                 disp_ch(10,4,fm_fre/100%10+'0');
  3086.                         }
  3087.                         else
  3088.                         {
  3089.                                 disp_hz_str(0,2,8,nopstr);
  3090.                                 if(english_chinese==0)
  3091.                                         disp_hz_str(0,2,8,"  唱碟输入  ");
  3092.                                 else
  3093.                                         disp_ch_str(0,5,16,"    CD INPUT    ");
  3094.                         }
  3095.         }
  3096. }
  3097. void disp_status()
  3098. {
  3099.         if(++icon_cnt==3)
  3100.                 icon_cnt=0;
  3101.         switch(icon_cnt)
  3102.         {
  3103.                 case 0:
  3104.                         disp_hz(0,3,0x375a);
  3105.                         if(FAN==1)
  3106.                                 disp_icon(0,3,fan_icon);
  3107.                         break;
  3108.                 case 1:
  3109.                         disp_hz(0,3,0x375a);
  3110.                         if(FAN==1)
  3111.                                 disp_icon(0,3,fan1_icon);
  3112.                         break;
  3113.                 case 2:
  3114.                         disp_hz(0,3,0x375a);
  3115.                         if(FAN==1)
  3116.                                 disp_icon(0,3,fan2_icon);
  3117.                         break;
  3118.         }
  3119.         disp_hz_str(1,3,7,nopstr);
  3120. //        FAN==1?disp_icon(0,3,fan_icon):disp_hz(0,3,0x375a);
  3121.         LAMP1==1||LAMP2==1?disp_icon(1,3,light_icon):disp_hz(1,3,0x375a);
  3122.         AMBDRV==1?disp_icon(2,3,amb_icon):disp_hz(2,3,0x375a);
  3123.         music_cnt?disp_icon(3,3,music_icon):disp_hz(3,3,0x375a);
  3124.         FWARM==1||FCOOL==1?disp_icon(4,3,cw_fan_icon):disp_hz(4,3,0x375a);
  3125.         O_INC==1?disp_icon(5,3,o2_icon):disp_hz(5,3,0x375a);
  3126.         KILLV==1?disp_icon(6,3,o3_icon):disp_hz(6,3,0x375a);
  3127.         W0==1|W1==1|W2==1|W3==1?disp_icon(7,3,pushw_icon):disp_hz(7,3,0x375a);
  3128. }
  3129. void chkself()
  3130. {
  3131.         int i;
  3132.         play_voice(34);
  3133.         if(english_chinese==0)
  3134.         {
  3135.                 disp_hz_str(0,0,8,chkself_str0);
  3136.                 disp_hz_str(0,1,8,chkself_str1);
  3137.                 disp_hz_str(0,2,8,chkself_str2);
  3138.                 disp_hz_str(0,3,8,chkself_str5);
  3139.         }
  3140.         else
  3141.         {
  3142.                 clr_lcd();
  3143.                 disp_ch_str(0,1,16,"The steamer is  ");
  3144.                 disp_ch_str(0,2,16,"in auto cleaning");
  3145.                 disp_ch_str(0,3,16,"and auto inspec-");
  3146.            disp_ch_str(0,4,16,"tion,and all fun");
  3147.                 disp_ch_str(0,5,16,"tion are stop   ");
  3148.                 disp_ch_str(0,6,16,"temporarily.    ");
  3149.                 disp_ch_str(0,7,16,"Please wait.....");
  3150.         }
  3151.         WP_SW=1;
  3152.         GO_W=0;
  3153.         delay(1000);
  3154.         ENTER_W=0;
  3155.         delay(3000);
  3156.         ENTER_W=1;
  3157.         delay(1400);
  3158.         GO_W=1;
  3159.         delay(1000);
  3160.         ENTER_W=0;                                //enter water for clear the water box
  3161.         delay(20000);
  3162.         ENTER_W=1;
  3163.         if(waterfull_flag==1)                        //if water is full
  3164.         {
  3165.                 GO_W=0;
  3166.                 delay(1000);
  3167.                 GO_W=1;
  3168.                 delay(1000);
  3169.                 GO_W=0;
  3170.                 delay(1000);
  3171.                 GO_W=1;
  3172.                 delay(1000);
  3173.                 GO_W=0;
  3174.                 delay(1000);
  3175.                 i=88;
  3176.                 do
  3177.                 {
  3178.                         delay(1000);
  3179.                         i--;
  3180.                 }while(waterfull_flag&&i>0);
  3181.                 if(i==0)
  3182.                 {
  3183.                         lockf=1;
  3184.                         GO_W=1;
  3185.                         ENTER_W=1;
  3186.                         clr_lcd();
  3187.                         if(english_chinese==0)
  3188.                         {
  3189.                                 disp_hz_str(0,1,8,chkself_str4);
  3190.                                 disp_hz_str(0,2,8,chkself_str6);
  3191.                                 disp_hz_str(0,3,8,chkself_str7);
  3192.                         }
  3193.                         else
  3194.                         {
  3195.                                 disp_ch_str(0,3,16,"Lock the steamer");
  3196.                         }
  3197.                         play_voice(36);
  3198.                         delay(2000);
  3199.                         return;
  3200.                 }
  3201.                 GO_W=1;                                //self check success
  3202.                 delay(1000);
  3203.                 GO_W=0;
  3204.                 delay(1000);
  3205.                 GO_W=1;                               
  3206.                 delay(1000);
  3207.                 GO_W=0;
  3208.                 delay(1000);
  3209.                 GO_W=1;
  3210.                 lockf=0;
  3211.                 ENTER_W=1;
  3212.                 clr_lcd();
  3213.                 if(english_chinese==0)
  3214.                 {
  3215.                         disp_hz_str(0,1,8,chkself_str3);
  3216.                 }
  3217.                 else
  3218.                 {
  3219.                         disp_ch_str(0,3,16,"Inspection is ok");
  3220.                 }
  3221.                 play_voice(35);
  3222.                 delay(2000);
  3223.                 return;
  3224.         }
  3225.         else                //if water is empty
  3226.         {
  3227.                 ENTER_W=0;
  3228.                 i=30;
  3229.                 do
  3230.                 {
  3231.                         delay(1000);
  3232.                         i--;
  3233.                 }while(waterfull_flag==0&&i>0);
  3234.                 if(i==0)
  3235.                 {
  3236.                         lockf=1;
  3237.                         GO_W=1;
  3238.                         ENTER_W=1;
  3239.                         clr_lcd();
  3240.                         if(english_chinese==0)
  3241.                         {
  3242.                                 disp_hz_str(0,1,8,chkself_str4);
  3243.                                 disp_hz_str(0,2,8,chkself_str6);
  3244.                                 disp_hz_str(0,3,8,chkself_str7);
  3245.                         }
  3246.                         else
  3247.                         {
  3248.                                 disp_ch_str(0,3,16,"Lock the steamer");
  3249.                         }
  3250.                         play_voice(36);
  3251.                         delay(2000);
  3252.                         return;
  3253.                 }
  3254.                 ENTER_W=1;
  3255.                 lockf=0;
  3256.                 clr_lcd();
  3257.                 if(english_chinese==0)
  3258.                 {
  3259.                         disp_hz_str(0,1,8,chkself_str3);
  3260.                 }
  3261.                 else
  3262.                 {
  3263.                         disp_ch_str(0,3,16,"Inspection is ok");
  3264.                 }
  3265.                 play_voice(35);
  3266.                 delay(2000);
  3267.                 return;
  3268.         }
  3269. }
  3270. void setvol(uchar volv)/*volv=0-80 (-80db---0db)*/
  3271. {
  3272.         uchar i=volv+7;
  3273.         uchar j;
  3274.         M62429_DA=0;
  3275.         i=i&0xfc;
  3276.         for(j=0;j<7;j++)
  3277.         {
  3278.                 M62429_CL=0;
  3279.                 M62429_DA=i&1;
  3280.                 i=i>>1;
  3281.                 M62429_CL=1;
  3282.                 M62429_DA=0;
  3283.         }
  3284.         i=volv+7;
  3285.         i=i&0x3;
  3286.         i=i|0xc;
  3287.         for(j=0;j<4;j++)
  3288.         {
  3289.                 M62429_CL=0;
  3290.                 M62429_DA=i&1;
  3291.                 i=i>>1;
  3292.                 M62429_CL=1;
  3293.                 M62429_DA=0;
  3294.         }
  3295.         M62429_DA=1;
  3296.         M62429_CL=0;
  3297.         M62429_DA=0;
  3298.         M62429_DA=1;
  3299. }
  3300. void wpchk()
  3301. {
  3302.         if(WP_SW)
  3303.         {
  3304.                 wfcnt=0;
  3305.                 if(++wecnt>=6)
  3306.                 {
  3307.                         wecnt=0;
  3308.                         waterfull_flag=0;
  3309.                 }
  3310.         }
  3311.         else
  3312.         {
  3313.                 wecnt=0;
  3314.                 if(++wfcnt>=6)
  3315.                 {
  3316.                         wfcnt=0;
  3317.                         waterfull_flag=1;
  3318.                 }
  3319.         }
  3320. }
  3321. void send_pll_data(unsigned long int ccb_data_block)
  3322. //ccb_data_block define:
  3323. //bit0-bit7:<b0,b1,b2,b3,a0,a1,a2,a3>;IN1=0x28;IN2=0x29;
  3324. //bit8-bit23:1.IN1 MODE:<p0-p15>;
  3325. //                                 2.IN2 MODE:<IOC1,IOC2,IO1,IO2,BO1,BO2,BO3,BO4,BO5,
  3326. //                                        DOC0,DOC1,DOC2,UL0,UL1,DZ0,DZ1>;
  3327. //bit24-bit31:1.IN1 MODE:<SNS,DVS,CTE,XS,R0,R1,R2,R3>;
  3328. //                                  2.IN2 MODE:<GT0,GT1,TBC,DLC,IFS,TEST0,TEST1,TEST2>
  3329. {
  3330.         uchar i;
  3331.         unsigned long int ccb_db=ccb_data_block;
  3332.         RADIO_CE=0;
  3333.         RADIO_CL=1;
  3334.         RADIO_DO=1;
  3335.         RADIO_DI=1;
  3336.         for(i=0;i<8;i++)        //send IN mode byte
  3337.         {
  3338.                 RADIO_CL=0;
  3339.                 ccb_db=ccb_db>>1;
  3340.                 RADIO_DI=CY;
  3341.       RADIO_DI=CY;
  3342.                 RADIO_CL=1;
  3343.                 RADIO_CL=1;
  3344.         }
  3345.         RADIO_CL=1;
  3346.         RADIO_CE=1;
  3347.         RADIO_CE=1;
  3348.         RADIO_CE=1;
  3349.         for(i=0;i<24;i++)        //send 24 bit data
  3350.         {
  3351.                 RADIO_CL=0;
  3352.                 ccb_db=ccb_db>>1;
  3353.                 RADIO_DI=CY;
  3354.       RADIO_DI=CY;
  3355.                 RADIO_CL=1;
  3356.                 RADIO_CL=1;
  3357.         }
  3358.         RADIO_CL=1;
  3359.         RADIO_CL=1;
  3360.         RADIO_CE=0;
  3361.         RADIO_CE=0;
  3362. }
  3363. unsigned long int rece_pll_data()
  3364. //read and return pll ccb data block
  3365. //bit0-bit19:<c0-c19>=IF count value;
  3366. //bit20-bit23:<UL,NC,I1,I2>;
  3367. {
  3368.         unsigned long int ccb_db=0x00000000;
  3369.         uchar i,out_mode_byte=0x2a;
  3370.         RADIO_CE=0;
  3371.         RADIO_CL=1;
  3372.         RADIO_DO=1;
  3373.         RADIO_DI=1;
  3374.         for(i=0;i<8;i++)        //send IN mode byte
  3375.         {
  3376.                 RADIO_CL=0;
  3377.                 RADIO_CL=0;
  3378.                 RADIO_CL=0;
  3379.                 out_mode_byte=out_mode_byte>>1;
  3380.                 RADIO_DI=CY;
  3381.      RADIO_DI=CY;
  3382.      RADIO_DI=CY;
  3383.                 RADIO_CL=1;
  3384.                 RADIO_CL=1;
  3385.                 RADIO_CL=1;
  3386.         }
  3387.         RADIO_CL=1;
  3388.         RADIO_CE=1;
  3389.         RADIO_CE=1;
  3390.         RADIO_CE=1;
  3391. //        C=0;
  3392.         for(i=0;i<24;i++)
  3393.         {
  3394.                 RADIO_CL=0;
  3395.                 RADIO_CL=0;
  3396.                 RADIO_CL=0;
  3397.                 RADIO_CL=0;
  3398.                 if(RADIO_DO)
  3399.                         ccb_db=ccb_db+ccb_db+1;
  3400.                 else
  3401.                         ccb_db=ccb_db+ccb_db;
  3402.                 RADIO_CL=1;
  3403.                 RADIO_CL=1;
  3404.                 RADIO_CL=1;
  3405.                 RADIO_CL=1;
  3406.         }
  3407.         RADIO_CL=1;
  3408.         RADIO_CL=1;
  3409.         RADIO_CE=0;
  3410.         RADIO_CE=0;
  3411.         return ccb_db;
  3412. }
  3413. bit set_radio_fre(unsigned long int fre)
  3414. //entry:fre(88000khz--108000khz));
  3415. //return 0 if lock success else return 1
  3416. {
  3417.         unsigned long int temp,ccb_db=fre;
  3418.         uchar i=0;
  3419.         ccb_db=(ccb_db+10700)/50;
  3420.         ccb_db=0x22000028|(ccb_db<<8);
  3421.         send_pll_data(0x12048029);//mute the radio
  3422.         delay(30);
  3423.         send_pll_data(ccb_db);//cte=0,reset the IF counter
  3424.         delay(10);
  3425.         send_pll_data(0x26000000|ccb_db);//cte=1;start the IF counter
  3426.         delay(32);
  3427.         i=0;
  3428.         while(++i<50&&RADIO_DO)
  3429.         {
  3430.                 delay(1);
  3431.         }
  3432.         temp=rece_pll_data()&0x000fffff;
  3433.         temp=temp/32;
  3434.         delay(30);
  3435.   if(temp>10708||temp<10692)
  3436.                 return 1;
  3437.         send_pll_data(ccb_db);//cte=0,reset the IF counter
  3438.         delay(10);
  3439.         send_pll_data(0x26000000|ccb_db);//cte=1;start the IF counter
  3440.         delay(32);
  3441.         i=0;
  3442.         while(++i<50&&RADIO_DO)
  3443.         {
  3444.                 delay(1);
  3445.         }
  3446.         temp=rece_pll_data()&0x000fffff;
  3447.         temp=temp/32;
  3448.         delay(30);
  3449.   if(temp>10708||temp<10692)
  3450.                 return 1;
  3451.         send_pll_data(ccb_db);//cte=0,reset the IF counter
  3452.         delay(10);
  3453.         send_pll_data(0x26000000|ccb_db);//cte=1;start the IF counter
  3454.         delay(32);
  3455.         i=0;
  3456.         while(++i<50&&RADIO_DO)
  3457.         {
  3458.                 delay(1);
  3459.         }
  3460.         temp=rece_pll_data()&0x000fffff;
  3461.         temp=temp/32;
  3462.         delay(30);
  3463.   if(temp>10708||temp<10692)
  3464.                 return 1;
  3465.         return 0;
  3466. /*        disp_hz_str(0,3,8,nopstr);
  3467.         disp_ch(7,7,ccb_db/100000%10+'0');
  3468.         disp_ch(8,7,ccb_db/10000%10+'0');
  3469.         disp_ch(9,7,ccb_db/1000%10+'0');
  3470.         disp_ch(7,7,ccb_db/100000%10+'0');
  3471.         disp_ch(8,7,ccb_db/10000%10+'0');
  3472.         disp_ch(9,7,ccb_db/1000%10+'0');
  3473.         disp_ch(10,7,ccb_db/100%10+'0');
  3474.         disp_ch(11,7,ccb_db/10%10+'0');
  3475.         disp_ch(12,7,ccb_db%10+'0');*/
  3476. //        send_pll_data(0x0200a029);//open the radio
  3477. }
  3478. void mute()
  3479. {
  3480.         setvol(0);
  3481. }
  3482. //***********************************************
  3483. //*   ISD4002 VOICE CHIP CONTROL PROGRAM SUB         *
  3484. //*   WRITEN BY LIU QING DONG                   *
  3485. //***********************************************
  3486. void send_isd_byte(uchar isd_data)
  3487. {
  3488.         uchar i;
  3489.         clrb(ISD_SS);
  3490.         for(i=0;i<8;i++)
  3491.         {
  3492.                 ISD_SCLK=0;
  3493.                 ISD_MOSI=isd_data&0x01;
  3494.                 ISD_SCLK=1;
  3495.                 isd_data=isd_data>>1;
  3496.         }
  3497.         ISD_SCLK=0;
  3498. }
  3499. void stop_isd()
  3500. {
  3501.         send_isd_byte(0x30);
  3502.         setb(ISD_SS);
  3503.         delay(50);
  3504. }
  3505. void up_isd()
  3506. {
  3507.         send_isd_byte(0x20);
  3508.         setb(ISD_SS);
  3509.         delay(100);
  3510. }
  3511. void play_voice(uchar seg_no)
  3512. {
  3513. /*seg_no:
  3514. 0:        welcome chinese
  3515. 1: welcome english
  3516. 2:        lamp on
  3517. 3: lamp off
  3518. 4:        fan on
  3519. 5: fan off
  3520. 6: wave on
  3521. 7: wave off
  3522. 8: amb on
  3523. 9: amb off
  3524. 10: radio on
  3525. 11: cd input
  3526. 12: music off
  3527. 13: menu entry
  3528. 14: o++ on
  3529. 15: o++ off
  3530. 16: killv on
  3531. 17: killv off
  3532. 18: cool air on
  3533. 19: cool air off
  3534. 20: dry heat on
  3535. 21: dry heat off
  3536. 22: speech on
  3537. 23: speech off
  3538. 24: key tone on
  3539. 25: key tone off
  3540. 26: chinese display
  3541. 27: english display
  3542. 28: steam on
  3543. 29: steam off
  3544. 30: radio adjust
  3545. 31: volume control
  3546. 32: time control
  3547. 33: temp control
  3548. 34: chkself start
  3549. 35: chkself ok
  3550. 36: chkself fail
  3551. 37: hello,bye-bye
  3552. 38: music on
  3553. */
  3554. //        uchar i,j;
  3555.         if(voice_flag&&seg_no!=speech_num)
  3556.         {
  3557.                 speech_num=seg_no;
  3558.                 stop_isd();
  3559.                 clrb(SOUND_CDRADIO);
  3560.                 send_isd_byte(isd_addr[speech_num]%256);
  3561.                 send_isd_byte((isd_addr[speech_num]/256)&0x07|0xe0);
  3562.                 setb(ISD_SS);
  3563.                 delay(50);
  3564. //                send_isd_byte(0x00);
  3565. //                send_isd_byte(0xe8);//set fast search address=0;
  3566. //                setb(ISD_SS);
  3567. //                if(seg_no)
  3568. //                {
  3569. //                        TR0=0;
  3570. //                        for(i=0;i<seg_no;i++)
  3571. //                        {
  3572. //                                send_isd_byte(0xf8);//fast search
  3573. //                                setb(ISD_SS);
  3574. //                                for(j=0;j<255;j++)
  3575. //                                        while(ISD_INT);
  3576. //                                delay(5);
  3577. //                        }
  3578. //                }
  3579. //                else
  3580. //                {
  3581. //                        stop_isd();
  3582. //                        send_isd_byte(0x00);
  3583. //                        send_isd_byte(0xe0);//set fast play address=0;
  3584. //                        setb(ISD_SS);
  3585. //                }
  3586. //                delay(1);
  3587.                 send_isd_byte(0xf0);//play
  3588.                 setb(ISD_SS);
  3589. //                TR0=1;
  3590. //                delay(50);
  3591.         }
  3592.         else
  3593.                 setb(SOUND_CDRADIO);
  3594. }
  3595. /**********************************************************
  3596. * AT24C01/02/04/16 IC CARD READ&WRITE SUB PROGRAMS GROUP *
  3597. *                      2001/04/26                        *
  3598. **********************************************************/
  3599. //
  3600. //--------------RADOM WRITE IC CARD DATA FOR AT24CXX CARD
  3601. //ENTRY:        byte_addr----byte data offset address at 24cxx
  3602. //              ic_type----24cxx type: 0-24c01,1-24c02,2-24c04;3-24c08;4-24c16
  3603. //              wdata---data want to write
  3604. //              WRITE success then return 0 else return 1
  3605. //
  3606. bit wrt_24cxx(uchar ic_type,uchar byte_addr,wdata)
  3607. {
  3608.         uchar at24cxx_cmd;
  3609.         switch(ic_type)
  3610.         {
  3611.                 case 0:
  3612.                         at24cxx_cmd=0xa0;//24c01
  3613.                         break;
  3614.                 case 1:
  3615.                         at24cxx_cmd=0xa0;//24c02
  3616.                         break;
  3617.                 case 2:
  3618.                         at24cxx_cmd=0xa2;//24c04
  3619.                         break;
  3620.                 case 3:
  3621.                         at24cxx_cmd=0xa6;//24c08
  3622.                         break;
  3623. //                case 4:
  3624. //                        at24cxx_cmd=0xa0;//24c16
  3625. //                        break;
  3626.                 default:
  3627.                         at24cxx_cmd=0xa0;
  3628.         }
  3629.         sstart();//send the start signal
  3630.         if(sdata(at24cxx_cmd))
  3631.                 return 1;
  3632.         if(sdata(byte_addr))
  3633.                 return 1;
  3634. //        for(i=0;i<data_num;i++)
  3635.         if(sdata(wdata))
  3636.                 return 1;
  3637.         sstop();
  3638.         delay(10);
  3639.         return 0;
  3640. }
  3641. //--------------RADOM READ IC CARD DATA FOR AT24CXX CARD
  3642. //ENTRY:        byte_addr----byte data offset address at 24cxx
  3643. //              ic_type----24cxx type: 0-24c01,1-24c02,2-24c04;3-24c08;4-24c16
  3644. //              rd_ptr-->data readed
  3645. //              read success then return 0 else return 1
  3646. //
  3647. bit rd_24cxx(uchar ic_type,uchar byte_addr,uchar *rd_ptr)
  3648. {
  3649.         uchar at24cxx_cmd;
  3650.         switch(ic_type)
  3651.         {
  3652.                 case 0:
  3653.                         at24cxx_cmd=0xa0;//24c01
  3654.                         break;
  3655.                 case 1:
  3656.                         at24cxx_cmd=0xa0;//24c02
  3657.                         break;
  3658.                 case 2:
  3659.                         at24cxx_cmd=0xa2;//24c04
  3660.                         break;
  3661.                 case 3:
  3662.                         at24cxx_cmd=0xa6;//24c08
  3663.                         break;
  3664. //                case 4:
  3665. //                        at24cxx_cmd=0xa0;//24c16
  3666. //                        break;
  3667.                 default:
  3668.                         at24cxx_cmd=0xa0;
  3669.         }
  3670.         sstart();//send the start signal
  3671.         if(sdata(at24cxx_cmd))
  3672.                 return 1;
  3673.         if(sdata(byte_addr))
  3674.                 return 1;
  3675.         sstart();
  3676.         if(sdata(at24cxx_cmd|0x01))
  3677.                 return 1;
  3678. //        for(i=0;i<data_num;i++)
  3679. // {
  3680. //        *rd_ptr=rdata();
  3681. //        send_ack();
  3682. // }
  3683. //        send_ack();
  3684.         *rd_ptr=rdata();
  3685.         send_noack();
  3686.         sstop();
  3687.         return 0;
  3688. }
  3689. void dly_us(uchar us_v)//delay i us
  3690. {
  3691.         uchar i=us_v/4;//6mhz
  3692.         while(i>0)
  3693.                 i--;
  3694. }
  3695. //---------------SEND START BIT FOR AT24XX
  3696. void sstart()
  3697. {
  3698.         EEPROM_SDA=1;
  3699.         dly_us(8);
  3700.         EEPROM_SCL=1;
  3701.         dly_us(8);
  3702.         EEPROM_SDA=0;
  3703.         dly_us(8);
  3704.         EEPROM_SCL=0;
  3705. }
  3706. //---------------SEND STOP BIT FOR AT24XX
  3707. void sstop()
  3708. {
  3709.         EEPROM_SDA=0;
  3710.         dly_us(8);
  3711.         EEPROM_SCL=1;
  3712.         dly_us(8);
  3713.         EEPROM_SDA=1;
  3714.         dly_us(8);
  3715. }
  3716. //---------------send ack
  3717. //void send_ack()
  3718. //{
  3719. //        EEPROM_SCL=0;
  3720. //        dly_us(10);
  3721. //        EEPROM_SDA=0;
  3722. //        dly_us(10);
  3723. //        EEPROM_SCL=1;
  3724. //        dly_us(10);
  3725. //        EEPROM_SCL=0;
  3726. //}
  3727. void send_noack()
  3728. {
  3729.         EEPROM_SCL=0;
  3730.         dly_us(10);
  3731.         EEPROM_SDA=1;
  3732.         dly_us(10);
  3733.         EEPROM_SCL=1;
  3734.         dly_us(10);
  3735.         EEPROM_SCL=0;
  3736. }
  3737. //--------------send data TO at24cxx
  3738. bit sdata(uchar tdata)
  3739. //if success then return 0 else return 1
  3740. {
  3741.         uchar i,j=tdata;
  3742.         for(i=0;i<8;i++)
  3743.         {
  3744.                 EEPROM_SDA=j&0x80;
  3745.                 j=j<<1;
  3746.                 dly_us(8);
  3747.                 EEPROM_SCL=1;
  3748.                 dly_us(8);
  3749.                 EEPROM_SCL=0;
  3750.         }
  3751.         dly_us(8);
  3752.         EEPROM_SDA=1;
  3753.         dly_us(8);
  3754.         EEPROM_SCL=1;
  3755.         dly_us(28);
  3756.         if(EEPROM_SDA==0)
  3757.         {
  3758.                 EEPROM_SCL=0;
  3759.                 return 0;
  3760.         }
  3761.         dly_us(8);
  3762.         EEPROM_SCL=0;
  3763.         return 1;
  3764. }
  3765. uchar rdata()        //read 1 byte data from at24cxx
  3766. {
  3767.         uchar i,j=0;
  3768.         EEPROM_SDA=1;
  3769.         dly_us(8);
  3770.         for(i=0;i<8;i++)
  3771.         {
  3772.                 j=j<<1;
  3773.                 EEPROM_SCL=0;
  3774.                 dly_us(8);
  3775.                 EEPROM_SCL=1;
  3776.                 if(EEPROM_SDA)
  3777.                         j=j|0x01;
  3778.                 else
  3779.                         j=j&0xfe;
  3780.                 dly_us(8);
  3781.         }
  3782.         return j;
  3783. }
  3784. void reset_dog()
  3785. {
  3786.         EEPROM_SDA=0;
  3787.         EEPROM_SDA=0;
  3788.         EEPROM_SDA=1;
  3789.         EEPROM_SDA=1;
  3790. }
  3791. void demo(uchar i)
  3792. {
  3793.         uchar row=0,k;
  3794. //        clr_lcd();
  3795.         for(k=0;k<4;k++)
  3796.         {
  3797.                 if(help_str[row+i][0]>=0xa0)
  3798.                         disp_hz_str(0,k,8,help_str[row+i]);
  3799.                 else
  3800.                 {
  3801.                         disp_hz_str(0,k,8,nopstr);
  3802.                         disp_ch_str(0,k*2,16,help_str[row+i]);
  3803.                         ++row;
  3804.                         disp_ch_str(0,k*2+1,16,help_str[row+i]);
  3805.                 }
  3806.                 ++row;
  3807.         }
  3808. }
复制代码

所有资料51hei提供下载:
桑拿浴房控制器.rar (565.64 KB, 下载次数: 32)


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:105206 发表于 2018-11-11 19:37 | 只看该作者
怎么没压缩包没文件?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表