⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hualong_v10.h

📁 嵌入式单片机开发,嵌入式单片机开发,嵌入式单片机开发
💻 H
📖 第 1 页 / 共 5 页
字号:
												break;
											case w_eplock:
												for(l=0;l<uselen;l++)
													wr_data[l]=a[l];
												data_addr.addri=useaddr;
												write(EPLOCK,uselen);
												onetime_biancheng(1,0x10,table_v10write[value1].recordecode);
												send_write_ok_v10();
												break;
											case w_ep1eplock:
												for(l=0;l<uselen;l++)
													wr_data[l]=a[l];
												data_addr.addri=useaddr;
												write(EPLOCK,uselen);
												write(EP1,uselen);
												onetime_biancheng(1,0x10,table_v10write[value1].recordecode);
												send_write_ok_v10();
												break;
											case w_dateweek:
												onetime_biancheng(1,0x10,table_v10write[value1].recordecode); 
                                                                                    		time_to_bianchengqian();
                                        							 powerup_changedtime_priceswitch=1;//time changed
                             	                                                 		rtc8025_write_week_day_month_year(&a[0]);
											       if(1==rtc8025_read_check())
                                        	                                          		move_rtc8025_to_softrtc();
                                        							copy_ram_to_fm(R_SOFT_SECOND,7,R_SOFT_SECOND);                                   
                                        							onetime_timedatep(1,bianchengqian);                                  
                                        							clr_had_jiaoshi();
                                        							 send_write_ok_v10();
												break;
											case w_time:
												onetime_biancheng(1,0x10,table_v10write[value1].recordecode); 
                                                                                    time_to_bianchengqian();
												powerup_changedtime_priceswitch=1;//time changed
        	                  	                                                 rtc8025_write_second_minute_hour(&a[0]);
                                                                                    delay_1ms();
        	                                                                      if(1==rtc8025_read_check())
        	                     	                                                move_rtc8025_to_softrtc();
                                                                                    copy_ram_to_fm(R_SOFT_SECOND,7,R_SOFT_SECOND);                            
                                                                                    onetime_timedatep(1,bianchengqian);                              
                                                                                    clr_had_jiaoshi();
                                                                                    send_write_ok_v10();
                                                                                    break;
											// add by zhanglong ---->start
											case w_dataweek_time:
												onetime_biancheng(1,0x10,table_v10write[value1].recordecode); 
                                                                                    time_to_bianchengqian();
												powerup_changedtime_priceswitch=1;//time changed
												
												rtc8025_timevalue[0]=a[4];
												 rtc8025_timevalue[1]=a[5];
												 rtc8025_timevalue[2]=a[6];
												 rtc8025_timevalue[3]=a[0];
												 rtc8025_timevalue[4]=a[1];
												 rtc8025_timevalue[5]=a[2];
												 rtc8025_timevalue[6]=a[3];
												rtc8025_write();    
												
                                                                                    delay_1ms();
        	                                                                      if(1==rtc8025_read_check())
        	                     	                                                move_rtc8025_to_softrtc();
                                                                                    copy_ram_to_fm(R_SOFT_SECOND,7,R_SOFT_SECOND);                            
                                                                                    onetime_timedatep(1,bianchengqian);                              
                                                                                    clr_had_jiaoshi();
                                                                                    send_write_ok_v10();									
												break;
											// add by zhanglong ---->end
										}										

								}
							else
								{
									switch(table_v10write[value1].type)
										{
											case clrbd00:// all clr  except prog
											// changed by zhanglong ---->start
											//	if(1==zongqing(0x55aa,1))
												if(1==zongqing(0x55aa,0))
											// changed  by zhanglong ---->end
													{
														onetime_biancheng(1,0x10,0x48);
														send_write_ok_v10();
													}
												 //chu bian chen wai suoyou clr
												break;
											case clrbd01:
												//di du qing ling
												        // onetime_biancheng(1,0x10,0x49);
													// clr_kwh();
							                                   	// 	send_write_ok_v10();
							                                   	send_write_err_v10(01);
													break;
											case clrbd02:
												//xuliangqingling
												
													//{
														xuliangqingling_qingqiu=1;
                                                                                    		onetime_biancheng(1,0x10,0x50);
											       		send_write_ok_v10();
													//}
												break;
											case clrbd03:
												//shi jian (event) qing ling
												if(1==envent_clr())
													{
														onetime_biancheng(1,0x10,0x51);
														send_write_ok_v10();
													}
												break;
											case clrbd04:

												//fuhejiluqingling
												// changed by zhanglong ---->start
												send_write_err_v10(01);
												//send_write_ok_v10();
												// changed by zhanglong ---->end
												break;
											case clrbd05:
												//to run status
												 if(RSTATUS_RUN==TEST)	   
	        											{	
	        												shiduan_onetimeprog=0;
														cuofengvalue_onetimeprog=0;
									           				cuofengshiduan_onetimeprog=0;
									           				priceyuyue_onetimeprog=0;
									           				cuofengshiduan_switch_onetimeprog=0;
									          				cuofengvalue_switch_onetimeprog=0;        
	            												RSTATUS_RUN=RUN;
	           												 wr_data[0]=RUN;
	           												 data_addr.addri=FM_STATUS_RUN;
	           												 write(FM,1);   
	            												 RSTATUS_TEST_TIMER=0;
                   												move_int_to_fm(RSTATUS_TEST_TIMER,FM_STATUS_TEST_TIMER);	           
	                                                                                           clr_4_dot();											                    
	        	                                                                        }
												  send_write_ok_v10();												 	
												break;
											case clrbe01:
												//quanbuqing	, all clr											
												   if(1==zongqing(0x55aa,0))
												   	send_write_ok_v10();																								
												   break;											
										}
								}

						}
				}
			}
                }
