Das makefile muss folgende source-files beinhalten:
# List C source files here. (C dependencies are automatically
generated.)
SRC = main1.c i2clcd.c
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase
.s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the
same,
# it will preserve the spelling of the filenames, and gcc itself
does
# care about how the name is spelled on its command-line.
#ASRC = i2cmaster.s
main.c ist deine Haupt-Funktion und und muss den Include-Aufruf i2clcd.h
enthalten.
i2cmaster.s ist das Assemblerfile für die i2c-Schnittstelle und muss
folgendermassen angepasst werden:
(Bsp. für Quarz 10MHz)
;***********************************************************************
**
; delay half period
; For I2C in normal mode (100kHz), use T/2 > 5us
; For I2C in fast mode (400kHz), use T/2 > 1.3us
;***********************************************************************
**
.stabs "",100,0,0,i2c_delay_T2
.stabs "i2cmaster.S",100,0,0,i2c_delay_T2
.func i2c_delay_T2 ; delay 5.0 microsec with 10 Mhz crystal
i2c_delay_T2: ; 4 cycles
rjmp 1f ; 2 "
1: rjmp 2f ; 2 "
2: rjmp 3f ; 2 "
3: rjmp 4f ; 2 "
4: rjmp 5f ; 2 "
5: rjmp 6f ; 2 "
6: rjmp 7f ; 2 "
7: rjmp 8f ; 2 "
8: rjmp 9f ; 2 "
9: rjmp 10f ; 2 "
10: rjmp 11f ; 2 "
11: rjmp 12f ; 2 "
12: rjmp 13f ; 2 "
13: rjmp 14f ; 2 "
14: rjmp 15f ; 2 "
15: rjmp 16f ; 2 "
16: rjmp 17f ; 2 "
17: rjmp 18f ; 2 "
18: rjmp 19f ; 2 "
19: rjmp 20f ; 2 "
20: rjmp 21f ; 2 "
21: nop ; 1 "
ret ; 3 "
.endfunc ; total 20 cyles = 5.0 microsec with 10 Mhz crystal
Hans Peter