Auto stash before merge of "main" and "origin/main"

This commit is contained in:
stijn
2021-03-31 09:32:16 +02:00
parent 692561f12d
commit ef42dae5a0
29 changed files with 4322 additions and 995 deletions

View File

@@ -0,0 +1,139 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL := cmd.exe
RM := rm -rf
USER_OBJS :=
LIBS :=
PROJ :=
O_SRCS :=
C_SRCS :=
S_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
PREPROCESSING_SRCS :=
OBJS :=
OBJS_AS_ARGS :=
C_DEPS :=
C_DEPS_AS_ARGS :=
EXECUTABLES :=
OUTPUT_FILE_PATH :=
OUTPUT_FILE_PATH_AS_ARGS :=
AVR_APP_PATH :=$$$AVR_APP_PATH$$$
QUOTE := "
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:=
LIB_DEP:=
LINKER_SCRIPT_DEP:=
# Every subdirectory with source files must be described here
SUBDIRS :=
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../main.c \
../stepper_driver.c
PREPROCESSING_SRCS +=
ASM_SRCS +=
OBJS += \
main.o \
stepper_driver.o
OBJS_AS_ARGS += \
main.o \
stepper_driver.o
C_DEPS += \
main.d \
stepper_driver.d
C_DEPS_AS_ARGS += \
main.d \
stepper_driver.d
OUTPUT_FILE_PATH +=Servo_driver.elf
OUTPUT_FILE_PATH_AS_ARGS +=Servo_driver.elf
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:= ./makedep.mk
LIB_DEP+=
LINKER_SCRIPT_DEP+=
# AVR32/GNU C Compiler
./main.o: .././main.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
./stepper_driver.o: .././stepper_driver.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
# AVR32/GNU Preprocessing Assembler
# AVR32/GNU Assembler
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES)
$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP)
@echo Building target: $@
@echo Invoking: AVR/GNU Linker : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="Servo_driver.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mrelax -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"
@echo Finished building target: $@
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "Servo_driver.elf" "Servo_driver.hex"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "Servo_driver.elf" "Servo_driver.eep" || exit 0
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "Servo_driver.elf" > "Servo_driver.lss"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "Servo_driver.elf" "Servo_driver.srec"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "Servo_driver.elf"
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "Servo_driver.elf" "Servo_driver.a" "Servo_driver.hex" "Servo_driver.lss" "Servo_driver.eep" "Servo_driver.map" "Servo_driver.srec" "Servo_driver.usersignatures"

View File

@@ -0,0 +1 @@
:00000001FF

View File

