-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheeprom.asm
57 lines (49 loc) · 915 Bytes
/
eeprom.asm
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
52
53
54
55
56
57
;------------------------------------------------------------------------------
; Ïîäïðîãðàììû äëÿ ðàáîòû ñ EEPROM ìèêðîêîíòðîëëåðîâ AVR
;
;
;
;------------------------------------------------------------------------------
#if defined (__ATmega328P__) || defined(__ATmega1284P__)
EEWrite:
SBIC EECR,EEPE
RJMP EEWrite
CLI
OUT EEARL,R16
OUT EEARH,R17
OUT EEDR,R18
SBI EECR,EEMPE
SBI EECR,EEPE
SEI
RET
EERead:
SBIC EECR,EEPE
RJMP EERead
OUT EEARL, R16
OUT EEARH, R17
SBI EECR,EERE
IN R18, EEDR
RET
#elif defined (__ATmega16A__) || defined(__ATmega16__)
EEWrite:
SBIC EECR,EEWE
RJMP EEWrite
CLI
OUT EEARL,R16
OUT EEARH,R17
OUT EEDR,R18
SBI EECR,EEMWE
SBI EECR,EEWE
SEI
RET
EERead:
SBIC EECR,EEWE
RJMP EERead
OUT EEARL, R16
OUT EEARH, R17
SBI EECR,EERE
IN R18, EEDR
RET
#else
#error "Unsupported part:" __PART_NAME__
#endif // part specific code