return value;
}

unsigned char v10read_kwh(point,len,code)
unsigned char *point,*len;
unsigned int code;//say command LL
{unsigned char codehl,codeh,codel,value,l,block,l1,addr;
 codeh=0xf&(code>>4);
 codel=code&0xf;
 codehl=0xf&(code>>8);
 value=1; 
 if((codel!=0xf)&&(codel>4)) 
 	value=0;//err
 if(codehl>3)// four quandrant kvarh
 	 if((codel!=0xf)&&(codel>0)) 
	 	value=0;
 if(codeh>0xb) // last month
 	value=0;
 if(codehl>7) // kwh kvarh 0---7
 	value=0;
 if(1==value)
 	{if(codehl<4)
 		addr=20*codehl;
 	  else
	  	addr=80+4*(codehl-4);
 	 if((codel==0xf)&&(codehl<4))
 	            *len=20;                    
        else 
         	     *len=4;
	if(codel!=0xf)
		addr=addr+4*codel;
 	 if(codeh==0)//RAM--- current month
 	     {for(l=0;l<*len;l++)
 	     		*(point+l)=RAM[R_KWH_F_BAKA+addr+l];
 	      }
 	 else//eeprom
 	 	{data_addr.addri=current_twobiaofm_block_addr(TYPE_EP1_HISTROY_KWH,codeh-1)+addr;
 	         read(EP1,*len);
 	         for(l=0;l<*len;l++)
			 *(point+l)=wr_data[l];
 	 	}
 	} 

 return value;
}


