Lifestream
전체 카테고리
(104)
Digital Life
(40)
Picture
(20)
Video
(20)
Daily Life
(20)
Game Life
(5)
Code Life
(18)
Information Life
(19)
Home
Category
Guestboook
Notice
Manage
Write
전체 카테고리
(104)
Digital Life
(40)
Picture
(20)
Video
(20)
Daily Life
(20)
Game Life
(5)
Code Life
(18)
Information Life
(19)
GTK_LeonHeart
Manage
Write
구독하기
RSS
어두운 모드
밝은 모드
Code Life
[Atmega] EEPROM 읽기, 쓰기
2018. 4. 12. 22:28
·
GTK_LeonHeart
·
보기
접기
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
#include
<
avr
/
io.h
>
void
EEPROM_write(unsigned
int
uiAddress, unsigned
char
ucData);
unsigned
char
EEPROM_read(unsigned
int
niAddress);
int
main(
void
)
{
unsigned
char
t;
DDRD
=
0xff
;
t
=
EEPROM_read(
0x123
);
PORTD
=
~t;
t
=
t
*
2
;
EEPROM_write(
0x123
, t);
return
0
;
}
void
EEPROM_write(unsigned
int
uiAddress, unsigned
char
ucData)
{
while
(EECR
&
(
1
<
<
EEWE))
;
EEAR
=
uiAddress;
EEDR
=
ucData;
EECR
|
=
(
1
<
<
EEMWE);
EECR
|
=
(
1
<
<
EEWE);
}
unsigned
char
EEPROM_read(unsigned
int
uiAddress)
{
while
(EECR
&
(
1
<
<
EEWE))
;
EEAR
=
uiAddress;
EECR
|
=
(
1
<
<
EERE);
return
EEDR;
}
Colored by Color Scripter
cs
접기
공유하기
게시글 관리
Lifestream
저작자표시
카테고리 다른 글
[WinAPI] 04 PE 파일 분석-Relocation 분석
[Atmega] LITTLE ENDIAN or BIG ENDIAN 체크
[Atmega] ATMEGA128 LED왕복
[Zigbee] 온도 & 습도 출력을 위한 소스의 헤더 (basedef.h) - DEFINE 값
more
티스토리툴바
Lifestream
구독하기