{
while (EECR&(1<
EEDR = data;
EECR |= (1<
unsigned char Read_byte_eeprom(unsigned short address)
{
while (EECR&(1<
EECR |= (1<
return EEDR;
}
void Refresh_eeprom(void)
{
unsigned char i = 0;
unsigned char check = 0;
unsigned char *p = (unsigned char *)&ram;
asm("cli");
ram.start = 0x55;
for (; i<(sizeof(ram)-1); i++)
{
Write_byte_eeprom(i,*(p+i));
check += *(p+i);
}
Write_byte_eeprom(i,check);
asm("sei");
}
void Read_eeprom(void)
{
unsigned char i = 0;
unsigned char check = 0;
unsigned char *p = (unsigned char *)&ram;
for (; i<(sizeof(ram)-1); i++)
{
*(p+i) = Read_byte_eeprom(i);
check += *(p+i);
}
*(p+i) = Read_byte_eeprom(i);
//取值合理性判断
if ((*(p+i) != check) || (*p != 0x55))
{
Parameter_reset();
}
}
Previous article:ARM-LINUX key interrupt driver
Next article:ATMEGA16 multi-channel AD acquisition
Recommended ReadingLatest update time:2024-11-16 14:26
- Popular Resources
- Popular amplifiers
- Principles and Applications of Single Chip Microcomputers 3rd Edition (Zhang Yigang)
- Metronom Real-Time Operating System RTOS for AVR microcontrollers
- Learn C language for AVR microcontrollers easily (with video tutorial) (Yan Yu, Li Jia, Qin Wenhai)
- ATmega16 MCU C language programming classic example (Chen Zhongping)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- LED PWM Dimming C Program
- Keil.STM32H7xx_DFP.2.2.0 installation package problem
- Drawing
- EEWORLD University Hall - Open Source Power Linux Kernel Source Code Study and Practical Exercises
- Let me show you how to calculate a current transformer!
- Theory and Implementation of Narrow-Band IF Sampling Based on DSP_C54X
- [RT-Thread reading notes] (1) Thread initialization and linked list
- Share the correct use and maintenance guide of NiMH batteries
- EEWORLD University Hall----Live Replay: The Latest Isolation Devices Compliant with USB 2.0 Standards
- EEWORLD University - Understanding PID Control (English subtitles)