unsigned char v10read_kw(point,len,code)
unsigned char *point,*len;
unsigned int code;//say command LL
{unsigned char codehl,codeh,codel,value,l,block,l1,addr;
 codeh=0xf&(code>>4);
 codel=code&0xf;
 codehl=0xf&(code>>8);
 value=1; 
 if((codel!=0xf)&&(codel>4)) 
 	value=0;
  if(codehl>3)
 	 if((codel!=0xf)&&(codel>0)) 
	 	value=0;
 if(codeh>0xb) 
 	value=0;
 if(codehl>7) 
 	value=0;
 if(1==value)
 	{if(codehl<4)
 		addr=35*codehl;
 	  else
	  	addr=140+7*(codehl-4);
 	 if((codel==0xf)&&(codehl<4))
 	            *len=35;                    
        else 
         	     *len=7;
	if(codel!=0xf)
		addr=addr+7*codel; 	
 	 if(codeh==0)//RAM
 	     {for(l=0;l<*len;l++)
 	     		*(point+l)=RAM[R_KW_F+addr+l];
 	      }
 	 else//eeprom
 	 	{data_addr.addri=current_twobiaofm_block_addr(TYPE_EP1_HISTROY_KW,codeh-1)+addr;
 	         read(EP1,*len);
 	         for(l=0;l<*len;l++)
			 *(point+l)=wr_data[l];
 	 	}
 	}
 return value;
}


/*******************************************/
#define class_lostv_currentnum 0
#define class_lostv_currentblock 1
#define class_lostv_historynum 2
#define class_lostv_historyblock 3
#define class_overkw_currentnum 4
#define class_overkw_historyblock 5
#define class_powerdownup_block 6
#define class_currentnumtime_historyblock 7
#define class_kwreverse_historyblock 8
#define class_abckwreverse_num 9
#define class_biancheng_history 10
#define class_kwhkvarh_historyprog 11
#define class_time_prog 12
#define class_priceprog_recorde 13
#define class_seasonprog_recorde 14
#define class_holidayprog_recorde 15
#define class_workoffdayprog_recorde 16
#define class_kwhkvarhmodeprog 17
#define class_clrkw_recorde 18
#define class_chaobiaori_prog_recorde 19
#define class_fulvyuyue_recorde 20
#define class_cuofeng_prog_recorde 21
#define class_seasonchange_recorde 22
#define class_currentcuofengblock 23
#define class_historycuofengblock 24
#define class_kwherr 25
#define class_timeerr 26


#define class_v7400 27
#define class_v7410 28
#define class_v7420 29
#define class_v7430 30
#define class_v7440 31
#define class_v7450 32
#define class_v7460 33
#define class_v7470 34
#define class_v7480 35
#define class_v7490 36
#define class_v74a0 37
#define class_v74b0 38
#define class_v7500 39
#define class_v7510 40
#define class_v7520 41
#define class_v7530 42
#define class_v7540 43

#define class_vb000 44
#define class_vb010 45
#define class_vb020 46
#define class_vb030 47
#define class_vb040 48
#define class_vb050 49
#define class_vb060 50
#define class_vb070 51
#define class_vb080 52
#define class_vb090 53
#define class_vc01fto5f 54
#define class_vc0df 55
#define class_c11f 56
#define class_c12f 57
#define class_vc000 58
#define class_v6e00 59

struct v10class{
                          unsigned int codemin;// code between  min------max  and f
			     unsigned char codemax;
                          unsigned char classtype;
			     unsigned int addr;//IF TWOTABLE ADDR IS NUM
			     // if abs   ----addr
			     // else
			     //        twotable ----last num
			     unsigned char stortype;//if twotable  type  then ram rom ep1 eplock
			     // if abs  ------ram ,fm ,fm1, ep1 or  eplock
			     // else
			     //        type------->twotable
    };


































