999 lines
27 KiB
C
999 lines
27 KiB
C
#include "eeprom_spi.h"
|
||
|
||
//使用方法:
|
||
// uint8_t eep_tx = 0x72;
|
||
// uint8_t eep_rx = 0;
|
||
// uint8_t eep_addr[3];
|
||
// uint8_t eep_test_flag = 0;
|
||
// uint8_t eep_status = 0;
|
||
|
||
// if(eep_test_flag == 0)
|
||
// {
|
||
// eep_test_flag = 1;
|
||
|
||
// eep_addr[0] = 0x00;
|
||
// eep_addr[1] = 0x00;
|
||
// eep_addr[2] = 0x00;
|
||
// eeprom_writedata(eep_addr, eep_tx);
|
||
|
||
// eep_rx = eeprom_readdata(eep_addr);
|
||
// }
|
||
// 结果:eep_rx = 0x72
|
||
|
||
void eeprom_spi_init(void)
|
||
{
|
||
EEPROM_CS_H; // CS 初始化高(手册中描述:S拉低时片选)
|
||
EEPROM_SCLK_L; // CLK 初始化低
|
||
EEPROM_WR_H; // 不使用硬件保护
|
||
}
|
||
|
||
void eeprom_spi_writebyte(uint8_t wrt_data)
|
||
{
|
||
uint8_t i = 0;
|
||
uint8_t temp = 0;
|
||
for(i = 0; i < 8; i++)
|
||
{
|
||
temp = ((wrt_data&0x80)==0x80)? 1:0;
|
||
|
||
wrt_data = wrt_data << 1;
|
||
|
||
EEPROM_SCLK_L; //CPOL=0
|
||
|
||
if(temp)
|
||
{
|
||
EEPROM_MOSI_H;
|
||
}
|
||
else
|
||
{
|
||
EEPROM_MOSI_L;
|
||
}
|
||
|
||
systick_delay_us(10); // 空等待
|
||
|
||
EEPROM_SCLK_H; //CPHA=0
|
||
|
||
systick_delay_us(10); // 空等待
|
||
}
|
||
|
||
EEPROM_SCLK_L;
|
||
}
|
||
|
||
uint8_t eeprom_spi_readbyte(void)
|
||
{
|
||
uint8_t i = 0;
|
||
uint8_t read_data = 0xFF;
|
||
for(i = 0; i < 8; i++)
|
||
{
|
||
read_data = read_data << 1;
|
||
|
||
EEPROM_SCLK_L;
|
||
|
||
systick_delay_us(10); // 空等待
|
||
|
||
EEPROM_SCLK_H;
|
||
|
||
systick_delay_us(10); // 空等待
|
||
|
||
if(EEPROM_MISO)
|
||
{
|
||
read_data = read_data + 1;
|
||
}
|
||
}
|
||
EEPROM_SCLK_L;
|
||
|
||
return read_data;
|
||
}
|
||
|
||
uint8_t SPI_WriteReadByte(uint8_t data)
|
||
{
|
||
uint16_t bit_ctr;
|
||
for(bit_ctr=0;bit_ctr<8;bit_ctr++)
|
||
{
|
||
if(data & 0x80)
|
||
{
|
||
EEPROM_MOSI_H;
|
||
}
|
||
else
|
||
{
|
||
EEPROM_MOSI_L;
|
||
}
|
||
|
||
data = (data << 1);
|
||
EEPROM_SCLK_H;
|
||
systick_delay_us(5); // 空等待
|
||
if(EEPROM_MISO)
|
||
{
|
||
data |= 0x01;
|
||
}
|
||
EEPROM_SCLK_L;
|
||
systick_delay_us(5); // 空等待
|
||
}
|
||
|
||
return(data);
|
||
}
|
||
|
||
void eeprom_writedata(int32_t addr_long, uint8_t txd)
|
||
{
|
||
uint8_t write_en_flag = 0;
|
||
uint8_t ee_status = 0;
|
||
uint8_t addr[3];
|
||
addr[0] = addr_long >> 16;
|
||
addr[1] = addr_long >> 8;
|
||
addr[2] = addr_long;
|
||
|
||
int16_t wait_max = 0;
|
||
do
|
||
{
|
||
EEPROM_CS_L;
|
||
delay_cnt(10);
|
||
eeprom_spi_writebyte(WRITE_ENABLE);
|
||
delay_cnt(10);
|
||
EEPROM_CS_H;
|
||
|
||
EEPROM_CS_L;
|
||
delay_cnt(10);
|
||
eeprom_spi_writebyte(READ_STATUS);
|
||
ee_status = eeprom_spi_readbyte();
|
||
delay_cnt(10);
|
||
EEPROM_CS_H;
|
||
|
||
write_en_flag = ee_status & 0x03;
|
||
|
||
wait_max++;
|
||
if(wait_max > 500)
|
||
{
|
||
system_sts.eeprom_write_error = 1;
|
||
return;
|
||
}
|
||
|
||
} while (write_en_flag != 0x02);
|
||
|
||
EEPROM_CS_L;
|
||
delay_cnt(10);
|
||
eeprom_spi_writebyte(WRITE_MEMORY);
|
||
eeprom_spi_writebyte(addr[0]);
|
||
eeprom_spi_writebyte(addr[1]);
|
||
eeprom_spi_writebyte(addr[2]);
|
||
eeprom_spi_writebyte(txd);
|
||
delay_cnt(10);
|
||
EEPROM_CS_H;
|
||
|
||
}
|
||
|
||
uint8_t eeprom_readdata(int32_t addr_long)
|
||
{
|
||
uint8_t rxd = 0;
|
||
uint8_t write_en_flag = 0;
|
||
uint8_t ee_status = 0;
|
||
uint8_t addr[3];
|
||
addr[0] = addr_long >> 16;
|
||
addr[1] = addr_long >> 8;
|
||
addr[2] = addr_long ;
|
||
|
||
int16_t wait_max = 0;
|
||
do
|
||
{
|
||
EEPROM_CS_L;
|
||
delay_cnt(10);
|
||
eeprom_spi_writebyte(WRITE_ENABLE);
|
||
delay_cnt(10);
|
||
EEPROM_CS_H;
|
||
|
||
EEPROM_CS_L;
|
||
delay_cnt(10);
|
||
eeprom_spi_writebyte(READ_STATUS);
|
||
ee_status = eeprom_spi_readbyte();
|
||
delay_cnt(10);
|
||
EEPROM_CS_H;
|
||
|
||
write_en_flag = ee_status & 0x01;
|
||
|
||
wait_max++;
|
||
if(wait_max > 500)
|
||
{
|
||
system_sts.eeprom_read_error = 1;
|
||
return 0;
|
||
}
|
||
|
||
} while (write_en_flag);
|
||
|
||
EEPROM_CS_L;
|
||
delay_cnt(10);
|
||
eeprom_spi_writebyte(READ_MEMORY);
|
||
eeprom_spi_writebyte(addr[0]);
|
||
eeprom_spi_writebyte(addr[1]);
|
||
eeprom_spi_writebyte(addr[2]);
|
||
rxd = eeprom_spi_readbyte();
|
||
delay_cnt(10);
|
||
EEPROM_CS_H;
|
||
|
||
return rxd;
|
||
}
|
||
|
||
#if DATA_SAVE_ALL
|
||
//存储参数,全部
|
||
void eeprom_datasave(void)
|
||
{
|
||
uint8_t temp_h = 0, temp_l = 0;
|
||
|
||
//VOL V
|
||
temp_h = tabdata.item0_page0_vup[0] >> 8;
|
||
temp_l = tabdata.item0_page0_vup[0] & 0xFF;
|
||
eeprom_writedata(VOL_V_UP_ADDR, temp_h);
|
||
eeprom_writedata(VOL_V_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page0_vlow[0] >> 8;
|
||
temp_l = tabdata.item0_page0_vlow[0] & 0xFF;
|
||
eeprom_writedata(VOL_V_LOW_ADDR, temp_h);
|
||
eeprom_writedata(VOL_V_LOW_ADDR + 8, temp_l);
|
||
|
||
//出现错误后,提前返回
|
||
if(system_sts.eeprom_write_error) return;
|
||
|
||
//VOL mV
|
||
temp_h = tabdata.item0_page0_vup[1] >> 8;
|
||
temp_l = tabdata.item0_page0_vup[1] & 0xFF;
|
||
eeprom_writedata(VOL_MV_UP_ADDR, temp_h);
|
||
eeprom_writedata(VOL_MV_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page0_vlow[1] >> 8;
|
||
temp_l = tabdata.item0_page0_vlow[1] & 0xFF;
|
||
eeprom_writedata(VOL_MV_LOW_ADDR, temp_h);
|
||
eeprom_writedata(VOL_MV_LOW_ADDR + 8, temp_l);
|
||
|
||
//CUR
|
||
temp_h = tabdata.item0_page0_cup >> 8;
|
||
temp_l = tabdata.item0_page0_cup & 0xFF;
|
||
eeprom_writedata(CUR_UP_ADDR, temp_h);
|
||
eeprom_writedata(CUR_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page0_clow >> 8;
|
||
temp_l = tabdata.item0_page0_clow & 0xFF;
|
||
eeprom_writedata(CUR_LOW_ADDR, temp_h);
|
||
eeprom_writedata(CUR_LOW_ADDR + 8, temp_l);
|
||
|
||
//RES
|
||
temp_h = tabdata.item0_page0_rup >> 8;
|
||
temp_l = tabdata.item0_page0_rup & 0xFF;
|
||
eeprom_writedata(RES_UP_ADDR, temp_h);
|
||
eeprom_writedata(RES_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_rlow >> 8;
|
||
temp_l = tabdata.item0_page1_rlow & 0xFF;
|
||
eeprom_writedata(RES_LOW_ADDR, temp_h);
|
||
eeprom_writedata(RES_LOW_ADDR + 8, temp_l);
|
||
|
||
//FRE
|
||
temp_h = tabdata.item0_page1_fup >> 8;
|
||
temp_l = tabdata.item0_page1_fup & 0xFF;
|
||
eeprom_writedata(FRE_UP_ADDR, temp_h);
|
||
eeprom_writedata(FRE_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_flow >> 8;
|
||
temp_l = tabdata.item0_page1_flow & 0xFF;
|
||
eeprom_writedata(FRE_LOW_ADDR, temp_h);
|
||
eeprom_writedata(FRE_LOW_ADDR + 8, temp_l);
|
||
|
||
//TC K
|
||
temp_h = tabdata.item0_page1_TCup[0] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[0] & 0xFF;
|
||
eeprom_writedata(TC_K_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_K_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[0] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[0] & 0xFF;
|
||
eeprom_writedata(TC_K_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_K_LOW_ADDR + 8, temp_l);
|
||
|
||
//TC S
|
||
temp_h = tabdata.item0_page1_TCup[1] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[1] & 0xFF;
|
||
eeprom_writedata(TC_S_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_S_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[1] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[1] & 0xFF;
|
||
eeprom_writedata(TC_S_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_S_LOW_ADDR + 8, temp_l);
|
||
|
||
//TC N
|
||
temp_h = tabdata.item0_page1_TCup[2] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[2] & 0xFF;
|
||
eeprom_writedata(TC_N_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_N_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[2] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[2] & 0xFF;
|
||
eeprom_writedata(TC_N_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_N_LOW_ADDR + 8, temp_l);
|
||
|
||
//TC B
|
||
temp_h = tabdata.item0_page1_TCup[3] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[3] & 0xFF;
|
||
eeprom_writedata(TC_B_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_B_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[3] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[3] & 0xFF;
|
||
eeprom_writedata(TC_B_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_B_LOW_ADDR + 8, temp_l);
|
||
|
||
//TC E
|
||
temp_h = tabdata.item0_page1_TCup[4] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[4] & 0xFF;
|
||
eeprom_writedata(TC_E_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_E_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[4] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[4] & 0xFF;
|
||
eeprom_writedata(TC_E_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_E_LOW_ADDR + 8, temp_l);
|
||
|
||
//TC J
|
||
temp_h = tabdata.item0_page1_TCup[5] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[5] & 0xFF;
|
||
eeprom_writedata(TC_J_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_J_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[5] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[5] & 0xFF;
|
||
eeprom_writedata(TC_J_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_J_LOW_ADDR + 8, temp_l);
|
||
|
||
//TC R
|
||
temp_h = tabdata.item0_page1_TCup[6] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[6] & 0xFF;
|
||
eeprom_writedata(TC_R_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_R_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[6] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[6] & 0xFF;
|
||
eeprom_writedata(TC_R_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_R_LOW_ADDR + 8, temp_l);
|
||
|
||
//TC T
|
||
temp_h = tabdata.item0_page1_TCup[7] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[7] & 0xFF;
|
||
eeprom_writedata(TC_T_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_T_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[7] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[7] & 0xFF;
|
||
eeprom_writedata(TC_T_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_T_LOW_ADDR + 8, temp_l);
|
||
|
||
//RTD
|
||
temp_h = tabdata.item0_page2_RTDup >> 8;
|
||
temp_l = tabdata.item0_page2_RTDup & 0xFF;
|
||
eeprom_writedata(RTD_UP_ADDR, temp_h);
|
||
eeprom_writedata(RTD_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page2_RTDlow >> 8;
|
||
temp_l = tabdata.item0_page2_RTDlow & 0xFF;
|
||
eeprom_writedata(RTD_LOW_ADDR, temp_h);
|
||
eeprom_writedata(RTD_LOW_ADDR + 8, temp_l);
|
||
|
||
//采样间隔
|
||
temp_h = tabdata.item1_page0_sample_interval >> 8;
|
||
temp_l = tabdata.item1_page0_sample_interval & 0xFF;
|
||
eeprom_writedata(SAMPLE_INTERVAL_ADDR, temp_h);
|
||
eeprom_writedata(SAMPLE_INTERVAL_ADDR + 8, temp_l);
|
||
|
||
//描点数量
|
||
temp_h = tabdata.item1_page0_plot_num >> 8;
|
||
temp_l = tabdata.item1_page0_plot_num & 0xFF;
|
||
eeprom_writedata(PLOT_COUNT_ADDR, temp_h);
|
||
eeprom_writedata(PLOT_COUNT_ADDR + 8, temp_l);
|
||
|
||
//输入曲线颜色
|
||
temp_h = tabdata.item1_page0_color_input >> 8;
|
||
temp_l = tabdata.item1_page0_color_input & 0xFF;
|
||
eeprom_writedata(INPUT_COLOR_ADDR, temp_h);
|
||
eeprom_writedata(INPUT_COLOR_ADDR + 8, temp_l);
|
||
|
||
//输出曲线颜色
|
||
temp_h = tabdata.item1_page0_color_output >> 8;
|
||
temp_l = tabdata.item1_page0_color_output & 0xFF;
|
||
eeprom_writedata(OUTPUT_COLOR_ADDR, temp_h);
|
||
eeprom_writedata(OUTPUT_COLOR_ADDR + 8, temp_l);
|
||
|
||
//语言选择
|
||
temp_h = tabdata.item3_page0_language >> 8;
|
||
temp_l = tabdata.item3_page0_language & 0xFF;
|
||
eeprom_writedata(LANGUAGE_SELECT_ADDR, temp_h);
|
||
eeprom_writedata(LANGUAGE_SELECT_ADDR + 8, temp_l);
|
||
|
||
}
|
||
#else
|
||
|
||
//保存修改过的数据
|
||
void eeprom_datasave_changed(void)
|
||
{
|
||
TABVIEW_DATA tab_temp;
|
||
memcpy(&tab_temp, &tabdata, sizeof(TABVIEW_DATA));
|
||
|
||
eeprom_dataread();
|
||
|
||
if( (tab_temp.item0_page0_vup[0] != tabdata.item0_page0_vup[0])||(tab_temp.item0_page0_vlow[0] != tabdata.item0_page0_vlow[0])||\
|
||
(tab_temp.item0_page0_vup[1] != tabdata.item0_page0_vup[1])||(tab_temp.item0_page0_vlow[1] != tabdata.item0_page0_vlow[1]) )
|
||
{
|
||
tabdata.item0_page0_vup[0] = tab_temp.item0_page0_vup[0];
|
||
tabdata.item0_page0_vlow[0] = tab_temp.item0_page0_vlow[0];
|
||
tabdata.item0_page0_vup[1] = tab_temp.item0_page0_vup[1];
|
||
tabdata.item0_page0_vlow[1] = tab_temp.item0_page0_vlow[1];
|
||
|
||
eeprom_datasave_single(0);
|
||
}
|
||
|
||
if( (tab_temp.item0_page0_cup != tabdata.item0_page0_cup)||(tab_temp.item0_page0_clow != tabdata.item0_page0_clow) )
|
||
{
|
||
tabdata.item0_page0_cup = tab_temp.item0_page0_cup;
|
||
tabdata.item0_page0_clow = tab_temp.item0_page0_clow;
|
||
|
||
eeprom_datasave_single(1);
|
||
}
|
||
|
||
if( (tab_temp.item0_page0_rup != tabdata.item0_page0_rup)||(tab_temp.item0_page1_rlow != tabdata.item0_page1_rlow) )
|
||
{
|
||
tabdata.item0_page0_rup = tab_temp.item0_page0_rup;
|
||
tabdata.item0_page1_rlow = tab_temp.item0_page1_rlow;
|
||
|
||
eeprom_datasave_single(2);
|
||
}
|
||
|
||
if( (tab_temp.item0_page1_fup != tabdata.item0_page1_fup)||(tab_temp.item0_page1_flow != tabdata.item0_page1_flow) )
|
||
{
|
||
tabdata.item0_page1_fup = tab_temp.item0_page1_fup;
|
||
tabdata.item0_page1_flow = tab_temp.item0_page1_flow;
|
||
|
||
eeprom_datasave_single(3);
|
||
}
|
||
|
||
for(uint8_t i = 0 ; i < 8; i++)
|
||
{
|
||
if( (tab_temp.item0_page1_TCup[i] != tabdata.item0_page1_TCup[i])||(tab_temp.item0_page1_TClow[i] != tabdata.item0_page1_TClow[i]) )
|
||
{
|
||
tabdata.item0_page1_TCup[i] = tab_temp.item0_page1_TCup[i];
|
||
tabdata.item0_page1_TClow[i] = tab_temp.item0_page1_TClow[i];
|
||
|
||
eeprom_datasave_single( i + 4 );
|
||
}
|
||
}
|
||
|
||
if( (tab_temp.item0_page2_RTDup != tabdata.item0_page2_RTDup)||(tab_temp.item0_page2_RTDlow != tabdata.item0_page2_RTDlow) )
|
||
{
|
||
tabdata.item0_page2_RTDup = tab_temp.item0_page2_RTDup;
|
||
tabdata.item0_page2_RTDlow = tab_temp.item0_page2_RTDlow;
|
||
|
||
eeprom_datasave_single(12);
|
||
}
|
||
|
||
if(tab_temp.item1_page0_sample_interval != tabdata.item1_page0_sample_interval)
|
||
{
|
||
tabdata.item1_page0_sample_interval = tab_temp.item1_page0_sample_interval;
|
||
|
||
eeprom_datasave_single(13);
|
||
}
|
||
|
||
if(tab_temp.item1_page0_plot_num != tabdata.item1_page0_plot_num)
|
||
{
|
||
tabdata.item1_page0_plot_num = tab_temp.item1_page0_plot_num;
|
||
|
||
eeprom_datasave_single(14);
|
||
}
|
||
|
||
if(tab_temp.item1_page0_color_input != tabdata.item1_page0_color_input)
|
||
{
|
||
tabdata.item1_page0_color_input = tab_temp.item1_page0_color_input;
|
||
|
||
eeprom_datasave_single(15);
|
||
}
|
||
|
||
if(tab_temp.item1_page0_color_output != tabdata.item1_page0_color_output)
|
||
{
|
||
tabdata.item1_page0_color_output = tab_temp.item1_page0_color_output;
|
||
|
||
eeprom_datasave_single(16);
|
||
}
|
||
|
||
if(tab_temp.item3_page0_language != tabdata.item3_page0_language)
|
||
{
|
||
tabdata.item3_page0_language = tab_temp.item3_page0_language;
|
||
|
||
eeprom_datasave_single(17);
|
||
}
|
||
}
|
||
|
||
#endif
|
||
|
||
void eeprom_datasave_single(uint8_t tag)
|
||
{
|
||
uint8_t temp_h = 0, temp_l = 0;
|
||
|
||
switch (tag)
|
||
{
|
||
case 0:
|
||
{
|
||
//VOL V
|
||
temp_h = tabdata.item0_page0_vup[0] >> 8;
|
||
temp_l = tabdata.item0_page0_vup[0] & 0xFF;
|
||
eeprom_writedata(VOL_V_UP_ADDR, temp_h);
|
||
eeprom_writedata(VOL_V_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page0_vlow[0] >> 8;
|
||
temp_l = tabdata.item0_page0_vlow[0] & 0xFF;
|
||
eeprom_writedata(VOL_V_LOW_ADDR, temp_h);
|
||
eeprom_writedata(VOL_V_LOW_ADDR + 8, temp_l);
|
||
|
||
//VOL mV
|
||
temp_h = tabdata.item0_page0_vup[1] >> 8;
|
||
temp_l = tabdata.item0_page0_vup[1] & 0xFF;
|
||
eeprom_writedata(VOL_MV_UP_ADDR, temp_h);
|
||
eeprom_writedata(VOL_MV_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page0_vlow[1] >> 8;
|
||
temp_l = tabdata.item0_page0_vlow[1] & 0xFF;
|
||
eeprom_writedata(VOL_MV_LOW_ADDR, temp_h);
|
||
eeprom_writedata(VOL_MV_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 1:
|
||
{
|
||
//CUR
|
||
temp_h = tabdata.item0_page0_cup >> 8;
|
||
temp_l = tabdata.item0_page0_cup & 0xFF;
|
||
eeprom_writedata(CUR_UP_ADDR, temp_h);
|
||
eeprom_writedata(CUR_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page0_clow >> 8;
|
||
temp_l = tabdata.item0_page0_clow & 0xFF;
|
||
eeprom_writedata(CUR_LOW_ADDR, temp_h);
|
||
eeprom_writedata(CUR_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 2:
|
||
{
|
||
//RES
|
||
temp_h = tabdata.item0_page0_rup >> 8;
|
||
temp_l = tabdata.item0_page0_rup & 0xFF;
|
||
eeprom_writedata(RES_UP_ADDR, temp_h);
|
||
eeprom_writedata(RES_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_rlow >> 8;
|
||
temp_l = tabdata.item0_page1_rlow & 0xFF;
|
||
eeprom_writedata(RES_LOW_ADDR, temp_h);
|
||
eeprom_writedata(RES_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 3:
|
||
{
|
||
//FRE
|
||
temp_h = tabdata.item0_page1_fup >> 8;
|
||
temp_l = tabdata.item0_page1_fup & 0xFF;
|
||
eeprom_writedata(FRE_UP_ADDR, temp_h);
|
||
eeprom_writedata(FRE_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_flow >> 8;
|
||
temp_l = tabdata.item0_page1_flow & 0xFF;
|
||
eeprom_writedata(FRE_LOW_ADDR, temp_h);
|
||
eeprom_writedata(FRE_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 4:
|
||
{
|
||
//TC K
|
||
temp_h = tabdata.item0_page1_TCup[0] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[0] & 0xFF;
|
||
eeprom_writedata(TC_K_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_K_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[0] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[0] & 0xFF;
|
||
eeprom_writedata(TC_K_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_K_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 5:
|
||
{
|
||
//TC S
|
||
temp_h = tabdata.item0_page1_TCup[1] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[1] & 0xFF;
|
||
eeprom_writedata(TC_S_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_S_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[1] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[1] & 0xFF;
|
||
eeprom_writedata(TC_S_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_S_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 6:
|
||
{
|
||
//TC N
|
||
temp_h = tabdata.item0_page1_TCup[2] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[2] & 0xFF;
|
||
eeprom_writedata(TC_N_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_N_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[2] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[2] & 0xFF;
|
||
eeprom_writedata(TC_N_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_N_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 7:
|
||
{
|
||
//TC B
|
||
temp_h = tabdata.item0_page1_TCup[3] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[3] & 0xFF;
|
||
eeprom_writedata(TC_B_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_B_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[3] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[3] & 0xFF;
|
||
eeprom_writedata(TC_B_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_B_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 8:
|
||
{
|
||
//TC E
|
||
temp_h = tabdata.item0_page1_TCup[4] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[4] & 0xFF;
|
||
eeprom_writedata(TC_E_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_E_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[4] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[4] & 0xFF;
|
||
eeprom_writedata(TC_E_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_E_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 9:
|
||
{
|
||
//TC J
|
||
temp_h = tabdata.item0_page1_TCup[5] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[5] & 0xFF;
|
||
eeprom_writedata(TC_J_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_J_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[5] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[5] & 0xFF;
|
||
eeprom_writedata(TC_J_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_J_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 10:
|
||
{
|
||
//TC R
|
||
temp_h = tabdata.item0_page1_TCup[6] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[6] & 0xFF;
|
||
eeprom_writedata(TC_R_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_R_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[6] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[6] & 0xFF;
|
||
eeprom_writedata(TC_R_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_R_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 11:
|
||
{
|
||
//TC T
|
||
temp_h = tabdata.item0_page1_TCup[7] >> 8;
|
||
temp_l = tabdata.item0_page1_TCup[7] & 0xFF;
|
||
eeprom_writedata(TC_T_UP_ADDR, temp_h);
|
||
eeprom_writedata(TC_T_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page1_TClow[7] >> 8;
|
||
temp_l = tabdata.item0_page1_TClow[7] & 0xFF;
|
||
eeprom_writedata(TC_T_LOW_ADDR, temp_h);
|
||
eeprom_writedata(TC_T_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 12:
|
||
{
|
||
//RTD
|
||
temp_h = tabdata.item0_page2_RTDup >> 8;
|
||
temp_l = tabdata.item0_page2_RTDup & 0xFF;
|
||
eeprom_writedata(RTD_UP_ADDR, temp_h);
|
||
eeprom_writedata(RTD_UP_ADDR + 8, temp_l);
|
||
|
||
temp_h = tabdata.item0_page2_RTDlow >> 8;
|
||
temp_l = tabdata.item0_page2_RTDlow & 0xFF;
|
||
eeprom_writedata(RTD_LOW_ADDR, temp_h);
|
||
eeprom_writedata(RTD_LOW_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 13:
|
||
{
|
||
//采样间隔
|
||
temp_h = tabdata.item1_page0_sample_interval >> 8;
|
||
temp_l = tabdata.item1_page0_sample_interval & 0xFF;
|
||
eeprom_writedata(SAMPLE_INTERVAL_ADDR, temp_h);
|
||
eeprom_writedata(SAMPLE_INTERVAL_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 14:
|
||
{
|
||
//描点数量
|
||
temp_h = tabdata.item1_page0_plot_num >> 8;
|
||
temp_l = tabdata.item1_page0_plot_num & 0xFF;
|
||
eeprom_writedata(PLOT_COUNT_ADDR, temp_h);
|
||
eeprom_writedata(PLOT_COUNT_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 15:
|
||
{
|
||
//输入曲线颜色
|
||
temp_h = ((uint8_t)tabdata.item1_page0_color_input) >> 8;
|
||
temp_l = ((uint8_t)tabdata.item1_page0_color_input) & 0xFF;
|
||
eeprom_writedata(INPUT_COLOR_ADDR, temp_h);
|
||
eeprom_writedata(INPUT_COLOR_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 16:
|
||
{
|
||
//输出曲线颜色
|
||
temp_h = ((uint8_t)tabdata.item1_page0_color_output) >> 8;
|
||
temp_l = ((uint8_t)tabdata.item1_page0_color_output) & 0xFF;
|
||
eeprom_writedata(OUTPUT_COLOR_ADDR, temp_h);
|
||
eeprom_writedata(OUTPUT_COLOR_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
case 17:
|
||
{
|
||
//语言选择
|
||
temp_h = ((uint8_t)tabdata.item3_page0_language) >> 8;
|
||
temp_l = ((uint8_t)tabdata.item3_page0_language) & 0xFF;
|
||
eeprom_writedata(LANGUAGE_SELECT_ADDR, temp_h);
|
||
eeprom_writedata(LANGUAGE_SELECT_ADDR + 8, temp_l);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
//开机上电后读取参数
|
||
void eeprom_dataread(void)
|
||
{
|
||
uint8_t temp_h = 0, temp_l = 0;
|
||
|
||
//VOL V
|
||
temp_h = eeprom_readdata(VOL_V_UP_ADDR);
|
||
temp_l = eeprom_readdata(VOL_V_UP_ADDR + 8);
|
||
tabdata.item0_page0_vup[0] = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(VOL_V_LOW_ADDR);
|
||
temp_l = eeprom_readdata(VOL_V_LOW_ADDR + 8);
|
||
tabdata.item0_page0_vlow[0] = ( temp_h << 8 ) + temp_l;
|
||
|
||
//出现错误后,提前返回
|
||
if(system_sts.eeprom_read_error) return;
|
||
|
||
//VOL mV
|
||
temp_h = eeprom_readdata(VOL_MV_UP_ADDR);
|
||
temp_l = eeprom_readdata(VOL_MV_UP_ADDR + 8);
|
||
tabdata.item0_page0_vup[1] = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(VOL_MV_LOW_ADDR);
|
||
temp_l = eeprom_readdata(VOL_MV_LOW_ADDR + 8);
|
||
tabdata.item0_page0_vlow[1] = ( temp_h << 8 ) + temp_l;
|
||
|
||
//CUR
|
||
//temp_h = eeprom_readdata(CUR_UP_ADDR);
|
||
temp_l = eeprom_readdata(CUR_UP_ADDR + 8);
|
||
tabdata.item0_page0_cup = temp_l;
|
||
|
||
//temp_h = eeprom_readdata(CUR_LOW_ADDR);
|
||
temp_l = eeprom_readdata(CUR_LOW_ADDR + 8);
|
||
tabdata.item0_page0_clow = temp_l;
|
||
|
||
//RES
|
||
temp_h = eeprom_readdata(RES_UP_ADDR);
|
||
temp_l = eeprom_readdata(RES_UP_ADDR + 8);
|
||
tabdata.item0_page0_rup = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(RES_LOW_ADDR);
|
||
temp_l = eeprom_readdata(RES_LOW_ADDR + 8);
|
||
tabdata.item0_page1_rlow = ( temp_h << 8 ) + temp_l;
|
||
|
||
//FRE
|
||
//temp_h = eeprom_readdata(FRE_UP_ADDR);
|
||
temp_l = eeprom_readdata(FRE_UP_ADDR + 8);
|
||
tabdata.item0_page1_fup = temp_l;
|
||
|
||
//temp_h = eeprom_readdata(FRE_LOW_ADDR);
|
||
temp_l = eeprom_readdata(FRE_LOW_ADDR + 8);
|
||
tabdata.item0_page1_flow = temp_l;
|
||
|
||
//TC K
|
||
temp_h = eeprom_readdata(TC_K_UP_ADDR);
|
||
temp_l = eeprom_readdata(TC_K_UP_ADDR + 8);
|
||
tabdata.item0_page1_TCup[0] = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(TC_K_LOW_ADDR);
|
||
temp_l = eeprom_readdata(TC_K_LOW_ADDR + 8);
|
||
tabdata.item0_page1_TClow[0] = ( temp_h << 8 ) + temp_l;
|
||
|
||
//TC S
|
||
temp_h = eeprom_readdata(TC_S_UP_ADDR);
|
||
temp_l = eeprom_readdata(TC_S_UP_ADDR + 8);
|
||
tabdata.item0_page1_TCup[1] = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(TC_S_LOW_ADDR);
|
||
temp_l = eeprom_readdata(TC_S_LOW_ADDR + 8);
|
||
tabdata.item0_page1_TClow[1] = ( temp_h << 8 ) + temp_l;
|
||
|
||
//TC N
|
||
temp_h = eeprom_readdata(TC_N_UP_ADDR);
|
||
temp_l = eeprom_readdata(TC_N_UP_ADDR + 8);
|
||
tabdata.item0_page1_TCup[2] = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(TC_N_LOW_ADDR);
|
||
temp_l = eeprom_readdata(TC_N_LOW_ADDR + 8);
|
||
tabdata.item0_page1_TClow[2] = ( temp_h << 8 ) + temp_l;
|
||
|
||
//TC B
|
||
temp_h = eeprom_readdata(TC_B_UP_ADDR);
|
||
temp_l = eeprom_readdata(TC_B_UP_ADDR + 8);
|
||
tabdata.item0_page1_TCup[3] = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(TC_B_LOW_ADDR);
|
||
temp_l = eeprom_readdata(TC_B_LOW_ADDR + 8);
|
||
tabdata.item0_page1_TClow[3] = ( temp_h << 8 ) + temp_l;
|
||
|
||
//TC E
|
||
temp_h = eeprom_readdata(TC_E_UP_ADDR);
|
||
temp_l = eeprom_readdata(TC_E_UP_ADDR + 8);
|
||
tabdata.item0_page1_TCup[4] = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(TC_E_LOW_ADDR);
|
||
temp_l = eeprom_readdata(TC_E_LOW_ADDR + 8);
|
||
tabdata.item0_page1_TClow[4] = ( temp_h << 8 ) + temp_l;
|
||
|
||
//TC J
|
||
temp_h = eeprom_readdata(TC_J_UP_ADDR);
|
||
temp_l = eeprom_readdata(TC_J_UP_ADDR + 8);
|
||
tabdata.item0_page1_TCup[5] = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(TC_J_LOW_ADDR);
|
||
temp_l = eeprom_readdata(TC_J_LOW_ADDR + 8);
|
||
tabdata.item0_page1_TClow[5] = ( temp_h << 8 ) + temp_l;
|
||
|
||
//TC R
|
||
temp_h = eeprom_readdata(TC_R_UP_ADDR);
|
||
temp_l = eeprom_readdata(TC_R_UP_ADDR + 8);
|
||
tabdata.item0_page1_TCup[6] = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(TC_R_LOW_ADDR);
|
||
temp_l = eeprom_readdata(TC_R_LOW_ADDR + 8);
|
||
tabdata.item0_page1_TClow[6] = ( temp_h << 8 ) + temp_l;
|
||
|
||
//TC T
|
||
temp_h = eeprom_readdata(TC_T_UP_ADDR);
|
||
temp_l = eeprom_readdata(TC_T_UP_ADDR + 8);
|
||
tabdata.item0_page1_TCup[7] = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(TC_T_LOW_ADDR);
|
||
temp_l = eeprom_readdata(TC_T_LOW_ADDR + 8);
|
||
tabdata.item0_page1_TClow[7] = ( temp_h << 8 ) + temp_l;
|
||
|
||
//RTD
|
||
temp_h = eeprom_readdata(RTD_UP_ADDR);
|
||
temp_l = eeprom_readdata(RTD_UP_ADDR + 8);
|
||
tabdata.item0_page2_RTDup = ( temp_h << 8 ) + temp_l;
|
||
|
||
temp_h = eeprom_readdata(RTD_LOW_ADDR);
|
||
temp_l = eeprom_readdata(RTD_LOW_ADDR + 8);
|
||
tabdata.item0_page2_RTDlow = ( temp_h << 8 ) + temp_l;
|
||
|
||
//采样间隔
|
||
temp_h = eeprom_readdata(SAMPLE_INTERVAL_ADDR);
|
||
temp_l = eeprom_readdata(SAMPLE_INTERVAL_ADDR + 8);
|
||
tabdata.item1_page0_sample_interval = ( temp_h << 8 ) + temp_l;
|
||
|
||
//描点数量
|
||
temp_h = eeprom_readdata(PLOT_COUNT_ADDR);
|
||
temp_l = eeprom_readdata(PLOT_COUNT_ADDR + 8);
|
||
tabdata.item1_page0_plot_num = ( temp_h << 8 ) + temp_l;
|
||
|
||
//输入曲线颜色
|
||
temp_h = eeprom_readdata(INPUT_COLOR_ADDR);
|
||
temp_l = eeprom_readdata(INPUT_COLOR_ADDR + 8);
|
||
tabdata.item1_page0_color_input = (COLORS)( ( temp_h << 8 ) + temp_l );
|
||
|
||
//输出曲线颜色
|
||
temp_h = eeprom_readdata(OUTPUT_COLOR_ADDR);
|
||
temp_l = eeprom_readdata(OUTPUT_COLOR_ADDR + 8);
|
||
tabdata.item1_page0_color_output = (COLORS)( ( temp_h << 8 ) + temp_l );
|
||
|
||
//语言选择
|
||
temp_h = eeprom_readdata(LANGUAGE_SELECT_ADDR);
|
||
temp_l = eeprom_readdata(LANGUAGE_SELECT_ADDR + 8);
|
||
tabdata.item3_page0_language = (LANGUAGES)( ( temp_h << 8 ) + temp_l );
|
||
}
|
||
|
||
//判断EEPROM内是否已存在数据
|
||
uint8_t eeprom_device_check(void)
|
||
{
|
||
uint8_t device_status_h = 0, device_status_l = 0;
|
||
int dev_sts = 0;
|
||
|
||
device_status_h = eeprom_readdata(DEVICE_CHECK);
|
||
device_status_l = eeprom_readdata(DEVICE_CHECK + 8);
|
||
dev_sts = (device_status_h << 8) + device_status_l;
|
||
|
||
if(dev_sts != 0xAAAA)
|
||
{
|
||
tabdata.item0_page0_vup[0] = VOL[0].up; //电压V上限
|
||
tabdata.item0_page0_vlow[0] = VOL[0].low; //电压V下限
|
||
tabdata.item0_page0_vup[1] = VOL[1].up; //电压mV上限
|
||
tabdata.item0_page0_vlow[1] = VOL[1].low; //电压mV下限
|
||
tabdata.item0_page0_cup = CUR.up; //电流上限
|
||
tabdata.item0_page0_clow = CUR.low; //电流下限
|
||
tabdata.item0_page0_rup = RES.up; //电阻上限
|
||
tabdata.item0_page1_rlow = RES.low; //电阻下限
|
||
tabdata.item0_page1_fup = FRE.up; //频率上限
|
||
tabdata.item0_page1_flow = FRE.low; //频率下限
|
||
tabdata.item0_page1_TCup[0] = TC[0].up; //TCK上限
|
||
tabdata.item0_page1_TClow[0] = TC[0].low; //TCK下限
|
||
tabdata.item0_page1_TCup[1] = TC[1].up; //TCS上限
|
||
tabdata.item0_page1_TClow[1] = TC[1].low; //TCS下限
|
||
tabdata.item0_page1_TCup[2] = TC[2].up; //TCN上限
|
||
tabdata.item0_page1_TClow[2] = TC[2].low; //TCN下限
|
||
tabdata.item0_page1_TCup[3] = TC[3].up; //TCB上限
|
||
tabdata.item0_page1_TClow[3] = TC[3].low; //TCB下限
|
||
tabdata.item0_page1_TCup[4] = TC[4].up; //TCE上限
|
||
tabdata.item0_page1_TClow[4] = TC[4].low; //TCE下限
|
||
tabdata.item0_page1_TCup[5] = TC[5].up; //TCJ上限
|
||
tabdata.item0_page1_TClow[5] = TC[5].low; //TCJ下限
|
||
tabdata.item0_page1_TCup[6] = TC[6].up; //TCR上限
|
||
tabdata.item0_page1_TClow[6] = TC[6].low; //TCR下限
|
||
tabdata.item0_page1_TCup[7] = TC[7].up; //TCT上限
|
||
tabdata.item0_page1_TClow[7] = TC[7].low; //TCT下限
|
||
tabdata.item0_page2_RTDup = RTD.up; //RTD上限
|
||
tabdata.item0_page2_RTDlow = RTD.low; //RTD下限
|
||
tabdata.item1_page0_sample_interval = 1500;
|
||
tabdata.item1_page0_plot_num = 5;
|
||
tabdata.item1_page0_color_input = COLOR_YELLOW;
|
||
tabdata.item1_page0_color_output = COLOR_BLUE;
|
||
tabdata.item3_page0_language = MENU_SIMPLYFY_CHINESE;
|
||
|
||
//eeprom_datasave();
|
||
eeprom_datasave_changed();
|
||
|
||
eeprom_writedata(DEVICE_CHECK, 0xAA);
|
||
eeprom_writedata(DEVICE_CHECK + 8, 0xAA);
|
||
|
||
return 0;
|
||
}
|
||
else
|
||
{
|
||
return 1;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|