added opdr 2.4
This commit is contained in:
125
Microcontrollers/opdracht 2.4/Debug/Makefile
Normal file
125
Microcontrollers/opdracht 2.4/Debug/Makefile
Normal file
@@ -0,0 +1,125 @@
|
||||
################################################################################
|
||||
# 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
|
||||
|
||||
|
||||
PREPROCESSING_SRCS +=
|
||||
|
||||
|
||||
ASM_SRCS +=
|
||||
|
||||
|
||||
OBJS += \
|
||||
main.o
|
||||
|
||||
OBJS_AS_ARGS += \
|
||||
main.o
|
||||
|
||||
C_DEPS += \
|
||||
main.d
|
||||
|
||||
C_DEPS_AS_ARGS += \
|
||||
main.d
|
||||
|
||||
OUTPUT_FILE_PATH +=opdracht\ 2.4.elf
|
||||
|
||||
OUTPUT_FILE_PATH_AS_ARGS +="opdracht 2.4.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: XC8 C Compiler : 2.31
|
||||
$(QUOTE)C:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe$(QUOTE) -mcpu=ATmega128 -mdfp="C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\xc8" -c -x c -funsigned-char -funsigned-bitfields -mext=cci -D__ATmega128__ -DDEBUG -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -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: XC8 C Linker : 2.31
|
||||
$(QUOTE)C:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -mcpu=ATmega128 -mdfp="C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\xc8" -Wl,-Map="opdracht 2.4.map" -funsigned-char -funsigned-bitfields -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums --memorysummary,memoryfile.xml
|
||||
@echo Finished building target: $@
|
||||
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "opdracht 2.4.elf" "opdracht 2.4.hex"
|
||||
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "opdracht 2.4.elf" "opdracht 2.4.eep" || exit 0
|
||||
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objdump.exe" -h -S "opdracht 2.4.elf" > "opdracht 2.4.lss"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Other Targets
|
||||
clean:
|
||||
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
|
||||
-$(RM) $(C_DEPS_AS_ARGS)
|
||||
rm -rf "opdracht 2.4.elf" "opdracht 2.4.hex" "opdracht 2.4.eep" "opdracht 2.4.map" "opdracht 2.4.usersignatures" "opdracht 2.4.a" "opdracht 2.4.lss"
|
||||
|
||||
6
Microcontrollers/opdracht 2.4/Debug/makedep.mk
Normal file
6
Microcontrollers/opdracht 2.4/Debug/makedep.mk
Normal file
@@ -0,0 +1,6 @@
|
||||
################################################################################
|
||||
# Automatically-generated file. Do not edit or delete the file
|
||||
################################################################################
|
||||
|
||||
main.c
|
||||
|
||||
17
Microcontrollers/opdracht 2.4/Debug/memoryfile.xml
Normal file
17
Microcontrollers/opdracht 2.4/Debug/memoryfile.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project>
|
||||
<executable name="opdracht 2.4.elf">
|
||||
<memory name="program">
|
||||
<units>bytes</units>
|
||||
<length>131072</length>
|
||||
<used>468</used>
|
||||
<free>130604</free>
|
||||
</memory>
|
||||
<memory name="data">
|
||||
<units>bytes</units>
|
||||
<length>4096</length>
|
||||
<used>144</used>
|
||||
<free>3952</free>
|
||||
</memory>
|
||||
</executable>
|
||||
</project>
|
||||
1
Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.eep
Normal file
1
Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.eep
Normal file
@@ -0,0 +1 @@
|
||||
:00000001FF
|
||||
235
Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.lss
Normal file
235
Microcontrollers/opdracht 2.4/Debug/opdracht 2.4.lss
Normal file
@@ -0,0 +1,235 @@
|
||||
|
||||
opdracht 2.4.elf: file format elf32-avr
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .data 00000000 00800100 000001d4 00000248 2**0
|
||||
ALLOC, LOAD, DATA
|
||||
1 .text 000000ec 00000000 00000000 00000074 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
2 .comment 0000002f 00000000 00000000 00000248 2**0
|
||||
CONTENTS, READONLY
|
||||
3 .debug_aranges 00000028 00000000 00000000 00000277 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
4 .debug_info 00000b85 00000000 00000000 0000029f 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
5 .debug_abbrev 00000854 00000000 00000000 00000e24 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
6 .debug_line 000002b1 00000000 00000000 00001678 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
7 .debug_frame 00000034 00000000 00000000 0000192c 2**2
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
8 .debug_str 0000027d 00000000 00000000 00001960 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
9 .debug_loc 000000b2 00000000 00000000 00001bdd 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
10 .debug_ranges 00000030 00000000 00000000 00001c8f 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
11 .text 00000004 00000140 00000140 000001b4 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001cc0 2**2
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
13 .text.wait 0000001e 00000122 00000122 00000196 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
14 .text.main 00000036 000000ec 000000ec 00000160 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
15 .data.segments 00000090 00800100 00000144 000001b8 2**0
|
||||
CONTENTS, ALLOC, LOAD, DATA
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
00000000 <__vectors>:
|
||||
0: 0c 94 4a 00 jmp 0x94 ; 0x94 <__ctors_end>
|
||||
4: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
8: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
10: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
14: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
18: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
1c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
20: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
24: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
28: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
2c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
30: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
34: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
38: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
3c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
40: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
44: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
48: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
4c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
50: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
54: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
58: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
5c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
60: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
64: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
68: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
6c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
70: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
74: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
78: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
7c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
80: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
84: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
88: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
|
||||
|
||||
0000008c <.dinit>:
|
||||
8c: 01 00 .word 0x0001 ; ????
|
||||
8e: 01 90 ld r0, Z+
|
||||
90: 00 01 movw r0, r0
|
||||
92: 44 00 .word 0x0044 ; ????
|
||||
|
||||
00000094 <__ctors_end>:
|
||||
94: 11 24 eor r1, r1
|
||||
96: 1f be out 0x3f, r1 ; 63
|
||||
98: cf ef ldi r28, 0xFF ; 255
|
||||
9a: d0 e1 ldi r29, 0x10 ; 16
|
||||
9c: de bf out 0x3e, r29 ; 62
|
||||
9e: cd bf out 0x3d, r28 ; 61
|
||||
|
||||
000000a0 <__do_copy_data>:
|
||||
a0: ec e8 ldi r30, 0x8C ; 140
|
||||
a2: f0 e0 ldi r31, 0x00 ; 0
|
||||
a4: 40 e0 ldi r20, 0x00 ; 0
|
||||
a6: 19 c0 rjmp .+50 ; 0xda <__do_clear_bss+0x8>
|
||||
a8: b7 91 elpm r27, Z+
|
||||
aa: a7 91 elpm r26, Z+
|
||||
ac: 37 91 elpm r19, Z+
|
||||
ae: 27 91 elpm r18, Z+
|
||||
b0: 07 91 elpm r16, Z+
|
||||
b2: 07 fd sbrc r16, 7
|
||||
b4: 0e c0 rjmp .+28 ; 0xd2 <__do_clear_bss>
|
||||
b6: 97 91 elpm r25, Z+
|
||||
b8: 87 91 elpm r24, Z+
|
||||
ba: ef 01 movw r28, r30
|
||||
bc: f9 2f mov r31, r25
|
||||
be: e8 2f mov r30, r24
|
||||
c0: 0b bf out 0x3b, r16 ; 59
|
||||
c2: 07 90 elpm r0, Z+
|
||||
c4: 0d 92 st X+, r0
|
||||
c6: a2 17 cp r26, r18
|
||||
c8: b3 07 cpc r27, r19
|
||||
ca: d9 f7 brne .-10 ; 0xc2 <__do_copy_data+0x22>
|
||||
cc: fe 01 movw r30, r28
|
||||
ce: 1b be out 0x3b, r1 ; 59
|
||||
d0: 04 c0 rjmp .+8 ; 0xda <__do_clear_bss+0x8>
|
||||
|
||||
000000d2 <__do_clear_bss>:
|
||||
d2: 1d 92 st X+, r1
|
||||
d4: a2 17 cp r26, r18
|
||||
d6: b3 07 cpc r27, r19
|
||||
d8: e1 f7 brne .-8 ; 0xd2 <__do_clear_bss>
|
||||
da: e3 39 cpi r30, 0x93 ; 147
|
||||
dc: f4 07 cpc r31, r20
|
||||
de: 21 f7 brne .-56 ; 0xa8 <__do_copy_data+0x8>
|
||||
e0: 0e 94 76 00 call 0xec ; 0xec <_etext>
|
||||
e4: 0c 94 74 00 jmp 0xe8 ; 0xe8 <_exit>
|
||||
|
||||
000000e8 <_exit>:
|
||||
e8: f8 94 cli
|
||||
|
||||
000000ea <__stop_program>:
|
||||
ea: ff cf rjmp .-2 ; 0xea <__stop_program>
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
00000140 <__bad_interrupt>:
|
||||
140: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__>
|
||||
|
||||
Disassembly of section .text.wait:
|
||||
|
||||
00000122 <wait>:
|
||||
waits a specific amount of miliseconds */
|
||||
/************************************************************************/
|
||||
void wait( int ms )
|
||||
|
||||
{
|
||||
for (int i=0; i<ms; i++)
|
||||
122: 20 e0 ldi r18, 0x00 ; 0
|
||||
124: 30 e0 ldi r19, 0x00 ; 0
|
||||
126: 08 c0 rjmp .+16 ; 0x138 <wait+0x16>
|
||||
#else
|
||||
//round up by default
|
||||
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
|
||||
#endif
|
||||
|
||||
__builtin_avr_delay_cycles(__ticks_dc);
|
||||
128: e3 ec ldi r30, 0xC3 ; 195
|
||||
12a: f9 e0 ldi r31, 0x09 ; 9
|
||||
12c: 31 97 sbiw r30, 0x01 ; 1
|
||||
12e: f1 f7 brne .-4 ; 0x12c <wait+0xa>
|
||||
130: 00 c0 rjmp .+0 ; 0x132 <wait+0x10>
|
||||
132: 00 00 nop
|
||||
134: 2f 5f subi r18, 0xFF ; 255
|
||||
136: 3f 4f sbci r19, 0xFF ; 255
|
||||
138: 28 17 cp r18, r24
|
||||
13a: 39 07 cpc r19, r25
|
||||
13c: ac f3 brlt .-22 ; 0x128 <wait+0x6>
|
||||
{
|
||||
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
|
||||
}
|
||||
}
|
||||
13e: 08 95 ret
|
||||
|
||||
Disassembly of section .text.main:
|
||||
|
||||
000000ec <main>:
|
||||
|
||||
int main( void )
|
||||
{
|
||||
DDRA = 0xFF;
|
||||
ec: 8f ef ldi r24, 0xFF ; 255
|
||||
ee: 8a bb out 0x1a, r24 ; 26
|
||||
while (1==1)
|
||||
{
|
||||
// Set index to begin of pattern array
|
||||
int index = 0;
|
||||
// as long as delay has meaningful content
|
||||
for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++)
|
||||
f0: 00 e0 ldi r16, 0x00 ; 0
|
||||
f2: 10 e0 ldi r17, 0x00 ; 0
|
||||
|
||||
|
||||
while (1==1)
|
||||
{
|
||||
// Set index to begin of pattern array
|
||||
int index = 0;
|
||||
f4: c0 e0 ldi r28, 0x00 ; 0
|
||||
f6: d0 e0 ldi r29, 0x00 ; 0
|
||||
// as long as delay has meaningful content
|
||||
for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++)
|
||||
f8: 10 c0 rjmp .+32 ; 0x11a <main+0x2e>
|
||||
{
|
||||
// Write data to PORTA
|
||||
PORTA = segments[index].data;
|
||||
fa: fe 01 movw r30, r28
|
||||
fc: ee 0f add r30, r30
|
||||
fe: ff 1f adc r31, r31
|
||||
100: ec 0f add r30, r28
|
||||
102: fd 1f adc r31, r29
|
||||
104: e0 50 subi r30, 0x00 ; 0
|
||||
106: ff 4f sbci r31, 0xFF ; 255
|
||||
108: 80 81 ld r24, Z
|
||||
10a: 8b bb out 0x1b, r24 ; 27
|
||||
// wait
|
||||
wait(segments[index].delay);
|
||||
10c: 81 81 ldd r24, Z+1 ; 0x01
|
||||
10e: 92 81 ldd r25, Z+2 ; 0x02
|
||||
110: 0e 94 91 00 call 0x122 ; 0x122 <wait>
|
||||
// increment for next round
|
||||
index++;
|
||||
114: 21 96 adiw r28, 0x01 ; 1
|
||||
while (1==1)
|
||||
{
|
||||
// Set index to begin of pattern array
|
||||
int index = 0;
|
||||
// as long as delay has meaningful content
|
||||
for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++)
|
||||
116: 0f 5f subi r16, 0xFF ; 255
|
||||
118: 1f 4f sbci r17, 0xFF ; 255
|
||||
11a: 00 33 cpi r16, 0x30 ; 48
|
||||
11c: 11 05 cpc r17, r1
|
||||
11e: 68 f3 brcs .-38 ; 0xfa <main+0xe>
|
||||
120: e7 cf rjmp .-50 ; 0xf0 <main+0x4>
|
||||
79
Microcontrollers/opdracht 2.4/main.c
Normal file
79
Microcontrollers/opdracht 2.4/main.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
** This software is in the public domain, furnished "as is", without technical
|
||||
** support, and with no warranty, express or implied, as to its usefulness for
|
||||
** any purpose.
|
||||
**
|
||||
** lookup.c
|
||||
**
|
||||
** Beschrijving: Ledpatroon op PORTD dmv table lookup (scheiding logica en data)
|
||||
** Target: AVR mcu
|
||||
** Build: avr-gcc -std=c99 -Wall -O3 -mmcu=atmega128 -D F_CPU=8000000UL -c switch.c
|
||||
** avr-gcc -g -mmcu=atmega128 -o lookup.elf lookup.o
|
||||
** avr-objcopy -O ihex lookup.elf lookup.hex
|
||||
** or type 'make'
|
||||
** Author: dkroeske@gmail.com
|
||||
** -------------------------------------------------------------------------*/
|
||||
|
||||
#define F_CPU 10e6
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
unsigned char data;
|
||||
unsigned int delay;
|
||||
} SEGMENT_DELAY;
|
||||
|
||||
SEGMENT_DELAY segments[] = {
|
||||
/* go around the outer layer twice */
|
||||
// 0 a b c d e f
|
||||
{0x00,100},{0x01,100},{0x02,100},{0x04,100},{0x08,100},{0x10,100},{0x20,100},{0x01,100},{0x02,100},{0x04,100},{0x08,100},{0x10,100},{0x20,100},
|
||||
/* then fill it starting at a */
|
||||
{0x01,100},{0x03,100},{0x07,100},{0x0F,100},{0x1F,100},{0x3F,100},{0b00111110,100},{0b00111100,100},{0b00111000,100},{0b00110000,100},{0b00100000,100},
|
||||
/* blink the 3 horizontal bars 2 times from top to bottom*/
|
||||
{0x01,50},{0x00,50},{0x01,50},{0x00,50},{0x01,50},{0x00,50},{0x01,50},{0x00,50},
|
||||
{0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50},
|
||||
{0x08,50},{0x00,50},{0x08,50},{0x00,50},{0x08,50},{0x00,50},{0x08,50},{0x00,50}
|
||||
/* go in a figure 8 pattern pattern*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* wait method
|
||||
waits a specific amount of miliseconds */
|
||||
/************************************************************************/
|
||||
void wait( int ms )
|
||||
|
||||
{
|
||||
for (int i=0; i<ms; i++)
|
||||
{
|
||||
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
|
||||
}
|
||||
}
|
||||
|
||||
int main( void )
|
||||
{
|
||||
DDRA = 0xFF;
|
||||
|
||||
|
||||
while (1==1)
|
||||
{
|
||||
// Set index to begin of pattern array
|
||||
int index = 0;
|
||||
// as long as delay has meaningful content
|
||||
for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++)
|
||||
{
|
||||
// Write data to PORTA
|
||||
PORTA = segments[index].data;
|
||||
// wait
|
||||
wait(segments[index].delay);
|
||||
// increment for next round
|
||||
index++;
|
||||
}
|
||||
}
|
||||
/*we need to free the memory taken up by the array, otherwise it won't clear properly*/
|
||||
free(segments);
|
||||
|
||||
return 1;
|
||||
}
|
||||
42
Microcontrollers/opdracht 2.4/opdracht 2.4.componentinfo.xml
Normal file
42
Microcontrollers/opdracht 2.4/opdracht 2.4.componentinfo.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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\xc8\avr\include\avr\iom128.h</AbsolutePath>
|
||||
<Attribute></Attribute>
|
||||
<Category>header</Category>
|
||||
<Condition>XC</Condition>
|
||||
<FileContentHash>JdJ7J9I/SJh965SEyyyVYw==</FileContentHash>
|
||||
<FileVersion></FileVersion>
|
||||
<Name>xc8/avr/include/avr/iom128.h</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>
|
||||
87
Microcontrollers/opdracht 2.4/opdracht 2.4.cproj
Normal file
87
Microcontrollers/opdracht 2.4/opdracht 2.4.cproj
Normal file
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>7.0</ProjectVersion>
|
||||
<ToolchainName>com.microchip.xc8</ToolchainName>
|
||||
<ProjectGuid>{0fa0c637-5ac0-44f3-999b-49c114b97183}</ProjectGuid>
|
||||
<avrdevice>ATmega128</avrdevice>
|
||||
<avrdeviceseries>none</avrdeviceseries>
|
||||
<OutputType>Executable</OutputType>
|
||||
<Language>C</Language>
|
||||
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
||||
<OutputFileExtension>.elf</OutputFileExtension>
|
||||
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||
<AssemblyName>opdracht 2.4</AssemblyName>
|
||||
<Name>opdracht 2.4</Name>
|
||||
<RootNamespace>opdracht 2.4</RootNamespace>
|
||||
<ToolchainFlavour>XC8_2.31</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 />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
<com.microchip.xc8>
|
||||
<com.microchip.xc8.common.optimization.RelaxBranches>True</com.microchip.xc8.common.optimization.RelaxBranches>
|
||||
<com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>(%24DeviceMacro)</Value>
|
||||
<Value>NDEBUG</Value>
|
||||
</ListValues>
|
||||
</com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||
<com.microchip.xc8.compiler.optimization.level>Optimize for size (-Os)</com.microchip.xc8.compiler.optimization.level>
|
||||
<com.microchip.xc8.compiler.optimization.PackStructureMembers>True</com.microchip.xc8.compiler.optimization.PackStructureMembers>
|
||||
<com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>True</com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<com.microchip.xc8.compiler.warnings.AllWarnings>True</com.microchip.xc8.compiler.warnings.AllWarnings>
|
||||
<com.microchip.xc8.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</com.microchip.xc8.linker.libraries.Libraries>
|
||||
</com.microchip.xc8>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
<com.microchip.xc8>
|
||||
<com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>(%24DeviceMacro)</Value>
|
||||
<Value>DEBUG</Value>
|
||||
</ListValues>
|
||||
</com.microchip.xc8.compiler.symbols.DefSymbols>
|
||||
<com.microchip.xc8.compiler.optimization.level>Optimize debugging experience (-Og)</com.microchip.xc8.compiler.optimization.level>
|
||||
<com.microchip.xc8.compiler.optimization.PackStructureMembers>True</com.microchip.xc8.compiler.optimization.PackStructureMembers>
|
||||
<com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>True</com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<com.microchip.xc8.compiler.optimization.DebugLevel>Default (-g2)</com.microchip.xc8.compiler.optimization.DebugLevel>
|
||||
<com.microchip.xc8.compiler.warnings.AllWarnings>True</com.microchip.xc8.compiler.warnings.AllWarnings>
|
||||
<com.microchip.xc8.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</com.microchip.xc8.linker.libraries.Libraries>
|
||||
<com.microchip.xc8.assembler.debugging.DebugLevel>Default (-Wa,-g)</com.microchip.xc8.assembler.debugging.DebugLevel>
|
||||
</com.microchip.xc8>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="main.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user