const struct v10class table_v10read[]=
{
		{0x3000,0x02,class_lostv_currentnum,R_LOSTV_NUM,RRAM},// l0
		{0x3010,0x1b,class_lostv_currentblock,R_LOSTV_A_NUM,RRAM},//l1
		{0x3030,0x3b,class_lostv_currentblock,R_LOSTV_B_NUM,RRAM},//l2
		{0x3050,0x5b,class_lostv_currentblock,R_LOSTV_C_NUM,RRAM},//l3
		{0x3070,0x7b,class_lostv_currentblock,R_LOSTV_AB_NUM,RRAM},//l4
		{0x3090,0x9b,class_lostv_currentblock,R_LOSTV_AC_NUM,RRAM},//l5
		{0x30b0,0xbb,class_lostv_currentblock,R_LOSTV_BC_NUM,RRAM},//l6
		{0x3100,0x02,class_lostv_historynum,0,TYPE_FM_LOSTV_RECORD},//current  fm  l7
		{0x3110,0x17,class_lostv_historyblock,0,TYPE_FM_LOSTV_RECORD},//l8
		{0x3130,0x32,class_lostv_historynum,1,TYPE_FM_LOSTV_RECORD},//l9
		{0x3140,0x47,class_lostv_historyblock,1,TYPE_FM_LOSTV_RECORD},//l10
		{0x3160,0x62,class_lostv_historynum,2,TYPE_FM_LOSTV_RECORD},//l11
		{0x3170,0x77,class_lostv_historyblock,2,TYPE_FM_LOSTV_RECORD},//l12
		{0x3190,0x92,class_lostv_historynum,3,TYPE_FM_LOSTV_RECORD},//l13
		{0x31a0,0xa7,class_lostv_historyblock,3,TYPE_FM_LOSTV_RECORD},//l14
		{0x31c0,0xc2,class_lostv_historynum,4,TYPE_FM_LOSTV_RECORD},//l15
		{0x31d0,0xd7,class_lostv_historyblock,4,TYPE_FM_LOSTV_RECORD},//l16
		{0x4000,0x02,class_lostv_currentnum,R_CUTV_NUM,RRAM},//l17
		{0x4010,0x1b,class_lostv_currentblock,R_CUTV_A_NUM,RRAM},//l18
		{0x4030,0x3b,class_lostv_currentblock,R_CUTV_B_NUM,RRAM},//l19
		{0x4050,0x5b,class_lostv_currentblock,R_CUTV_C_NUM,RRAM},//l20
		{0x4070,0x7b,class_lostv_currentblock,R_CUTV_AB_NUM,RRAM},//l21
		{0x4090,0x9b,class_lostv_currentblock,R_CUTV_AC_NUM,RRAM},//l22
		{0x40b0,0xbb,class_lostv_currentblock,R_CUTV_BC_NUM,RRAM},//l23
		{0x4100,0x02,class_lostv_historynum,0,TYPE_FM_CUTV_RECORD},//current fml24
		{0x4110,0x17,class_lostv_historyblock,0,TYPE_FM_CUTV_RECORD},//l25
		{0x4130,0x32,class_lostv_historynum,1,TYPE_FM_CUTV_RECORD},//l26
		{0x4140,0x47,class_lostv_historyblock,1,TYPE_FM_CUTV_RECORD},//l27
		{0x4160,0x62,class_lostv_historynum,2,TYPE_FM_CUTV_RECORD},//l28
		{0x4170,0x77,class_lostv_historyblock,2,TYPE_FM_CUTV_RECORD},//l29
		{0x4190,0x92,class_lostv_historynum,3,TYPE_FM_CUTV_RECORD},//l30
		{0x41a0,0xa7,class_lostv_historyblock,3,TYPE_FM_CUTV_RECORD},//l31
		{0x41c0,0xc2,class_lostv_historynum,4,TYPE_FM_CUTV_RECORD},//l32
		{0x41d0,0xd7,class_lostv_historyblock,4,TYPE_FM_CUTV_RECORD},//l33
		{0x6800,0x01,class_overkw_currentnum,R_OVER_KW_NUM,RRAM},//l34
		{0x6910,0x1a,class_overkw_historyblock,0,TYPE_FM_KWOVER_RECORD},//l35
		{0x6920,0x2a,class_overkw_historyblock,1,TYPE_FM_KWOVER_RECORD},//l36
		{0x6930,0x3a,class_overkw_historyblock,2,TYPE_FM_KWOVER_RECORD},//l37
		{0x6940,0x4a,class_overkw_historyblock,3,TYPE_FM_KWOVER_RECORD},//l38
		{0x6950,0x5a,class_overkw_historyblock,4,TYPE_FM_KWOVER_RECORD},//l39
		{0x6a10,0x1a,class_overkw_historyblock,0,TYPE_FM_A_KWOVER_RECORD},//l40
		{0x6a20,0x2a,class_overkw_historyblock,1,TYPE_FM_A_KWOVER_RECORD},//l41
		{0x6a30,0x3a,class_overkw_historyblock,2,TYPE_FM_A_KWOVER_RECORD},//l42
		{0x6a40,0x4a,class_overkw_historyblock,3,TYPE_FM_A_KWOVER_RECORD},//l43
		{0x6a50,0x5a,class_overkw_historyblock,4,TYPE_FM_A_KWOVER_RECORD},//l44
		{0x6b10,0x1a,class_overkw_historyblock,0,TYPE_FM_B_KWOVER_RECORD},//l45
		{0x6b20,0x2a,class_overkw_historyblock,1,TYPE_FM_B_KWOVER_RECORD},//l46
		{0x6b30,0x3a,class_overkw_historyblock,2,TYPE_FM_B_KWOVER_RECORD},//l47
		{0x6b40,0x4a,class_overkw_historyblock,3,TYPE_FM_B_KWOVER_RECORD},//l48
		{0x6b50,0x5a,class_overkw_historyblock,4,TYPE_FM_B_KWOVER_RECORD},//l49
		{0x6c10,0x1a,class_overkw_historyblock,0,TYPE_FM_C_KWOVER_RECORD},//l50
		{0x6c20,0x2a,class_overkw_historyblock,1,TYPE_FM_C_KWOVER_RECORD},//l51
		{0x6c30,0x3a,class_overkw_historyblock,2,TYPE_FM_C_KWOVER_RECORD},//l52
		{0x6c40,0x4a,class_overkw_historyblock,3,TYPE_FM_C_KWOVER_RECORD},//l53
		{0x6c50,0x5a,class_overkw_historyblock,4,TYPE_FM_C_KWOVER_RECORD},//l54
		{0x6d20,0x2b,class_powerdownup_block,R_POWERDOWN_NUM,RRAM},//l55
		{0x6d30,0x36,class_currentnumtime_historyblock,R_ALLLOSTV_NUM,RRAM},//l56
		{0x6d40,0x46,class_currentnumtime_historyblock,R_V_REVERSE_NUM,RRAM},//l57
		{0x6d50,0x56,class_currentnumtime_historyblock,R_BIAOGAI_NUM,RRAM},//l58
		{0x6d60,0x66,class_currentnumtime_historyblock,R_DUANNIUGAI_NUM,RRAM},//l59
		{0x7000,0x01,class_overkw_currentnum,R_ORDER_KW_NUM,RRAM},//l60
		{0x7010,0x12,class_kwreverse_historyblock,0,TYPE_FM_KWREVERSE_RECORD},//CURRENTl61
		{0x7020,0x22,class_kwreverse_historyblock,1,TYPE_FM_KWREVERSE_RECORD},//l62
		{0x7030,0x32,class_kwreverse_historyblock,2,TYPE_FM_KWREVERSE_RECORD},//l63
		{0x7040,0x42,class_kwreverse_historyblock,3,TYPE_FM_KWREVERSE_RECORD},//l64
		{0x7050,0x52,class_kwreverse_historyblock,4,TYPE_FM_KWREVERSE_RECORD},//l65
		{0x7100,0x01,class_abckwreverse_num,R_ORDER_KW_A_NUM,RRAM},//l66
		{0x7110,0x12,class_kwreverse_historyblock,0,TYPE_FM_AKWREVERSE_RECORD},//CURRENTl67

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -