9 Commits

Author SHA1 Message Date
Sem van der Hoeven
c2b532b8ae added opdr 2.4 2021-02-10 20:17:58 +01:00
Sem van der Hoeven
a26e370acb added opdr 2.4 2021-02-10 20:17:23 +01:00
Guilliam Lutz
b99a4646ec begin 2.5 2021-02-10 17:46:27 +01:00
stijn
093ffec420 fix 2021-02-10 14:11:25 +01:00
stijn
31610eb739 add opdracht 2.3 2021-02-10 12:40:32 +01:00
Sem van der Hoeven
35ce5510a0 added opdracht 2.3 folder 2021-02-10 11:46:53 +01:00
Sem van der Hoeven
9e1445737d Merge branch 'opdr2-B2' into main 2021-02-10 11:36:20 +01:00
stijn
90b0ad4e30 Merge remote-tracking branch 'origin/main' into main 2021-02-10 10:06:08 +01:00
stijn
7673bb3bbf Auto stash before merge of "main" and "origin/main" 2021-02-10 10:06:04 +01:00
26 changed files with 1719 additions and 213 deletions

View File

@@ -17,6 +17,10 @@ Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.1", "opdracht 2.
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "Opdracht 2.2", "Opdracht 2.2\Opdracht 2.2.cproj", "{7328E66F-4181-4553-9542-DA5CC2A74A4E}"
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.3", "opdracht 2.3\opdracht 2.3.cproj", "{E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}"
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.4", "opdracht 2.4\opdracht 2.4.cproj", "{0FA0C637-5AC0-44F3-999B-49C114B97183}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AVR = Debug|AVR
@@ -51,6 +55,14 @@ Global
{7328E66F-4181-4553-9542-DA5CC2A74A4E}.Debug|AVR.Build.0 = Debug|AVR
{7328E66F-4181-4553-9542-DA5CC2A74A4E}.Release|AVR.ActiveCfg = Release|AVR
{7328E66F-4181-4553-9542-DA5CC2A74A4E}.Release|AVR.Build.0 = Release|AVR
{E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Debug|AVR.ActiveCfg = Debug|AVR
{E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Debug|AVR.Build.0 = Debug|AVR
{E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Release|AVR.ActiveCfg = Release|AVR
{E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Release|AVR.Build.0 = Release|AVR
{0FA0C637-5AC0-44F3-999B-49C114B97183}.Debug|AVR.ActiveCfg = Debug|AVR
{0FA0C637-5AC0-44F3-999B-49C114B97183}.Debug|AVR.Build.0 = Debug|AVR
{0FA0C637-5AC0-44F3-999B-49C114B97183}.Release|AVR.ActiveCfg = Release|AVR
{0FA0C637-5AC0-44F3-999B-49C114B97183}.Release|AVR.Build.0 = Release|AVR
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -28,54 +28,66 @@
<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>
<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>
<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>
<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>

View File

@@ -14,7 +14,10 @@ void wait( int ms ) {
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
/************************************************************************/
/* interrupt 1
walk the light 1 down */
/************************************************************************/
ISR( INT1_vect ) {
if (PORTC == 0b10000000)
{
@@ -26,6 +29,10 @@ ISR( INT1_vect ) {
}
/************************************************************************/
/* interrupt 2
walk the light 1 up */
/************************************************************************/
ISR( INT2_vect ) {
if (PORTC == 0b00000001)
{
@@ -47,13 +54,13 @@ int main(void)
EICRA |= 0x2C; // INT2 falling edge, INT1 rising edge
EIMSK |= 0x06; // Enable INT2 & INT1
PORTC = 0x01;
PORTC = 0x01; // init the first bit
sei();
sei(); // enable input mechanism
while (1)
{
wait(500);
}
}

View File

@@ -20,74 +20,74 @@
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<RamSnippetAddress>0x20000000</RamSnippetAddress>
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<OverrideVtorValue>exception_table</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>
<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>
<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>
<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>
<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>

View File

@@ -1,104 +1,104 @@
/*
* main.c
*
* Created: 08-Feb-21 10:03:33 AM
* Author: lemms
*/
# define F_CPU 10000000UL
#include <util/delay.h>
#include <xc.h>
typedef enum {
IDLE,
PERPARE_COFFEE_POWDER,
BOIL_WATER,
POUR_COFFEE
} state ;
typedef enum {
false = 0,
true = 1
} bool;
state current_state;
void wait( int ms )
{
for (int i=0; i<ms; i++)
{
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
void setPulveriserState(bool state){
// set coffee powder mill on or off;
}
bool checkCoffeePowderLevel(){
// check sensor
return true;
}
void updateScreen(){
// update its display;
if(...){
current_state = PERPARE_COFFEE_POWDER;
}
}
void setBoilerState(bool state){
// set boiler on or off;
}
bool checkWaterTemp(){
// check sensor
return true;
}
long milisPouring;
void setPourPumpState(bool state){
// set pump on or off;
}
int main(void)
{
while(1)
{
switch(state){
case IDLE:
updateScreen();
break;
case PERPARE_COFFEE_POWDER:
bool coffeeLevel = checkCoffeePowderLevel();
setPulveriserState(!coffeeLevel);
if(coffeeLevel){
current_state = BOIL_WATER;
}
break;
case BOIL_WATER:
bool waterTemp = checkWaterTemp();
setBoilerState(!waterTemp);
if(waterTemp){
current_state = POUR_COFFEE;
}
break;
case POUR_COFFEE:
bool shouldPour = !(milisPouring => 2000);
setPourPumpState(shouldPour);
milisPouring++;
if(!shouldPour){
milisPouring = 0;
}
break;
}
wait(1);
}
}
// /*
// * main.c
// *
// * Created: 08-Feb-21 10:03:33 AM
// * Author: lemms
// */
// # define F_CPU 10000000UL
//
// #include <util/delay.h>
// #include <xc.h>
//
// typedef enum {
// IDLE,
// PERPARE_COFFEE_POWDER,
// BOIL_WATER,
// POUR_COFFEE
// } state ;
//
// typedef enum {
// false = 0,
// true = 1
// } bool;
//
// state current_state;
//
// void wait( int ms )
// {
// for (int i=0; i<ms; i++)
// {
// _delay_ms( 1 ); // library function (max 30 ms at 8MHz)
// }
// }
//
// void setPulveriserState(bool state){
// // set coffee powder mill on or off;
// }
//
// bool checkCoffeePowderLevel(){
// // check sensor
// return true;
// }
//
// void updateScreen(){
// // update its display;
// if(...){
// current_state = PERPARE_COFFEE_POWDER;
// }
// }
//
// void setBoilerState(bool state){
// // set boiler on or off;
// }
//
// bool checkWaterTemp(){
// // check sensor
// return true;
// }
//
// long milisPouring;
//
// void setPourPumpState(bool state){
// // set pump on or off;
// }
//
// int main(void)
// {
// while(1)
// {
// switch(state){
// case IDLE:
// updateScreen();
// break;
//
// case PERPARE_COFFEE_POWDER:
// bool coffeeLevel = checkCoffeePowderLevel();
// setPulveriserState(!coffeeLevel);
//
// if(coffeeLevel){
// current_state = BOIL_WATER;
// }
// break;
//
// case BOIL_WATER:
// bool waterTemp = checkWaterTemp();
// setBoilerState(!waterTemp);
// if(waterTemp){
// current_state = POUR_COFFEE;
// }
// break;
//
// case POUR_COFFEE:
// bool shouldPour = !(milisPouring => 2000);
// setPourPumpState(shouldPour);
//
// milisPouring++;
//
// if(!shouldPour){
// milisPouring = 0;
// }
// break;
// }
// wait(1);
// }
// }

View File

@@ -14,7 +14,7 @@
** Author: dkroeske@gmail.com
** -------------------------------------------------------------------------*/
#define F_CPU 8e6
#define F_CPU 10e6
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
@@ -44,18 +44,7 @@ notes: Set PORTD.5
Version : DMK, Initial code
*******************************************************************/
ISR( INT0_vect ) {
PORTD |= (1<<5);
}
/******************************************************************
short: ISR INT1
inputs:
outputs:
notes: Clear PORTD.5
Version : DMK, Initial code
*******************************************************************/
ISR( INT1_vect ) {
PORTD &= ~(1<<5);
PORTC
}
/******************************************************************
@@ -70,7 +59,7 @@ int main( void ) {
DDRD = 0xF0; // PORTD(7:4) output, PORTD(3:0) input
// Init Interrupt hardware
EICRA |= 0x0B; // INT1 falling edge, INT0 rising edge
EICRA |= 0x00000010; // INT0 falling edge
EIMSK |= 0x03; // Enable INT1 & INT0
// Enable global interrupt system
@@ -78,8 +67,7 @@ int main( void ) {
sei();
while (1) {
PORTD ^= (1<<7); // Toggle PORTD.7
wait( 500 );
}
return 1;

View 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.3.elf
OUTPUT_FILE_PATH_AS_ARGS +="opdracht 2.3.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 -mext=cci -D__ATmega128__ -O0 -ffunction-sections -fdata-sections -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.3.map" -Wl,--start-group -Wl,--end-group -Wl,--gc-sections -O0 -ffunction-sections -fdata-sections --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.3.elf" "opdracht 2.3.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.3.elf" "opdracht 2.3.eep" || exit 0
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objdump.exe" -h -S "opdracht 2.3.elf" > "opdracht 2.3.lss"
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "opdracht 2.3.elf" "opdracht 2.3.hex" "opdracht 2.3.eep" "opdracht 2.3.map" "opdracht 2.3.usersignatures" "opdracht 2.3.a" "opdracht 2.3.lss"

View File

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

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<executable name="opdracht 2.3.elf">
<memory name="program">
<units>bytes</units>
<length>131072</length>
<used>769</used>
<free>130303</free>
</memory>
<memory name="data">
<units>bytes</units>
<length>4096</length>
<used>2</used>
<free>4094</free>
</memory>
</executable>
</project>

View File

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

View File

@@ -0,0 +1,390 @@
opdracht 2.3.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000000 00800100 00800100 00000396 2**0
ALLOC, LOAD, DATA
1 .text 000000ea 00000000 00000000 00000094 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 00000002 00800100 00800100 00000396 2**0
ALLOC
3 .comment 0000002f 00000000 00000000 00000396 2**0
CONTENTS, READONLY
4 .debug_info 00000780 00000000 00000000 000003c5 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000718 00000000 00000000 00000b45 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 0000016d 00000000 00000000 0000125d 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_str 0000027d 00000000 00000000 000013ca 2**0
CONTENTS, READONLY, DEBUGGING
8 .text 00000004 000002fe 000002fe 00000392 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
9 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001648 2**2
CONTENTS, READONLY, DEBUGGING
10 .text.__vector_1 00000080 000000fa 000000fa 0000018e 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
11 .text.__vector_2 00000080 0000017a 0000017a 0000020e 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .progmemx.data.Characters 0000000f 000000ea 000000ea 0000017e 2**0
CONTENTS, ALLOC, LOAD, READONLY, PROGMEMX
13 .text.initDisplay 0000001a 000002d6 000002d6 0000036a 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
14 .text.setDisplay 00000062 00000274 00000274 00000308 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
15 .text.main 0000007a 000001fa 000001fa 0000028e 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
16 .text.libgcc 0000000e 000002f0 000002f0 00000384 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 49 00 jmp 0x92 ; 0x92 <__ctors_end>
4: 0c 94 7d 00 jmp 0xfa ; 0xfa <__vector_1>
8: 0c 94 bd 00 jmp 0x17a ; 0x17a <__vector_2>
c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
10: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
14: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
18: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
1c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
20: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
24: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
28: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
2c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
30: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
34: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
38: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
3c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
40: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
44: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
48: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
4c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
50: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
54: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
58: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
5c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
60: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
64: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
68: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
6c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
70: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
74: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
78: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
7c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
80: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
84: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
88: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
0000008c <.dinit>:
8c: 01 00 .word 0x0001 ; ????
8e: 01 02 muls r16, r17
90: 80 00 .word 0x0080 ; ????
00000092 <__ctors_end>:
92: 11 24 eor r1, r1
94: 1f be out 0x3f, r1 ; 63
96: cf ef ldi r28, 0xFF ; 255
98: d0 e1 ldi r29, 0x10 ; 16
9a: de bf out 0x3e, r29 ; 62
9c: cd bf out 0x3d, r28 ; 61
0000009e <__do_copy_data>:
9e: ec e8 ldi r30, 0x8C ; 140
a0: f0 e0 ldi r31, 0x00 ; 0
a2: 40 e0 ldi r20, 0x00 ; 0
a4: 19 c0 rjmp .+50 ; 0xd8 <__do_clear_bss+0x8>
a6: b7 91 elpm r27, Z+
a8: a7 91 elpm r26, Z+
aa: 37 91 elpm r19, Z+
ac: 27 91 elpm r18, Z+
ae: 07 91 elpm r16, Z+
b0: 07 fd sbrc r16, 7
b2: 0e c0 rjmp .+28 ; 0xd0 <__do_clear_bss>
b4: 97 91 elpm r25, Z+
b6: 87 91 elpm r24, Z+
b8: ef 01 movw r28, r30
ba: f9 2f mov r31, r25
bc: e8 2f mov r30, r24
be: 0b bf out 0x3b, r16 ; 59
c0: 07 90 elpm r0, Z+
c2: 0d 92 st X+, r0
c4: a2 17 cp r26, r18
c6: b3 07 cpc r27, r19
c8: d9 f7 brne .-10 ; 0xc0 <__do_copy_data+0x22>
ca: fe 01 movw r30, r28
cc: 1b be out 0x3b, r1 ; 59
ce: 04 c0 rjmp .+8 ; 0xd8 <__do_clear_bss+0x8>
000000d0 <__do_clear_bss>:
d0: 1d 92 st X+, r1
d2: a2 17 cp r26, r18
d4: b3 07 cpc r27, r19
d6: e1 f7 brne .-8 ; 0xd0 <__do_clear_bss>
d8: e1 39 cpi r30, 0x91 ; 145
da: f4 07 cpc r31, r20
dc: 21 f7 brne .-56 ; 0xa6 <__do_copy_data+0x8>
de: 0e 94 fd 00 call 0x1fa ; 0x1fa <main>
e2: 0c 94 73 00 jmp 0xe6 ; 0xe6 <_exit>
000000e6 <_exit>:
e6: f8 94 cli
000000e8 <__stop_program>:
e8: ff cf rjmp .-2 ; 0xe8 <__stop_program>
Disassembly of section .text:
000002fe <__bad_interrupt>:
2fe: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
Disassembly of section .text.__vector_1:
000000fa <__vector_1>:
fa: 1f 92 push r1
fc: 0f 92 push r0
fe: 00 90 5f 00 lds r0, 0x005F ; 0x80005f <__TEXT_REGION_LENGTH__+0x7e005f>
102: 0f 92 push r0
104: 11 24 eor r1, r1
106: 00 90 5b 00 lds r0, 0x005B ; 0x80005b <__TEXT_REGION_LENGTH__+0x7e005b>
10a: 0f 92 push r0
10c: 2f 93 push r18
10e: 3f 93 push r19
110: 4f 93 push r20
112: 5f 93 push r21
114: 6f 93 push r22
116: 7f 93 push r23
118: 8f 93 push r24
11a: 9f 93 push r25
11c: af 93 push r26
11e: bf 93 push r27
120: ef 93 push r30
122: ff 93 push r31
124: cf 93 push r28
126: df 93 push r29
128: cd b7 in r28, 0x3d ; 61
12a: de b7 in r29, 0x3e ; 62
12c: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
130: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
134: 01 96 adiw r24, 0x01 ; 1
136: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <_edata+0x1>
13a: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <_edata>
13e: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
142: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
146: 0e 94 3a 01 call 0x274 ; 0x274 <setDisplay>
14a: 00 00 nop
14c: df 91 pop r29
14e: cf 91 pop r28
150: ff 91 pop r31
152: ef 91 pop r30
154: bf 91 pop r27
156: af 91 pop r26
158: 9f 91 pop r25
15a: 8f 91 pop r24
15c: 7f 91 pop r23
15e: 6f 91 pop r22
160: 5f 91 pop r21
162: 4f 91 pop r20
164: 3f 91 pop r19
166: 2f 91 pop r18
168: 0f 90 pop r0
16a: 00 92 5b 00 sts 0x005B, r0 ; 0x80005b <__TEXT_REGION_LENGTH__+0x7e005b>
16e: 0f 90 pop r0
170: 00 92 5f 00 sts 0x005F, r0 ; 0x80005f <__TEXT_REGION_LENGTH__+0x7e005f>
174: 0f 90 pop r0
176: 1f 90 pop r1
178: 18 95 reti
Disassembly of section .text.__vector_2:
0000017a <__vector_2>:
17a: 1f 92 push r1
17c: 0f 92 push r0
17e: 00 90 5f 00 lds r0, 0x005F ; 0x80005f <__TEXT_REGION_LENGTH__+0x7e005f>
182: 0f 92 push r0
184: 11 24 eor r1, r1
186: 00 90 5b 00 lds r0, 0x005B ; 0x80005b <__TEXT_REGION_LENGTH__+0x7e005b>
18a: 0f 92 push r0
18c: 2f 93 push r18
18e: 3f 93 push r19
190: 4f 93 push r20
192: 5f 93 push r21
194: 6f 93 push r22
196: 7f 93 push r23
198: 8f 93 push r24
19a: 9f 93 push r25
19c: af 93 push r26
19e: bf 93 push r27
1a0: ef 93 push r30
1a2: ff 93 push r31
1a4: cf 93 push r28
1a6: df 93 push r29
1a8: cd b7 in r28, 0x3d ; 61
1aa: de b7 in r29, 0x3e ; 62
1ac: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
1b0: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
1b4: 01 97 sbiw r24, 0x01 ; 1
1b6: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <_edata+0x1>
1ba: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <_edata>
1be: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
1c2: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
1c6: 0e 94 3a 01 call 0x274 ; 0x274 <setDisplay>
1ca: 00 00 nop
1cc: df 91 pop r29
1ce: cf 91 pop r28
1d0: ff 91 pop r31
1d2: ef 91 pop r30
1d4: bf 91 pop r27
1d6: af 91 pop r26
1d8: 9f 91 pop r25
1da: 8f 91 pop r24
1dc: 7f 91 pop r23
1de: 6f 91 pop r22
1e0: 5f 91 pop r21
1e2: 4f 91 pop r20
1e4: 3f 91 pop r19
1e6: 2f 91 pop r18
1e8: 0f 90 pop r0
1ea: 00 92 5b 00 sts 0x005B, r0 ; 0x80005b <__TEXT_REGION_LENGTH__+0x7e005b>
1ee: 0f 90 pop r0
1f0: 00 92 5f 00 sts 0x005F, r0 ; 0x80005f <__TEXT_REGION_LENGTH__+0x7e005f>
1f4: 0f 90 pop r0
1f6: 1f 90 pop r1
1f8: 18 95 reti
Disassembly of section .text.initDisplay:
000002d6 <initDisplay>:
2d6: cf 93 push r28
2d8: df 93 push r29
2da: cd b7 in r28, 0x3d ; 61
2dc: de b7 in r29, 0x3e ; 62
2de: 8a e3 ldi r24, 0x3A ; 58
2e0: 90 e0 ldi r25, 0x00 ; 0
2e2: 2f ef ldi r18, 0xFF ; 255
2e4: fc 01 movw r30, r24
2e6: 20 83 st Z, r18
2e8: 00 00 nop
2ea: df 91 pop r29
2ec: cf 91 pop r28
2ee: 08 95 ret
Disassembly of section .text.setDisplay:
00000274 <setDisplay>:
274: 0f 93 push r16
276: 1f 93 push r17
278: cf 93 push r28
27a: df 93 push r29
27c: 00 d0 rcall .+0 ; 0x27e <setDisplay+0xa>
27e: cd b7 in r28, 0x3d ; 61
280: de b7 in r29, 0x3e ; 62
282: 9a 83 std Y+2, r25 ; 0x02
284: 89 83 std Y+1, r24 ; 0x01
286: 89 81 ldd r24, Y+1 ; 0x01
288: 9a 81 ldd r25, Y+2 ; 0x02
28a: 40 97 sbiw r24, 0x10 ; 16
28c: 24 f4 brge .+8 ; 0x296 <setDisplay+0x22>
28e: 89 81 ldd r24, Y+1 ; 0x01
290: 9a 81 ldd r25, Y+2 ; 0x02
292: 99 23 and r25, r25
294: 24 f4 brge .+8 ; 0x29e <setDisplay+0x2a>
296: 8e e0 ldi r24, 0x0E ; 14
298: 90 e0 ldi r25, 0x00 ; 0
29a: 9a 83 std Y+2, r25 ; 0x02
29c: 89 83 std Y+1, r24 ; 0x01
29e: 0b e3 ldi r16, 0x3B ; 59
2a0: 10 e0 ldi r17, 0x00 ; 0
2a2: 2a ee ldi r18, 0xEA ; 234
2a4: 30 e0 ldi r19, 0x00 ; 0
2a6: 40 e0 ldi r20, 0x00 ; 0
2a8: 89 81 ldd r24, Y+1 ; 0x01
2aa: 9a 81 ldd r25, Y+2 ; 0x02
2ac: 09 2e mov r0, r25
2ae: 00 0c add r0, r0
2b0: aa 0b sbc r26, r26
2b2: 82 0f add r24, r18
2b4: 93 1f adc r25, r19
2b6: a4 1f adc r26, r20
2b8: fc 01 movw r30, r24
2ba: 5a 2f mov r21, r26
2bc: 0e 94 78 01 call 0x2f0 ; 0x2f0 <__xload_1>
2c0: 86 2f mov r24, r22
2c2: f8 01 movw r30, r16
2c4: 80 83 st Z, r24
2c6: 00 00 nop
2c8: 0f 90 pop r0
2ca: 0f 90 pop r0
2cc: df 91 pop r29
2ce: cf 91 pop r28
2d0: 1f 91 pop r17
2d2: 0f 91 pop r16
2d4: 08 95 ret
Disassembly of section .text.main:
000001fa <main>:
1fa: cf 93 push r28
1fc: df 93 push r29
1fe: cd b7 in r28, 0x3d ; 61
200: de b7 in r29, 0x3e ; 62
202: 0e 94 6b 01 call 0x2d6 ; 0x2d6 <initDisplay>
206: 80 e0 ldi r24, 0x00 ; 0
208: 90 e0 ldi r25, 0x00 ; 0
20a: 0e 94 3a 01 call 0x274 ; 0x274 <setDisplay>
20e: 81 e3 ldi r24, 0x31 ; 49
210: 90 e0 ldi r25, 0x00 ; 0
212: fc 01 movw r30, r24
214: 10 82 st Z, r1
216: 8a e6 ldi r24, 0x6A ; 106
218: 90 e0 ldi r25, 0x00 ; 0
21a: 2a e6 ldi r18, 0x6A ; 106
21c: 30 e0 ldi r19, 0x00 ; 0
21e: f9 01 movw r30, r18
220: 20 81 ld r18, Z
222: 2a 60 ori r18, 0x0A ; 10
224: fc 01 movw r30, r24
226: 20 83 st Z, r18
228: 89 e5 ldi r24, 0x59 ; 89
22a: 90 e0 ldi r25, 0x00 ; 0
22c: 29 e5 ldi r18, 0x59 ; 89
22e: 30 e0 ldi r19, 0x00 ; 0
230: f9 01 movw r30, r18
232: 20 81 ld r18, Z
234: 23 60 ori r18, 0x03 ; 3
236: fc 01 movw r30, r24
238: 20 83 st Z, r18
23a: 85 e3 ldi r24, 0x35 ; 53
23c: 90 e0 ldi r25, 0x00 ; 0
23e: 21 e0 ldi r18, 0x01 ; 1
240: fc 01 movw r30, r24
242: 20 83 st Z, r18
244: 78 94 sei
246: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
24a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
24e: 89 2b or r24, r25
250: d1 f3 breq .-12 ; 0x246 <main+0x4c>
252: 80 e3 ldi r24, 0x30 ; 48
254: 90 e0 ldi r25, 0x00 ; 0
256: fc 01 movw r30, r24
258: 80 81 ld r24, Z
25a: 83 30 cpi r24, 0x03 ; 3
25c: a1 f7 brne .-24 ; 0x246 <main+0x4c>
25e: 10 92 01 01 sts 0x0101, r1 ; 0x800101 <_edata+0x1>
262: 10 92 00 01 sts 0x0100, r1 ; 0x800100 <_edata>
266: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
26a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
26e: 0e 94 3a 01 call 0x274 ; 0x274 <setDisplay>
272: e9 cf rjmp .-46 ; 0x246 <main+0x4c>
Disassembly of section .text.libgcc:
000002f0 <__xload_1>:
2f0: 57 fd sbrc r21, 7
2f2: 03 c0 rjmp .+6 ; 0x2fa <__xload_1+0xa>
2f4: 5b bf out 0x3b, r21 ; 59
2f6: 67 91 elpm r22, Z+
2f8: 08 95 ret
2fa: 60 81 ld r22, Z
2fc: 08 95 ret

View File

@@ -0,0 +1,92 @@
/*
* main.c
*
* Created: 2/10/2021 11:45:42 AM
* Author: Sem
*/
#include <avr/interrupt.h>
#include <xc.h>
#include <avr/io.h>
#include <util/delay.h>
void wait( int ms ) {
for (int i=0; i<ms; i++) {
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
int count;
/************************************************************************/
/* interrupt 1
walk the light 1 down */
/************************************************************************/
ISR( INT0_vect ) {
setDisplay(++count);
}
/************************************************************************/
/* interrupt 2
walk the light 1 up */
/************************************************************************/
ISR( INT1_vect ) {
setDisplay(--count);
}
const unsigned char Characters [15] = {
0b00111111, // 0
0b00000110, // 1
0b01011011, // 2
0b01001111, // 3
0b01100110, // 4
0b01101101, // 5
0b01111101, // 6
0b00000111, // 7
0b01111111, // 8
0b01101111, // 9
0b01110111, // A
0b01111100, // B
0b00111001, // C
0b01011110, // D
0b01111001, // E
0b01110001, // F
};
void initDisplay(){
DDRA = 0b11111111;
}
void setDisplay(int num){
if(num > 15 || num < 0)
num = 14;
PORTA = Characters[num];
}
int main(void)
{
initDisplay();
setDisplay(0);
/* Replace with your application code */
// Init I/O
DDRD = 0b00000000;
// Init Interrupt hardware
EICRA |= 0b00001010; // INT2 falling edge, INT1 rising edge
EIMSK |= 0b00000011; // Enable INT1 & INT0
PORTC = 0x01; // init the first bit
sei(); // enable input mechanism
while(1)
{
if((count != 0) && (PIND == 0b00000011)){
count = 0;
setDisplay(count);
}
}
}

View 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>

View File

@@ -0,0 +1,56 @@
<?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>{e0046ce4-d6f8-435f-9c6e-72e6eb89ccb3}</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.3</AssemblyName>
<Name>opdracht 2.3</Name>
<RootNamespace>opdracht 2.3</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 />
<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 />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings />
</PropertyGroup>
<ItemGroup>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

View 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"

View File

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

View 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>

View File

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

View 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>

View 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;
}

View 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>

View 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>

View File

@@ -0,0 +1,16 @@
/*
* main.c
*
* Created: 2/10/2021 2:04:13 PM
* Author: User
*/
#include <xc.h>
int main(void)
{
while(1)
{
//TODO:: Please write your application code
}
}

View File

@@ -0,0 +1,6 @@
/*
* ldc.h
*
* Created: 10-2-2021 14:06:38
* Author: User
*/

View 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>

View File

@@ -0,0 +1,102 @@
<?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>{a8e029a0-3e6c-453c-ac34-4d6f411bed60}</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.5</AssemblyName>
<Name>opdracht 2.5</Name>
<RootNamespace>opdracht 2.5</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 />
<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>
<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="ldc.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="ldc.h">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>