@@ -0,0 +1,395 @@
Servo_driver.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000008 00800100 00000216 000002aa 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 00000216 00000000 00000000 00000094 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 00000005 00800108 00800108 000002b2 2**0
ALLOC
3 .comment 00000030 00000000 00000000 000002b2 2**0
CONTENTS, READONLY
4 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000002e4 2**2
CONTENTS, READONLY
5 .debug_aranges 00000080 00000000 00000000 00000320 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_info 00000b4f 00000000 00000000 000003a0 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_abbrev 00000987 00000000 00000000 00000eef 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_line 000004cb 00000000 00000000 00001876 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_frame 00000110 00000000 00000000 00001d44 2**2
CONTENTS, READONLY, DEBUGGING
10 .debug_str 00000514 00000000 00000000 00001e54 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_loc 000001d2 00000000 00000000 00002368 2**0
CONTENTS, READONLY, DEBUGGING
12 .debug_ranges 00000060 00000000 00000000 0000253a 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 45 c0 rjmp .+138 ; 0x8c <__ctors_end>
2: 00 00 nop
4: 60 c0 rjmp .+192 ; 0xc6 <__bad_interrupt>
6: 00 00 nop
8: 5e c0 rjmp .+188 ; 0xc6 <__bad_interrupt>
a: 00 00 nop
c: 5c c0 rjmp .+184 ; 0xc6 <__bad_interrupt>
e: 00 00 nop
10: 5a c0 rjmp .+180 ; 0xc6 <__bad_interrupt>
12: 00 00 nop
14: 58 c0 rjmp .+176 ; 0xc6 <__bad_interrupt>
16: 00 00 nop
18: 56 c0 rjmp .+172 ; 0xc6 <__bad_interrupt>
1a: 00 00 nop
1c: 54 c0 rjmp .+168 ; 0xc6 <__bad_interrupt>
1e: 00 00 nop
20: 52 c0 rjmp .+164 ; 0xc6 <__bad_interrupt>
22: 00 00 nop
24: 80 c0 rjmp .+256 ; 0x126 <__vector_9>
26: 00 00 nop
28: 4e c0 rjmp .+156 ; 0xc6 <__bad_interrupt>
2a: 00 00 nop
2c: 4c c0 rjmp .+152 ; 0xc6 <__bad_interrupt>
2e: 00 00 nop
30: 4a c0 rjmp .+148 ; 0xc6 <__bad_interrupt>
32: 00 00 nop
34: 48 c0 rjmp .+144 ; 0xc6 <__bad_interrupt>
36: 00 00 nop
38: 46 c0 rjmp .+140 ; 0xc6 <__bad_interrupt>
3a: 00 00 nop
3c: 44 c0 rjmp .+136 ; 0xc6 <__bad_interrupt>
3e: 00 00 nop
40: 42 c0 rjmp .+132 ; 0xc6 <__bad_interrupt>
42: 00 00 nop
44: 40 c0 rjmp .+128 ; 0xc6 <__bad_interrupt>
46: 00 00 nop
48: 3e c0 rjmp .+124 ; 0xc6 <__bad_interrupt>
4a: 00 00 nop
4c: 3c c0 rjmp .+120 ; 0xc6 <__bad_interrupt>
4e: 00 00 nop
50: 3a c0 rjmp .+116 ; 0xc6 <__bad_interrupt>
52: 00 00 nop
54: 38 c0 rjmp .+112 ; 0xc6 <__bad_interrupt>
56: 00 00 nop
58: 36 c0 rjmp .+108 ; 0xc6 <__bad_interrupt>
5a: 00 00 nop
5c: 34 c0 rjmp .+104 ; 0xc6 <__bad_interrupt>
5e: 00 00 nop
60: 32 c0 rjmp .+100 ; 0xc6 <__bad_interrupt>
62: 00 00 nop
64: 30 c0 rjmp .+96 ; 0xc6 <__bad_interrupt>
66: 00 00 nop
68: 2e c0 rjmp .+92 ; 0xc6 <__bad_interrupt>
6a: 00 00 nop
6c: 2c c0 rjmp .+88 ; 0xc6 <__bad_interrupt>
6e: 00 00 nop
70: 2a c0 rjmp .+84 ; 0xc6 <__bad_interrupt>
72: 00 00 nop
74: 28 c0 rjmp .+80 ; 0xc6 <__bad_interrupt>
76: 00 00 nop
78: 26 c0 rjmp .+76 ; 0xc6 <__bad_interrupt>
7a: 00 00 nop
7c: 24 c0 rjmp .+72 ; 0xc6 <__bad_interrupt>
7e: 00 00 nop
80: 22 c0 rjmp .+68 ; 0xc6 <__bad_interrupt>
82: 00 00 nop
84: 20 c0 rjmp .+64 ; 0xc6 <__bad_interrupt>
86: 00 00 nop
88: 1e c0 rjmp .+60 ; 0xc6 <__bad_interrupt>
...
0000008c <__ctors_end>:
8c: 11 24 eor r1, r1
8e: 1f be out 0x3f, r1 ; 63
90: cf ef ldi r28, 0xFF ; 255
92: d0 e1 ldi r29, 0x10 ; 16
94: de bf out 0x3e, r29 ; 62
96: cd bf out 0x3d, r28 ; 61
00000098 <__do_copy_data>:
98: 11 e0 ldi r17, 0x01 ; 1
9a: a0 e0 ldi r26, 0x00 ; 0
9c: b1 e0 ldi r27, 0x01 ; 1
9e: e6 e1 ldi r30, 0x16 ; 22
a0: f2 e0 ldi r31, 0x02 ; 2
a2: 00 e0 ldi r16, 0x00 ; 0
a4: 0b bf out 0x3b, r16 ; 59
a6: 02 c0 rjmp .+4 ; 0xac <__do_copy_data+0x14>
a8: 07 90 elpm r0, Z+
aa: 0d 92 st X+, r0
ac: a8 30 cpi r26, 0x08 ; 8
ae: b1 07 cpc r27, r17
b0: d9 f7 brne .-10 ; 0xa8 <__do_copy_data+0x10>
000000b2 <__do_clear_bss>:
b2: 21 e0 ldi r18, 0x01 ; 1
b4: a8 e0 ldi r26, 0x08 ; 8
b6: b1 e0 ldi r27, 0x01 ; 1
b8: 01 c0 rjmp .+2 ; 0xbc <.do_clear_bss_start>
000000ba <.do_clear_bss_loop>:
ba: 1d 92 st X+, r1
000000bc <.do_clear_bss_start>:
bc: ad 30 cpi r26, 0x0D ; 13
be: b2 07 cpc r27, r18
c0: e1 f7 brne .-8 ; 0xba <.do_clear_bss_loop>
c2: 16 d0 rcall .+44 ; 0xf0 <main>
c4: a6 c0 rjmp .+332 ; 0x212 <_exit>
000000c6 <__bad_interrupt>:
c6: 9c cf rjmp .-200 ; 0x0 <__vectors>
000000c8 <wait>:
int value = 0;
value = ADCH;
value <<= 2;
value += (ADCL >> 6);
return value;
}
c8: 20 e0 ldi r18, 0x00 ; 0
ca: 30 e0 ldi r19, 0x00 ; 0
cc: 08 c0 rjmp .+16 ; 0xde <wait+0x16>
ce: e3 ec ldi r30, 0xC3 ; 195
d0: f9 e0 ldi r31, 0x09 ; 9
d2: 31 97 sbiw r30, 0x01 ; 1
d4: f1 f7 brne .-4 ; 0xd2 <wait+0xa>
d6: 00 c0 rjmp .+0 ; 0xd8 <wait+0x10>
d8: 00 00 nop
da: 2f 5f subi r18, 0xFF ; 255
dc: 3f 4f sbci r19, 0xFF ; 255
de: 28 17 cp r18, r24
e0: 39 07 cpc r19, r25
e2: ac f3 brlt .-22 ; 0xce <wait+0x6>
e4: 08 95 ret
000000e6 <adcInit>:
e6: 80 ee ldi r24, 0xE0 ; 224
e8: 87 b9 out 0x07, r24 ; 7
ea: 86 e8 ldi r24, 0x86 ; 134
ec: 86 b9 out 0x06, r24 ; 6
ee: 08 95 ret
000000f0 <main>:
int main(void)
{
/* Replace with your application code */
DDRF = 0x00;
f0: 10 92 61 00 sts 0x0061, r1 ; 0x800061 <__TEXT_REGION_LENGTH__+0x7e0061>
adcInit();
f4: f8 df rcall .-16 ; 0xe6 <adcInit>
init_stepper_driver();
f6: 7f d0 rcall .+254 ; 0x1f6 <init_stepper_driver>
f8: 80 e0 ldi r24, 0x00 ; 0
stepper_rotate(512);
fa: 92 e0 ldi r25, 0x02 ; 2
fc: 75 d0 rcall .+234 ; 0x1e8 <stepper_rotate>
fe: 84 e6 ldi r24, 0x64 ; 100
while (1)
{
wait(100);
100: 90 e0 ldi r25, 0x00 ; 0
102: e2 df rcall .-60 ; 0xc8 <wait>
104: fc cf rjmp .-8 ; 0xfe <main+0xe>
00000106 <set_stepper_state>:
106: e8 2f mov r30, r24
108: f0 e0 ldi r31, 0x00 ; 0
}
void (*snap_event)(uint8_t);
void set_snap_event(void (*snap_event_p)(uint8_t)){
snap_event = snap_event_p;
10a: e0 50 subi r30, 0x00 ; 0
10c: ff 4f sbci r31, 0xFF ; 255
10e: 80 81 ld r24, Z
110: 83 b9 out 0x03, r24 ; 3
112: 08 95 ret
00000114 <stepper_rotate_full_rotation>:
}
}
}
void stepper_rotate_full_rotation(){
steps_to_do = 512;
114: 80 e0 ldi r24, 0x00 ; 0
116: 92 e0 ldi r25, 0x02 ; 2
118: 90 93 0a 01 sts 0x010A, r25 ; 0x80010a <steps_to_do+0x1>
11c: 80 93 09 01 sts 0x0109, r24 ; 0x800109 <steps_to_do>
TCCR2 = 0b00001100;
120: 8c e0 ldi r24, 0x0C ; 12
122: 85 bd out 0x25, r24 ; 37
124: 08 95 ret
00000126 <__vector_9>:
snap_event = snap_event_p;
}
uint16_t steps_to_do = 0;
uint8_t stepper_state = 0;
ISR( TIMER2_COMP_vect ){
126: 1f 92 push r1
128: 0f 92 push r0
12a: 0f b6 in r0, 0x3f ; 63
12c: 0f 92 push r0
12e: 11 24 eor r1, r1
130: 0b b6 in r0, 0x3b ; 59
132: 0f 92 push r0
134: 2f 93 push r18
136: 3f 93 push r19
138: 4f 93 push r20
13a: 5f 93 push r21
13c: 6f 93 push r22
13e: 7f 93 push r23
140: 8f 93 push r24
142: 9f 93 push r25
144: af 93 push r26
146: bf 93 push r27
148: ef 93 push r30
14a: ff 93 push r31
TCNT2 = 0;
14c: 14 bc out 0x24, r1 ; 36
set_stepper_state(stepper_state);
14e: 80 91 08 01 lds r24, 0x0108 ; 0x800108 <__data_end>
152: d9 df rcall .-78 ; 0x106 <set_stepper_state>
if(stepper_state < 7){
154: 80 91 08 01 lds r24, 0x0108 ; 0x800108 <__data_end>
158: 87 30 cpi r24, 0x07 ; 7
15a: 20 f4 brcc .+8 ; 0x164 <__vector_9+0x3e>
stepper_state++;
15c: 8f 5f subi r24, 0xFF ; 255
15e: 80 93 08 01 sts 0x0108, r24 ; 0x800108 <__data_end>
162: 2f c0 rjmp .+94 ; 0x1c2 <__vector_9+0x9c>
} else {
//OCR2 = ADCH;
stepper_state = 0;
164: 10 92 08 01 sts 0x0108, r1 ; 0x800108 <__data_end>
if(steps_to_do == 0){
168: 80 91 09 01 lds r24, 0x0109 ; 0x800109 <steps_to_do>
16c: 90 91 0a 01 lds r25, 0x010A ; 0x80010a <steps_to_do+0x1>
170: 00 97 sbiw r24, 0x00 ; 0
172: 19 f4 brne .+6 ; 0x17a <__vector_9+0x54>
TCCR2 = 0b00000000;
stepper_rotate_full_rotation();
174: 15 bc out 0x25, r1 ; 37
176: ce df rcall .-100 ; 0x114 <stepper_rotate_full_rotation>
178: 24 c0 rjmp .+72 ; 0x1c2 <__vector_9+0x9c>
} else {
if(steps_to_do % 32 == 0){
17a: 8f 71 andi r24, 0x1F ; 31
17c: 99 27 eor r25, r25
17e: 89 2b or r24, r25
180: b9 f4 brne .+46 ; 0x1b0 <__vector_9+0x8a>
if(PORTG == 0x01){
182: 80 91 65 00 lds r24, 0x0065 ; 0x800065 <__TEXT_REGION_LENGTH__+0x7e0065>
186: 81 30 cpi r24, 0x01 ; 1
188: 19 f4 brne .+6 ; 0x190 <__vector_9+0x6a>
PORTG = 0x00;
18a: 10 92 65 00 sts 0x0065, r1 ; 0x800065 <__TEXT_REGION_LENGTH__+0x7e0065>
18e: 07 c0 rjmp .+14 ; 0x19e <__vector_9+0x78>
} else if (PORTG == 0x00){
190: 80 91 65 00 lds r24, 0x0065 ; 0x800065 <__TEXT_REGION_LENGTH__+0x7e0065>
194: 81 11 cpse r24, r1
196: 03 c0 rjmp .+6 ; 0x19e <__vector_9+0x78>
PORTG = 0x01;
198: 81 e0 ldi r24, 0x01 ; 1
19a: 80 93 65 00 sts 0x0065, r24 ; 0x800065 <__TEXT_REGION_LENGTH__+0x7e0065>
}
if(snap_event != NULL)
19e: e0 91 0b 01 lds r30, 0x010B ; 0x80010b <snap_event>
1a2: f0 91 0c 01 lds r31, 0x010C ; 0x80010c <snap_event+0x1>
1a6: 30 97 sbiw r30, 0x00 ; 0
1a8: 19 f0 breq .+6 ; 0x1b0 <__vector_9+0x8a>
snap_event(steps_to_do);
1aa: 80 91 09 01 lds r24, 0x0109 ; 0x800109 <steps_to_do>
1ae: 09 95 icall
}
steps_to_do--;
1b0: 80 91 09 01 lds r24, 0x0109 ; 0x800109 <steps_to_do>
1b4: 90 91 0a 01 lds r25, 0x010A ; 0x80010a <steps_to_do+0x1>
1b8: 01 97 sbiw r24, 0x01 ; 1
1ba: 90 93 0a 01 sts 0x010A, r25 ; 0x80010a <steps_to_do+0x1>
1be: 80 93 09 01 sts 0x0109, r24 ; 0x800109 <steps_to_do>
}
}
}
1c2: ff 91 pop r31
1c4: ef 91 pop r30
1c6: bf 91 pop r27
1c8: af 91 pop r26
1ca: 9f 91 pop r25
1cc: 8f 91 pop r24
1ce: 7f 91 pop r23
1d0: 6f 91 pop r22
1d2: 5f 91 pop r21
1d4: 4f 91 pop r20
1d6: 3f 91 pop r19
1d8: 2f 91 pop r18
1da: 0f 90 pop r0
1dc: 0b be out 0x3b, r0 ; 59
1de: 0f 90 pop r0
1e0: 0f be out 0x3f, r0 ; 63
1e2: 0f 90 pop r0
1e4: 1f 90 pop r1
1e6: 18 95 reti
000001e8 <stepper_rotate>:
steps_to_do = 512;
TCCR2 = 0b00001100;
}
void stepper_rotate(uint16_t steps){
steps_to_do = steps;
1e8: 90 93 0a 01 sts 0x010A, r25 ; 0x80010a <steps_to_do+0x1>
1ec: 80 93 09 01 sts 0x0109, r24 ; 0x800109 <steps_to_do>
TCCR2 = 0b00001100;
1f0: 8c e0 ldi r24, 0x0C ; 12
1f2: 85 bd out 0x25, r24 ; 37
1f4: 08 95 ret
000001f6 <init_stepper_driver>:
}
void init_stepper_driver(){
DDRE = 0xff;
1f6: 8f ef ldi r24, 0xFF ; 255
1f8: 82 b9 out 0x02, r24 ; 2
DDRG = 0xff;
1fa: 80 93 64 00 sts 0x0064, r24 ; 0x800064 <__TEXT_REGION_LENGTH__+0x7e0064>
PORTG = 0x01;
1fe: 81 e0 ldi r24, 0x01 ; 1
200: 80 93 65 00 sts 0x0065, r24 ; 0x800065 <__TEXT_REGION_LENGTH__+0x7e0065>
PORTE = 0x00;
204: 13 b8 out 0x03, r1 ; 3
OCR2 = 50;
206: 82 e3 ldi r24, 0x32 ; 50
208: 83 bd out 0x23, r24 ; 35
TIMSK = BIT(7);
20a: 80 e8 ldi r24, 0x80 ; 128
20c: 87 bf out 0x37, r24 ; 55
sei();
20e: 78 94 sei
210: 08 95 ret
00000212 <_exit>:
212: f8 94 cli
00000214 <__stop_program>:
214: ff cf rjmp .-2 ; 0x214 <__stop_program>

View File

@@ -0,0 +1,37 @@
S0140000536572766F5F6472697665722E7372656316
S113000045C0000060C000005EC000005CC000008D
S11300105AC0000058C0000056C0000054C0000080
S113002052C0000080C000004EC000004CC0000060
S11300304AC0000048C0000046C0000044C00000A0
S113004042C0000040C000003EC000003CC00000B0
S11300503AC0000038C0000036C0000034C00000C0
S113006032C0000030C000002EC000002CC00000D0
S11300702AC0000028C0000026C0000024C00000E0
S113008022C0000020C000001EC0000011241FBEBA
S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0E6E1FB
S11300A0F2E000E00BBF02C007900D92A830B10748
S11300B0D9F721E0A8E0B1E001C01D92AD30B2074C
S11300C0E1F716D0A6C09CCF20E030E008C0E3ECF6
S11300D0F9E03197F1F700C000002F5F3F4F281778
S11300E03907ACF3089580EE87B986E886B9089598
S11300F010926100F8DF7FD080E092E075D084E652
S113010090E0E2DFFCCFE82FF0E0E050FF4F808189
S113011083B9089580E092E090930A0180930901E5
S11301208CE085BD08951F920F920FB60F92112493
S11301300BB60F922F933F934F935F936F937F93DD
S11301408F939F93AF93BF93EF93FF9314BC8091CE
S11301500801D9DF80910801873020F48F5F8093F4
S113016008012FC0109208018091090190910A01A1
S1130170009719F415BCCEDF24C08F719927892B01
S1130180B9F480916500813019F41092650007C0BC
S113019080916500811103C081E080936500E09146
S11301A00B01F0910C01309719F080910901099528
S11301B08091090190910A01019790930A0180931B
S11301C00901FF91EF91BF91AF919F918F917F9121
S11301D06F915F914F913F912F910F900BBE0F90B4
S11301E00FBE0F901F90189590930A0180930901F8
S11301F08CE085BD08958FEF82B98093640081E01F
S11302008093650013B882E383BD80E887BF789448
S10902100895F894FFCFED
S10B0216080C040602030109AF
S9030000FC

View File

@@ -0,0 +1,8 @@
################################################################################
# Automatically-generated file. Do not edit or delete the file
################################################################################
main.c
stepper_driver.c

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<Store xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="AtmelPackComponentManagement">
<ProjectComponents>
<ProjectComponent z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
<CApiVersion></CApiVersion>
<CBundle></CBundle>
<CClass>Device</CClass>
<CGroup>Startup</CGroup>
<CSub></CSub>
<CVariant></CVariant>
<CVendor>Atmel</CVendor>
<CVersion>1.6.0</CVersion>
<DefaultRepoPath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs</DefaultRepoPath>
<DependentComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
<Description></Description>
<Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include\</AbsolutePath>
<Attribute></Attribute>
<Category>include</Category>
<Condition>C</Condition>
<FileContentHash i:nil="true" />
<FileVersion></FileVersion>
<Name>include/</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include\avr\iom128.h</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>C</Condition>
<FileContentHash>JdJ7J9I/SJh965SEyyyVYw==</FileContentHash>
<FileVersion></FileVersion>
<Name>include/avr/iom128.h</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\templates\main.c</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>3JyV3AVW3kDDXpyeQO3NhQ==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/main.c</Name>
<SelectString>Main file (.c)</SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\templates\main.cpp</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>mkKaE95TOoATsuBGv6jmxg==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/main.cpp</Name>
<SelectString>Main file (.cpp)</SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128</AbsolutePath>
<Attribute></Attribute>
<Category>libraryPrefix</Category>
<Condition>GCC</Condition>
<FileContentHash i:nil="true" />
<FileVersion></FileVersion>
<Name>gcc/dev/atmega128</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
</Files>
<PackName>ATmega_DFP</PackName>
<PackPath>C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.6.364/Atmel.ATmega_DFP.pdsc</PackPath>
<PackVersion>1.6.364</PackVersion>
<PresentInProject>true</PresentInProject>
<ReferenceConditionId>ATmega128</ReferenceConditionId>
<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string></d4p1:string>
</RteComponents>
<Status>Resolved</Status>
<VersionMode>Fixed</VersionMode>
<IsComponentInAtProject>true</IsComponentInAtProject>
</ProjectComponent>
</ProjectComponents>
</Store>

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
<ProjectGuid>{fe1d92d4-4858-4112-ad41-e57799a980c9}</ProjectGuid>
<avrdevice>ATmega128</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>GLCDdriver</AssemblyName>
<Name>Servo_driver</Name>
<RootNamespace>GLCDdriver</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.49.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize debugging experience (-Og)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="stepper_driver.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="stepper_driver.h">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

View File

@@ -0,0 +1,49 @@
/*
* GLCDdriver.c
*
* Created: 10-Mar-21 10:47:34 AM
* Author : lemms
*/
#define F_CPU 10e6
#include <avr/io.h>
#include <stdio.h>
#include <stdlib.h>
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "stepper_driver.h"
void wait( int ms ) {
for (int tms=0; tms<ms; tms++) {
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
void adcInit(){
ADMUX = 0b11100000; // internal reference: 2.56V and SEI on ADC0 and left-adjusted.
ADCSRA = 0b10000110; // enable ADC. No free-run. Clock 64 D-factor.
}
int getADCValue(){
int value = 0;
value = ADCH;
value <<= 2;
value += (ADCL >> 6);
return value;
}
int main(void)
{
/* Replace with your application code */
DDRF = 0x00;
adcInit();
init_stepper_driver();
stepper_rotate(512);
while (1)
{
wait(100);
}
}

View File

@@ -0,0 +1,101 @@
/*
* stepper_driver.c
* PORTB
* Created: 10-Mar-21 12:21:47 PM
* Author: lemms
*/
#define F_CPU 10e6
#include <avr/interrupt.h>
#include <avr/io.h>
#include <util/delay.h>
#include <stdbool.h>
#include <stdio.h>
#define BIT(x) (1 << (x))
uint8_t CCW[8] = {0x09,0x01,0x03,0x02,0x06,0x04,0x0c,0x08};
uint8_t CW[8] = {0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09};
/*
Een timer met interupt routine.
in de interump routine een state machine voor de 8 nibbles
elke keer dat de interupt routine wordt geroepen wordt de state
incremented. hier houd je ook een var bij om de relatieve
positie te weten van de stappenmotor.
Nog een timer voor microstepping.
Timers:
timer voor de speed.
stappen van 100ms naar 10ms
prescaler = 255
*/
void stepper_rotate_full_rotation();
void set_stepper_state(uint8_t count){
PORTE = CW[count];
}
void (*snap_event)(uint8_t);
void set_snap_event(void (*snap_event_p)(uint8_t)){
snap_event = snap_event_p;
}
uint16_t steps_to_do = 0;
uint8_t stepper_state = 0;
ISR( TIMER2_COMP_vect ){
TCNT2 = 0;
set_stepper_state(stepper_state);
if(stepper_state < 7){
stepper_state++;
} else {
//OCR2 = ADCH;
stepper_state = 0;
if(steps_to_do == 0){
TCCR2 = 0b00000000;
stepper_rotate_full_rotation();
} else {
if(steps_to_do % 32 == 0){
if(PORTG == 0x01){
PORTG = 0x00;
} else if (PORTG == 0x00){
PORTG = 0x01;
}
if(snap_event != NULL)
snap_event(steps_to_do);
}
steps_to_do--;
}
}
}
void stepper_rotate_full_rotation(){
steps_to_do = 512;
TCCR2 = 0b00001100;
}
void stepper_rotate(uint16_t steps){
steps_to_do = steps;
TCCR2 = 0b00001100;
}
void init_stepper_driver(){
DDRE = 0xff;
DDRG = 0xff;
PORTG = 0x01;
PORTE = 0x00;
OCR2 = 50;
TIMSK = BIT(7);
sei();
}

View File

@@ -0,0 +1,17 @@
/*
* stepper_driver.h
*
* Created: 10-Mar-21 12:35:30 PM
* Author: lemms
*/
#ifndef STEPPER_DRIVER_H_
#define STEPPER_DRIVER_H_
#include <stdbool.h>
void stepper_rotate(uint16_t steps);
void init_stepper_driver();
#endif /* STEPPER_DRIVER_H_ */