Set_Num[ 3 ] = 0x20;
Set_Num[ 4 ] = Hex4Bcd_Buf[4] + 0x30;
}
else
{
Set_Num[ 3 ] = Hex4Bcd_Buf[3] + 0x30;
Set_Num[ 4 ] = Hex4Bcd_Buf[4] + 0x30;
}
}
else
{
for( i = 2; i < 5; i ++ )
{
Set_Num[ i ] = Hex4Bcd_Buf + 0x30;
}
}
}
else
{
for( i = 1; i < 5; i ++ )
{
Set_Num[ i ] = Hex4Bcd_Buf + 0x30;
}
}
}
else
{
for( i = 0; i < 5; i ++ )
{
Set_Num[ i ] = Hex4Bcd_Buf + 0x30;
}
}
}
/*==================================================================================*/
// 功 能: 写资料到 EEPROM 指定地址.
// 传入参数: 1. 资料码.
// 2. 地址码.
void Eeprom_Write_Data( unint Address_Rg, unint Value_Rg )
{
EE_Write_Start_Bit();
EE_Write_Code_Bit( 0x40, 2 ); // 写操作码 "01"
// 写地址 A8 ( 93C66 )
EE_Write_Code_Bit( ( unchar )( Address_Rg >> 1 ), 1 );
// 写地址 A7 -- A0 ( 93C66 )
EE_Write_Code_Bit( ( unchar )Address_Rg, 8 );
// 写 1 个 Byte 资料
EE_Write_Code_Bit( ( unchar )Value_Rg, 8 );
// 检测 "忙"
Eeprom_Check_Busy();
Eeprom_CS_Fg = 0;
}
/*==================================================================================*/
// 功 能: 从 EEPROM 指定地址读取资料.
// 传入参数: 地址码.
// 传回参数: 资料码.
unchar Eeprom_Read_Data( unint Address_Rg )
{
unchar Read_Data_Buf;
EE_Write_Start_Bit();
// 写操作码 "10"
EE_Write_Code_Bit( 0x80, 2 );
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] 下一页
本文关键字:控制器 程序 51单片机,单片机-工控设备 - 51单片机